blob: 599d25310aca243926660e2ebe9e5f87b09688cb [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
Mugdha Lakhani00b27a02020-03-24 13:41:3119namespace permissions {
Ken Buchanan76365d12021-04-20 18:46:1920class ObjectPermissionContextBase;
Mugdha Lakhani00b27a02020-03-24 13:41:3121class PermissionDecisionAutoBlocker;
22} // namespace permissions
23
Hans Wennborg3e67bab2021-04-08 11:34:3124namespace safe_browsing {
25class PasswordProtectionService;
26} // namespace safe_browsing
27
28namespace ui {
29class Event;
30} // namespace ui
31
Mugdha Lakhani00b27a02020-03-24 13:41:3132class HostContentSettingsMap;
33class StatefulSSLHostStateDelegate;
34
35// PageInfoDelegate allows an embedder to customize PageInfo logic.
Mugdha Lakhani83baeab2020-03-20 13:08:2336class PageInfoDelegate {
37 public:
38 virtual ~PageInfoDelegate() = default;
39
Ken Buchanan76365d12021-04-20 18:46:1940 // 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 Lakhani1de9c492020-03-23 17:35:4044 ContentSettingsType type) = 0;
45
Mugdha Lakhani09e02f622020-03-21 19:48:0346#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 Lakhani09e02f622020-03-21 19:48:0351 safe_browsing::WarningAction action) = 0;
Jan Wilken Dörriefa241ba2021-03-11 17:57:0152 virtual std::u16string GetWarningDetailText() = 0;
Mugdha Lakhani09e02f622020-03-21 19:48:0353#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 Lakhani00b27a02020-03-24 13:41:3159#if !defined(OS_ANDROID)
Colin Blundelle70a6d82021-05-04 12:03:1960 // Creates an infobars::ContentInfoBarManager and an InfoBarDelegate using it,
61 // if possible. Returns true if an InfoBarDelegate was created, false
62 // otherwise.
Mugdha Lakhani00b27a02020-03-24 13:41:3163 virtual bool CreateInfoBarDelegate() = 0;
64
65 virtual void ShowSiteSettings(const GURL& site_url) = 0;
Olesia Marukhno3ed46b42021-03-23 15:26:3966 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 Lakhani00b27a02020-03-24 13:41:3170#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 Mironce1eb00a2020-08-20 15:57:3882 // 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 Lakhani3c22480d42020-04-24 12:43:4286 virtual std::unique_ptr<
Carlos Caballerob4283202020-08-10 14:40:4687 content_settings::PageSpecificContentSettings::Delegate>
88 GetPageSpecificContentSettingsDelegate() = 0;
Mugdha Lakhani00b27a02020-03-24 13:41:3189 virtual bool IsContentDisplayedInVrHeadset() = 0;
Mugdha Lakhani65bd7e52020-03-31 19:26:1690 virtual security_state::SecurityLevel GetSecurityLevel() = 0;
91 virtual security_state::VisibleSecurityState GetVisibleSecurityState() = 0;
Mugdha Lakhani2c21fc662020-05-06 15:33:1292#if defined(OS_ANDROID)
93 // Gets the name of the embedder.
Jan Wilken Dörriefa241ba2021-03-11 17:57:0194 virtual const std::u16string GetClientApplicationName() = 0;
Mugdha Lakhani2c21fc662020-05-06 15:33:1295#endif
Mugdha Lakhani83baeab2020-03-20 13:08:2396};
97
Mugdha Lakhanib6762162020-03-30 10:23:2598#endif // COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_