#include "chrome/browser/chrome_content_browser_client.h"
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>
#include "base/base_switches.h"
#include "base/check_deref.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/containers/fixed_flat_set.h"
#include "base/dcheck_is_on.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/i18n/base_i18n_switches.h"
#include "base/i18n/character_encoding.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/ranges/algorithm.h"
#include "base/stl_util.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "build/config/chromebox_for_meetings/buildflags.h"
#include "chrome/browser/after_startup_task_utils.h"
#include "chrome/browser/ai/ai_manager_keyed_service_factory.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.h"
#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_model_delegate.h"
#include "chrome/browser/browsing_topics/browsing_topics_service_factory.h"
#include "chrome/browser/captive_portal/captive_portal_service_factory.h"
#include "chrome/browser/child_process_host_flags.h"
#include "chrome/browser/chrome_browser_main_extra_parts_nacl_deprecation.h"
#include "chrome/browser/chrome_content_browser_client_binder_policies.h"
#include "chrome/browser/chrome_content_browser_client_parts.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
#include "chrome/browser/data_saver/data_saver.h"
#include "chrome/browser/data_sharing/data_sharing_navigation_throttle.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/device_api/device_service_impl.h"
#include "chrome/browser/device_api/managed_configuration_service.h"
#include "chrome/browser/dips/chrome_dips_delegate.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/enterprise/browser_management/management_service_factory.h"
#include "chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_service.h"
#include "chrome/browser/enterprise/reporting/prefs.h"
#include "chrome/browser/enterprise/util/managed_browser_utils.h"
#include "chrome/browser/extensions/chrome_extension_cookies.h"
#include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/favicon/favicon_utils.h"
#include "chrome/browser/first_party_sets/first_party_sets_navigation_throttle.h"
#include "chrome/browser/font_family_cache.h"
#include "chrome/browser/gpu/chrome_browser_main_extra_parts_gpu.h"
#include "chrome/browser/headless/headless_mode_util.h"
#include "chrome/browser/hid/chrome_hid_delegate.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/interstitials/enterprise_util.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/lookalikes/lookalike_url_navigation_throttle.h"
#include "chrome/browser/media/audio_service_util.h"
#include "chrome/browser/media/prefs/capture_device_ranking.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/webrtc/audio_debug_recordings_handler.h"
#include "chrome/browser/media/webrtc/capture_policy_utils.h"
#include "chrome/browser/media/webrtc/chrome_screen_enumerator.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
#include "chrome/browser/media/webrtc/webrtc_logging_controller.h"
#include "chrome/browser/memory/chrome_browser_main_extra_parts_memory.h"
#include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
#include "chrome/browser/metrics/chrome_feature_list_creator.h"
#include "chrome/browser/navigation_predictor/anchor_element_preloader.h"
#include "chrome/browser/net/chrome_network_delegate.h"
#include "chrome/browser/net/profile_network_context_service.h"
#include "chrome/browser/net/profile_network_context_service_factory.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/optimization_guide/chrome_browser_main_extra_parts_optimization_guide.h"
#include "chrome/browser/payments/payment_request_display_manager_factory.h"
#include "chrome/browser/performance_manager/public/chrome_browser_main_extra_parts_performance_manager.h"
#include "chrome/browser/performance_manager/public/chrome_content_browser_client_performance_manager_part.h"
#include "chrome/browser/performance_monitor/chrome_browser_main_extra_parts_performance_monitor.h"
#include "chrome/browser/plugins/pdf_iframe_navigation_throttle.h"
#include "chrome/browser/plugins/plugin_utils.h"
#include "chrome/browser/policy/policy_util.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/predictors/loading_predictor.h"
#include "chrome/browser/predictors/loading_predictor_factory.h"
#include "chrome/browser/preloading/navigation_ablation_throttle.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/chrome_no_state_prefetch_contents_delegate.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/chrome_speculation_host_delegate.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_manager_factory.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_navigation_throttle.h"
#include "chrome/browser/preloading/prefetch/prefetch_service/chrome_prefetch_service_delegate.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/field_trial_settings.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_url_loader.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.h"
#include "chrome/browser/preloading/preloading_features.h"
#include "chrome/browser/preloading/preloading_prefs.h"
#include "chrome/browser/preloading/prerender/prerender_web_contents_delegate.h"
#include "chrome/browser/privacy_budget/identifiability_study_state.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h"
#include "chrome/browser/privacy_sandbox/tracking_protection_settings_factory.h"
#include "chrome/browser/private_network_access/chrome_private_network_device_delegate.h"
#include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_selections.h"
#include "chrome/browser/profiles/renderer_updater.h"
#include "chrome/browser/profiles/renderer_updater_factory.h"
#include "chrome/browser/profiling_host/chrome_browser_main_extra_parts_profiling.h"
#include "chrome/browser/renderer_host/chrome_navigation_ui_data.h"
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/request_header_integrity/buildflags.h"
#include "chrome/browser/safe_browsing/chrome_ping_manager_factory.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h"
#include "chrome/browser/safe_browsing/delayed_warning_navigation_throttle.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/url_checker_delegate_impl.h"
#include "chrome/browser/safe_browsing/url_lookup_service_factory.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/segmentation_platform/chrome_browser_main_extra_parts_segmentation_platform.h"
#include "chrome/browser/sharing/sms/sms_remote_fetcher.h"
#include "chrome/browser/signin/chrome_signin_proxying_url_loader_factory.h"
#include "chrome/browser/signin/chrome_signin_url_loader_throttle.h"
#include "chrome/browser/signin/header_modification_delegate_impl.h"
#include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
#include "chrome/browser/ssl/chrome_security_blocking_page_factory.h"
#include "chrome/browser/ssl/chrome_security_state_tab_helper.h"
#include "chrome/browser/ssl/https_defaulted_callbacks.h"
#include "chrome/browser/ssl/https_upgrades_interceptor.h"
#include "chrome/browser/ssl/https_upgrades_navigation_throttle.h"
#include "chrome/browser/ssl/sct_reporting_service.h"
#include "chrome/browser/ssl/ssl_client_certificate_selector.h"
#include "chrome/browser/ssl/typed_navigation_upgrade_throttle.h"
#include "chrome/browser/supervised_user/classify_url_navigation_throttle.h"
#include "chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.h"
#include "chrome/browser/supervised_user/supervised_user_navigation_throttle.h"
#include "chrome/browser/tab_group_sync/tab_group_sync_utils.h"
#include "chrome/browser/task_manager/sampling/task_manager_impl.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/tracing/chrome_tracing_delegate.h"
#include "chrome/browser/translate/translate_service.h"
#include "chrome/browser/ui/blocked_content/blocked_window_params.h"
#include "chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.h"
#include "chrome/browser/ui/blocked_content/tab_under_navigation_throttle.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/browser/ui/lens/lens_overlay_side_panel_navigation_throttle.h"
#include "chrome/browser/ui/login/http_auth_coordinator.h"
#include "chrome/browser/ui/login/login_navigation_throttle.h"
#include "chrome/browser/ui/passwords/password_manager_navigation_throttle.h"
#include "chrome/browser/ui/passwords/well_known_change_password_navigation_throttle.h"
#include "chrome/browser/ui/prefs/pref_watcher.h"
#include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webid/identity_dialog_controller.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/browser/ui/webui/log_web_ui_url.h"
#include "chrome/browser/ui/webui/top_chrome/webui_url_utils.h"
#include "chrome/browser/universal_web_contents_observers.h"
#include "chrome/browser/usb/chrome_usb_delegate.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_info.h"
#include "chrome/browser/webapps/web_app_offline.h"
#include "chrome/browser/webauthn/webauthn_pref_names.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/crash_keys.h"
#include "chrome/common/env_vars.h"
#include "chrome/common/google_url_loader_throttle.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/ppapi_utils.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/profiler/main_thread_stack_sampling_profiler.h"
#include "chrome/common/profiler/process_type.h"
#include "chrome/common/profiler/thread_profiler_configuration.h"
#include "chrome/common/renderer_configuration.mojom.h"
#include "chrome/common/secure_origin_allowlist.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/installer/util/google_update_settings.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/blocked_content/popup_blocker.h"
#include "components/browsing_topics/browsing_topics_service.h"
#include "components/captive_portal/core/buildflags.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/browser/private_network_settings.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/custom_handlers/protocol_handler_registry.h"
#include "components/custom_handlers/protocol_handler_throttle.h"
#include "components/dom_distiller/core/dom_distiller_switches.h"
#include "components/dom_distiller/core/url_constants.h"
#include "components/embedder_support/content_settings_utils.h"
#include "components/embedder_support/origin_trials/origin_trials_settings_storage.h"
#include "components/embedder_support/switches.h"
#include "components/embedder_support/user_agent_utils.h"
#include "components/enterprise/buildflags/buildflags.h"
#include "components/enterprise/common/proto/connectors.pb.h"
#include "components/enterprise/content/clipboard_restriction_service.h"
#include "components/enterprise/content/pref_names.h"
#include "components/error_page/common/error.h"
#include "components/error_page/common/error_page_switches.h"
#include "components/error_page/common/localized_error.h"
#include "components/error_page/content/browser/net_error_auto_reloader.h"
#include "components/fingerprinting_protection_filter/browser/throttle_manager.h"
#include "components/fingerprinting_protection_filter/common/fingerprinting_protection_filter_features.h"
#include "components/google/core/common/google_switches.h"
#include "components/heap_profiling/in_process/heap_profiler_controller.h"
#include "components/history/content/browser/visited_link_navigation_throttle.h"
#include "components/keep_alive_registry/keep_alive_types.h"
#include "components/keep_alive_registry/scoped_keep_alive.h"
#include "components/language/core/browser/pref_names.h"
#include "components/lens/buildflags.h"
#include "components/live_caption/caption_util.h"
#include "components/media_device_salt/media_device_salt_service.h"
#include "components/media_router/browser/presentation/presentation_service_delegate_impl.h"
#include "components/media_router/browser/presentation/receiver_presentation_service_delegate_impl.h"
#include "components/media_router/browser/presentation/web_contents_presentation_manager.h"
#include "components/metrics/client_info.h"
#include "components/metrics_services_manager/metrics_services_manager.h"
#include "components/net_log/chrome_net_log.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "components/no_state_prefetch/browser/no_state_prefetch_manager.h"
#include "components/no_state_prefetch/common/no_state_prefetch_final_status.h"
#include "components/no_state_prefetch/common/no_state_prefetch_url_loader_throttle.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/page_load_metrics/browser/metrics_navigation_throttle.h"
#include "components/page_load_metrics/browser/metrics_web_contents_observer.h"
#include "components/payments/content/payment_credential_factory.h"
#include "components/payments/content/payment_handler_navigation_throttle.h"
#include "components/payments/content/payment_request_display_manager.h"
#include "components/pdf/common/pdf_util.h"
#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "components/permissions/bluetooth_delegate_impl.h"
#include "components/permissions/permission_context_base.h"
#include "components/policy/content/policy_blocklist_navigation_throttle.h"
#include "components/policy/content/policy_blocklist_service.h"
#include "components/policy/core/common/management/management_service.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/privacy_sandbox/privacy_sandbox_prefs.h"
#include "components/privacy_sandbox/privacy_sandbox_settings.h"
#include "components/privacy_sandbox/tracking_protection_settings.h"
#include "components/safe_browsing/content/browser/async_check_tracker.h"
#include "components/safe_browsing/content/browser/browser_url_loader_throttle.h"
#include "components/safe_browsing/content/browser/password_protection/password_protection_commit_deferring_condition.h"
#include "components/safe_browsing/content/browser/safe_browsing_navigation_throttle.h"
#include "components/safe_browsing/content/browser/ui_manager.h"
#include "components/safe_browsing/core/browser/hashprefix_realtime/hash_realtime_service.h"
#include "components/safe_browsing/core/browser/realtime/policy_engine.h"
#include "components/safe_browsing/core/browser/realtime/url_lookup_service.h"
#include "components/safe_browsing/core/browser/url_checker_delegate.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/hashprefix_realtime/hash_realtime_utils.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/security_interstitials/content/insecure_form_navigation_throttle.h"
#include "components/security_interstitials/content/ssl_error_handler.h"
#include "components/security_interstitials/content/ssl_error_navigation_throttle.h"
#include "components/security_state/core/security_state.h"
#include "components/site_isolation/pref_names.h"
#include "components/site_isolation/preloaded_isolated_origins.h"
#include "components/site_isolation/site_isolation_policy.h"
#include "components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h"
#include "components/supervised_user/core/common/features.h"
#include "components/translate/core/common/translate_switches.h"
#include "components/user_prefs/user_prefs.h"
#include "components/variations/variations_associated_data.h"
#include "components/variations/variations_switches.h"
#include "components/version_info/version_info.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/browser/attribution_data_model.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_main_parts.h"
#include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/browser_url_handler.h"
#include "content/public/browser/certificate_request_result_type.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/digital_identity_provider.h"
#include "content/public/browser/file_url_loader.h"
#include "content/public/browser/isolated_web_apps_policy.h"
#include "content/public/browser/legacy_tech_cookie_issue_details.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/overlay_window.h"
#include "content/public/browser/permission_controller.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/site_isolation_mode.h"
#include "content/public/browser/sms_fetcher.h"
#include "content/public/browser/tts_controller.h"
#include "content/public/browser/tts_platform.h"
#include "content/public/browser/url_loader_request_interceptor.h"
#include "content/public/browser/vpn_service_proxy.h"
#include "content/public/browser/weak_document_ptr.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_view_delegate.h"
#include "content/public/browser/web_ui_url_loader_factory.h"
#include "content/public/browser/webui_config_map.h"
#include "content/public/common/content_descriptors.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/window_container_type.mojom-shared.h"
#include "device/vr/buildflags/buildflags.h"
#include "extensions/browser/browser_frame_context_data.h"
#include "extensions/buildflags/buildflags.h"
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/google_api_keys.h"
#include "gpu/config/gpu_switches.h"
#include "media/base/media_switches.h"
#include "media/media_buildflags.h"
#include "media/mojo/buildflags.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/features.h"
#include "net/cookies/site_for_cookies.h"
#include "net/ssl/client_cert_store.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_private_key.h"
#include "pdf/buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "sandbox/policy/features.h"
#include "sandbox/policy/mojom/sandbox.mojom.h"
#include "sandbox/policy/switches.h"
#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/self_deleting_url_loader_factory.h"
#include "services/network/public/cpp/web_sandbox_flags.h"
#include "services/network/public/mojom/cert_verifier_service.mojom.h"
#include "services/network/public/mojom/network_service.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/web_transport.mojom.h"
#include "services/video_effects/public/mojom/video_effects_processor.mojom-forward.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
#include "third_party/blink/public/common/navigation/navigation_policy.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/public/mojom/browsing_topics/browsing_topics.mojom.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom.h"
#include "third_party/blink/public/public_buildflags.h"
#include "third_party/widevine/cdm/buildflags.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_provider_key.h"
#include "ui/gfx/switches.h"
#include "ui/native_theme/native_theme.h"
#include "url/gurl.h"
#include "url/origin.h"
#include "url/third_party/mozilla/url_parse.h"
#include "url/url_constants.h"
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
#include "chrome/browser/enterprise/platform_auth/platform_auth_navigation_throttle.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/files/file_util.h"
#include "base/strings/string_tokenizer.h"
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "chrome/browser/chrome_browser_main_win.h"
#include "chrome/browser/lifetime/application_lifetime_desktop.h"
#include "chrome/install_static/install_util.h"
#include "chrome/services/util_win/public/mojom/util_win.mojom.h"
#include "sandbox/win/src/sandbox_policy.h"
#elif BUILDFLAG(IS_MAC)
#include "chrome/browser/browser_process_platform_part_mac.h"
#include "chrome/browser/chrome_browser_main_mac.h"
#include "chrome/browser/mac/auth_session_request.h"
#include "chrome/browser/mac/chrome_browser_main_extra_parts_mac.h"
#include "components/soda/constants.h"
#include "sandbox/mac/sandbox_compiler.h"
#include "sandbox/policy/mac/params.h"
#include "sandbox/policy/mac/sandbox_mac.h"
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/constants/ash_switches.h"
#include "ash/public/cpp/tablet_mode.h"
#include "ash/webui/camera_app_ui/url_constants.h"
#include "ash/webui/help_app_ui/url_constants.h"
#include "ash/webui/media_app_ui/url_constants.h"
#include "ash/webui/print_management/url_constants.h"
#include "ash/webui/recorder_app_ui/url_constants.h"
#include "ash/webui/scanning/url_constants.h"
#include "ash/webui/shortcut_customization_ui/url_constants.h"
#include "chrome/app/chrome_crash_reporter_client.h"
#include "chrome/browser/ash/arc/fileapi/arc_content_file_system_backend_delegate.h"
#include "chrome/browser/ash/arc/fileapi/arc_documents_provider_backend_delegate.h"
#include "chrome/browser/ash/chrome_browser_main_parts_ash.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/browser/ash/drive/fileapi/drivefs_file_system_backend_delegate.h"
#include "chrome/browser/ash/file_manager/app_id.h"
#include "chrome/browser/ash/file_system_provider/fileapi/backend_delegate.h"
#include "chrome/browser/ash/fileapi/external_file_url_loader_factory.h"
#include "chrome/browser/ash/fileapi/file_system_backend.h"
#include "chrome/browser/ash/fileapi/mtp_file_system_backend_delegate.h"
#include "chrome/browser/ash/http_auth_dialog.h"
#include "chrome/browser/ash/login/signin/merge_session_navigation_throttle.h"
#include "chrome/browser/ash/login/signin/merge_session_throttling_utils.h"
#include "chrome/browser/ash/login/signin_partition_manager.h"
#include "chrome/browser/ash/login/startup_utils.h"
#include "chrome/browser/ash/net/network_health/network_health_manager.h"
#include "chrome/browser/ash/net/system_proxy_manager.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/ash/smb_client/fileapi/smbfs_file_system_backend_delegate.h"
#include "chrome/browser/ash/system/input_device_settings.h"
#include "chrome/browser/ash/url_handler/url_handler.h"
#include "chrome/browser/chromeos/app_mode/kiosk_settings_navigation_throttle.h"
#include "chrome/browser/speech/tts_chromeos.h"
#include "chrome/browser/speech/tts_controller_delegate_impl.h"
#include "chrome/browser/ui/ash/main_extra_parts/chrome_browser_main_extra_parts_ash.h"
#include "chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/webui/ash/kerberos/kerberos_in_browser_dialog.h"
#include "chrome/common/webui_url_constants.h"
#include "chromeos/ash/components/browser_context_helper/browser_context_types.h"
#include "chromeos/ash/components/settings/cros_settings.h"
#include "chromeos/ash/services/network_health/public/cpp/network_health_helper.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
#include "services/service_manager/public/mojom/interface_provider_spec.mojom.h"
#include "storage/browser/file_system/external_mount_points.h"
#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/chrome_browser_main_linux.h"
#include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h"
#elif BUILDFLAG(IS_ANDROID)
#include "base/android/application_status_listener.h"
#include "base/android/build_info.h"
#include "base/feature_list.h"
#include "chrome/android/features/dev_ui/buildflags.h"
#include "chrome/browser/android/customtabs/client_data_header_web_contents_observer.h"
#include "chrome/browser/android/devtools_manager_delegate_android.h"
#include "chrome/browser/android/ntp/new_tab_page_url_handler.h"
#include "chrome/browser/android/service_tab_launcher.h"
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/android/tab_web_contents_delegate_android.h"
#include "chrome/browser/chrome_browser_main_android.h"
#include "chrome/browser/digital_credentials/digital_identity_provider_android.h"
#include "chrome/browser/download/android/available_offline_content_provider.h"
#include "chrome/browser/download/android/intercept_oma_download_navigation_throttle.h"
#include "chrome/browser/flags/android/chrome_feature_list.h"
#include "chrome/browser/ui/android/tab_model/tab_model_list.h"
#include "chrome/common/chrome_descriptors.h"
#include "components/browser_ui/accessibility/android/font_size_prefs_android.h"
#include "components/crash/content/browser/child_exit_observer_android.h"
#include "components/crash/content/browser/crash_memory_metrics_collector_android.h"
#include "components/navigation_interception/intercept_navigation_delegate.h"
#include "components/viz/common/features.h"
#include "components/viz/common/viz_utils.h"
#include "content/public/browser/android/java_interfaces.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "ui/base/resource/resource_bundle_android.h"
#include "ui/base/ui_base_paths.h"
#include "ui/display/util/display_util.h"
#if BUILDFLAG(DFMIFY_DEV_UI)
#include "chrome/browser/dev_ui/android/dev_ui_loader_throttle.h"
#endif
#elif BUILDFLAG(IS_POSIX)
#include "chrome/browser/chrome_browser_main_posix.h"
#endif
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/digital_credentials/digital_identity_provider_desktop.h"
#include "chrome/browser/preloading/preview/preview_navigation_throttle.h"
#include "chrome/browser/web_applications/isolated_web_apps/chrome_content_browser_client_isolated_web_apps_part.h"
#include "chrome/browser/web_applications/locks/app_lock.h"
#include "chrome/browser/web_applications/proto/web_app_install_state.pb.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "components/keep_alive_registry/keep_alive_registry.h"
#include "third_party/blink/public/mojom/installedapp/related_application.mojom.h"
#endif
#if BUILDFLAG(IS_CHROMEOS)
#include "base/debug/leak_annotations.h"
#include "chrome/browser/apps/app_service/app_install/app_install_navigation_throttle.h"
#include "chrome/browser/apps/intent_helper/chromeos_disabled_apps_throttle.h"
#include "chrome/browser/apps/link_capturing/chromeos_link_capturing_delegate.h"
#include "chrome/browser/chromeos/enterprise/incognito_navigation_throttle.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_scoped_file_access_delegate.h"
#include "chrome/browser/chromeos/quickoffice/quickoffice_prefs.h"
#include "chrome/browser/chromeos/tablet_mode/chrome_content_browser_client_tablet_mode_part.h"
#include "chrome/browser/file_system_access/cloud_identifier/cloud_identifier_util_cros.h"
#include "chrome/browser/policy/networking/policy_cert_service.h"
#include "chrome/browser/policy/networking/policy_cert_service_factory.h"
#include "chrome/browser/policy/system_features_disable_list_policy_handler.h"
#include "chrome/browser/smart_card/chromeos_smart_card_delegate.h"
#include "chrome/browser/web_applications/web_app_tab_helper.h"
#include "chrome/common/chromeos/extensions/chromeos_system_extension_info.h"
#include "chromeos/components/kiosk/kiosk_utils.h"
#include "chromeos/constants/chromeos_features.h"
#include "content/public/browser/chromeos/multi_capture_service.h"
#include "third_party/cros_system_api/switches/chrome_switches.h"
#endif
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/apps/link_capturing/link_capturing_navigation_throttle.h"
#include "chrome/browser/devtools/chrome_devtools_manager_delegate.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/direct_sockets/chrome_direct_sockets_delegate.h"
#include "chrome/browser/enterprise/connectors/connectors_service.h"
#include "chrome/browser/headless/chrome_browser_main_extra_parts_headless.h"
#include "chrome/browser/media/unified_autoplay_config.h"
#include "chrome/browser/media_effects/media_effects_manager_binder.h"
#include "chrome/browser/metrics/usage_scenario/chrome_responsiveness_calculator_delegate.h"
#include "chrome/browser/new_tab_page/new_tab_page_util.h"
#include "chrome/browser/page_info/about_this_site_side_panel_throttle.h"
#include "chrome/browser/search/instant_service.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/serial/chrome_serial_delegate.h"
#include "chrome/browser/task_manager/task_manager_interface.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/search/new_tab_page_navigation_throttle.h"
#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_side_panel_navigation_throttle.h"
#include "chrome/browser/ui/web_applications/tabbed_web_app_navigation_throttle.h"
#include "chrome/browser/ui/web_applications/webui_web_app_navigation_throttle.h"
#include "chrome/browser/ui/webui/chrome_content_browser_client_webui_part.h"
#include "chrome/browser/ui/webui/webui_util_desktop.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_error_page.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_loader_factory.h"
#include "chrome/browser/web_applications/policy/web_app_policy_manager.h"
#include "chrome/browser/web_applications/web_app_helpers.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_utils.h"
#include "chrome/browser/webauthn/authenticator_request_scheduler.h"
#include "chrome/browser/webauthn/chrome_authenticator_request_delegate.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/lens/lens_features.h"
#include "components/password_manager/content/common/web_ui_constants.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom.h"
#endif
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
#include "chrome/browser/browser_switcher/browser_switcher_navigation_throttle.h"
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include "components/crash/core/app/crash_switches.h"
#include "components/crash/core/app/crashpad.h"
#endif
#if BUILDFLAG(IS_ANDROID)
#include "components/crash/content/browser/crash_handler_host_linux.h"
#else
#include "chrome/browser/apps/link_capturing/web_app_link_capturing_delegate.h"
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
#include "chrome/browser/enterprise/chrome_browser_main_extra_parts_enterprise.h"
#include "chrome/browser/enterprise/profile_management/oidc_auth_response_capture_navigation_throttle.h"
#include "chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.h"
#include "chrome/browser/ui/webui/app_settings/web_app_settings_navigation_throttle.h"
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/enterprise/connectors/device_trust/navigation_throttle.h"
#endif
#if defined(TOOLKIT_VIEWS)
#include "chrome/browser/ui/side_search/side_search_side_contents_helper.h"
#include "chrome/browser/ui/side_search/side_search_utils.h"
#include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h"
#endif
#if BUILDFLAG(ENABLE_LENS_DESKTOP_GOOGLE_BRANDED_FEATURES)
#include "chrome/browser/ui/views/lens/lens_side_panel_navigation_helper.h"
#endif
#if BUILDFLAG(IS_LINUX)
#include "chrome/browser/chrome_browser_main_extra_parts_linux.h"
#elif BUILDFLAG(IS_OZONE)
#include "chrome/browser/chrome_browser_main_extra_parts_ozone.h"
#endif
#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
#include "components/captive_portal/content/captive_portal_tab_helper.h"
#include "components/captive_portal/content/captive_portal_url_loader_throttle.h"
#endif
#if BUILDFLAG(ENABLE_NACL)
#include "components/nacl/browser/nacl_host_message_filter.h"
#include "components/nacl/browser/nacl_process_host.h"
#include "components/nacl/common/nacl_process_type.h"
#include "components/nacl/common/nacl_switches.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h"
#include "extensions/browser/extension_navigation_throttle.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/process_map.h"
#include "extensions/browser/script_injection_tracker.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/user_script_listener.h"
#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "content/public/browser/site_isolation_policy.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/api/web_request/web_request_proxying_webtransport.h"
#endif
#if BUILDFLAG(ENABLE_GUEST_VIEW)
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#endif
#if BUILDFLAG(ENABLE_PLATFORM_APPS)
#include "chrome/browser/apps/platform_apps/platform_app_navigation_redirector.h"
#endif
#if BUILDFLAG(ENABLE_PLUGINS)
#include "chrome/browser/plugins/chrome_content_browser_client_plugins_part.h"
#include "chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h"
#endif
#if BUILDFLAG(ENABLE_PDF)
#include "chrome/browser/pdf/chrome_pdf_stream_delegate.h"
#include "components/pdf/browser/pdf_navigation_throttle.h"
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
#include "components/pdf/common/constants.h"
#if BUILDFLAG(IS_WIN)
#include "pdf/pdf_features.h"
#endif
#endif
#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
#include "chrome/browser/media/cast_remoting_connector.h"
#endif
#if BUILDFLAG(ENABLE_REQUEST_HEADER_INTEGRITY)
#include "chrome/browser/request_header_integrity/request_header_integrity_url_loader_throttle.h"
#endif
#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
#endif
#if BUILDFLAG(SAFE_BROWSING_DB_LOCAL)
#include "chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.h"
#include "chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service_factory.h"
#endif
#if BUILDFLAG(ENABLE_OFFLINE_PAGES)
#include "chrome/browser/offline_pages/offline_page_navigation_throttle.h"
#include "chrome/browser/offline_pages/offline_page_tab_helper.h"
#include "chrome/browser/offline_pages/offline_page_url_loader_request_interceptor.h"
#endif
#if BUILDFLAG(FULL_SAFE_BROWSING)
#include "chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.h"
#endif
#if BUILDFLAG(ENABLE_VR)
#include "chrome/browser/vr/chrome_xr_integration_client.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/chrome_browser_main_parts_lacros.h"
#include "chrome/browser/lacros/chrome_browser_main_extra_parts_lacros.h"
#include "chrome/browser/speech/tts_lacros.h"
#include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_lacros.h"
#include "chrome/common/chrome_descriptors.h"
#include "chromeos/crosapi/mojom/kerberos_in_browser.mojom.h"
#include "chromeos/lacros/lacros_service.h"
#include "chromeos/startup/browser_init_params.h"
#include "chromeos/startup/browser_postlogin_params.h"
#include "chromeos/startup/startup.h"
#include "chromeos/startup/startup_switches.h"
#include "mojo/core/embedder/embedder.h"
#include "ui/base/ui_base_switches.h"
#endif
#if BUILDFLAG(USE_MINIKIN_HYPHENATION) && !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/component_updater/hyphenation_component_installer.h"
#endif
#if BUILDFLAG(FULL_SAFE_BROWSING)
#include "components/enterprise/common/files_scan_data.h"
#endif
#if defined(_WINDOWS_)
#include "base/win/windows_h_disallowed.h"
#endif
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/screen_ai/screen_ai_install_state.h"
#endif
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
#include "chrome/browser/signin/bound_session_credentials/bound_session_cookie_refresh_service.h"
#include "chrome/browser/signin/bound_session_credentials/bound_session_cookie_refresh_service_factory.h"
#include "chrome/browser/signin/bound_session_credentials/bound_session_request_throttled_handler_browser_impl.h"
#include "chrome/common/bound_session_request_throttled_handler.h"
#endif
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/components/kiosk/kiosk_utils.h"
#endif
#if BUILDFLAG(ENTERPRISE_DATA_CONTROLS) && !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/enterprise/data_protection/data_protection_clipboard_utils.h"
#include "chrome/browser/enterprise/data_protection/paste_allowed_request.h"
#endif
#if BUILDFLAG(OS_LEVEL_GEOLOCATION_PERMISSION_SUPPORTED)
#include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h"
#endif
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/feed/feed_service_factory.h"
#include "components/feed/feed_feature_list.h"
#endif
EffectiveConnectionType;
WebPreferences;
BrowserThread;
BrowserURLHandler;
ChildProcessSecurityPolicy;
RenderFrameHost;
SiteInstance;
WebContents;
#if BUILDFLAG(IS_POSIX)
PosixFileDescriptorInfo;
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
APIPermission;
ChromeContentBrowserClientExtensionsPart;
Extension;
Manifest;
APIPermissionID;
#endif
#if BUILDFLAG(ENABLE_PLUGINS)
ChromeContentBrowserClientPluginsPart;
#endif
#if !BUILDFLAG(IS_ANDROID)
ChromeContentBrowserClientIsolatedWebAppsPart;
#endif
namespace {
#if BUILDFLAG(IS_ANDROID)
BASE_FEATURE(kAllowGaiaOriginIsolationOnAndroid,
"AllowGaiaOriginIsolationOnAndroid",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kPrivateNetworkAccessRestrictionsForAutomotive,
"PrivateNetworkAccessRestrictionsForAutomotive",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif
class ChromeBrowserMainExtraPartsThreadNotifier final
: public ChromeBrowserMainExtraParts { … };
void HandleSSLErrorWrapper(
content::WebContents* web_contents,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
SSLErrorHandler::BlockingPageReadyCallback blocking_page_ready_callback) { … }
std::string& GetIOThreadApplicationLocale() { … }
GURL ReplaceURLHostAndPath(const GURL& url,
const std::string& host,
const std::string& path) { … }
bool HandleNewTabPageLocationOverride(
GURL* url,
content::BrowserContext* browser_context) { … }
#if !BUILDFLAG(IS_ANDROID)
bool IsFileOrDirectoryPickerWithoutGestureAllowed(
content::WebContents* contents) { … }
bool IsAutoplayAllowedByPolicy(content::WebContents* contents,
PrefService* prefs) { … }
#endif
blink::mojom::AutoplayPolicy GetAutoplayPolicyForWebContents(
WebContents* web_contents) { … }
#if BUILDFLAG(IS_ANDROID)
int GetCrashSignalFD(const base::CommandLine& command_line) {
return crashpad::CrashHandlerHost::Get()->GetDeathSignalSocket();
}
#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
int GetCrashSignalFD(const base::CommandLine& command_line) { … }
#endif
void SetApplicationLocaleOnIOThread(const std::string& locale) { … }
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
bool URLHasExtensionPermission(extensions::ProcessMap* process_map,
extensions::ExtensionRegistry* registry,
const GURL& url,
int render_process_id,
APIPermissionID permission) { … }
bool IsExtensionIdAllowedToUseIsolatedContext(std::string_view extension_id) { … }
#endif
mojo::PendingRemote<prerender::mojom::PrerenderCanceler> GetPrerenderCanceler(
base::OnceCallback<content::WebContents*()> wc_getter) { … }
bool ShouldHonorPolicies() { … }
const char kDisableSandboxExternalProtocolSwitch[] = …;
void LaunchURL(
base::WeakPtr<ChromeContentBrowserClient> client,
const GURL& url,
content::WebContents::Getter web_contents_getter,
ui::PageTransition page_transition,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
bool has_user_gesture,
const std::optional<url::Origin>& initiating_origin,
content::WeakDocumentPtr initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { … }
void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) { … }
#if BUILDFLAG(IS_WIN) && !defined(COMPONENT_BUILD) && \
!defined(ADDRESS_SANITIZER)
base::FilePath GetModulePath(std::wstring_view module_name) {
base::FilePath exe_dir;
const bool has_path = base::PathService::Get(base::DIR_EXE, &exe_dir);
DCHECK(has_path);
const base::FilePath module_path =
exe_dir.AppendASCII(chrome::kChromeVersion).Append(module_name);
if (base::PathExists(module_path))
return module_path;
return exe_dir.Append(module_name);
}
#endif
void MaybeAddThrottle(
std::unique_ptr<content::NavigationThrottle> maybe_throttle,
std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) { … }
#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
void MaybeAddCondition(
std::unique_ptr<content::CommitDeferringCondition> maybe_condition,
std::vector<std::unique_ptr<content::CommitDeferringCondition>>*
conditions) { … }
#endif
void MaybeAddThrottles(
std::vector<std::unique_ptr<content::NavigationThrottle>> additional,
std::vector<std::unique_ptr<content::NavigationThrottle>>* combined) { … }
bool IsInHostedApp(WebContents* web_contents) { … }
bool IsErrorPageAutoReloadEnabled() { … }
bool IsTopChromeRendererPresent(Profile* profile) { … }
bool ShouldUseSpareRenderProcessHostForTopChromePage(Profile* profile) { … }
#if BUILDFLAG(IS_CHROMEOS)
void NotifyMultiCaptureStarted(const std::string& label,
content::WebContents* web_contents,
const webapps::AppId* app_id) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (app_id &&
video_capture::mojom::MultiCaptureServiceClient::Version_ >=
video_capture::mojom::MultiCaptureServiceClient::MethodMinVersions::
kMultiCaptureStartedFromAppMinVersion) {
content::GetMultiCaptureService().NotifyMultiCaptureStartedFromApp(
label, *app_id,
web_app::WebAppProvider::GetForWebContents(web_contents)
->registrar_unsafe()
.GetAppShortName(*app_id));
} else {
content::GetMultiCaptureService().NotifyMultiCaptureStarted(
label, url::Origin::Create(web_contents->GetLastCommittedURL()));
}
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
chromeos::LacrosService& service =
CHECK_DEREF(chromeos::LacrosService::Get());
crosapi::mojom::MultiCaptureService& multi_capture_service = CHECK_DEREF(
service.GetRemote<crosapi::mojom::MultiCaptureService>().get());
if (app_id &&
service.GetInterfaceVersion<crosapi::mojom::MultiCaptureService>() >=
(int)crosapi::mojom::MultiCaptureService::MethodMinVersions::
kMultiCaptureStartedFromAppMinVersion) {
multi_capture_service.MultiCaptureStartedFromApp(
label, *app_id,
web_app::WebAppProvider::GetForWebContents(web_contents)
->registrar_unsafe()
.GetAppShortName(*app_id));
} else {
multi_capture_service.MultiCaptureStarted(
label, web_contents->GetLastCommittedURL().host());
}
#endif
}
void NotifyMultiCaptureStopped(const std::string& label) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
content::GetMultiCaptureService().NotifyMultiCaptureStopped(label);
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
crosapi::mojom::MultiCaptureService& multi_capture_service =
CHECK_DEREF(chromeos::LacrosService::Get()
->GetRemote<crosapi::mojom::MultiCaptureService>()
.get());
multi_capture_service.MultiCaptureStopped(label);
#endif
}
bool IsSubAppsPermissionGrantedByAdmins(content::WebContents* contents) {
if (!contents) {
return false;
}
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
if (!profile) {
return false;
}
PrefService* prefs = profile->GetPrefs();
if (!prefs) {
return false;
}
return policy::IsOriginInAllowlist(
contents->GetURL(), prefs,
prefs::kSubAppsAPIsAllowedWithoutGestureAndAuthorizationForOrigins);
}
bool SubAppsAPIsRequireUserGestureAndAuthorization(
content::WebContents* web_contents) {
return !IsSubAppsPermissionGrantedByAdmins(web_contents);
}
#endif
std::unique_ptr<blocked_content::PopupNavigationDelegate>
CreatePopupNavigationDelegate(NavigateParams params) { … }
std::unique_ptr<VisitedLinkNavigationThrottle>
MaybeCreateVisitedLinkNavigationThrottleFor(
content::NavigationHandle* navigation_handle) { … }
ChromeContentBrowserClient::PopupNavigationDelegateFactory
g_popup_navigation_delegate_factory = …;
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(CHROME_FOR_TESTING)
bool DetermineIfDevToolsUserForProcessPerSite() { … }
#endif
net::handles::NetworkHandle GetBoundNetworkFromRenderFrameHost(
content::RenderFrameHost* frame) { … }
}
ChromeContentBrowserClient::PopupNavigationDelegateFactory&
ChromeContentBrowserClient::GetPopupNavigationDelegateFactoryForTesting() { … }
ChromeContentBrowserClient::ChromeContentBrowserClient() { … }
ChromeContentBrowserClient::~ChromeContentBrowserClient() { … }
void ChromeContentBrowserClient::RegisterLocalStatePrefs(
PrefRegistrySimple* registry) { … }
void ChromeContentBrowserClient::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
void ChromeContentBrowserClient::SetApplicationLocale(
const std::string& locale) { … }
void ChromeContentBrowserClient::MaybeProxyNetworkBoundRequest(
content::BrowserContext* browser_context,
net::handles::NetworkHandle bound_network,
network::URLLoaderFactoryBuilder& factory_builder,
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
const net::IsolationInfo& isolation_info) { … }
std::unique_ptr<content::BrowserMainParts>
ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) { … }
void ChromeContentBrowserClient::PostAfterStartupTask(
const base::Location& from_here,
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
base::OnceClosure task) { … }
bool ChromeContentBrowserClient::IsBrowserStartupComplete() { … }
void ChromeContentBrowserClient::SetBrowserStartupIsCompleteForTesting() { … }
bool ChromeContentBrowserClient::IsShuttingDown() { … }
void ChromeContentBrowserClient::ThreadPoolWillTerminate() { … }
content::StoragePartitionConfig
ChromeContentBrowserClient::GetStoragePartitionConfigForSite(
content::BrowserContext* browser_context,
const GURL& site) { … }
std::unique_ptr<content::WebContentsViewDelegate>
ChromeContentBrowserClient::GetWebContentsViewDelegate(
content::WebContents* web_contents) { … }
bool ChromeContentBrowserClient::AllowGpuLaunchRetryOnIOThread() { … }
void ChromeContentBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) { … }
GURL ChromeContentBrowserClient::GetEffectiveURL(
content::BrowserContext* browser_context,
const GURL& url) { … }
bool ChromeContentBrowserClient::
ShouldCompareEffectiveURLsForSiteInstanceSelection(
content::BrowserContext* browser_context,
content::SiteInstance* candidate_site_instance,
bool is_outermost_main_frame,
const GURL& candidate_url,
const GURL& destination_url) { … }
bool ChromeContentBrowserClient::ShouldUseProcessPerSite(
content::BrowserContext* browser_context,
const GURL& site_url) { … }
bool ChromeContentBrowserClient::ShouldAllowProcessPerSiteForMultipleMainFrames(
content::BrowserContext* browser_context) { … }
std::optional<
content::ContentBrowserClient::SpareProcessRefusedByEmbedderReason>
ChromeContentBrowserClient::ShouldUseSpareRenderProcessHost(
content::BrowserContext* browser_context,
const GURL& site_url) { … }
bool ChromeContentBrowserClient::DoesSiteRequireDedicatedProcess(
content::BrowserContext* browser_context,
const GURL& effective_site_url) { … }
bool ChromeContentBrowserClient::
ShouldAllowCrossProcessSandboxedFrameForPrecursor(
content::BrowserContext* browser_context,
const GURL& precursor,
const GURL& url) { … }
bool ChromeContentBrowserClient::DoesWebUIUrlRequireProcessLock(
const GURL& url) { … }
bool ChromeContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
std::string_view scheme,
bool is_embedded_origin_secure) { … }
bool ChromeContentBrowserClient::
ShouldIgnoreSameSiteCookieRestrictionsWhenTopLevel(
std::string_view scheme,
bool is_embedded_origin_secure) { … }
std::string ChromeContentBrowserClient::GetSiteDisplayNameForCdmProcess(
content::BrowserContext* browser_context,
const GURL& site_url) { … }
void ChromeContentBrowserClient::OverrideURLLoaderFactoryParams(
content::BrowserContext* browser_context,
const url::Origin& origin,
bool is_for_isolated_world,
network::mojom::URLLoaderFactoryParams* factory_params) { … }
void ChromeContentBrowserClient::GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) { … }
void ChromeContentBrowserClient::GetAdditionalViewSourceSchemes(
std::vector<std::string>* additional_schemes) { … }
network::mojom::IPAddressSpace
ChromeContentBrowserClient::DetermineAddressSpaceFromURL(const GURL& url) { … }
bool ChromeContentBrowserClient::LogWebUIUrl(const GURL& web_ui_url) { … }
bool ChromeContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests(
const url::Origin& origin) { … }
bool ChromeContentBrowserClient::IsHandledURL(const GURL& url) { … }
bool ChromeContentBrowserClient::HasCustomSchemeHandler(
content::BrowserContext* browser_context,
const std::string& scheme) { … }
bool ChromeContentBrowserClient::CanCommitURL(
content::RenderProcessHost* process_host,
const GURL& url) { … }
void ChromeContentBrowserClient::OverrideNavigationParams(
std::optional<GURL> source_process_site_url,
ui::PageTransition* transition,
bool* is_renderer_initiated,
content::Referrer* referrer,
std::optional<url::Origin>* initiator_origin) { … }
bool ChromeContentBrowserClient::ShouldStayInParentProcessForNTP(
const GURL& url,
const GURL& parent_site_url) { … }
bool ChromeContentBrowserClient::IsSuitableHost(
content::RenderProcessHost* process_host,
const GURL& site_url) { … }
bool ChromeContentBrowserClient::MayReuseHost(
content::RenderProcessHost* process_host) { … }
size_t ChromeContentBrowserClient::GetProcessCountToIgnoreForLimit() { … }
std::optional<blink::ParsedPermissionsPolicy>
ChromeContentBrowserClient::GetPermissionsPolicyForIsolatedWebApp(
content::WebContents* web_contents,
const url::Origin& app_origin) { … }
bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost(
content::BrowserContext* browser_context,
const GURL& url) { … }
bool ChromeContentBrowserClient::ShouldEmbeddedFramesTryToReuseExistingProcess(
content::RenderFrameHost* outermost_main_frame) { … }
void ChromeContentBrowserClient::SiteInstanceGotProcessAndSite(
SiteInstance* site_instance) { … }
bool ChromeContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
SiteInstance* site_instance,
const GURL& current_effective_url,
const GURL& destination_effective_url) { … }
bool ChromeContentBrowserClient::ShouldIsolateErrorPage(bool in_main_frame) { … }
std::vector<url::Origin>
ChromeContentBrowserClient::GetOriginsRequiringDedicatedProcess() { … }
bool ChromeContentBrowserClient::ShouldEnableStrictSiteIsolation() { … }
bool ChromeContentBrowserClient::ShouldDisableSiteIsolation(
content::SiteIsolationMode site_isolation_mode) { … }
std::vector<std::string>
ChromeContentBrowserClient::GetAdditionalSiteIsolationModes() { … }
void ChromeContentBrowserClient::PersistIsolatedOrigin(
content::BrowserContext* context,
const url::Origin& origin,
content::ChildProcessSecurityPolicy::IsolatedOriginSource source) { … }
bool ChromeContentBrowserClient::ShouldUrlUseApplicationIsolationLevel(
content::BrowserContext* browser_context,
const GURL& url) { … }
bool ChromeContentBrowserClient::IsIsolatedContextAllowedForUrl(
content::BrowserContext* browser_context,
const GURL& lock_url) { … }
void ChromeContentBrowserClient::CheckGetAllScreensMediaAllowed(
content::RenderFrameHost* render_frame_host,
base::OnceCallback<void(bool)> callback) { … }
bool ChromeContentBrowserClient::IsFileAccessAllowed(
const base::FilePath& path,
const base::FilePath& absolute_path,
const base::FilePath& profile_path) { … }
namespace {
void MaybeAppendBlinkSettingsSwitchForFieldTrial(
const base::CommandLine& browser_command_line,
base::CommandLine* command_line) { … }
}
void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) { … }
std::string
ChromeContentBrowserClient::GetApplicationClientGUIDForQuarantineCheck() { … }
download::QuarantineConnectionCallback
ChromeContentBrowserClient::GetQuarantineConnectionCallback() { … }
std::string ChromeContentBrowserClient::GetApplicationLocale() { … }
std::string ChromeContentBrowserClient::GetAcceptLangs(
content::BrowserContext* context) { … }
gfx::ImageSkia ChromeContentBrowserClient::GetDefaultFavicon() { … }
bool ChromeContentBrowserClient::IsDataSaverEnabled(
content::BrowserContext* browser_context) { … }
void ChromeContentBrowserClient::UpdateRendererPreferencesForWorker(
content::BrowserContext* browser_context,
blink::RendererPreferences* out_prefs) { … }
content::AllowServiceWorkerResult
ChromeContentBrowserClient::AllowServiceWorker(
const GURL& scope,
const net::SiteForCookies& site_for_cookies,
const std::optional<url::Origin>& top_frame_origin,
const GURL& script_url,
content::BrowserContext* context) { … }
bool ChromeContentBrowserClient::MayDeleteServiceWorkerRegistration(
const GURL& scope,
content::BrowserContext* browser_context) { … }
bool ChromeContentBrowserClient::ShouldTryToUpdateServiceWorkerRegistration(
const GURL& scope,
content::BrowserContext* browser_context) { … }
bool ChromeContentBrowserClient::AllowSharedWorker(
const GURL& worker_url,
const net::SiteForCookies& site_for_cookies,
const std::optional<url::Origin>& top_frame_origin,
const std::string& name,
const blink::StorageKey& storage_key,
const blink::mojom::SharedWorkerSameSiteCookies same_site_cookies,
content::BrowserContext* context,
int render_process_id,
int render_frame_id) { … }
bool ChromeContentBrowserClient::DoesSchemeAllowCrossOriginSharedWorker(
const std::string& scheme) { … }
bool ChromeContentBrowserClient::AllowSignedExchange(
content::BrowserContext* browser_context) { … }
bool ChromeContentBrowserClient::AllowCompressionDictionaryTransport(
content::BrowserContext* browser_context) { … }
void ChromeContentBrowserClient::RequestFilesAccess(
const std::vector<base::FilePath>& files,
const GURL& destination_url,
base::OnceCallback<void(file_access::ScopedFileAccess)>
continuation_callback) { … }
void ChromeContentBrowserClient::AllowWorkerFileSystem(
const GURL& url,
content::BrowserContext* browser_context,
const std::vector<content::GlobalRenderFrameHostId>& render_frames,
base::OnceCallback<void(bool)> callback) { … }
#if BUILDFLAG(ENABLE_GUEST_VIEW)
void ChromeContentBrowserClient::GuestPermissionRequestHelper(
const GURL& url,
const std::vector<content::GlobalRenderFrameHostId>& render_frames,
base::OnceCallback<void(bool)> callback,
bool allow) { … }
#endif
void ChromeContentBrowserClient::FileSystemAccessed(
const GURL& url,
const std::vector<content::GlobalRenderFrameHostId>& render_frames,
base::OnceCallback<void(bool)> callback,
bool allow) { … }
bool ChromeContentBrowserClient::AllowWorkerIndexedDB(
const GURL& url,
content::BrowserContext* browser_context,
const std::vector<content::GlobalRenderFrameHostId>& render_frames) { … }
bool ChromeContentBrowserClient::AllowWorkerCacheStorage(
const GURL& url,
content::BrowserContext* browser_context,
const std::vector<content::GlobalRenderFrameHostId>& render_frames) { … }
bool ChromeContentBrowserClient::AllowWorkerWebLocks(
const GURL& url,
content::BrowserContext* browser_context,
const std::vector<content::GlobalRenderFrameHostId>& render_frames) { … }
ChromeContentBrowserClient::AllowWebBluetoothResult
ChromeContentBrowserClient::AllowWebBluetooth(
content::BrowserContext* browser_context,
const url::Origin& requesting_origin,
const url::Origin& embedding_origin) { … }
std::string ChromeContentBrowserClient::GetWebBluetoothBlocklist() { … }
bool ChromeContentBrowserClient::IsInterestGroupAPIAllowed(
content::RenderFrameHost* render_frame_host,
InterestGroupApiOperation operation,
const url::Origin& top_frame_origin,
const url::Origin& api_origin) { … }
bool ChromeContentBrowserClient::IsPrivacySandboxReportingDestinationAttested(
content::BrowserContext* browser_context,
const url::Origin& destination_origin,
content::PrivacySandboxInvokingAPI invoking_api,
bool post_impression_reporting) { … }
void ChromeContentBrowserClient::OnAuctionComplete(
content::RenderFrameHost* render_frame_host,
std::optional<content::InterestGroupManager::InterestGroupDataKey>
winner_data_key,
bool is_server_auction,
bool is_on_device_auction,
content::AuctionResult result) { … }
bool ChromeContentBrowserClient::IsAttributionReportingOperationAllowed(
content::BrowserContext* browser_context,
AttributionReportingOperation operation,
content::RenderFrameHost* rfh,
const url::Origin* source_origin,
const url::Origin* destination_origin,
const url::Origin* reporting_origin,
bool* can_bypass) { … }
bool ChromeContentBrowserClient::IsAttributionReportingAllowedForContext(
content::BrowserContext* browser_context,
content::RenderFrameHost* rfh,
const url::Origin& context_origin,
const url::Origin& reporting_origin) { … }
bool ChromeContentBrowserClient::IsSharedStorageAllowed(
content::BrowserContext* browser_context,
content::RenderFrameHost* rfh,
const url::Origin& top_frame_origin,
const url::Origin& accessing_origin,
std::string* out_debug_message,
bool* out_block_is_site_setting_specific) { … }
bool ChromeContentBrowserClient::IsSharedStorageSelectURLAllowed(
content::BrowserContext* browser_context,
const url::Origin& top_frame_origin,
const url::Origin& accessing_origin,
std::string* out_debug_message,
bool* out_block_is_site_setting_specific) { … }
bool ChromeContentBrowserClient::IsPrivateAggregationAllowed(
content::BrowserContext* browser_context,
const url::Origin& top_frame_origin,
const url::Origin& reporting_origin,
bool* out_block_is_site_setting_specific) { … }
bool ChromeContentBrowserClient::IsPrivateAggregationDebugModeAllowed(
content::BrowserContext* browser_context,
const url::Origin& top_frame_origin,
const url::Origin& reporting_origin) { … }
bool ChromeContentBrowserClient::IsCookieDeprecationLabelAllowed(
content::BrowserContext* browser_context) { … }
bool ChromeContentBrowserClient::IsCookieDeprecationLabelAllowedForContext(
content::BrowserContext* browser_context,
const url::Origin& top_frame_origin,
const url::Origin& context_origin) { … }
bool ChromeContentBrowserClient::IsFullCookieAccessAllowed(
content::BrowserContext* browser_context,
content::WebContents* web_contents,
const GURL& url,
const blink::StorageKey& storage_key) { … }
#if BUILDFLAG(IS_CHROMEOS)
void ChromeContentBrowserClient::OnTrustAnchorUsed(
content::BrowserContext* browser_context) {
policy::PolicyCertService* service =
policy::PolicyCertServiceFactory::GetForProfile(
Profile::FromBrowserContext(browser_context));
if (!service) {
NOTREACHED_IN_MIGRATION();
return;
}
service->SetUsedPolicyCertificates();
}
#endif
bool ChromeContentBrowserClient::CanSendSCTAuditingReport(
content::BrowserContext* browser_context) { … }
void ChromeContentBrowserClient::OnNewSCTAuditingReportSent(
content::BrowserContext* browser_context) { … }
scoped_refptr<network::SharedURLLoaderFactory>
ChromeContentBrowserClient::GetSystemSharedURLLoaderFactory() { … }
network::mojom::NetworkContext*
ChromeContentBrowserClient::GetSystemNetworkContext() { … }
std::string ChromeContentBrowserClient::GetGeolocationApiKey() { … }
#if BUILDFLAG(OS_LEVEL_GEOLOCATION_PERMISSION_SUPPORTED)
device::GeolocationSystemPermissionManager*
ChromeContentBrowserClient::GetGeolocationSystemPermissionManager() {
return device::GeolocationSystemPermissionManager::GetInstance();
}
#endif
#if BUILDFLAG(IS_ANDROID)
bool ChromeContentBrowserClient::ShouldUseGmsCoreGeolocationProvider() {
return true;
}
#endif
content::GeneratedCodeCacheSettings
ChromeContentBrowserClient::GetGeneratedCodeCacheSettings(
content::BrowserContext* context) { … }
std::string ChromeContentBrowserClient::GetWebUIHostnameForCodeCacheMetrics(
const GURL& webui_url) const { … }
void ChromeContentBrowserClient::AllowCertificateError(
content::WebContents* web_contents,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
bool is_primary_main_frame_request,
bool strict_enforcement,
base::OnceCallback<void(content::CertificateRequestResultType)> callback) { … }
#if !BUILDFLAG(IS_ANDROID)
bool ChromeContentBrowserClient::ShouldDenyRequestOnCertificateError(
const GURL main_page_url) { … }
#endif
namespace {
bool ShouldDisableForcedColorsForWebContent(content::WebContents* contents,
bool in_forced_colors) { … }
bool UpdateForcedColorsForWebContent(WebPreferences* web_prefs,
WebContents* web_contents,
const ui::NativeTheme* native_theme) { … }
#if !BUILDFLAG(IS_ANDROID)
blink::mojom::PreferredColorScheme ToBlinkPreferredColorScheme(
ui::NativeTheme::PreferredColorScheme native_theme_scheme) { … }
#endif
bool UpdatePreferredColorScheme(WebPreferences* web_prefs,
const GURL& url,
WebContents* web_contents,
const ui::NativeTheme* native_theme) { … }
bool CanPromptWithNonmatchingCertificates(const Profile* profile) { … }
bool ShouldPromptOnMultipleMatchingCertificates(const Profile* profile) { … }
}
base::OnceClosure ChromeContentBrowserClient::SelectClientCertificate(
content::BrowserContext* browser_context,
int process_id,
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
net::ClientCertIdentityList client_certs,
std::unique_ptr<content::ClientCertificateDelegate> delegate) { … }
content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { … }
content::FeatureObserverClient*
ChromeContentBrowserClient::GetFeatureObserverClient() { … }
bool ChromeContentBrowserClient::CanCreateWindow(
RenderFrameHost* opener,
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const url::Origin& source_origin,
content::mojom::WindowContainerType container_type,
const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
bool* no_javascript_access) { … }
content::SpeechRecognitionManagerDelegate*
ChromeContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
content::TtsControllerDelegate*
ChromeContentBrowserClient::GetTtsControllerDelegate() {
return TtsControllerDelegateImpl::GetInstance();
}
#endif
void ChromeContentBrowserClient::MaybeOverrideManifest(
content::RenderFrameHost* render_frame_host,
blink::mojom::ManifestPtr& manifest) { … }
content::TtsPlatform* ChromeContentBrowserClient::GetTtsPlatform() { … }
void ChromeContentBrowserClient::OverrideWebkitPrefs(
WebContents* web_contents,
WebPreferences* web_prefs) { … }
bool ChromeContentBrowserClientParts::OverrideWebPreferencesAfterNavigation(
WebContents* web_contents,
WebPreferences* web_prefs) { … }
bool ChromeContentBrowserClient::OverrideWebPreferencesAfterNavigation(
WebContents* web_contents,
WebPreferences* web_prefs) { … }
void ChromeContentBrowserClient::BrowserURLHandlerCreated(
BrowserURLHandler* handler) { … }
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { … }
std::string ChromeContentBrowserClient::GetDefaultDownloadName() { … }
base::FilePath ChromeContentBrowserClient::GetShaderDiskCacheDirectory() { … }
base::FilePath ChromeContentBrowserClient::GetGrShaderDiskCacheDirectory() { … }
base::FilePath ChromeContentBrowserClient::GetGraphiteDawnDiskCacheDirectory() { … }
base::FilePath ChromeContentBrowserClient::GetNetLogDefaultDirectory() { … }
base::FilePath ChromeContentBrowserClient::GetFirstPartySetsDirectory() { … }
std::optional<base::FilePath>
ChromeContentBrowserClient::GetLocalTracesDirectory() { … }
void ChromeContentBrowserClient::DidCreatePpapiPlugin(
content::BrowserPpapiHost* browser_host) { … }
content::BrowserPpapiHost*
ChromeContentBrowserClient::GetExternalBrowserPpapiHost(int plugin_process_id) { … }
bool ChromeContentBrowserClient::AllowPepperSocketAPI(
content::BrowserContext* browser_context,
const GURL& url,
bool private_api,
const content::SocketPermissionRequest* params) { … }
bool ChromeContentBrowserClient::IsPepperVpnProviderAPIAllowed(
content::BrowserContext* browser_context,
const GURL& url) { … }
std::unique_ptr<content::VpnServiceProxy>
ChromeContentBrowserClient::GetVpnServiceProxy(
content::BrowserContext* browser_context) { … }
std::unique_ptr<ui::SelectFilePolicy>
ChromeContentBrowserClient::CreateSelectFilePolicy(WebContents* web_contents) { … }
void ChromeContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_allowed_schemes) { … }
void ChromeContentBrowserClient::GetSchemesBypassingSecureContextCheckAllowlist(
std::set<std::string>* schemes) { … }
void ChromeContentBrowserClient::GetURLRequestAutoMountHandlers(
std::vector<storage::URLRequestAutoMountHandler>* handlers) { … }
void ChromeContentBrowserClient::GetAdditionalFileSystemBackends(
content::BrowserContext* browser_context,
const base::FilePath& storage_partition_path,
std::vector<std::unique_ptr<storage::FileSystemBackend>>*
additional_backends) { … }
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
PosixFileDescriptorInfo* mappings) { … }
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
void ChromeContentBrowserClient::GetAdditionalMappedFilesForZygote(
base::CommandLine* command_line,
PosixFileDescriptorInfo* mappings) {
mojo::core::Init();
base::ScopedFD cros_startup_fd =
chromeos::BrowserInitParams::CreateStartupData();
mojo::core::ShutDown();
if (cros_startup_fd.is_valid()) {
constexpr int kStartupDataFD =
kCrosStartupDataDescriptor + base::GlobalDescriptors::kBaseDescriptor;
command_line->AppendSwitchASCII(chromeos::switches::kCrosStartupDataFD,
base::NumberToString(kStartupDataFD));
mappings->Transfer(kStartupDataFD, std::move(cros_startup_fd));
}
}
#endif
#if BUILDFLAG(IS_WIN)
std::wstring ChromeContentBrowserClient::GetAppContainerSidForSandboxType(
sandbox::mojom::Sandbox sandbox_type,
AppContainerFlags flags) {
switch (sandbox_type) {
case sandbox::mojom::Sandbox::kRenderer:
if (flags & AppContainerFlags::kAppContainerFlagDisableAppContainer)
return std::wstring();
return std::wstring(install_static::GetSandboxSidPrefix()) + L"129201922";
case sandbox::mojom::Sandbox::kUtility:
return std::wstring();
case sandbox::mojom::Sandbox::kGpu:
return std::wstring();
case sandbox::mojom::Sandbox::kOnDeviceModelExecution:
return std::wstring();
#if BUILDFLAG(ENABLE_PPAPI)
case sandbox::mojom::Sandbox::kPpapi:
#endif
case sandbox::mojom::Sandbox::kNoSandbox:
case sandbox::mojom::Sandbox::kNoSandboxAndElevatedPrivileges:
case sandbox::mojom::Sandbox::kXrCompositing:
case sandbox::mojom::Sandbox::kNetwork:
case sandbox::mojom::Sandbox::kCdm:
#if BUILDFLAG(ENABLE_OOP_PRINTING)
case sandbox::mojom::Sandbox::kPrintBackend:
#endif
case sandbox::mojom::Sandbox::kPrintCompositor:
case sandbox::mojom::Sandbox::kAudio:
case sandbox::mojom::Sandbox::kScreenAI:
case sandbox::mojom::Sandbox::kSpeechRecognition:
case sandbox::mojom::Sandbox::kPdfConversion:
case sandbox::mojom::Sandbox::kService:
case sandbox::mojom::Sandbox::kServiceWithJit:
case sandbox::mojom::Sandbox::kIconReader:
case sandbox::mojom::Sandbox::kMediaFoundationCdm:
case sandbox::mojom::Sandbox::kWindowsSystemProxyResolver:
CHECK(0);
return std::wstring();
}
}
bool ChromeContentBrowserClient::IsAppContainerDisabled(
sandbox::mojom::Sandbox sandbox_type) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
constexpr auto kSandboxPolicyPrefMapping =
base::MakeFixedFlatMap<sandbox::mojom::Sandbox, std::string_view>({
{sandbox::mojom::Sandbox::kRenderer,
prefs::kRendererAppContainerEnabled},
{sandbox::mojom::Sandbox::kPrintCompositor,
prefs::kPrintingLPACSandboxEnabled},
});
auto iter = kSandboxPolicyPrefMapping.find(sandbox_type);
if (iter == kSandboxPolicyPrefMapping.end()) {
return false;
}
PrefService* local_state = g_browser_process->local_state();
const PrefService::Preference* pref =
local_state->FindPreference(iter->second);
if (pref && pref->IsManaged() && !pref->GetValue()->GetBool())
return true;
return false;
}
std::wstring
ChromeContentBrowserClient::GetLPACCapabilityNameForNetworkService() {
version_info::Channel channel = chrome::GetChannel();
switch (channel) {
case version_info::Channel::CANARY:
return std::wstring(L"lpacChromeCanaryNetworkSandbox");
case version_info::Channel::BETA:
return std::wstring(L"lpacChromeBetaNetworkSandbox");
case version_info::Channel::DEV:
return std::wstring(L"lpacChromeDevNetworkSandbox");
case version_info::Channel::STABLE:
return std::wstring(L"lpacChromeStableNetworkSandbox");
case version_info::Channel::UNKNOWN:
return std::wstring(L"lpacChromeNetworkSandbox");
}
}
bool ChromeContentBrowserClient::PreSpawnChild(
sandbox::TargetConfig* config,
sandbox::mojom::Sandbox sandbox_type,
ChildSpawnFlags flags) {
DCHECK(!config->IsConfigured());
#if !defined(COMPONENT_BUILD) && !defined(ADDRESS_SANITIZER)
bool enforce_code_integrity = false;
switch (sandbox_type) {
case sandbox::mojom::Sandbox::kRenderer:
enforce_code_integrity =
(flags & ChildSpawnFlags::kChildSpawnFlagRendererCodeIntegrity);
break;
case sandbox::mojom::Sandbox::kNetwork:
enforce_code_integrity = base::FeatureList::IsEnabled(
sandbox::policy::features::kNetworkServiceCodeIntegrity);
break;
case sandbox::mojom::Sandbox::kServiceWithJit:
enforce_code_integrity = true;
break;
case sandbox::mojom::Sandbox::kUtility:
case sandbox::mojom::Sandbox::kGpu:
#if BUILDFLAG(ENABLE_PPAPI)
case sandbox::mojom::Sandbox::kPpapi:
#endif
case sandbox::mojom::Sandbox::kNoSandbox:
case sandbox::mojom::Sandbox::kNoSandboxAndElevatedPrivileges:
case sandbox::mojom::Sandbox::kXrCompositing:
case sandbox::mojom::Sandbox::kCdm:
#if BUILDFLAG(ENABLE_PRINTING)
case sandbox::mojom::Sandbox::kPrintBackend:
#endif
case sandbox::mojom::Sandbox::kPrintCompositor:
#if !BUILDFLAG(IS_ANDROID)
case sandbox::mojom::Sandbox::kScreenAI:
#endif
case sandbox::mojom::Sandbox::kAudio:
case sandbox::mojom::Sandbox::kOnDeviceModelExecution:
case sandbox::mojom::Sandbox::kSpeechRecognition:
case sandbox::mojom::Sandbox::kPdfConversion:
case sandbox::mojom::Sandbox::kService:
case sandbox::mojom::Sandbox::kIconReader:
case sandbox::mojom::Sandbox::kMediaFoundationCdm:
case sandbox::mojom::Sandbox::kWindowsSystemProxyResolver:
break;
}
if (!enforce_code_integrity)
return true;
base::FilePath exe_path;
if (!base::PathService::Get(base::FILE_EXE, &exe_path))
return true;
if (chrome::kBrowserProcessExecutableName != exe_path.BaseName().value())
return true;
sandbox::MitigationFlags mitigations = config->GetProcessMitigations();
mitigations |= sandbox::MITIGATION_FORCE_MS_SIGNED_BINS;
sandbox::ResultCode result = config->SetProcessMitigations(mitigations);
if (result != sandbox::SBOX_ALL_OK)
return false;
for (const auto* dll : {chrome::kBrowserResourcesDll, chrome::kElfDll}) {
result = config->AllowExtraDlls(GetModulePath(dll).value().c_str());
if (result != sandbox::SBOX_ALL_OK)
return false;
}
#endif
return true;
}
bool ChromeContentBrowserClient::IsRendererCodeIntegrityEnabled() {
if (base::FeatureList::IsEnabled(
sandbox::policy::features::kWinSboxForceRendererCodeIntegrity)) {
return true;
}
PrefService* local_state = g_browser_process->local_state();
return !local_state->HasPrefPath(prefs::kRendererCodeIntegrityEnabled) ||
local_state->GetBoolean(prefs::kRendererCodeIntegrityEnabled);
}
bool ChromeContentBrowserClient::IsPdfFontProxyEnabled() {
#if BUILDFLAG(ENABLE_PDF)
return base::FeatureList::IsEnabled(
chrome_pdf::features::kWinPdfUseFontProxy);
#else
return false;
#endif
}
bool ChromeContentBrowserClient::IsUtilityCetCompatible(
const std::string& utility_sub_type) {
if (utility_sub_type == chrome::mojom::UtilWin::Name_)
return false;
return true;
}
void ChromeContentBrowserClient::SessionEnding(
std::optional<DWORD> control_type) {
chrome::SessionEnding();
}
bool ChromeContentBrowserClient::ShouldEnableAudioProcessHighPriority() {
return IsAudioProcessHighPriorityEnabled();
}
bool ChromeContentBrowserClient::ShouldUseSkiaFontManager(
const GURL& site_url) {
return IsTopChromeWebUIURL(site_url) &&
base::FeatureList::IsEnabled(features::kSkiaFontService);
}
#endif
void ChromeContentBrowserClient::
RegisterMojoBinderPoliciesForSameOriginPrerendering(
content::MojoBinderPolicyMap& policy_map) { … }
void ChromeContentBrowserClient::RegisterMojoBinderPoliciesForPreview(
content::MojoBinderPolicyMap& policy_map) { … }
void ChromeContentBrowserClient::OpenURL(
content::SiteInstance* site_instance,
const content::OpenURLParams& params,
base::OnceCallback<void(content::WebContents*)> callback) { … }
content::ControllerPresentationServiceDelegate*
ChromeContentBrowserClient::GetControllerPresentationServiceDelegate(
content::WebContents* web_contents) { … }
content::ReceiverPresentationServiceDelegate*
ChromeContentBrowserClient::GetReceiverPresentationServiceDelegate(
content::WebContents* web_contents) { … }
void ChromeContentBrowserClient::AddPresentationObserver(
content::PresentationObserver* observer,
content::WebContents* web_contents) { … }
void ChromeContentBrowserClient::RemovePresentationObserver(
content::PresentationObserver* observer,
content::WebContents* web_contents) { … }
bool ChromeContentBrowserClient::AddPrivacySandboxAttestationsObserver(
content::PrivacySandboxAttestationsObserver* observer) { … }
void ChromeContentBrowserClient::RemovePrivacySandboxAttestationsObserver(
content::PrivacySandboxAttestationsObserver* observer) { … }
std::vector<std::unique_ptr<content::NavigationThrottle>>
ChromeContentBrowserClient::CreateThrottlesForNavigation(
content::NavigationHandle* handle) { … }
std::vector<std::unique_ptr<content::CommitDeferringCondition>>
ChromeContentBrowserClient::CreateCommitDeferringConditionsForNavigation(
content::NavigationHandle* navigation_handle,
content::CommitDeferringCondition::NavigationType navigation_type) { … }
std::unique_ptr<content::NavigationUIData>
ChromeContentBrowserClient::GetNavigationUIData(
content::NavigationHandle* navigation_handle) { … }
std::unique_ptr<media::ScreenEnumerator>
ChromeContentBrowserClient::CreateScreenEnumerator() const { … }
bool ChromeContentBrowserClient::EnforceSystemAudioEchoCancellation() { … }
std::unique_ptr<content::DevToolsManagerDelegate>
ChromeContentBrowserClient::CreateDevToolsManagerDelegate() { … }
void ChromeContentBrowserClient::UpdateDevToolsBackgroundServiceExpiration(
content::BrowserContext* browser_context,
int service,
base::Time expiration_time) { … }
base::flat_map<int, base::Time>
ChromeContentBrowserClient::GetDevToolsBackgroundServiceExpirations(
content::BrowserContext* browser_context) { … }
std::optional<base::TimeDelta>
ChromeContentBrowserClient::GetSpareRendererDelayForSiteURL(
const GURL& site_url) { … }
std::unique_ptr<content::TracingDelegate>
ChromeContentBrowserClient::CreateTracingDelegate() { … }
bool ChromeContentBrowserClient::IsSystemWideTracingEnabled() { … }
bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
content::BrowserContext* browser_context,
const GURL& url) { … }
bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
content::BrowserContext* browser_context,
const GURL& url) { … }
void ChromeContentBrowserClient::InitOnUIThread() { … }
void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch(
base::CommandLine* to_command_line,
const base::CommandLine& from_command_line,
version_info::Channel channel) { … }
#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
void ChromeContentBrowserClient::CreateMediaRemoter(
content::RenderFrameHost* render_frame_host,
mojo::PendingRemote<media::mojom::RemotingSource> source,
mojo::PendingReceiver<media::mojom::Remoter> receiver) { … }
#endif
base::FilePath ChromeContentBrowserClient::GetLoggingFileName(
const base::CommandLine& command_line) { … }
#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
std::unique_ptr<blink::URLLoaderThrottle>
ChromeContentBrowserClient::MaybeCreateSafeBrowsingURLLoaderThrottle(
const network::ResourceRequest& request,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
int frame_tree_node_id,
std::optional<int64_t> navigation_id,
Profile* profile) { … }
#endif
#if BUILDFLAG(IS_ANDROID)
std::tuple<std::string , bool >
GetClientDataHeader(int frame_tree_node_id) {
std::string client_data_header;
bool is_custom_tab = false;
if (frame_tree_node_id != content::RenderFrameHost::kNoFrameTreeNodeId) {
auto* web_contents = WebContents::FromFrameTreeNodeId(frame_tree_node_id);
if (web_contents) {
auto* client_data_header_observer =
customtabs::ClientDataHeaderWebContentsObserver::FromWebContents(
web_contents);
if (client_data_header_observer) {
client_data_header = client_data_header_observer->header();
}
auto* delegate =
TabAndroid::FromWebContents(web_contents)
? static_cast<android::TabWebContentsDelegateAndroid*>(
web_contents->GetDelegate())
: nullptr;
if (delegate) {
is_custom_tab = delegate->IsCustomTab();
}
}
}
return {client_data_header, is_custom_tab};
}
#endif
std::unique_ptr<blink::URLLoaderThrottle> CreateGoogleURLLoaderThrottle(
#if BUILDFLAG(IS_ANDROID)
const std::string& client_data_header,
#endif
Profile* profile) { … }
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
ChromeContentBrowserClient::CreateURLLoaderThrottles(
const network::ResourceRequest& request,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id,
std::optional<int64_t> navigation_id) { … }
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
ChromeContentBrowserClient::CreateURLLoaderThrottlesForKeepAlive(
const network::ResourceRequest& request,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
int frame_tree_node_id) { … }
mojo::PendingRemote<network::mojom::URLLoaderFactory>
ChromeContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory(
const std::string& scheme,
int frame_tree_node_id) { … }
void ChromeContentBrowserClient::
RegisterNonNetworkWorkerMainResourceURLLoaderFactories(
content::BrowserContext* browser_context,
NonNetworkURLLoaderFactoryMap* factories) { … }
void ChromeContentBrowserClient::
RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(
content::BrowserContext* browser_context,
NonNetworkURLLoaderFactoryMap* factories) { … }
namespace {
class SpecialAccessFileURLLoaderFactory
: public network::SelfDeletingURLLoaderFactory { … };
#if BUILDFLAG(IS_CHROMEOS)
bool IsSystemFeatureDisabled(policy::SystemFeature system_feature) {
return policy::SystemFeaturesDisableListPolicyHandler::
IsSystemFeatureDisabled(system_feature, g_browser_process->local_state());
}
bool IsSystemFeatureURLDisabled(const GURL& url) {
if (!url.SchemeIs(content::kChromeUIScheme) &&
!url.SchemeIs(content::kChromeUIUntrustedScheme)) {
return false;
}
if (url.DomainIs(chrome::kChromeUIOSSettingsHost) &&
url.path() != "/pwa.html") {
return IsSystemFeatureDisabled(policy::SystemFeature::kOsSettings);
}
if (url.DomainIs(chrome::kChromeUISettingsHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kBrowserSettings);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (url.DomainIs(chrome::kChromeUIUntrustedCroshHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kCrosh);
}
if (url.DomainIs(ash::kChromeUIScanningAppHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kScanning);
}
if (url.DomainIs(ash::kChromeUICameraAppHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kCamera);
}
if (url.DomainIs(ash::kChromeUIHelpAppHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kExplore);
}
if (url.DomainIs(ash::kChromeUIMediaAppHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kGallery);
}
if (url.DomainIs(chrome::kChromeUIUntrustedTerminalHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kTerminal);
}
if (url.DomainIs(ash::kChromeUIPrintManagementHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kPrintJobs);
}
if (url.DomainIs(ash::kChromeUIShortcutCustomizationAppHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kKeyShortcuts);
}
if (url.DomainIs(ash::kChromeUIRecorderAppHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kRecorder);
}
#endif
return false;
}
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
void InitializeFileURLLoaderFactoryForExtension(
int render_process_id,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
ChromeContentBrowserClient::NonNetworkURLLoaderFactoryMap* factories) { … }
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
void AddChromeSchemeFactories(
int render_process_id,
content::RenderFrameHost* frame_host,
content::WebContents* web_contents,
const extensions::Extension* extension,
ChromeContentBrowserClient::NonNetworkURLLoaderFactoryMap* factories) { … }
#endif
}
void ChromeContentBrowserClient::
RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
const std::optional<url::Origin>& request_initiator_origin,
NonNetworkURLLoaderFactoryMap* factories) { … }
void ChromeContentBrowserClient::WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
int render_process_id,
URLLoaderFactoryType type,
const url::Origin& request_initiator,
const net::IsolationInfo& isolation_info,
std::optional<int64_t> navigation_id,
ukm::SourceIdObj ukm_source_id,
network::URLLoaderFactoryBuilder& factory_builder,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,
bool* bypass_redirect_checks,
bool* disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) { … }
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id,
int64_t navigation_id,
bool force_no_https_upgrade,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) { … }
content::ContentBrowserClient::URLLoaderRequestHandler
ChromeContentBrowserClient::
CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
int frame_tree_node_id,
const network::ResourceRequest& resource_request) { … }
bool ChromeContentBrowserClient::WillInterceptWebSocket(
content::RenderFrameHost* frame) { … }
void ChromeContentBrowserClient::CreateWebSocket(
content::RenderFrameHost* frame,
WebSocketFactory factory,
const GURL& url,
const net::SiteForCookies& site_for_cookies,
const std::optional<std::string>& user_agent,
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
handshake_client) { … }
void ChromeContentBrowserClient::WillCreateWebTransport(
int process_id,
int frame_routing_id,
const GURL& url,
const url::Origin& initiator_origin,
mojo::PendingRemote<network::mojom::WebTransportHandshakeClient>
handshake_client,
WillCreateWebTransportCallback callback) { … }
bool ChromeContentBrowserClient::WillCreateRestrictedCookieManager(
network::mojom::RestrictedCookieManagerRole role,
content::BrowserContext* browser_context,
const url::Origin& origin,
const net::IsolationInfo& isolation_info,
bool is_service_worker,
int process_id,
int routing_id,
mojo::PendingReceiver<network::mojom::RestrictedCookieManager>* receiver) { … }
void ChromeContentBrowserClient::OnNetworkServiceCreated(
network::mojom::NetworkService* network_service) { … }
void ChromeContentBrowserClient::ConfigureNetworkContextParams(
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
network::mojom::NetworkContextParams* network_context_params,
cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params) { … }
std::vector<base::FilePath>
ChromeContentBrowserClient::GetNetworkContextsParentDirectory() { … }
base::Value::Dict ChromeContentBrowserClient::GetNetLogConstants() { … }
bool ChromeContentBrowserClient::AllowRenderingMhtmlOverHttp(
content::NavigationUIData* navigation_ui_data) { … }
bool ChromeContentBrowserClient::ShouldForceDownloadResource(
content::BrowserContext* browser_context,
const GURL& url,
const std::string& mime_type) { … }
content::BluetoothDelegate* ChromeContentBrowserClient::GetBluetoothDelegate() { … }
content::UsbDelegate* ChromeContentBrowserClient::GetUsbDelegate() { … }
content::PrivateNetworkDeviceDelegate*
ChromeContentBrowserClient::GetPrivateNetworkDeviceDelegate() { … }
bool ChromeContentBrowserClient::IsSecurityLevelAcceptableForWebAuthn(
content::RenderFrameHost* rfh,
const url::Origin& caller_origin) { … }
#if !BUILDFLAG(IS_ANDROID)
void ChromeContentBrowserClient::CreateDeviceInfoService(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<blink::mojom::DeviceAPIService> receiver) { … }
void ChromeContentBrowserClient::CreateManagedConfigurationService(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<blink::mojom::ManagedConfigurationService> receiver) { … }
content::SerialDelegate* ChromeContentBrowserClient::GetSerialDelegate() { … }
content::HidDelegate* ChromeContentBrowserClient::GetHidDelegate() { … }
content::DirectSocketsDelegate*
ChromeContentBrowserClient::GetDirectSocketsDelegate() { … }
content::WebAuthenticationDelegate*
ChromeContentBrowserClient::GetWebAuthenticationDelegate() { … }
std::unique_ptr<content::AuthenticatorRequestClientDelegate>
ChromeContentBrowserClient::GetWebAuthenticationRequestDelegate(
content::RenderFrameHost* render_frame_host) { … }
#endif
void ChromeContentBrowserClient::CreatePaymentCredential(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<payments::mojom::PaymentCredential> receiver) { … }
std::unique_ptr<net::ClientCertStore>
ChromeContentBrowserClient::CreateClientCertStore(
content::BrowserContext* browser_context) { … }
std::unique_ptr<content::LoginDelegate>
ChromeContentBrowserClient::CreateLoginDelegate(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const content::GlobalRequestID& request_id,
bool is_request_for_primary_main_frame,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
LoginAuthRequiredCallback auth_required_callback) { … }
bool ChromeContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
ui::PageTransition page_transition,
bool has_user_gesture,
const std::optional<url::Origin>& initiating_origin,
content::RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { … }
std::unique_ptr<content::VideoOverlayWindow>
ChromeContentBrowserClient::CreateWindowForVideoPictureInPicture(
content::VideoPictureInPictureWindowController* controller) { … }
void ChromeContentBrowserClient::RegisterRendererPreferenceWatcher(
content::BrowserContext* browser_context,
mojo::PendingRemote<blink::mojom::RendererPreferenceWatcher> watcher) { … }
bool ChromeContentBrowserClient::HandleWebUI(
GURL* url,
content::BrowserContext* browser_context) { … }
#if BUILDFLAG(IS_CHROMEOS)
content::SmartCardDelegate* ChromeContentBrowserClient::GetSmartCardDelegate() {
if (!smart_card_delegate_) {
smart_card_delegate_ = std::make_unique<ChromeOsSmartCardDelegate>();
}
return smart_card_delegate_.get();
}
#endif
bool ChromeContentBrowserClient::ShowPaymentHandlerWindow(
content::BrowserContext* browser_context,
const GURL& url,
base::OnceCallback<void(bool, int, int)> callback) { … }
bool ChromeContentBrowserClient::HandleWebUIReverse(
GURL* url,
content::BrowserContext* browser_context) { … }
const ui::NativeTheme* ChromeContentBrowserClient::GetWebTheme() const { … }
void ChromeContentBrowserClient::AddExtraPart(
ChromeContentBrowserClientParts* part) { … }
std::unique_ptr<HttpAuthCoordinator>
ChromeContentBrowserClient::CreateHttpAuthCoordinator() { … }
scoped_refptr<safe_browsing::UrlCheckerDelegate>
ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
bool safe_browsing_enabled_for_profile,
bool should_check_on_sb_disabled,
const std::vector<std::string>& allowlist_domains) { … }
safe_browsing::RealTimeUrlLookupServiceBase*
ChromeContentBrowserClient::GetUrlLookupService(
content::BrowserContext* browser_context,
bool is_enterprise_lookup_enabled,
bool is_consumer_lookup_enabled) { … }
safe_browsing::AsyncCheckTracker*
ChromeContentBrowserClient::GetAsyncCheckTracker(
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
bool is_enterprise_lookup_enabled,
bool is_consumer_lookup_enabled,
safe_browsing::hash_realtime_utils::HashRealTimeSelection
hash_realtime_selection,
int frame_tree_node_id) { … }
void ChromeContentBrowserClient::ReportLegacyTechEvent(
content::RenderFrameHost* render_frame_host,
const std::string type,
const GURL& url,
const GURL& frame_url,
const std::string& filename,
uint64_t line,
uint64_t column,
std::optional<content::LegacyTechCookieIssueDetails> cookie_issue_details) { … }
bool ChromeContentBrowserClient::CanAcceptUntrustedExchangesIfNeeded() { … }
void ChromeContentBrowserClient::OnNetworkServiceDataUseUpdate(
content::GlobalRenderFrameHostId render_frame_host_id,
int32_t network_traffic_annotation_id_hash,
int64_t recv_bytes,
int64_t sent_bytes) { … }
base::FilePath
ChromeContentBrowserClient::GetSandboxedStorageServiceDataDirectory() { … }
bool ChromeContentBrowserClient::ShouldSandboxAudioService() { … }
bool ChromeContentBrowserClient::ShouldSandboxNetworkService() { … }
bool ChromeContentBrowserClient::ShouldRunOutOfProcessSystemDnsResolution() { … }
void ChromeContentBrowserClient::LogWebFeatureForCurrentPage(
content::RenderFrameHost* render_frame_host,
blink::mojom::WebFeature feature) { … }
void ChromeContentBrowserClient::LogWebDXFeatureForCurrentPage(
content::RenderFrameHost* render_frame_host,
blink::mojom::WebDXFeature feature) { … }
std::string ChromeContentBrowserClient::GetProduct() { … }
std::string ChromeContentBrowserClient::GetUserAgent() { … }
std::string ChromeContentBrowserClient::GetUserAgentBasedOnPolicy(
content::BrowserContext* context) { … }
blink::UserAgentMetadata ChromeContentBrowserClient::GetUserAgentMetadata() { … }
std::optional<gfx::ImageSkia> ChromeContentBrowserClient::GetProductLogo() { … }
bool ChromeContentBrowserClient::IsBuiltinComponent(
content::BrowserContext* browser_context,
const url::Origin& origin) { … }
bool ChromeContentBrowserClient::ShouldBlockRendererDebugURL(
const GURL& url,
content::BrowserContext* context,
content::RenderFrameHost* render_frame_host) { … }
#if BUILDFLAG(IS_ANDROID)
content::ContentBrowserClient::WideColorGamutHeuristic
ChromeContentBrowserClient::GetWideColorGamutHeuristic() {
if (viz::AlwaysUseWideColorGamut() ||
features::IsDynamicColorGamutEnabled()) {
return WideColorGamutHeuristic::kUseDisplay;
}
if (display::HasForceDisplayColorProfile() &&
display::GetForcedDisplayColorProfile() ==
gfx::ColorSpace::CreateDisplayP3D65()) {
return WideColorGamutHeuristic::kUseDisplay;
}
return WideColorGamutHeuristic::kNone;
}
#endif
base::flat_set<std::string>
ChromeContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
content::BrowserContext* browser_context) { … }
void ChromeContentBrowserClient::AugmentNavigationDownloadPolicy(
content::RenderFrameHost* frame_host,
bool user_gesture,
blink::NavigationDownloadPolicy* download_policy) { … }
bool ChromeContentBrowserClient::HandleTopicsWebApi(
const url::Origin& context_origin,
content::RenderFrameHost* main_frame,
browsing_topics::ApiCallerSource caller_source,
bool get_topics,
bool observe,
std::vector<blink::mojom::EpochTopicPtr>& topics) { … }
int ChromeContentBrowserClient::NumVersionsInTopicsEpochs(
content::RenderFrameHost* main_frame) const { … }
bool ChromeContentBrowserClient::IsBluetoothScanningBlocked(
content::BrowserContext* browser_context,
const url::Origin& requesting_origin,
const url::Origin& embedding_origin) { … }
void ChromeContentBrowserClient::BlockBluetoothScanning(
content::BrowserContext* browser_context,
const url::Origin& requesting_origin,
const url::Origin& embedding_origin) { … }
void ChromeContentBrowserClient::GetMediaDeviceIDSalt(
content::RenderFrameHost* rfh,
const net::SiteForCookies& site_for_cookies,
const blink::StorageKey& storage_key,
base::OnceCallback<void(bool, const std::string&)> callback) { … }
#if !BUILDFLAG(IS_ANDROID)
base::OnceClosure ChromeContentBrowserClient::FetchRemoteSms(
content::WebContents* web_contents,
const std::vector<url::Origin>& origin_list,
base::OnceCallback<void(std::optional<std::vector<url::Origin>>,
std::optional<std::string>,
std::optional<content::SmsFetchFailureType>)>
callback) { … }
#endif
bool ChromeContentBrowserClient::IsClipboardPasteAllowed(
content::RenderFrameHost* render_frame_host) { … }
void ChromeContentBrowserClient::IsClipboardPasteAllowedByPolicy(
const content::ClipboardEndpoint& source,
const content::ClipboardEndpoint& destination,
const content::ClipboardMetadata& metadata,
ClipboardPasteData clipboard_paste_data,
IsClipboardPasteAllowedCallback callback) { … }
void ChromeContentBrowserClient::IsClipboardCopyAllowedByPolicy(
const content::ClipboardEndpoint& source,
const content::ClipboardMetadata& metadata,
const ClipboardPasteData& data,
IsClipboardCopyAllowedCallback callback) { … }
#if BUILDFLAG(ENABLE_VR)
content::XrIntegrationClient*
ChromeContentBrowserClient::GetXrIntegrationClient() { … }
#endif
void ChromeContentBrowserClient::BindBrowserControlInterface(
mojo::ScopedMessagePipeHandle pipe) { … }
bool ChromeContentBrowserClient::
ShouldInheritCrossOriginEmbedderPolicyImplicitly(const GURL& url) { … }
bool ChromeContentBrowserClient::
ShouldServiceWorkerInheritPolicyContainerFromCreator(const GURL& url) { … }
void ChromeContentBrowserClient::
GrantAdditionalRequestPrivilegesToWorkerProcess(int child_id,
const GURL& script_url) { … }
content::ContentBrowserClient::PrivateNetworkRequestPolicyOverride
ChromeContentBrowserClient::ShouldOverridePrivateNetworkRequestPolicy(
content::BrowserContext* browser_context,
const url::Origin& origin) { … }
bool ChromeContentBrowserClient::IsJitDisabledForSite(
content::BrowserContext* browser_context,
const GURL& site_url) { … }
bool ChromeContentBrowserClient::AreV8OptimizationsDisabledForSite(
content::BrowserContext* browser_context,
const GURL& site_url) { … }
ukm::UkmService* ChromeContentBrowserClient::GetUkmService() { … }
blink::mojom::OriginTrialsSettingsPtr
ChromeContentBrowserClient::GetOriginTrialsSettings() { … }
void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
content::BrowserContext* context) { … }
void ChromeContentBrowserClient::OnKeepaliveRequestFinished() { … }
#if BUILDFLAG(IS_MAC)
bool ChromeContentBrowserClient::SetupEmbedderSandboxParameters(
sandbox::mojom::Sandbox sandbox_type,
sandbox::SandboxCompiler* compiler) {
if (sandbox_type == sandbox::mojom::Sandbox::kSpeechRecognition) {
base::FilePath soda_component_path = speech::GetSodaDirectory();
CHECK(!soda_component_path.empty());
CHECK(compiler->SetParameter(sandbox::policy::kParamSodaComponentPath,
soda_component_path.value()));
base::FilePath soda_language_pack_path =
speech::GetSodaLanguagePacksDirectory();
CHECK(!soda_language_pack_path.empty());
CHECK(compiler->SetParameter(sandbox::policy::kParamSodaLanguagePackPath,
soda_language_pack_path.value()));
return true;
} else if (sandbox_type == sandbox::mojom::Sandbox::kScreenAI) {
base::FilePath screen_ai_binary_path =
screen_ai::ScreenAIInstallState::GetInstance()
->get_component_binary_path();
if (screen_ai_binary_path.empty()) {
VLOG(1) << "Screen AI component not found.";
return false;
}
return compiler->SetParameter(sandbox::policy::kParamScreenAiComponentPath,
screen_ai_binary_path.value());
}
return false;
}
#endif
void ChromeContentBrowserClient::GetHyphenationDictionary(
base::OnceCallback<void(const base::FilePath&)> callback) { … }
bool ChromeContentBrowserClient::HasErrorPage(int http_status_code) { … }
std::unique_ptr<content::IdentityRequestDialogController>
ChromeContentBrowserClient::CreateIdentityRequestDialogController(
content::WebContents* web_contents) { … }
std::unique_ptr<content::DigitalIdentityProvider>
ChromeContentBrowserClient::CreateDigitalIdentityProvider() { … }
bool ChromeContentBrowserClient::SuppressDifferentOriginSubframeJSDialogs(
content::BrowserContext* browser_context) { … }
bool ChromeContentBrowserClient::IsFindInPageDisabledForOrigin(
const url::Origin& origin) { … }
std::unique_ptr<content::AnchorElementPreconnectDelegate>
ChromeContentBrowserClient::CreateAnchorElementPreconnectDelegate(
content::RenderFrameHost& render_frame_host) { … }
std::unique_ptr<content::SpeculationHostDelegate>
ChromeContentBrowserClient::CreateSpeculationHostDelegate(
content::RenderFrameHost& render_frame_host) { … }
std::unique_ptr<content::PrefetchServiceDelegate>
ChromeContentBrowserClient::CreatePrefetchServiceDelegate(
content::BrowserContext* browser_context) { … }
std::unique_ptr<content::PrerenderWebContentsDelegate>
ChromeContentBrowserClient::CreatePrerenderWebContentsDelegate() { … }
void ChromeContentBrowserClient::OnWebContentsCreated(
content::WebContents* web_contents) { … }
#if !BUILDFLAG(IS_ANDROID)
base::TimeDelta ChromeContentBrowserClient::GetKeepaliveTimerTimeout(
content::BrowserContext* context) { … }
void ChromeContentBrowserClient::OnKeepaliveTimerFired(
std::unique_ptr<ScopedKeepAlive> keep_alive_handle) { … }
#endif
bool ChromeContentBrowserClient::ShouldPreconnectNavigation(
content::RenderFrameHost* render_frame_host) { … }
bool ChromeContentBrowserClient::ShouldDisableOriginAgentClusterDefault(
content::BrowserContext* browser_context) { … }
bool ChromeContentBrowserClient::WillProvidePublicFirstPartySets() { … }
content::mojom::AlternativeErrorPageOverrideInfoPtr
ChromeContentBrowserClient::GetAlternativeErrorPageOverrideInfo(
const GURL& url,
content::RenderFrameHost* render_frame_host,
content::BrowserContext* browser_context,
int32_t error_code) { … }
void ChromeContentBrowserClient::OnSharedStorageWorkletHostCreated(
content::RenderFrameHost* rfh) { … }
void ChromeContentBrowserClient::OnSharedStorageSelectURLCalled(
content::RenderFrameHost* main_rfh) { … }
bool ChromeContentBrowserClient::ShouldSendOutermostOriginToRenderer(
const url::Origin& outermost_origin) { … }
bool ChromeContentBrowserClient::IsFileSystemURLNavigationAllowed(
content::BrowserContext* browser_context,
const GURL& url) { … }
bool ChromeContentBrowserClient::AreIsolatedWebAppsEnabled(
content::BrowserContext* browser_context) { … }
bool ChromeContentBrowserClient::IsThirdPartyStoragePartitioningAllowed(
content::BrowserContext* browser_context,
const url::Origin& top_level_origin) { … }
bool ChromeContentBrowserClient::AreDeprecatedAutomaticBeaconCredentialsAllowed(
content::BrowserContext* browser_context,
const GURL& destination_url,
const url::Origin& top_frame_origin) { … }
bool ChromeContentBrowserClient::
IsTransientActivationRequiredForShowFileOrDirectoryPicker(
content::WebContents* web_contents) { … }
#if BUILDFLAG(IS_MAC)
std::string ChromeContentBrowserClient::GetChildProcessSuffix(int child_flags) {
if (child_flags == chrome::kChildProcessHelperAlerts) {
return chrome::kMacHelperSuffixAlerts;
}
NOTREACHED_IN_MIGRATION() << "Unsupported child process flags!";
return {};
}
#endif
bool ChromeContentBrowserClient::ShouldUseFirstPartyStorageKey(
const url::Origin& origin) { … }
std::unique_ptr<content::ResponsivenessCalculatorDelegate>
ChromeContentBrowserClient::CreateResponsivenessCalculatorDelegate() { … }
bool ChromeContentBrowserClient::DoesGaiaOriginRequireDedicatedProcess() { … }
bool ChromeContentBrowserClient::CanBackForwardCachedPageReceiveCookieChanges(
content::BrowserContext& browser_context,
const GURL& url,
const net::SiteForCookies& site_for_cookies,
const std::optional<url::Origin>& top_frame_origin,
const net::CookieSettingOverrides overrides) { … }
void ChromeContentBrowserClient::GetCloudIdentifiers(
const storage::FileSystemURL& url,
content::FileSystemAccessPermissionContext::HandleType handle_type,
GetCloudIdentifiersCallback callback) { … }
bool ChromeContentBrowserClient::
ShouldAllowBackForwardCacheForCacheControlNoStorePage(
content::BrowserContext* browser_context) { … }
void ChromeContentBrowserClient::SetIsMinimalMode(bool minimal) { … }
bool ChromeContentBrowserClient::
UseOutermostMainFrameOrEmbedderForSubCaptureTargets() const { … }
#if !BUILDFLAG(IS_ANDROID)
void ChromeContentBrowserClient::BindVideoEffectsManager(
const std::string& device_id,
content::BrowserContext* browser_context,
mojo::PendingReceiver<media::mojom::VideoEffectsManager>
video_effects_manager) { … }
void ChromeContentBrowserClient::BindVideoEffectsProcessor(
const std::string& device_id,
content::BrowserContext* browser_context,
mojo::PendingReceiver<video_effects::mojom::VideoEffectsProcessor>
video_effects_processor) { … }
#endif
void ChromeContentBrowserClient::PreferenceRankAudioDeviceInfos(
content::BrowserContext* browser_context,
blink::WebMediaDeviceInfoArray& infos) { … }
void ChromeContentBrowserClient::PreferenceRankVideoDeviceInfos(
content::BrowserContext* browser_context,
blink::WebMediaDeviceInfoArray& infos) { … }
network::mojom::IpProtectionProxyBypassPolicy
ChromeContentBrowserClient::GetIpProtectionProxyBypassPolicy() { … }
void ChromeContentBrowserClient::MaybePrewarmHttpDiskCache(
content::BrowserContext& browser_context,
const std::optional<url::Origin>& initiator_origin,
const GURL& navigation_url) { … }
#if BUILDFLAG(IS_CHROMEOS)
void ChromeContentBrowserClient::NotifyMultiCaptureStateChanged(
content::GlobalRenderFrameHostId capturer_rfh_id,
const std::string& label,
MultiCaptureChanged state) {
switch (state) {
case MultiCaptureChanged::kStarted: {
content::WebContents* const web_contents =
WebContents::FromRenderFrameHost(
RenderFrameHost::FromID(capturer_rfh_id));
if (!web_contents) {
return;
}
NotifyMultiCaptureStarted(
label, web_contents,
web_app::WebAppTabHelper::GetAppId(web_contents));
} break;
case MultiCaptureChanged::kStopped:
NotifyMultiCaptureStopped(label);
break;
}
}
#endif
std::unique_ptr<content::DipsDelegate>
ChromeContentBrowserClient::CreateDipsDelegate() { … }
bool ChromeContentBrowserClient::ShouldSuppressAXLoadComplete(
RenderFrameHost* rfh) { … }
void ChromeContentBrowserClient::BindAIManager(
content::BrowserContext* browser_context,
std::variant<content::RenderFrameHost*, base::SupportsUserData*> context,
mojo::PendingReceiver<blink::mojom::AIManager> receiver) { … }
#if !BUILDFLAG(IS_ANDROID)
void ChromeContentBrowserClient::QueryInstalledWebAppsByManifestId(
const GURL& frame_url,
const GURL& manifest_id,
content::BrowserContext* browser_context,
base::OnceCallback<void(std::optional<blink::mojom::RelatedApplication>)>
callback) { … }
#endif
bool ChromeContentBrowserClient::IsSaveableNavigation(
content::NavigationHandle* navigation_handle) { … }
void ChromeContentBrowserClient::SetSamplingProfiler(
std::unique_ptr<MainThreadStackSamplingProfiler> sampling_profiler) { … }