#include "chrome/browser/ui/page_info/chrome_page_info_delegate.h"
#include "base/metrics/histogram_functions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/content_settings/page_specific_content_settings_delegate.h"
#include "chrome/browser/permissions/permission_decision_auto_blocker_factory.h"
#include "chrome/browser/permissions/permission_manager_factory.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_service.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_service_factory.h"
#include "chrome/browser/privacy_sandbox/tracking_protection_settings_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
#include "chrome/browser/ssl/chrome_security_state_tab_helper.h"
#include "chrome/browser/ssl/stateful_ssl_host_state_delegate_factory.h"
#include "chrome/browser/subresource_filter/subresource_filter_profile_context_factory.h"
#include "chrome/browser/ui/url_identity.h"
#include "chrome/browser/usb/usb_chooser_context.h"
#include "chrome/browser/usb/usb_chooser_context_factory.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/page_info/core/features.h"
#include "components/permissions/contexts/bluetooth_chooser_context.h"
#include "components/permissions/object_permission_context_base.h"
#include "components/permissions/permission_manager.h"
#include "components/prefs/pref_service.h"
#include "components/security_interstitials/content/stateful_ssl_host_state_delegate.h"
#include "components/subresource_filter/content/browser/subresource_filter_content_settings_manager.h"
#include "components/subresource_filter/content/browser/subresource_filter_profile_context.h"
#include "content/public/browser/permission_controller.h"
#include "content/public/browser/permission_result.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "ui/base/window_open_disposition_utils.h"
#include "url/origin.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ui/webui/ash/settings/app_management/app_management_uma.h"
#endif
#if BUILDFLAG(IS_ANDROID)
#include "chrome/grit/branded_strings.h"
#include "ui/base/l10n/l10n_util.h"
#else
#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/hid/hid_chooser_context.h"
#include "chrome/browser/hid/hid_chooser_context_factory.h"
#include "chrome/browser/lookalikes/safety_tip_ui_helper.h"
#include "chrome/browser/picture_in_picture/auto_picture_in_picture_tab_helper.h"
#include "chrome/browser/serial/serial_chooser_context.h"
#include "chrome/browser/serial/serial_chooser_context_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/hats/trust_safety_sentiment_service.h"
#include "chrome/browser/ui/hats/trust_safety_sentiment_service_factory.h"
#include "chrome/browser/ui/page_info/page_info_infobar_delegate.h"
#include "chrome/browser/ui/tab_dialogs.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/ui/web_applications/web_app_ui_utils.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_tab_helper.h"
#include "components/webapps/common/web_app_id.h"
#include "ui/events/event.h"
#endif
namespace {
constexpr UrlIdentity::TypeSet kUrlIdentityAllowedTypes = …;
constexpr UrlIdentity::FormatOptions kUrlIdentityOptions{ … };
}
ChromePageInfoDelegate::ChromePageInfoDelegate(
content::WebContents* web_contents)
: … { … }
Profile* ChromePageInfoDelegate::GetProfile() const { … }
permissions::ObjectPermissionContextBase*
ChromePageInfoDelegate::GetChooserContext(ContentSettingsType type) { … }
#if BUILDFLAG(FULL_SAFE_BROWSING)
safe_browsing::ChromePasswordProtectionService*
ChromePageInfoDelegate::GetChromePasswordProtectionService() const { … }
safe_browsing::PasswordProtectionService*
ChromePageInfoDelegate::GetPasswordProtectionService() const { … }
void ChromePageInfoDelegate::OnUserActionOnPasswordUi(
safe_browsing::WarningAction action) { … }
std::u16string ChromePageInfoDelegate::GetWarningDetailText() { … }
#endif
content::PermissionResult ChromePageInfoDelegate::GetPermissionResult(
blink::PermissionType permission,
const url::Origin& origin,
const std::optional<url::Origin>& requesting_origin) { … }
#if !BUILDFLAG(IS_ANDROID)
void ChromePageInfoDelegate::FocusWebContents() { … }
std::optional<std::u16string> ChromePageInfoDelegate::GetRwsOwner(
const GURL& site_url) { … }
bool ChromePageInfoDelegate::IsRwsManaged() { … }
bool ChromePageInfoDelegate::CreateInfoBarDelegate() { … }
std::unique_ptr<content_settings::CookieControlsController>
ChromePageInfoDelegate::CreateCookieControlsController() { … }
bool ChromePageInfoDelegate::IsIsolatedWebApp() { … }
void ChromePageInfoDelegate::ShowSiteSettings(const GURL& site_url) { … }
void ChromePageInfoDelegate::ShowCookiesSettings() { … }
void ChromePageInfoDelegate::ShowAllSitesSettingsFilteredByRwsOwner(
const std::u16string& rws_owner) { … }
void ChromePageInfoDelegate::OpenCookiesDialog() { … }
void ChromePageInfoDelegate::OpenCertificateDialog(
net::X509Certificate* certificate) { … }
void ChromePageInfoDelegate::OpenConnectionHelpCenterPage(
const ui::Event& event) { … }
void ChromePageInfoDelegate::OpenSafetyTipHelpCenterPage() { … }
void ChromePageInfoDelegate::OpenContentSettingsExceptions(
ContentSettingsType content_settings_type) { … }
void ChromePageInfoDelegate::OnPageInfoActionOccurred(
page_info::PageInfoAction action) { … }
void ChromePageInfoDelegate::OnUIClosing() { … }
#endif
std::u16string ChromePageInfoDelegate::GetSubjectName(const GURL& url) { … }
permissions::PermissionDecisionAutoBlocker*
ChromePageInfoDelegate::GetPermissionDecisionAutoblocker() { … }
StatefulSSLHostStateDelegate*
ChromePageInfoDelegate::GetStatefulSSLHostStateDelegate() { … }
HostContentSettingsMap* ChromePageInfoDelegate::GetContentSettings() { … }
bool ChromePageInfoDelegate::IsSubresourceFilterActivated(
const GURL& site_url) { … }
bool ChromePageInfoDelegate::HasAutoPictureInPictureBeenRegistered() { … }
bool ChromePageInfoDelegate::IsContentDisplayedInVrHeadset() { … }
security_state::SecurityLevel ChromePageInfoDelegate::GetSecurityLevel() { … }
security_state::VisibleSecurityState
ChromePageInfoDelegate::GetVisibleSecurityState() { … }
void ChromePageInfoDelegate::OnCookiesPageOpened() { … }
std::unique_ptr<content_settings::PageSpecificContentSettings::Delegate>
ChromePageInfoDelegate::GetPageSpecificContentSettingsDelegate() { … }
#if BUILDFLAG(IS_ANDROID)
const std::u16string ChromePageInfoDelegate::GetClientApplicationName() {
return l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
}
#endif
bool ChromePageInfoDelegate::IsHttpsFirstModeEnabled() { … }
void ChromePageInfoDelegate::SetSecurityStateForTests(
security_state::SecurityLevel security_level,
security_state::VisibleSecurityState visible_security_state) { … }