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