blob: acd53050436d3a745658d4c6cae27467ad156f48 [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
Mugdha Lakhani09e02f622020-03-21 19:48:038#include "base/strings/string16.h"
Mugdha Lakhani00b27a02020-03-24 13:41:319#include "build/build_config.h"
Mugdha Lakhani3c22480d42020-04-24 12:43:4210#include "components/content_settings/browser/tab_specific_content_settings.h"
Mugdha Lakhani83baeab2020-03-20 13:08:2311#include "components/content_settings/core/common/content_settings_types.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0312#include "components/permissions/permission_result.h"
Mugdha Lakhani00b27a02020-03-24 13:41:3113#include "components/permissions/permission_uma_util.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0314#include "components/safe_browsing/buildflags.h"
15#include "components/safe_browsing/content/password_protection/metrics_util.h"
Mugdha Lakhani65bd7e52020-03-31 19:26:1616#include "components/security_state/core/security_state.h"
Mugdha Lakhani09e02f622020-03-21 19:48:0317
18namespace safe_browsing {
19class PasswordProtectionService;
20} // namespace safe_browsing
Mugdha Lakhani83baeab2020-03-20 13:08:2321
Mugdha Lakhani00b27a02020-03-24 13:41:3122namespace permissions {
Mugdha Lakhani4b10b6512020-04-27 19:52:1223class ChooserContextBase;
Mugdha Lakhani00b27a02020-03-24 13:41:3124class PermissionDecisionAutoBlocker;
25} // namespace permissions
26
Mugdha Lakhani00b27a02020-03-24 13:41:3127class HostContentSettingsMap;
28class StatefulSSLHostStateDelegate;
29
30// PageInfoDelegate allows an embedder to customize PageInfo logic.
Mugdha Lakhani83baeab2020-03-20 13:08:2331class PageInfoDelegate {
32 public:
33 virtual ~PageInfoDelegate() = default;
34
Mugdha Lakhani1de9c492020-03-23 17:35:4035 // 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 Lakhani09e02f622020-03-21 19:48:0341#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 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;
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 Lakhani3c22480d42020-04-24 12:43:4273 virtual std::unique_ptr<
74 content_settings::TabSpecificContentSettings::Delegate>
75 GetTabSpecificContentSettingsDelegate() = 0;
Mugdha Lakhani00b27a02020-03-24 13:41:3176 virtual bool IsContentDisplayedInVrHeadset() = 0;
Mugdha Lakhani65bd7e52020-03-31 19:26:1677 virtual security_state::SecurityLevel GetSecurityLevel() = 0;
78 virtual security_state::VisibleSecurityState GetVisibleSecurityState() = 0;
Mugdha Lakhani2c21fc662020-05-06 15:33:1279#if defined(OS_ANDROID)
80 // Gets the name of the embedder.
81 virtual const base::string16 GetClientApplicationName() = 0;
82#endif
Mugdha Lakhani83baeab2020-03-20 13:08:2383};
84
Mugdha Lakhanib6762162020-03-30 10:23:2585#endif // COMPONENTS_PAGE_INFO_PAGE_INFO_DELEGATE_H_