blob: e9d7394eba9bc4dade3873568489adb19420dc41 [file] [log] [blame]
Mugdha Lakhani83baeab2020-03-20 13:08:231// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_DELEGATE_H_
6#define CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_DELEGATE_H_
7
Mugdha Lakhani09e02f622020-03-21 19:48:038#include "base/strings/string16.h"
Mugdha Lakhani00b27a02020-03-24 13:41:319#include "build/build_config.h"
Mugdha Lakhani83baeab2020-03-20 13:08:2310#include "components/content_settings/core/common/content_settings_types.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0311#include "components/permissions/permission_result.h"
Mugdha Lakhani00b27a02020-03-24 13:41:3112#include "components/permissions/permission_uma_util.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0313#include "components/safe_browsing/buildflags.h"
14#include "components/safe_browsing/content/password_protection/metrics_util.h"
15
16namespace safe_browsing {
17class PasswordProtectionService;
18} // namespace safe_browsing
Mugdha Lakhani83baeab2020-03-20 13:08:2319
Mugdha Lakhani00b27a02020-03-24 13:41:3120namespace permissions {
21class PermissionDecisionAutoBlocker;
22} // namespace permissions
23
Mugdha Lakhani1de9c492020-03-23 17:35:4024namespace permissions {
25class ChooserContextBase;
26}
27
Mugdha Lakhani00b27a02020-03-24 13:41:3128class HostContentSettingsMap;
29class StatefulSSLHostStateDelegate;
30
31// PageInfoDelegate allows an embedder to customize PageInfo logic.
Mugdha Lakhani83baeab2020-03-20 13:08:2332class PageInfoDelegate {
33 public:
34 virtual ~PageInfoDelegate() = default;
35
Mugdha Lakhani1de9c492020-03-23 17:35:4036 // Return the |ChooserContextBase| corresponding to the content settings
37 // type, |type|. Returns a nullptr for content settings for which there's no
38 // ChooserContextBase.
39 virtual permissions::ChooserContextBase* GetChooserContext(
40 ContentSettingsType type) = 0;
41
Mugdha Lakhani83baeab2020-03-20 13:08:2342 // Whether the content setting of type |type| has changed via Page Info UI.
43 virtual bool HasContentSettingChangedViaPageInfo(
44 ContentSettingsType type) = 0;
Mugdha Lakhani09e02f622020-03-21 19:48:0345
Mugdha Lakhani00b27a02020-03-24 13:41:3146 // Notifies the delegate that the content setting of type |type| has changed
47 // via Page Info UI.
48 virtual void ContentSettingChangedViaPageInfo(ContentSettingsType type) = 0;
49
Mugdha Lakhani09e02f622020-03-21 19:48:0350 // Get counts of allowed and blocked cookies.
Mugdha Lakhanib3dcbb92020-03-20 18:39:1851 virtual int GetFirstPartyAllowedCookiesCount(const GURL& site_url) = 0;
52 virtual int GetFirstPartyBlockedCookiesCount(const GURL& site_url) = 0;
53 virtual int GetThirdPartyAllowedCookiesCount(const GURL& site_url) = 0;
54 virtual int GetThirdPartyBlockedCookiesCount(const GURL& site_url) = 0;
Mugdha Lakhani09e02f622020-03-21 19:48:0355
56#if BUILDFLAG(FULL_SAFE_BROWSING)
57 // Helper methods requiring access to PasswordProtectionService.
58 virtual safe_browsing::PasswordProtectionService*
59 GetPasswordProtectionService() const = 0;
60 virtual void OnUserActionOnPasswordUi(
61 content::WebContents* web_contents,
62 safe_browsing::WarningAction action) = 0;
63 virtual base::string16 GetWarningDetailText() = 0;
64#endif
65 // Get permission status for the permission associated with ContentSetting of
66 // type |type|.
67 virtual permissions::PermissionResult GetPermissionStatus(
68 ContentSettingsType type,
69 const GURL& site_url) = 0;
Mugdha Lakhani00b27a02020-03-24 13:41:3170#if !defined(OS_ANDROID)
71 // Creates an InfoBarService and an InfoBarDelegate using it, if possible.
72 // Returns true if an InfoBarDelegate was created, false otherwise.
73 virtual bool CreateInfoBarDelegate() = 0;
74
75 virtual void ShowSiteSettings(const GURL& site_url) = 0;
76#endif
77 virtual permissions::PermissionDecisionAutoBlocker*
78 GetPermissionDecisionAutoblocker() = 0;
79
80 // Service for managing SSL error page bypasses. Used to revoke bypass
81 // decisions by users.
82 virtual StatefulSSLHostStateDelegate* GetStatefulSSLHostStateDelegate() = 0;
83
84 // The |HostContentSettingsMap| is the service that provides and manages
85 // content settings (aka. site permissions).
86 virtual HostContentSettingsMap* GetContentSettings() = 0;
87
88 virtual bool IsContentDisplayedInVrHeadset() = 0;
Mugdha Lakhani83baeab2020-03-20 13:08:2389};
90
91#endif // CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_DELEGATE_H_