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