blob: 78e19b30fdcfeb9cd96f926d78f0e214ab99cf85 [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
Mugdha Lakhanib6762162020-03-30 10:23:255#ifndef COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_
6#define COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_
Mugdha Lakhani83baeab2020-03-20 13:08:237
Jan Wilken Dörriead587c32021-03-11 14:09:278#include <string>
9
Mugdha Lakhani00b27a02020-03-24 13:41:3110#include "build/build_config.h"
Carlos Caballerob4283202020-08-10 14:40:4611#include "components/content_settings/browser/page_specific_content_settings.h"
Mugdha Lakhani83baeab2020-03-20 13:08:2312#include "components/content_settings/core/common/content_settings_types.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0313#include "components/permissions/permission_result.h"
Mugdha Lakhani00b27a02020-03-24 13:41:3114#include "components/permissions/permission_uma_util.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0315#include "components/safe_browsing/buildflags.h"
edchin85cfa662020-11-18 21:31:0816#include "components/safe_browsing/core/password_protection/metrics_util.h"
Mugdha Lakhani65bd7e52020-03-31 19:26:1617#include "components/security_state/core/security_state.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0318
19namespace safe_browsing {
20class PasswordProtectionService;
21} // namespace safe_browsing
Mugdha Lakhani83baeab2020-03-20 13:08:2322
Mugdha Lakhani00b27a02020-03-24 13:41:3123namespace permissions {
Mugdha Lakhani4b10b6512020-04-27 19:52:1224class ChooserContextBase;
Mugdha Lakhani00b27a02020-03-24 13:41:3125class PermissionDecisionAutoBlocker;
26} // namespace permissions
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 Lakhani09e02f622020-03-21 19:48:0342#if BUILDFLAG(FULL_SAFE_BROWSING)
43 // Helper methods requiring access to PasswordProtectionService.
44 virtual safe_browsing::PasswordProtectionService*
45 GetPasswordProtectionService() const = 0;
46 virtual void OnUserActionOnPasswordUi(
Mugdha Lakhani09e02f622020-03-21 19:48:0347 safe_browsing::WarningAction action) = 0;
Jan Wilken Dörriefa241ba2021-03-11 17:57:0148 virtual std::u16string GetWarningDetailText() = 0;
Mugdha Lakhani09e02f622020-03-21 19:48:0349#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 Lakhani00b27a02020-03-24 13:41:3155#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;
Olesia Marukhno3ed46b42021-03-23 15:26:3961 virtual void OpenCookiesDialog() = 0;
62 virtual void OpenCertificateDialog(net::X509Certificate* certificate) = 0;
63 virtual void OpenConnectionHelpCenterPage(const ui::Event& event) = 0;
64 virtual void OpenSafetyTipHelpCenterPage() = 0;
Mugdha Lakhani00b27a02020-03-24 13:41:3165#endif
66 virtual permissions::PermissionDecisionAutoBlocker*
67 GetPermissionDecisionAutoblocker() = 0;
68
69 // Service for managing SSL error page bypasses. Used to revoke bypass
70 // decisions by users.
71 virtual StatefulSSLHostStateDelegate* GetStatefulSSLHostStateDelegate() = 0;
72
73 // The |HostContentSettingsMap| is the service that provides and manages
74 // content settings (aka. site permissions).
75 virtual HostContentSettingsMap* GetContentSettings() = 0;
76
Justin Mironce1eb00a2020-08-20 15:57:3877 // The subresource filter service determines whether ads should be blocked on
78 // the site and relevant permission prompts should be shown respectively.
79 virtual bool IsSubresourceFilterActivated(const GURL& site_url) = 0;
80
Mugdha Lakhani3c22480d42020-04-24 12:43:4281 virtual std::unique_ptr<
Carlos Caballerob4283202020-08-10 14:40:4682 content_settings::PageSpecificContentSettings::Delegate>
83 GetPageSpecificContentSettingsDelegate() = 0;
Mugdha Lakhani00b27a02020-03-24 13:41:3184 virtual bool IsContentDisplayedInVrHeadset() = 0;
Mugdha Lakhani65bd7e52020-03-31 19:26:1685 virtual security_state::SecurityLevel GetSecurityLevel() = 0;
86 virtual security_state::VisibleSecurityState GetVisibleSecurityState() = 0;
Mugdha Lakhani2c21fc662020-05-06 15:33:1287#if defined(OS_ANDROID)
88 // Gets the name of the embedder.
Jan Wilken Dörriefa241ba2021-03-11 17:57:0189 virtual const std::u16string GetClientApplicationName() = 0;
Mugdha Lakhani2c21fc662020-05-06 15:33:1290#endif
Mugdha Lakhani83baeab2020-03-20 13:08:2391};
92
Mugdha Lakhanib6762162020-03-30 10:23:2593#endif // COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_