Mugdha Lakhani | 83baeab | 2020-03-20 13:08:23 | [diff] [blame] | 1 | // 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 | |
Mugdha Lakhani | b676216 | 2020-03-30 10:23:25 | [diff] [blame] | 5 | #ifndef COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_ |
| 6 | #define COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_ |
Mugdha Lakhani | 83baeab | 2020-03-20 13:08:23 | [diff] [blame] | 7 | |
Jan Wilken Dörrie | ad587c3 | 2021-03-11 14:09:27 | [diff] [blame^] | 8 | #include <string> |
| 9 | |
Mugdha Lakhani | 09e02f62 | 2020-03-21 19:48:03 | [diff] [blame] | 10 | #include "base/strings/string16.h" |
Mugdha Lakhani | 00b27a0 | 2020-03-24 13:41:31 | [diff] [blame] | 11 | #include "build/build_config.h" |
Carlos Caballero | b428320 | 2020-08-10 14:40:46 | [diff] [blame] | 12 | #include "components/content_settings/browser/page_specific_content_settings.h" |
Mugdha Lakhani | 83baeab | 2020-03-20 13:08:23 | [diff] [blame] | 13 | #include "components/content_settings/core/common/content_settings_types.h" |
Mugdha Lakhani | 09e02f62 | 2020-03-21 19:48:03 | [diff] [blame] | 14 | #include "components/permissions/permission_result.h" |
Mugdha Lakhani | 00b27a0 | 2020-03-24 13:41:31 | [diff] [blame] | 15 | #include "components/permissions/permission_uma_util.h" |
Mugdha Lakhani | 09e02f62 | 2020-03-21 19:48:03 | [diff] [blame] | 16 | #include "components/safe_browsing/buildflags.h" |
edchin | 85cfa66 | 2020-11-18 21:31:08 | [diff] [blame] | 17 | #include "components/safe_browsing/core/password_protection/metrics_util.h" |
Mugdha Lakhani | 65bd7e5 | 2020-03-31 19:26:16 | [diff] [blame] | 18 | #include "components/security_state/core/security_state.h" |
Mugdha Lakhani | 09e02f62 | 2020-03-21 19:48:03 | [diff] [blame] | 19 | |
| 20 | namespace safe_browsing { |
| 21 | class PasswordProtectionService; |
| 22 | } // namespace safe_browsing |
Mugdha Lakhani | 83baeab | 2020-03-20 13:08:23 | [diff] [blame] | 23 | |
Mugdha Lakhani | 00b27a0 | 2020-03-24 13:41:31 | [diff] [blame] | 24 | namespace permissions { |
Mugdha Lakhani | 4b10b651 | 2020-04-27 19:52:12 | [diff] [blame] | 25 | class ChooserContextBase; |
Mugdha Lakhani | 00b27a0 | 2020-03-24 13:41:31 | [diff] [blame] | 26 | class PermissionDecisionAutoBlocker; |
| 27 | } // namespace permissions |
| 28 | |
Mugdha Lakhani | 00b27a0 | 2020-03-24 13:41:31 | [diff] [blame] | 29 | class HostContentSettingsMap; |
| 30 | class StatefulSSLHostStateDelegate; |
| 31 | |
| 32 | // PageInfoDelegate allows an embedder to customize PageInfo logic. |
Mugdha Lakhani | 83baeab | 2020-03-20 13:08:23 | [diff] [blame] | 33 | class PageInfoDelegate { |
| 34 | public: |
| 35 | virtual ~PageInfoDelegate() = default; |
| 36 | |
Mugdha Lakhani | 1de9c49 | 2020-03-23 17:35:40 | [diff] [blame] | 37 | // Return the |ChooserContextBase| corresponding to the content settings |
| 38 | // type, |type|. Returns a nullptr for content settings for which there's no |
| 39 | // ChooserContextBase. |
| 40 | virtual permissions::ChooserContextBase* GetChooserContext( |
| 41 | ContentSettingsType type) = 0; |
| 42 | |
Mugdha Lakhani | 09e02f62 | 2020-03-21 19:48:03 | [diff] [blame] | 43 | #if BUILDFLAG(FULL_SAFE_BROWSING) |
| 44 | // Helper methods requiring access to PasswordProtectionService. |
| 45 | virtual safe_browsing::PasswordProtectionService* |
| 46 | GetPasswordProtectionService() const = 0; |
| 47 | virtual void OnUserActionOnPasswordUi( |
| 48 | content::WebContents* web_contents, |
| 49 | safe_browsing::WarningAction action) = 0; |
| 50 | virtual base::string16 GetWarningDetailText() = 0; |
| 51 | #endif |
| 52 | // Get permission status for the permission associated with ContentSetting of |
| 53 | // type |type|. |
| 54 | virtual permissions::PermissionResult GetPermissionStatus( |
| 55 | ContentSettingsType type, |
| 56 | const GURL& site_url) = 0; |
Mugdha Lakhani | 00b27a0 | 2020-03-24 13:41:31 | [diff] [blame] | 57 | #if !defined(OS_ANDROID) |
| 58 | // Creates an InfoBarService and an InfoBarDelegate using it, if possible. |
| 59 | // Returns true if an InfoBarDelegate was created, false otherwise. |
| 60 | virtual bool CreateInfoBarDelegate() = 0; |
| 61 | |
| 62 | virtual void ShowSiteSettings(const GURL& site_url) = 0; |
| 63 | #endif |
| 64 | virtual permissions::PermissionDecisionAutoBlocker* |
| 65 | GetPermissionDecisionAutoblocker() = 0; |
| 66 | |
| 67 | // Service for managing SSL error page bypasses. Used to revoke bypass |
| 68 | // decisions by users. |
| 69 | virtual StatefulSSLHostStateDelegate* GetStatefulSSLHostStateDelegate() = 0; |
| 70 | |
| 71 | // The |HostContentSettingsMap| is the service that provides and manages |
| 72 | // content settings (aka. site permissions). |
| 73 | virtual HostContentSettingsMap* GetContentSettings() = 0; |
| 74 | |
Justin Miron | ce1eb00a | 2020-08-20 15:57:38 | [diff] [blame] | 75 | // The subresource filter service determines whether ads should be blocked on |
| 76 | // the site and relevant permission prompts should be shown respectively. |
| 77 | virtual bool IsSubresourceFilterActivated(const GURL& site_url) = 0; |
| 78 | |
Mugdha Lakhani | 3c22480d4 | 2020-04-24 12:43:42 | [diff] [blame] | 79 | virtual std::unique_ptr< |
Carlos Caballero | b428320 | 2020-08-10 14:40:46 | [diff] [blame] | 80 | content_settings::PageSpecificContentSettings::Delegate> |
| 81 | GetPageSpecificContentSettingsDelegate() = 0; |
Mugdha Lakhani | 00b27a0 | 2020-03-24 13:41:31 | [diff] [blame] | 82 | virtual bool IsContentDisplayedInVrHeadset() = 0; |
Mugdha Lakhani | 65bd7e5 | 2020-03-31 19:26:16 | [diff] [blame] | 83 | virtual security_state::SecurityLevel GetSecurityLevel() = 0; |
| 84 | virtual security_state::VisibleSecurityState GetVisibleSecurityState() = 0; |
Mugdha Lakhani | 2c21fc66 | 2020-05-06 15:33:12 | [diff] [blame] | 85 | #if defined(OS_ANDROID) |
| 86 | // Gets the name of the embedder. |
| 87 | virtual const base::string16 GetClientApplicationName() = 0; |
| 88 | #endif |
Mugdha Lakhani | 83baeab | 2020-03-20 13:08:23 | [diff] [blame] | 89 | }; |
| 90 | |
Mugdha Lakhani | b676216 | 2020-03-30 10:23:25 | [diff] [blame] | 91 | #endif // COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_ |