blob: 2b72b5448ddefd6874a4b01efb7ce370e7fdfc14 [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 Lakhani09e02f622020-03-21 19:48:0310#include "base/strings/string16.h"
Mugdha Lakhani00b27a02020-03-24 13:41:3111#include "build/build_config.h"
Carlos Caballerob4283202020-08-10 14:40:4612#include "components/content_settings/browser/page_specific_content_settings.h"
Mugdha Lakhani83baeab2020-03-20 13:08:2313#include "components/content_settings/core/common/content_settings_types.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0314#include "components/permissions/permission_result.h"
Mugdha Lakhani00b27a02020-03-24 13:41:3115#include "components/permissions/permission_uma_util.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0316#include "components/safe_browsing/buildflags.h"
edchin85cfa662020-11-18 21:31:0817#include "components/safe_browsing/core/password_protection/metrics_util.h"
Mugdha Lakhani65bd7e52020-03-31 19:26:1618#include "components/security_state/core/security_state.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0319
20namespace safe_browsing {
21class PasswordProtectionService;
22} // namespace safe_browsing
Mugdha Lakhani83baeab2020-03-20 13:08:2323
Mugdha Lakhani00b27a02020-03-24 13:41:3124namespace permissions {
Mugdha Lakhani4b10b6512020-04-27 19:52:1225class ChooserContextBase;
Mugdha Lakhani00b27a02020-03-24 13:41:3126class PermissionDecisionAutoBlocker;
27} // namespace permissions
28
Mugdha Lakhani00b27a02020-03-24 13:41:3129class HostContentSettingsMap;
30class StatefulSSLHostStateDelegate;
31
32// PageInfoDelegate allows an embedder to customize PageInfo logic.
Mugdha Lakhani83baeab2020-03-20 13:08:2333class PageInfoDelegate {
34 public:
35 virtual ~PageInfoDelegate() = default;
36
Mugdha Lakhani1de9c492020-03-23 17:35:4037 // 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 Lakhani09e02f622020-03-21 19:48:0343#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 Lakhani00b27a02020-03-24 13:41:3157#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 Mironce1eb00a2020-08-20 15:57:3875 // 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 Lakhani3c22480d42020-04-24 12:43:4279 virtual std::unique_ptr<
Carlos Caballerob4283202020-08-10 14:40:4680 content_settings::PageSpecificContentSettings::Delegate>
81 GetPageSpecificContentSettingsDelegate() = 0;
Mugdha Lakhani00b27a02020-03-24 13:41:3182 virtual bool IsContentDisplayedInVrHeadset() = 0;
Mugdha Lakhani65bd7e52020-03-31 19:26:1683 virtual security_state::SecurityLevel GetSecurityLevel() = 0;
84 virtual security_state::VisibleSecurityState GetVisibleSecurityState() = 0;
Mugdha Lakhani2c21fc662020-05-06 15:33:1285#if defined(OS_ANDROID)
86 // Gets the name of the embedder.
87 virtual const base::string16 GetClientApplicationName() = 0;
88#endif
Mugdha Lakhani83baeab2020-03-20 13:08:2389};
90
Mugdha Lakhanib6762162020-03-30 10:23:2591#endif // COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_