[AUTO][FILECONTROL] - version 129.0.6668.42

This commit is contained in:
uazo
2024-09-12 09:13:10 +00:00
committed by github-actions[bot]
parent 7b841f470e
commit 089923ee94
113 changed files with 4108 additions and 2353 deletions
+1 -1
View File
@@ -1 +1 @@
128.0.6613.120
129.0.6668.42
@@ -844,6 +844,20 @@ bool AwContentBrowserClient::ShouldOverrideUrlLoading(
request_headers, ignore_navigation);
}
bool AwContentBrowserClient::ShouldAllowSameSiteRenderFrameHostChange(
const content::RenderFrameHost& rfh) {
content::RenderFrameHost* rfh_ptr =
const_cast<content::RenderFrameHost*>(&rfh);
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(rfh_ptr);
AwSettings* aw_settings = AwSettings::FromWebContents(web_contents);
// Don't allow same-site RFH swap on non-crashed frames if the initial page
// scale is non-default. See the comment in `AwSettings` about this for more
// details.
return !aw_settings || !rfh_ptr->IsRenderFrameLive() ||
!aw_settings->initial_page_scale_is_non_default();
}
std::unique_ptr<content::LoginDelegate>
AwContentBrowserClient::CreateLoginDelegate(
const net::AuthChallengeInfo& auth_info,
@@ -1337,7 +1351,7 @@ bool AwContentBrowserClient::IsAttributionReportingOperationAllowed(
}
}
NOTREACHED_NORETURN();
NOTREACHED();
}
content::ContentBrowserClient::AttributionReportingOsRegistrars
@@ -1385,7 +1399,7 @@ AwContentBrowserClient::GetAttributionReportingOsRegistrars(
AttributionReportingOsRegistrar::kDisabled};
}
NOTREACHED_NORETURN();
NOTREACHED();
}
network::mojom::IpProtectionProxyBypassPolicy
@@ -165,6 +165,11 @@ void AwFieldTrials::RegisterFeatureOverrides(base::FeatureList* feature_list) {
// clear on how user can remove persistent media licenses from UI.
aw_feature_overrides.DisableFeature(media::kMediaDrmPersistentLicense);
// WebView does not support multiple processes, so don't try to call some
// MediaDrm APIs in a separate process.
aw_feature_overrides.DisableFeature(
media::kAllowMediaCodecCallsInSeparateProcess);
aw_feature_overrides.DisableFeature(::features::kBackgroundFetch);
// SurfaceControl is controlled by kWebViewSurfaceControl flag.
@@ -226,10 +231,6 @@ void AwFieldTrials::RegisterFeatureOverrides(base::FeatureList* feature_list) {
aw_feature_overrides.DisableFeature(blink::features::kDevicePosture);
aw_feature_overrides.DisableFeature(blink::features::kViewportSegments);
// New Safe Browsing API is still being rolled out on WebView.
aw_feature_overrides.DisableFeature(
safe_browsing::kSafeBrowsingNewGmsApiForBrowseUrlDatabaseCheck);
// PaintHolding for OOPIFs. This should be a no-op since WebView doesn't use
// site isolation but field trial testing doesn't indicate that. Revisit when
// enabling site isolation. See crbug.com/356170748.
@@ -262,10 +263,16 @@ void AwFieldTrials::RegisterFeatureOverrides(base::FeatureList* feature_list) {
// kHashPrefixRealTimeLookups on WebView.
aw_feature_overrides.DisableFeature(
safe_browsing::kSafeBrowsingAsyncRealTimeCheck);
aw_feature_overrides.DisableFeature(
safe_browsing::kHashPrefixRealTimeLookups);
// WebView does not currently support the Permissions API (crbug.com/490120)
aw_feature_overrides.DisableFeature(::features::kWebPermissionsApi);
// TODO(crbug.com/41492947): See crrev.com/c/5744034 for details, but I was
// unable to add this feature to fieldtrial_testing_config and pass all tests.
aw_feature_overrides.EnableFeature(blink::features::kElementGetInnerHTML);
// TODO(crbug.com/356827071): Enable the feature for WebView.
// Disable PlzDedicatedWorker as a workaround for crbug.com/356827071.
// Otherwise, importScripts fails on WebView.
@@ -405,7 +405,10 @@ by a child template that "extends" this file.
android:theme="@style/Theme.BrowserUI.NoDisplay"
android:taskAffinity=""
android:excludeFromRecents="true"
android:exported="false" />
android:exported="false">
<property android:name="android.window.PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI"
android:value="true" />
</activity>
<!-- The singleInstancePerTask launch mode is required by Samsung OS to determine
support for multi-instance in the drag & drop use case. See b/232168063 for
@@ -415,7 +418,10 @@ by a child template that "extends" this file.
android:taskAffinity=""
android:excludeFromRecents="true"
android:launchMode="singleInstancePerTask"
android:windowNoDisplay="true"
android:exported="false">
<property android:name="android.window.PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI"
android:value="true" />
<intent-filter>
<action android:name="org.chromium.chrome.browser.dragdrop.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
@@ -505,7 +511,7 @@ by a child template that "extends" this file.
{% endblock %}
{% block chrome_activity_common %}
android:windowSoftInputMode="adjustResize"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize|uiMode|navigation"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize|uiMode|navigation|density"
android:hardwareAccelerated="false"
{% endblock %}
>
@@ -528,10 +534,14 @@ by a child template that "extends" this file.
{% block extra_web_rendering_activity_definitions %}
{% endblock %}
<property android:name="android.window.PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI"
android:value="true" />
</activity>
<activity-alias android:name="com.google.android.apps.chrome.Main"
android:targetActivity="org.chromium.chrome.browser.ChromeTabbedActivity"
android:exported="true">
<property android:name="android.window.PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
@@ -578,7 +588,7 @@ by a child template that "extends" this file.
{{ self.first_run_activity_common() }}>
</activity>
<activity android:name="org.chromium.chrome.browser.firstrun.FirstRunActivity"
android:theme="@style/Theme.Chromium.DialogWhenLarge"
android:theme="@style/Theme.Chromium.Activity.Fullscreen"
android:launchMode="singleTop"
{% block first_run_activity_common %}
android:label="@string/fre_activity_label"
@@ -588,11 +598,6 @@ by a child template that "extends" this file.
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize|uiMode"
{% endblock %}>
</activity>
<activity android:name="org.chromium.chrome.browser.firstrun.TabbedModeFirstRunActivity"
android:theme="@style/Theme.Chromium.TabbedMode"
android:launchMode="singleTop"
{{ self.first_run_activity_common() }}>
</activity>
{% set enable_cardboard = enable_cardboard|default(0) %}
{% if enable_cardboard == "true" %}
<!-- Based on //third_party/cardboard/src/sdk/qrcode/android/AndroidManifest.xml -->
@@ -1024,15 +1029,6 @@ by a child template that "extends" this file.
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/>
<!-- Background Task Scheduler job service -->
<service android:name="org.chromium.components.background_task_scheduler.internal.BackgroundTaskJobService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/>
<!-- Background Task Scheduler alarm receiver -->
<receiver android:name="org.chromium.components.background_task_scheduler.internal.BackgroundTaskBroadcastReceiver"
android:exported="false" />
<!-- GcmTaskService implementation to wake Chrome on scheduled events -->
<service android:name="org.chromium.chrome.browser.ChromeBackgroundService"
android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE"
@@ -1049,6 +1045,7 @@ by a child template that "extends" this file.
<action android:name="android.support.customtabs.action.CustomTabsService" />
<category android:name="androidx.browser.customtabs.category.ColorSchemeCustomization"/>
<category android:name="androidx.browser.customtabs.category.NavBarColorCustomization"/>
<category android:name="androidx.browser.customtabs.category.SetNetwork"/>
<category android:name="androidx.browser.trusted.category.ImmersiveMode"/>
<category android:name="androidx.browser.trusted.category.LaunchSiteSettings" />
<category android:name="androidx.browser.trusted.category.LaunchWebApkSiteSettings"/>
@@ -1329,9 +1326,7 @@ by a child template that "extends" this file.
<!-- Disables at startup init of Emoji2. See http://crbug.com/1205141 -->
<provider
android:authorities="{{ manifest_package }}.androidx-startup"
android:name="androidx.startup.InitializationProvider"
android:exported="false"
tools:node="remove">
</provider>
@@ -104,7 +104,6 @@
#include "components/crash/core/app/crashpad.h"
#include "components/custom_handlers/protocol_handler_registry.h"
#include "components/device_event_log/device_event_log.h"
#include "components/feed/buildflags.h"
#include "components/heavy_ad_intervention/heavy_ad_blocklist.h"
#include "components/heavy_ad_intervention/heavy_ad_service.h"
#include "components/history/core/browser/history_service.h"
@@ -167,21 +166,19 @@
#include "chrome/browser/android/customtabs/chrome_origin_verifier.h"
#include "chrome/browser/android/oom_intervention/oom_intervention_decider.h"
#include "chrome/browser/android/webapps/webapp_registry.h"
#include "chrome/browser/feed/feed_service_factory.h"
#include "chrome/browser/offline_pages/offline_page_model_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/android/tab_model/tab_model.h"
#include "chrome/browser/ui/android/tab_model/tab_model_list.h"
#include "components/cdm/browser/media_drm_storage_impl.h" // nogncheck crbug.com/1125897
#include "components/feed/core/v2/public/feed_service.h" // nogncheck
#include "components/feed/feed_feature_list.h"
#include "components/installedapp/android/jni_headers/PackageHash_jni.h"
#include "components/offline_pages/core/offline_page_feature.h"
#include "components/offline_pages/core/offline_page_model.h"
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(ENABLE_FEED_V2)
#include "chrome/browser/feed/feed_service_factory.h"
#include "components/feed/core/v2/public/feed_service.h" // nogncheck
#include "components/feed/feed_feature_list.h"
#endif // BUILDFLAG(ENABLE_FEED_V2)
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/user_education/browser_feature_promo_storage_service.h"
@@ -209,6 +206,8 @@
#include "chromeos/ash/components/dbus/attestation/interface.pb.h"
#include "chromeos/ash/components/dbus/constants/attestation_constants.h" // nogncheck
#include "chromeos/ash/components/dbus/dbus_thread_manager.h" // nogncheck
#include "chromeos/components/mahi/public/cpp/mahi_manager.h"
#include "chromeos/constants/chromeos_features.h"
#include "components/user_manager/user.h"
#include "device/fido/cros/credential_store.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
@@ -1133,7 +1132,6 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
}
#if BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(ENABLE_FEED_V2)
if (filter_builder->MatchesMostOriginsAndDomains()) {
// Don't bridge through if the service isn't present, which means
// we're probably running in a native unit test.
@@ -1143,8 +1141,6 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
service->ClearCachedData();
}
}
#endif // BUILDFLAG(ENABLE_FEED_V2)
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_ANDROID)
@@ -1187,6 +1183,14 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
&history_task_tracker_);
}
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
// If the cache from the browser is cleared. Mahi should clear its cache.
if (filter_builder->MatchesMostOriginsAndDomains() &&
chromeos::features::IsMahiEnabled() && chromeos::MahiManager::Get()) {
chromeos::MahiManager::Get()->ClearCache();
}
#endif
}
//////////////////////////////////////////////////////////////////////////////
@@ -1455,6 +1459,12 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
tab_model->CloseTabsNavigatedInTimeWindow(delete_begin, delete_end);
}
TabModel* archived_tab_model = TabModelList::GetArchivedTabModel();
if (archived_tab_model) {
archived_tab_model->CloseTabsNavigatedInTimeWindow(delete_begin,
delete_end);
}
#else // BUILDFLAG(IS_ANDROID)
NOTIMPLEMENTED();
#endif // BUILDFLAG(IS_ANDROID)
@@ -32,7 +32,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
#include "chrome/browser/speech/on_device_speech_recognition_impl.h"
#include "chrome/browser/translate/translate_frame_binder.h"
#include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
#include "chrome/browser/ui/ui_features.h"
@@ -68,7 +68,6 @@
#include "components/dom_distiller/content/common/mojom/distillability_service.mojom.h"
#include "components/dom_distiller/content/common/mojom/distiller_javascript_service.mojom.h"
#include "components/dom_distiller/core/dom_distiller_service.h"
#include "components/feed/buildflags.h"
#include "components/history_clusters/core/features.h"
#include "components/history_clusters/core/history_clusters_service.h"
#include "components/history_clusters/history_clusters_internals/webui/history_clusters_internals_ui.h"
@@ -86,6 +85,7 @@
#include "components/safe_browsing/buildflags.h"
#include "components/search_engines/search_engine_choice/search_engine_choice_utils.h"
#include "components/security_state/content/content_utils.h"
#include "components/security_state/content/security_state_tab_helper.h"
#include "components/security_state/core/security_state.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/site_engagement/core/mojom/site_engagement_details.mojom.h"
@@ -102,7 +102,6 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/image_annotation/public/mojom/image_annotation.mojom.h"
#include "services/screen_ai/buildflags/buildflags.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/features_generated.h"
#include "third_party/blink/public/mojom/credentialmanagement/credential_manager.mojom.h"
@@ -116,11 +115,6 @@
#include "third_party/blink/public/public_buildflags.h"
#include "ui/accessibility/accessibility_features.h"
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
#include "chrome/browser/screen_ai/screen_ai_service_router.h"
#include "chrome/browser/screen_ai/screen_ai_service_router_factory.h"
#endif
#if BUILDFLAG(ENABLE_UNHANDLED_TAP)
#include "chrome/browser/android/contextualsearch/unhandled_tap_notifier_impl.h"
#include "chrome/browser/android/contextualsearch/unhandled_tap_web_contents_observer.h"
@@ -157,9 +151,7 @@
#else
#include "chrome/browser/badging/badge_manager.h"
#include "chrome/browser/cart/chrome_cart.mojom.h"
#include "chrome/browser/new_tab_page/modules/feed/feed.mojom.h"
#include "chrome/browser/new_tab_page/modules/file_suggestion/file_suggestion.mojom.h"
#include "chrome/browser/new_tab_page/modules/history_clusters/history_clusters.mojom.h"
#include "chrome/browser/new_tab_page/modules/v2/calendar/google_calendar.mojom.h"
#include "chrome/browser/new_tab_page/modules/v2/most_relevant_tab_resumption/most_relevant_tab_resumption.mojom.h"
#include "chrome/browser/new_tab_page/modules/v2/tab_resumption/tab_resumption.mojom.h"
@@ -192,6 +184,7 @@
#include "chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_ui.h"
#include "chrome/browser/ui/webui/omnibox_popup/omnibox_popup_ui.h"
#include "chrome/browser/ui/webui/password_manager/password_manager_ui.h"
#include "chrome/browser/ui/webui/privacy_sandbox/private_state_tokens/private_state_tokens.mojom.h"
#include "chrome/browser/ui/webui/privacy_sandbox/related_website_sets/related_website_sets.mojom.h"
#include "chrome/browser/ui/webui/search_engine_choice/search_engine_choice.mojom.h" // nogncheck crbug.com/1125897
#include "chrome/browser/ui/webui/search_engine_choice/search_engine_choice_ui.h"
@@ -228,6 +221,8 @@
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/companion/visual_query/visual_query_suggestions_service_factory.h"
#include "chrome/browser/screen_ai/screen_ai_service_router.h"
#include "chrome/browser/screen_ai/screen_ai_service_router_factory.h"
#include "chrome/browser/ui/web_applications/sub_apps_service_impl.h"
#include "chrome/browser/ui/webui/discards/discards.mojom.h"
#include "chrome/browser/ui/webui/discards/discards_ui.h"
@@ -830,6 +825,14 @@ void BindMediaFoundationRendererNotifierHandler(
#endif // BUILDFLAG(IS_WIN)
#endif // BUILDFLAG(ENABLE_SPEECH_SERVICE)
void BindOnDeviceSpeechRecognitionHandler(
content::RenderFrameHost* frame_host,
mojo::PendingReceiver<media::mojom::OnDeviceSpeechRecognition> receiver) {
speech::OnDeviceSpeechRecognitionImpl::GetOrCreateForCurrentDocument(
frame_host)
->Bind(std::move(receiver));
}
#if BUILDFLAG(IS_WIN)
void BindMediaFoundationPreferences(
content::RenderFrameHost* frame_host,
@@ -842,7 +845,8 @@ void BindMediaFoundationPreferences(
}
#endif // BUILDFLAG(IS_WIN)
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
BUILDFLAG(IS_WIN)
void BindScreenAIAnnotator(
content::RenderFrameHost* frame_host,
mojo::PendingReceiver<screen_ai::mojom::ScreenAIAnnotator> receiver) {
@@ -861,10 +865,7 @@ void BindScreen2xMainContentExtractor(
frame_host->GetProcess()->GetBrowserContext())
->BindMainContentExtractor(std::move(receiver));
}
#endif
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
BUILDFLAG(IS_WIN)
void BindVisualSuggestionsModelProvider(
content::RenderFrameHost* frame_host,
mojo::PendingReceiver<
@@ -1045,6 +1046,8 @@ void PopulateChromeFrameBinders(
map->Add<network_hints::mojom::NetworkHintsHandler>(
base::BindRepeating(&BindNetworkHintsHandler));
map->Add<media::mojom::OnDeviceSpeechRecognition>(
base::BindRepeating(&BindOnDeviceSpeechRecognitionHandler));
#if BUILDFLAG(ENABLE_SPEECH_SERVICE)
map->Add<media::mojom::SpeechRecognitionContext>(
@@ -1075,9 +1078,7 @@ void PopulateChromeFrameBinders(
map->Add<companion::visual_query::mojom::VisualSuggestionsModelProvider>(
base::BindRepeating(&BindVisualSuggestionsModelProvider));
}
#endif
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
if (features::IsPdfOcrEnabled()) {
map->Add<screen_ai::mojom::ScreenAIAnnotator>(
base::BindRepeating(&BindScreenAIAnnotator));
@@ -1194,7 +1195,8 @@ void PopulateChromeWebUIFrameBinders(
lens::LensUntrustedUI>(map);
}
if (lens::features::IsLensOverlaySearchBubbleEnabled()) {
if (lens::features::IsLensOverlayEnabled() &&
lens::features::IsLensOverlaySearchBubbleEnabled()) {
RegisterWebUIControllerInterfaceBinder<
lens::mojom::SearchBubblePageHandlerFactory, lens::SearchBubbleUI>(map);
}
@@ -1312,11 +1314,6 @@ void PopulateChromeWebUIFrameBinders(
file_suggestion::mojom::FileSuggestionHandler, NewTabPageUI>(map);
}
if (base::FeatureList::IsEnabled(ntp_features::kNtpFeedModule)) {
RegisterWebUIControllerInterfaceBinder<ntp::feed::mojom::FeedHandler,
NewTabPageUI>(map);
}
if (base::FeatureList::IsEnabled(ntp_features::kNtpTabResumptionModule)) {
RegisterWebUIControllerInterfaceBinder<
ntp::tab_resumption::mojom::PageHandler, NewTabPageUI>(map);
@@ -1764,7 +1761,7 @@ void PopulateChromeWebUIFrameBinders(
DiscardsUI>(map);
#endif
#if BUILDFLAG(ENABLE_FEED_V2) && BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_ANDROID)
RegisterWebUIControllerInterfaceBinder<feed_internals::mojom::PageHandler,
FeedInternalsUI>(map);
#endif
@@ -1813,8 +1810,8 @@ void PopulateChromeWebUIFrameBinders(
#if !BUILDFLAG(IS_ANDROID)
if (base::FeatureList::IsEnabled(
optimization_guide::features::kOptimizationGuideOnDeviceModel)) {
RegisterWebUIControllerInterfaceBinder<::mojom::OnDeviceInternalsPage,
OnDeviceInternalsUI>(map);
RegisterWebUIControllerInterfaceBinder<
::mojom::OnDeviceInternalsPageHandlerFactory, OnDeviceInternalsUI>(map);
}
#endif
@@ -1831,6 +1828,12 @@ void PopulateChromeWebUIFrameBinders(
related_website_sets::mojom::RelatedWebsiteSetsPageHandler,
privacy_sandbox_internals::PrivacySandboxInternalsUI>(map);
}
if (base::FeatureList::IsEnabled(privacy_sandbox::kPrivateStateTokensDevUI)) {
RegisterWebUIControllerInterfaceBinder<
private_state_tokens::mojom::PrivateStateTokensPageHandler,
privacy_sandbox_internals::PrivacySandboxInternalsUI>(map);
}
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
@@ -1886,7 +1889,7 @@ void PopulateChromeWebUIFrameInterfaceBrokers(
// --- Section 2: chrome-untrusted:// WebUIs:
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (ash::features::IsBocaEnabled()) {
registry.ForWebUI<ash::BocaUI>()
registry.ForWebUI<ash::boca::BocaUI>()
.Add<ash::boca::mojom::BocaPageHandlerFactory>()
.Add<color_change_listener::mojom::PageHandler>();
}
@@ -1934,6 +1937,12 @@ void PopulateChromeWebUIFrameInterfaceBrokers(
.Add<searchbox::mojom::PageHandler>()
.Add<color_change_listener::mojom::PageHandler>();
}
if (lens::features::IsLensOverlaySearchBubbleEnabled()) {
registry.ForWebUI<lens::SearchBubbleUI>()
.Add<lens::mojom::SearchBubblePageHandlerFactory>()
.Add<searchbox::mojom::PageHandler>()
.Add<color_change_listener::mojom::PageHandler>();
}
if (companion::IsCompanionFeatureEnabled()) {
registry.ForWebUI<CompanionSidePanelUntrustedUI>()
.Add<side_panel::mojom::CompanionPageHandlerFactory>();
@@ -21,6 +21,7 @@
#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"
@@ -43,6 +44,7 @@
#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" // PLATFORM_CFM
@@ -81,6 +83,7 @@
#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"
@@ -155,15 +158,17 @@
#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/security_state_tab_helper.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"
@@ -201,6 +206,7 @@
#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"
@@ -306,6 +312,7 @@
#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"
@@ -409,13 +416,15 @@
#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/enterprise/platform_auth/platform_auth_navigation_throttle.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"
@@ -437,7 +446,9 @@
#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/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"
@@ -459,7 +470,7 @@
#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.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"
@@ -523,6 +534,7 @@
#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 // !BUILDFLAG(IS_ANDROID)
@@ -756,7 +768,7 @@
#include "base/win/windows_h_disallowed.h"
#endif // defined(_WINDOWS_)
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/screen_ai/screen_ai_install_state.h"
#endif
@@ -771,10 +783,10 @@
#include "chromeos/components/kiosk/kiosk_utils.h"
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(ENTERPRISE_DATA_CONTROLS)
#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 // BUILDFLAG(ENTERPRISE_DATA_CONTROLS)
#endif // BUILDFLAG(ENTERPRISE_DATA_CONTROLS) && !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(OS_LEVEL_GEOLOCATION_PERMISSION_SUPPORTED)
#include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h"
@@ -1464,7 +1476,9 @@ std::unique_ptr<VisitedLinkNavigationThrottle>
MaybeCreateVisitedLinkNavigationThrottleFor(
content::NavigationHandle* navigation_handle) {
if (!base::FeatureList::IsEnabled(
blink::features::kPartitionVisitedLinkDatabase)) {
blink::features::kPartitionVisitedLinkDatabase) &&
!base::FeatureList::IsEnabled(
blink::features::kPartitionVisitedLinkDatabaseWithSelfLinks)) {
return nullptr;
}
Profile* profile = Profile::FromBrowserContext(
@@ -1486,14 +1500,19 @@ MaybeCreateVisitedLinkNavigationThrottleFor(
ChromeContentBrowserClient::PopupNavigationDelegateFactory
g_popup_navigation_delegate_factory = &CreatePopupNavigationDelegate;
bool DetermineIfDevtoolsUserForProcessPerSite() {
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(CHROME_FOR_TESTING)
bool DetermineIfDevToolsUserForProcessPerSite() {
bool is_devtools_user = false;
// Only count uses of DevTools from within the last week.
constexpr base::TimeDelta kDevToolsUserActivityWindow = base::Days(7);
auto now = base::Time::Now();
if (ProfileManager* profile_manager = g_browser_process->profile_manager()) {
std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles();
for (auto* profile : profiles) {
if (profile->GetPrefs()->HasPrefPath(
prefs::kDevToolsSyncedPreferencesSyncDisabled) ||
profile->GetPrefs()->HasPrefPath(prefs::kDevToolsPreferences)) {
base::Time last_open_time = base::Time::FromDeltaSinceWindowsEpoch(
base::Milliseconds(profile->GetPrefs()->GetInt64(
prefs::kDevToolsLastOpenTimestamp)));
if (now - last_open_time < kDevToolsUserActivityWindow) {
is_devtools_user = true;
break;
}
@@ -1504,6 +1523,7 @@ bool DetermineIfDevtoolsUserForProcessPerSite() {
is_devtools_user);
return is_devtools_user;
}
#endif
net::handles::NetworkHandle GetBoundNetworkFromRenderFrameHost(
content::RenderFrameHost* frame) {
@@ -1849,7 +1869,7 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) {
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
main_parts->AddParts(
std::make_unique<
chrome::enterprise_util::ChromeBrowserMainExtraPartsEnterprise>());
enterprise_util::ChromeBrowserMainExtraPartsEnterprise>());
#endif
#if !BUILDFLAG(IS_ANDROID)
@@ -2089,13 +2109,33 @@ bool ChromeContentBrowserClient::ShouldUseProcessPerSite(
bool ChromeContentBrowserClient::ShouldAllowProcessPerSiteForMultipleMainFrames(
content::BrowserContext* browser_context) {
static bool is_devtools_user = DetermineIfDevtoolsUserForProcessPerSite();
#if !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(CHROME_FOR_TESTING)
static bool is_devtools_user = true;
#else
static bool is_devtools_user =
DetermineIfDevToolsUserForProcessPerSite() || headless::IsHeadlessMode();
#endif
// TODO(dtapuska): Implement enterprise policy support here.
if (is_devtools_user && base::FeatureList::IsEnabled(
features::kProcessPerSiteSkipDevtoolsUsers)) {
return false;
}
#endif
// Skip enterprise users.
if (base::FeatureList::IsEnabled(
features::kProcessPerSiteSkipEnterpriseUsers)) {
Profile* profile = Profile::FromBrowserContext(browser_context);
if (!profile) {
return false;
}
auto* management_service =
policy::ManagementServiceFactory::GetForProfile(profile);
if (policy::ManagementServiceFactory::GetForPlatform()->IsManaged() &&
management_service && management_service->IsManaged()) {
return false;
}
}
return true;
}
@@ -2700,6 +2740,7 @@ void MaybeAppendBlinkSettingsSwitchForFieldTrial(
void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) {
crash_keys::AppendStringAnnotationsCommandLineSwitch(command_line);
#if BUILDFLAG(IS_MAC)
std::unique_ptr<metrics::ClientInfo> client_info =
GoogleUpdateSettings::LoadMetricsClientInfo();
@@ -3055,7 +3096,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
if (const auto* heap_profiler_controller =
heap_profiling::HeapProfilerController::GetInstance()) {
heap_profiler_controller->AppendCommandLineSwitchForChildProcess(
command_line, GetProfileParamsProcess(*command_line),
command_line, GetProfilerProcessType(*command_line),
child_process_id);
}
}
@@ -3469,11 +3510,19 @@ bool ChromeContentBrowserClient::IsPrivacySandboxReportingDestinationAttested(
void ChromeContentBrowserClient::OnAuctionComplete(
content::RenderFrameHost* render_frame_host,
content::InterestGroupManager::InterestGroupDataKey winner_data_key) {
content_settings::PageSpecificContentSettings::BrowsingDataAccessed(
render_frame_host, winner_data_key,
BrowsingDataModel::StorageType::kInterestGroup,
/*blocked=*/false);
std::optional<content::InterestGroupManager::InterestGroupDataKey>
winner_data_key) {
if (winner_data_key) {
content_settings::PageSpecificContentSettings::BrowsingDataAccessed(
render_frame_host, winner_data_key.value(),
BrowsingDataModel::StorageType::kInterestGroup,
/*blocked=*/false);
}
if (auto* observer =
page_load_metrics::MetricsWebContentsObserver::FromWebContents(
WebContents::FromRenderFrameHost(render_frame_host))) {
observer->OnAdAuctionComplete(render_frame_host);
}
}
bool ChromeContentBrowserClient::IsAttributionReportingOperationAllowed(
@@ -3826,8 +3875,9 @@ bool ChromeContentBrowserClient::ShouldDenyRequestOnCertificateError(
namespace {
bool ShouldDisableForcedColorsForWebContent(content::WebContents* contents) {
if (!contents) {
bool ShouldDisableForcedColorsForWebContent(content::WebContents* contents,
bool in_forced_colors) {
if (!contents || !in_forced_colors) {
return false;
}
@@ -3865,7 +3915,8 @@ bool ShouldDisableForcedColorsForWebContent(content::WebContents* contents) {
bool IsForcedColorsEnabledForWebContent(content::WebContents* contents,
const ui::NativeTheme* native_theme) {
return native_theme->InForcedColorsMode() &&
!ShouldDisableForcedColorsForWebContent(contents);
!ShouldDisableForcedColorsForWebContent(contents,
/*in_forced_colors=*/true);
}
#if !BUILDFLAG(IS_ANDROID)
@@ -3938,6 +3989,7 @@ bool UpdatePreferredColorScheme(WebPreferences* web_prefs,
if (force_light) {
web_prefs->preferred_color_scheme =
blink::mojom::PreferredColorScheme::kLight;
#if !BUILDFLAG(IS_ANDROID)
} else if (content::HasWebUIScheme(url)) {
// If color scheme is not forced, WebUI should track the color mode of the
// ColorProvider associated with `web_contents`.
@@ -3945,6 +3997,7 @@ bool UpdatePreferredColorScheme(WebPreferences* web_prefs,
web_contents->GetColorMode() == ui::ColorProviderKey::ColorMode::kLight
? blink::mojom::PreferredColorScheme::kLight
: blink::mojom::PreferredColorScheme::kDark;
#endif // !BUILDFLAG(IS_ANDROID)
}
return old_preferred_color_scheme != web_prefs->preferred_color_scheme;
@@ -4045,12 +4098,12 @@ base::OnceClosure ChromeContentBrowserClient::SelectClientCertificate(
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
GURL requesting_url = chrome::enterprise_util::GetRequestingUrl(
cert_request_info->host_and_port);
GURL requesting_url =
enterprise_util::GetRequestingUrl(cert_request_info->host_and_port);
DCHECK(requesting_url.is_valid()) << "Invalid URL string: " << requesting_url;
net::ClientCertIdentityList matching_certificates, nonmatching_certificates;
chrome::enterprise_util::AutoSelectCertificates(
enterprise_util::AutoSelectCertificates(
profile, requesting_url, std::move(client_certs), &matching_certificates,
&nonmatching_certificates);
@@ -4516,10 +4569,6 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
web_prefs->require_transient_activation_for_show_file_or_directory_picker =
IsFileOrDirectoryPickerWithoutGestureAllowed(web_contents);
#endif // !BUILDFLAG(IS_ANDROID)
// TODO(crbug.com/40941384): Remove this pref and solely rely on permissions.
web_prefs->require_transient_activation_for_html_fullscreen =
IsTransientActivationRequiredForHtmlFullscreen(
web_contents->GetPrimaryMainFrame());
#if BUILDFLAG(IS_CHROMEOS)
web_prefs->subapps_apis_require_user_gesture_and_authorization =
@@ -4545,8 +4594,8 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
web_prefs->in_forced_colors =
IsForcedColorsEnabledForWebContent(web_contents, GetWebTheme());
web_prefs->is_forced_colors_disabled =
ShouldDisableForcedColorsForWebContent(web_contents);
web_prefs->is_forced_colors_disabled = ShouldDisableForcedColorsForWebContent(
web_contents, GetWebTheme()->InForcedColorsMode());
UpdatePreferredColorScheme(
web_prefs,
@@ -4628,15 +4677,6 @@ bool ChromeContentBrowserClient::OverrideWebPreferencesAfterNavigation(
web_prefs->require_transient_activation_for_show_file_or_directory_picker =
require_transient_activation_for_show_file_or_directory_picker;
#endif // !BUILDFLAG(IS_ANDROID)
// TODO(crbug.com/40941384): Remove this pref and solely rely on permissions.
const bool require_transient_activation_for_html_fullscreen =
IsTransientActivationRequiredForHtmlFullscreen(
web_contents->GetPrimaryMainFrame());
prefs_changed |=
(web_prefs->require_transient_activation_for_html_fullscreen !=
require_transient_activation_for_html_fullscreen);
web_prefs->require_transient_activation_for_html_fullscreen =
require_transient_activation_for_html_fullscreen;
for (auto& parts : extra_parts_) {
prefs_changed |=
@@ -4648,8 +4688,8 @@ bool ChromeContentBrowserClient::OverrideWebPreferencesAfterNavigation(
prefs_changed |= (web_prefs->in_forced_colors != in_forced_colors);
web_prefs->in_forced_colors = in_forced_colors;
const bool is_forced_colors_disabled =
ShouldDisableForcedColorsForWebContent(web_contents);
const bool is_forced_colors_disabled = ShouldDisableForcedColorsForWebContent(
web_contents, GetWebTheme()->InForcedColorsMode());
prefs_changed |=
(web_prefs->is_forced_colors_disabled != is_forced_colors_disabled);
web_prefs->is_forced_colors_disabled = is_forced_colors_disabled;
@@ -5023,9 +5063,7 @@ std::wstring ChromeContentBrowserClient::GetAppContainerSidForSandboxType(
#endif
case sandbox::mojom::Sandbox::kPrintCompositor:
case sandbox::mojom::Sandbox::kAudio:
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
case sandbox::mojom::Sandbox::kScreenAI:
#endif
case sandbox::mojom::Sandbox::kSpeechRecognition:
case sandbox::mojom::Sandbox::kPdfConversion:
case sandbox::mojom::Sandbox::kService:
@@ -5125,7 +5163,7 @@ bool ChromeContentBrowserClient::PreSpawnChild(
case sandbox::mojom::Sandbox::kPrintBackend:
#endif
case sandbox::mojom::Sandbox::kPrintCompositor:
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
#if !BUILDFLAG(IS_ANDROID)
case sandbox::mojom::Sandbox::kScreenAI:
#endif
case sandbox::mojom::Sandbox::kAudio:
@@ -5419,9 +5457,16 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
SupervisedUserGoogleAuthNavigationThrottle::MaybeCreate(handle),
&throttles);
MaybeAddThrottle(
SupervisedUserNavigationThrottle::MaybeCreateThrottleFor(handle),
&throttles);
if (base::FeatureList::IsEnabled(
supervised_user::kClassifyUrlOnProcessResponseEvent)) {
MaybeAddThrottle(
supervised_user::MaybeCreateClassifyUrlNavigationThrottleFor(handle),
&throttles);
} else {
MaybeAddThrottle(
SupervisedUserNavigationThrottle::MaybeCreateThrottleFor(handle),
&throttles);
}
if (auto* throttle_manager =
subresource_filter::ContentSubresourceFilterThrottleManager::
@@ -5429,8 +5474,8 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
throttle_manager->MaybeAppendNavigationThrottles(handle, &throttles);
}
if (base::FeatureList::IsEnabled(fingerprinting_protection_filter::features::
kEnableFingerprintingProtectionFilter)) {
if (fingerprinting_protection_filter::features::
IsFingerprintingProtectionFeatureEnabled()) {
if (auto* throttle_manager = fingerprinting_protection_filter::
ThrottleManager::FromNavigationHandle(*handle)) {
throttle_manager->MaybeAppendNavigationThrottles(handle, &throttles);
@@ -5644,7 +5689,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
&throttles);
}
#if BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
// Don't perform platform authentication in incognito and guest profiles.
if (profile && !profile->IsOffTheRecord()) {
MaybeAddThrottle(
@@ -5652,7 +5697,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
handle),
&throttles);
}
#endif // BUILDFLAG(IS_WIN)
#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_CHROMEOS)
// TODO(b:296844164) Handle captive portal signin properly.
@@ -5714,7 +5759,7 @@ bool ChromeContentBrowserClient::EnforceSystemAudioEchoCancellation() {
// TODO(b/270042522): This is a short term solution to enforce the system
// audio cancellation and will be removed before Lacros is released. The
// short term solution will not work on Lacros.
#if BUILDFLAG(IS_CHROMEOS_ASH) && defined(USE_CRAS)
#if BUILDFLAG(IS_CHROMEOS_ASH) && BUILDFLAG(USE_CRAS)
bool system_aec_enabled = false;
ash::CrosSettings::Get()->GetBoolean(ash::kDeviceSystemAecEnabled,
&system_aec_enabled);
@@ -5787,13 +5832,23 @@ ChromeContentBrowserClient::GetDevToolsBackgroundServiceExpirations(
std::optional<base::TimeDelta>
ChromeContentBrowserClient::GetSpareRendererDelayForSiteURL(
const GURL& site_url) {
if (!IsTopChromeWebUIURL(site_url)) {
return std::nullopt;
if (IsTopChromeWebUIURL(site_url)) {
// Experiments have shown that delaying 2s brings the most significant
// improvements to Top Chrome WebUIs. See crbug.com/41490050.
return base::Seconds(2);
}
// Experiments have shown that delaying 2s brings the most significant
// improvements to Top Chrome WebUIs. See crbug.com/41490050.
return base::Seconds(2);
#if BUILDFLAG(IS_ANDROID)
// Delay the creation of the renderer on Android since the CPU tends
// to be busy during loading.
if (base::FeatureList::IsEnabled(
features::kAndroidWarmUpSpareRendererWithTimeout)) {
return base::Milliseconds(
features::kAndroidSpareRendererCreationDelayMs.Get());
}
#endif
return std::nullopt;
}
std::unique_ptr<content::TracingDelegate>
@@ -5911,7 +5966,8 @@ ChromeContentBrowserClient::MaybeCreateSafeBrowsingURLLoaderThrottle(
connectors_service->GetDMTokenForRealTimeUrlCheck().has_value();
bool is_enterprise_lookup_enabled =
safe_browsing::RealTimePolicyEngine::CanPerformEnterpriseFullURLLookup(
profile->GetPrefs(), has_valid_dm_token, profile->IsOffTheRecord());
profile->GetPrefs(), has_valid_dm_token, profile->IsOffTheRecord(),
profile->IsGuestSession());
#else
bool is_enterprise_lookup_enabled = false;
#endif
@@ -6065,9 +6121,12 @@ ChromeContentBrowserClient::CreateURLLoaderThrottles(
#endif
#if BUILDFLAG(ENABLE_REQUEST_HEADER_INTEGRITY)
result.push_back(
std::make_unique<
request_header_integrity::RequestHeaderIntegrityURLLoaderThrottle>());
if (request_header_integrity::RequestHeaderIntegrityURLLoaderThrottle::
IsFeatureEnabled()) {
result.push_back(
std::make_unique<request_header_integrity::
RequestHeaderIntegrityURLLoaderThrottle>());
}
#endif
if (chrome_navigation_ui_data &&
@@ -6384,6 +6443,14 @@ bool IsSystemFeatureURLDisabled(const GURL& url) {
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);
}
#endif
return false;
@@ -6934,7 +7001,7 @@ bool ChromeContentBrowserClient::IsSecurityLevelAcceptableForWebAuthn(
}
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(rfh);
SecurityStateTabHelper::CreateForWebContents(web_contents);
ChromeSecurityStateTabHelper::CreateForWebContents(web_contents);
SecurityStateTabHelper* helper =
SecurityStateTabHelper::FromWebContents(web_contents);
security_state::SecurityLevel security_level = helper->GetSecurityLevel();
@@ -7151,6 +7218,16 @@ bool ChromeContentBrowserClient::HandleWebUI(
chrome::kChromeUIHelpHost);
}
#if BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI)
if (base::FeatureList::IsEnabled(features::kEnableCertManagementUIV2) &&
url->SchemeIs(content::kChromeUIScheme) &&
url->host() == chrome::kChromeUISettingsHost &&
url->path() == chrome::kChromeUICertificateRedirectPath) {
*url = GURL(chrome::kChromeUICertificateManagerDialogURL);
return true;
}
#endif // BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI)
#if !BUILDFLAG(IS_ANDROID)
Profile* profile = Profile::FromBrowserContext(browser_context);
auto* tracking_protection_settings =
@@ -7258,16 +7335,15 @@ bool ChromeContentBrowserClient::HandleWebUIReverse(
}
#endif // BUILDFLAG(IS_WIN)
#if !BUILDFLAG(IS_ANDROID)
// TODO(crbug.com/40258836): Remove this after feature is launched.
#if BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI)
// No need to actually reverse-rewrite the URL, but return true to update the
// displayed URL when rewriting chrome://settings/passwords to
// chrome://password-manager.
// displayed URL when rewriting chrome://settings/certificates to
// chrome://certificate-manager
if (url->SchemeIs(content::kChromeUIScheme) &&
url->DomainIs(password_manager::kChromeUIPasswordManagerHost)) {
url->host() == chrome::kChromeUICertificateManagerHost) {
return true;
}
#endif
#endif // BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI)
// No need to actually reverse-rewrite the URL, but return true to update the
// displayed URL when rewriting chrome://help to chrome://settings/help.
@@ -7778,7 +7854,8 @@ void ChromeContentBrowserClient::IsClipboardPasteAllowedByPolicy(
const content::ClipboardMetadata& metadata,
ClipboardPasteData clipboard_paste_data,
IsClipboardPasteAllowedCallback callback) {
#if BUILDFLAG(ENTERPRISE_DATA_CONTROLS)
// TODO(b/352728209): Add Android-specific hook for Data Controls.
#if BUILDFLAG(ENTERPRISE_DATA_CONTROLS) && !BUILDFLAG(IS_ANDROID)
enterprise_data_protection::PasteAllowedRequest::StartPasteAllowedRequest(
source, destination, metadata, std::move(clipboard_paste_data),
std::move(callback));
@@ -7792,7 +7869,8 @@ void ChromeContentBrowserClient::IsClipboardCopyAllowedByPolicy(
const content::ClipboardMetadata& metadata,
const ClipboardPasteData& data,
IsClipboardCopyAllowedCallback callback) {
#if BUILDFLAG(ENTERPRISE_DATA_CONTROLS)
// TODO(b/352728209): Add Android-specific hook for Data Controls.
#if BUILDFLAG(ENTERPRISE_DATA_CONTROLS) && !BUILDFLAG(IS_ANDROID)
enterprise_data_protection::IsClipboardCopyAllowedByPolicy(
source, metadata, data, std::move(callback));
#else
@@ -7808,7 +7886,7 @@ void ChromeContentBrowserClient::IsClipboardCopyAllowedByPolicy(
std::move(callback).Run(metadata.format_type, data,
std::move(replacement_data));
}
#endif // BUILDFLAG(ENTERPRISE_DATA_CONTROLS)
#endif // BUILDFLAG(ENTERPRISE_DATA_CONTROLS) && !BUILDFLAG(IS_ANDROID)
}
#if BUILDFLAG(ENABLE_VR)
@@ -7919,6 +7997,30 @@ bool ChromeContentBrowserClient::IsJitDisabledForSite(
CONTENT_SETTING_BLOCK);
}
bool ChromeContentBrowserClient::AreV8OptimizationsDisabledForSite(
content::BrowserContext* browser_context,
const GURL& site_url) {
Profile* profile = Profile::FromBrowserContext(browser_context);
auto* map = HostContentSettingsMapFactory::GetForProfile(profile);
// Special case to determine if any policy is set.
if (map && site_url.is_empty()) {
return map->GetDefaultContentSetting(
ContentSettingsType::JAVASCRIPT_OPTIMIZER, nullptr) ==
CONTENT_SETTING_BLOCK;
}
// Only disable optimizations for schemes that might atually load web content.
auto* policy = ChildProcessSecurityPolicy::GetInstance();
if (!policy->IsWebSafeScheme(site_url.scheme())) {
return false;
}
return (map &&
map->GetContentSetting(site_url, site_url,
ContentSettingsType::JAVASCRIPT_OPTIMIZER) ==
CONTENT_SETTING_BLOCK);
}
ukm::UkmService* ChromeContentBrowserClient::GetUkmService() {
return g_browser_process->GetMetricsServicesManager()->GetUkmService();
}
@@ -7946,15 +8048,19 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
const auto timeout = GetKeepaliveTimerTimeout(context);
keepalive_deadline_ = std::max(keepalive_deadline_, now + timeout);
if (keepalive_deadline_ > now && !keepalive_timer_.IsRunning()) {
DVLOG(1) << "Starting a keepalive timer(" << timeout.InSecondsF()
<< " seconds)";
keepalive_timer_.Start(
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
weak_factory_.GetWeakPtr(),
std::make_unique<ScopedKeepAlive>(
KeepAliveOrigin::BROWSER, KeepAliveRestartOption::DISABLED)));
if (!KeepAliveRegistry::GetInstance()->IsShuttingDown()) {
DVLOG(1) << "Starting a keepalive timer(" << timeout.InSecondsF()
<< " seconds)";
keepalive_timer_.Start(
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
weak_factory_.GetWeakPtr(),
std::make_unique<ScopedKeepAlive>(
KeepAliveOrigin::BROWSER, KeepAliveRestartOption::DISABLED)));
} else {
DVLOG(1) << "Keepalive timer not started as browser is shutting down";
}
}
#endif // !BUILDFLAG(IS_ANDROID)
}
@@ -7990,7 +8096,6 @@ bool ChromeContentBrowserClient::SetupEmbedderSandboxParameters(
CHECK(compiler->SetParameter(sandbox::policy::kParamSodaLanguagePackPath,
soda_language_pack_path.value()));
return true;
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
} else if (sandbox_type == sandbox::mojom::Sandbox::kScreenAI) {
// ScreenAI service needs read access to ScreenAI component binary path to
// load it.
@@ -8003,7 +8108,6 @@ bool ChromeContentBrowserClient::SetupEmbedderSandboxParameters(
}
return compiler->SetParameter(sandbox::policy::kParamScreenAiComponentPath,
screen_ai_binary_path.value());
#endif
}
return false;
@@ -8014,6 +8118,23 @@ bool ChromeContentBrowserClient::SetupEmbedderSandboxParameters(
void ChromeContentBrowserClient::GetHyphenationDictionary(
base::OnceCallback<void(const base::FilePath&)> callback) {
#if BUILDFLAG(USE_MINIKIN_HYPHENATION) && !BUILDFLAG(IS_ANDROID)
// Chrome for Testing bundles hyphenation dictionaries however, if the
// component updater is disabled (which is commonly the case with test
// automation frameworks), the hyphenation dictionaries directory is never
// initialized. To work around this, provide the well known hyphenation
// directory here bypassing the disabled component installer.
#if BUILDFLAG(CHROME_FOR_TESTING)
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableComponentUpdate)) {
base::FilePath dir;
if (base::PathService::Get(base::DIR_EXE, &dir)) {
dir = dir.AppendASCII("hyphen-data");
std::move(callback).Run(dir);
return;
}
}
#endif // BUILDFLAG(CHROME_FOR_TESTING)
component_updater::HyphenationComponentInstallerPolicy::
GetHyphenationDictionary(std::move(callback));
#endif
@@ -8157,13 +8278,9 @@ bool ChromeContentBrowserClient::ShouldDisableOriginAgentClusterDefault(
}
bool ChromeContentBrowserClient::WillProvidePublicFirstPartySets() {
#if BUILDFLAG(ENABLE_COMPONENT_UPDATER)
return !is_minimal_mode_ &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableComponentUpdate);
#else
return false;
#endif // BUILDFLAG(ENABLE_COMPONENT_UPDATER)
}
content::mojom::AlternativeErrorPageOverrideInfoPtr
@@ -8330,28 +8447,6 @@ bool ChromeContentBrowserClient::
#endif // !BUILDFLAG(IS_ANDROID)
}
bool ChromeContentBrowserClient::IsTransientActivationRequiredForHtmlFullscreen(
content::RenderFrameHost* render_frame_host) {
// TODO(crbug.com/40941384): Remove this code and solely rely on permissions.
if (base::FeatureList::IsEnabled(
features::kAutomaticFullscreenContentSetting) &&
!base::FeatureList::IsEnabled(
blink::features::kAutomaticFullscreenPermissionsQuery)) {
const GURL& url = render_frame_host->GetLastCommittedURL();
const HostContentSettingsMap* const content_settings =
HostContentSettingsMapFactory::GetForProfile(
render_frame_host->GetBrowserContext());
if (content_settings &&
content_settings->GetContentSetting(
url, url, ContentSettingsType::AUTOMATIC_FULLSCREEN) ==
CONTENT_SETTING_ALLOW) {
return false;
}
}
return true;
}
#if BUILDFLAG(IS_MAC)
std::string ChromeContentBrowserClient::GetChildProcessSuffix(int child_flags) {
if (child_flags == chrome::kChildProcessHelperAlerts) {
@@ -8444,7 +8539,7 @@ bool ChromeContentBrowserClient::
}
#endif
if (chrome::IsRunningInAppMode()) {
if (IsRunningInAppMode()) {
return false;
}
@@ -8578,10 +8673,11 @@ bool ChromeContentBrowserClient::ShouldSuppressAXLoadComplete(
void ChromeContentBrowserClient::BindAIManager(
content::BrowserContext* browser_context,
std::variant<content::RenderFrameHost*, base::SupportsUserData*> context,
mojo::PendingReceiver<blink::mojom::AIManager> receiver) {
auto* ai_manager =
AIManagerKeyedServiceFactory::GetAIManagerKeyedService(browser_context);
ai_manager->AddReceiver(std::move(receiver));
ai_manager->AddReceiver(std::move(receiver), context);
}
#if !BUILDFLAG(IS_ANDROID)
@@ -8655,6 +8751,11 @@ void ChromeContentBrowserClient::QueryInstalledWebAppsByManifestId(
}
#endif // !BUILDFLAG(IS_ANDROID)
bool ChromeContentBrowserClient::IsSaveableNavigation(
content::NavigationHandle* navigation_handle) {
return tab_groups::TabGroupSyncUtils::IsSaveableNavigation(navigation_handle);
}
void ChromeContentBrowserClient::SetSamplingProfiler(
std::unique_ptr<MainThreadStackSamplingProfiler> sampling_profiler) {
sampling_profiler_ = std::move(sampling_profiler);
@@ -70,7 +70,6 @@
#include "chrome/browser/push_messaging/push_messaging_service_impl.h"
#include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/sharing/sharing_sync_preference.h"
#include "chrome/browser/sharing_hub/sharing_hub_features.h"
#include "chrome/browser/ssl/ssl_config_service_manager.h"
#include "chrome/browser/task_manager/task_manager_interface.h"
@@ -97,7 +96,10 @@
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/browser/ui/webui/policy/policy_ui.h"
#include "chrome/browser/ui/webui/print_preview/policy_settings.h"
#include "components/plus_addresses/plus_address_prefs.h"
#include "components/privacy_sandbox/tpcd_pref_names.h"
#include "components/sharing_message/sharing_sync_preference.h"
#include "components/signin/core/browser/active_primary_accounts_metrics_recorder.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ui/webui/settings/reset_settings_handler.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
@@ -123,7 +125,7 @@
#include "components/embedder_support/origin_trials/origin_trial_prefs.h"
#include "components/enterprise/browser/identifiers/identifiers_prefs.h"
#include "components/enterprise/buildflags/buildflags.h"
#include "components/enterprise/connectors/connectors_prefs.h"
#include "components/enterprise/connectors/core/connectors_prefs.h"
#include "components/fingerprinting_protection_filter/common/fingerprinting_protection_filter_constants.h"
#include "components/flags_ui/pref_service_flags_storage.h"
#include "components/history_clusters/core/history_clusters_prefs.h"
@@ -198,7 +200,6 @@
#include "ppapi/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "rlz/buildflags/buildflags.h"
#include "services/screen_ai/buildflags/buildflags.h"
#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
#include "chrome/browser/background/background_mode_manager.h"
@@ -208,8 +209,8 @@
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/apps/platform_apps/shortcut_manager.h"
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/extensions/api/commands/command_service.h"
#include "chrome/browser/extensions/api/tabs/tabs_api.h"
#include "chrome/browser/extensions/commands/command_service.h"
#include "chrome/browser/extensions/extension_web_ui.h"
#include "chrome/browser/extensions/preinstalled_apps.h"
#include "chrome/browser/ui/extensions/settings_api_bubble_helpers.h"
@@ -244,17 +245,6 @@
#include "chrome/browser/pdf/pdf_pref_names.h"
#endif // BUILDFLAG(ENABLE_PDF)
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
#include "chrome/browser/screen_ai/pref_names.h"
#endif
#include "components/feed/buildflags.h"
#if BUILDFLAG(ENABLE_FEED_V2)
#include "components/feed/core/common/pref_names.h" // nogncheck
#include "components/feed/core/shared_prefs/pref_names.h" // nogncheck
#include "components/feed/core/v2/ios_shared_prefs.h" // nogncheck
#endif
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/accessibility/accessibility_prefs/android/accessibility_prefs_controller.h"
#include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h"
@@ -271,6 +261,9 @@
#include "chrome/browser/readaloud/android/prefs.h"
#include "chrome/browser/ssl/known_interception_disclosure_infobar_delegate.h"
#include "components/cdm/browser/media_drm_storage_impl.h" // nogncheck crbug.com/1125897
#include "components/feed/core/common/pref_names.h" // nogncheck
#include "components/feed/core/shared_prefs/pref_names.h" // nogncheck
#include "components/feed/core/v2/ios_shared_prefs.h" // nogncheck
#include "components/ntp_tiles/popular_sites_impl.h"
#include "components/permissions/contexts/geolocation_permission_context_android.h"
#include "components/query_tiles/tile_service_prefs.h"
@@ -292,6 +285,7 @@
#include "chrome/browser/new_tab_page/modules/v2/tab_resumption/tab_resumption_page_handler.h"
#include "chrome/browser/new_tab_page/promos/promo_service.h"
#include "chrome/browser/policy/developer_tools_policy_handler.h"
#include "chrome/browser/screen_ai/pref_names.h"
#include "chrome/browser/search/background/ntp_custom_background_service.h"
#include "chrome/browser/search_engine_choice/search_engine_choice_dialog_service.h"
#include "chrome/browser/serial/serial_policy_allowed_ports.h"
@@ -353,10 +347,7 @@
#include "chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.h"
#include "chrome/browser/ash/app_list/app_list_syncable_service.h"
#include "chrome/browser/ash/app_list/arc/arc_app_list_prefs.h"
#include "chrome/browser/ash/app_mode/kiosk_chrome_app_manager.h"
#include "chrome/browser/ash/app_mode/kiosk_cryptohome_remover.h"
#include "chrome/browser/ash/app_mode/kiosk_system_session.h"
#include "chrome/browser/ash/app_mode/web_app/web_kiosk_app_manager.h"
#include "chrome/browser/ash/app_mode/kiosk_controller.h"
#include "chrome/browser/ash/app_restore/full_restore_prefs.h"
#include "chrome/browser/ash/apps/apk_web_app_service.h"
#include "chrome/browser/ash/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h"
@@ -427,12 +418,12 @@
#include "chrome/browser/ash/policy/status_collector/status_collector.h"
#include "chrome/browser/ash/power/auto_screen_brightness/metrics_reporter.h"
#include "chrome/browser/ash/power/power_metrics_reporter.h"
#include "chrome/browser/ash/preferences.h"
#include "chrome/browser/ash/preferences/preferences.h"
#include "chrome/browser/ash/printing/cups_printers_manager.h"
#include "chrome/browser/ash/printing/enterprise/enterprise_printers_provider.h"
#include "chrome/browser/ash/release_notes/release_notes_storage.h"
#include "chrome/browser/ash/scanning/chrome_scanning_app_delegate.h"
#include "chrome/browser/ash/scheduler_configuration_manager.h"
#include "chrome/browser/ash/scheduler_config/scheduler_configuration_manager.h"
#include "chrome/browser/ash/settings/device_settings_cache.h"
#include "chrome/browser/ash/system/automatic_reboot_manager.h"
#include "chrome/browser/ash/system/input_device_settings.h"
@@ -454,6 +445,7 @@
#include "chromeos/ash/components/network/managed_cellular_pref_handler.h"
#include "chromeos/ash/components/network/network_metadata_store.h"
#include "chromeos/ash/components/network/proxy/proxy_config_handler.h"
#include "chromeos/ash/components/policy/restriction_schedule/device_restriction_schedule_controller.h"
#include "chromeos/ash/components/report/report_controller.h"
#include "chromeos/ash/components/standalone_browser/migrator_util.h"
#include "chromeos/ash/components/timezone/timezone_resolver.h"
@@ -551,7 +543,7 @@
#endif
#if BUILDFLAG(ENTERPRISE_DATA_CONTROLS)
#include "components/enterprise/data_controls/core/prefs.h"
#include "components/enterprise/data_controls/core/browser/prefs.h"
#endif
namespace {
@@ -559,10 +551,6 @@ namespace {
// Please keep the list of deprecated prefs in chronological order. i.e. Add to
// the bottom of the list, not here at the top.
// Deprecated 08/2023.
const char kDriveFsBulkPinningMaxQueueSize[] =
"drivefs.bulk_pinning.max_queue_size";
// Deprecated 09/2023.
const char kPrivacySandboxM1Unrestricted[] = "privacy_sandbox.m1.unrestricted";
#if BUILDFLAG(IS_WIN)
@@ -925,10 +913,8 @@ inline constexpr char kTrackingProtectionOnboardingNoticeLastRequested[] =
#if !BUILDFLAG(IS_ANDROID)
inline constexpr char kAccessibilityReadAnythingOmniboxIconLabelShownCount[] =
"settings.a11y.read_anything.omnibox_icon_label_shown_count";
#endif
// Deprecated 06/2024.
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
inline constexpr char kAccessibilityPdfOcrAlwaysActive[] =
"settings.a11y.pdf_ocr_always_active";
#endif
@@ -1034,6 +1020,33 @@ constexpr char kAppDeduplicationServiceLastGetTimestamp[] =
constexpr char kShowTunaScreenEnabled[] = "ash.tuna_screen_oobe_enabled";
#endif
// Deprecated 08/2024
#if BUILDFLAG(IS_CHROMEOS)
inline constexpr char kStandaloneWindowMigrationNudgeShown[] =
"standalone_window_migration_nudge_shown";
#endif
#if BUILDFLAG(IS_ANDROID)
// All of these were deprecated 08/24.
constexpr char kObsoleteUnenrolledFromGoogleMobileServicesAfterApiErrorCode[] =
"unenrolled_from_google_mobile_services_after_api_error_code";
constexpr char kObsoleteRequiresMigrationAfterSyncStatusChange[] =
"requires_migration_after_sync_status_change";
constexpr char
kObsoleteUnenrolledFromGoogleMobileServicesWithErrorListVersion[] =
"unenrolled_from_google_mobile_services_with_error_list_version";
constexpr char kObsoleteTimesReenrolledToGoogleMobileServices[] =
"times_reenrolled_to_google_mobile_services";
constexpr char kObsoleteTimesAttemptedToReenrollToGoogleMobileServices[] =
"times_attempted_to_reenroll_to_google_mobile_services";
constexpr char kObsoleteUserReceivedGMSCoreError[] =
"user_received_gmscore_error";
#endif
// Deprecated 08/2024.
constexpr char kSafeBrowsingEsbOptInWithFriendlierSettings[] =
"safebrowsing.esb_opt_in_with_friendlier_settings";
// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
@@ -1123,9 +1136,6 @@ void RegisterProfilePrefsForMigration(
user_prefs::PrefRegistrySyncable* registry) {
chrome_browser_net::secure_dns::RegisterProbesSettingBackupPref(registry);
// Deprecated 08/2023.
registry->RegisterIntegerPref(kDriveFsBulkPinningMaxQueueSize, 0);
// Deprecated 09/2023.
registry->RegisterBooleanPref(kPrivacySandboxM1Unrestricted, false);
#if BUILDFLAG(IS_WIN)
@@ -1351,10 +1361,8 @@ void RegisterProfilePrefsForMigration(
#if !BUILDFLAG(IS_ANDROID)
registry->RegisterIntegerPref(
kAccessibilityReadAnythingOmniboxIconLabelShownCount, 0);
#endif
// Deprecated 06/2024.
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
// Deprecated 06/2024.
registry->RegisterBooleanPref(kAccessibilityPdfOcrAlwaysActive, true);
#endif
@@ -1418,6 +1426,29 @@ void RegisterProfilePrefsForMigration(
// Deprecated 07/2024.
registry->RegisterBooleanPref(kShowTunaScreenEnabled, true);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
// Deprecated 08/2024
#if BUILDFLAG(IS_CHROMEOS)
registry->RegisterBooleanPref(kStandaloneWindowMigrationNudgeShown, false);
#endif
#if BUILDFLAG(IS_ANDROID)
// All of these were deprecated 08/2024.
registry->RegisterIntegerPref(
kObsoleteUnenrolledFromGoogleMobileServicesAfterApiErrorCode, 0);
registry->RegisterBooleanPref(kObsoleteRequiresMigrationAfterSyncStatusChange,
false);
registry->RegisterIntegerPref(
kObsoleteUnenrolledFromGoogleMobileServicesWithErrorListVersion, 0);
registry->RegisterIntegerPref(kObsoleteTimesReenrolledToGoogleMobileServices,
0);
registry->RegisterIntegerPref(
kObsoleteTimesAttemptedToReenrollToGoogleMobileServices, 0);
registry->RegisterBooleanPref(kObsoleteUserReceivedGMSCoreError, false);
#endif
// Deprecated 08/2024.
registry->RegisterBooleanPref(kSafeBrowsingEsbOptInWithFriendlierSettings,
false);
}
void ClearSyncRequestedPrefAndMaybeMigrate(PrefService* profile_prefs) {
@@ -1460,7 +1491,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
ChromeContentBrowserClient::RegisterLocalStatePrefs(registry);
chrome_labs_prefs::RegisterLocalStatePrefs(registry);
ChromeMetricsServiceClient::RegisterPrefs(registry);
chrome::enterprise_util::RegisterLocalStatePrefs(registry);
enterprise_util::RegisterLocalStatePrefs(registry);
component_updater::RegisterPrefs(registry);
domain_reliability::RegisterPrefs(registry);
embedder_support::OriginTrialPrefs::RegisterPrefs(registry);
@@ -1502,6 +1533,8 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
HidPolicyAllowedDevices::RegisterLocalStatePrefs(registry);
#endif
sessions::SessionIdGenerator::RegisterPrefs(registry);
signin::ActivePrimaryAccountsMetricsRecorder::RegisterLocalStatePrefs(
registry);
SSLConfigServiceManager::RegisterPrefs(registry);
subresource_filter::IndexedRulesetVersion::RegisterPrefs(
registry, subresource_filter::kSafeBrowsingRulesetConfig.filter_tag);
@@ -1599,9 +1632,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
ash::FastTransitionObserver::RegisterPrefs(registry);
ash::HWDataUsageController::RegisterLocalStatePrefs(registry);
ash::KerberosCredentialsManager::RegisterLocalStatePrefs(registry);
ash::KioskChromeAppManager::RegisterLocalStatePrefs(registry);
ash::KioskSystemSession::RegisterLocalStatePrefs(registry);
ash::KioskCryptohomeRemover::RegisterPrefs(registry);
ash::KioskController::RegisterLocalStatePrefs(registry);
ash::language_prefs::RegisterPrefs(registry);
ash::local_search_service::SearchMetricsReporter::RegisterLocalStatePrefs(
registry);
@@ -1626,7 +1657,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
ash::TimeZoneResolver::RegisterPrefs(registry);
ash::UserImageManagerImpl::RegisterPrefs(registry);
ash::UserSessionManager::RegisterPrefs(registry);
ash::WebKioskAppManager::RegisterPrefs(registry);
component_updater::MetadataTable::RegisterPrefs(registry);
ash::CryptAuthDeviceIdProviderImpl::RegisterLocalPrefs(registry);
extensions::ExtensionAssetsManagerChromeOS::RegisterPrefs(registry);
@@ -1641,12 +1671,14 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
policy::BrowserPolicyConnectorAsh::RegisterPrefs(registry);
policy::CrdAdminSessionController::RegisterLocalStatePrefs(registry);
policy::DeviceCloudPolicyManagerAsh::RegisterPrefs(registry);
policy::DeviceRestrictionScheduleController::RegisterLocalStatePrefs(
registry);
policy::DeviceStatusCollector::RegisterPrefs(registry);
policy::DeviceWallpaperImageExternalDataHandler::RegisterPrefs(registry);
policy::DMTokenStorage::RegisterPrefs(registry);
policy::EnrollmentRequisitionManager::RegisterPrefs(registry);
policy::MinimumVersionPolicyHandler::RegisterPrefs(registry);
policy::EuiccStatusUploader::RegisterLocalStatePrefs(registry);
policy::MinimumVersionPolicyHandler::RegisterPrefs(registry);
policy::TPMAutoUpdateModePolicyHandler::RegisterPrefs(registry);
quirks::QuirksManager::RegisterPrefs(registry);
UpgradeDetectorChromeos::RegisterPrefs(registry);
@@ -1665,6 +1697,11 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
QuitWithAppsController::RegisterPrefs(registry);
system_media_permissions::RegisterSystemMediaPermissionStatesPrefs(registry);
AppShimRegistry::Get()->RegisterLocalPrefs(registry);
// The default value is not signicant as this preference is only consulted if
// it is explicitly set by an enterprise policy.
registry->RegisterBooleanPref(prefs::kWebAppsUseAdHocCodeSigningForAppShims,
false);
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -1706,9 +1743,9 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
DeviceOAuth2TokenStoreDesktop::RegisterPrefs(registry);
#endif
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
#if !BUILDFLAG(IS_ANDROID)
screen_ai::RegisterLocalStatePrefs(registry);
#endif // BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
#endif // !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
PlatformAuthPolicyObserver::RegisterPrefs(registry);
@@ -1772,6 +1809,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
commerce::RegisterPrefs(registry);
DocumentProvider::RegisterProfilePrefs(registry);
enterprise::RegisterIdentifiersProfilePrefs(registry);
enterprise_connectors::RegisterProfilePrefs(registry);
enterprise_reporting::RegisterProfilePrefs(registry);
dom_distiller::DistilledPagePrefs::RegisterProfilePrefs(registry);
DownloadPrefs::RegisterProfilePrefs(registry);
@@ -1804,6 +1842,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
permissions::RegisterProfilePrefs(registry);
PermissionBubbleMediaAccessHandler::RegisterProfilePrefs(registry);
PlatformNotificationServiceImpl::RegisterProfilePrefs(registry);
plus_addresses::prefs::RegisterProfilePrefs(registry);
policy::URLBlocklistManager::RegisterProfilePrefs(registry);
PolicyUI::RegisterProfilePrefs(registry);
PrefProxyConfigTrackerImpl::RegisterProfilePrefs(registry);
@@ -1893,12 +1932,9 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
ChromeRLZTrackerDelegate::RegisterProfilePrefs(registry);
#endif
#if BUILDFLAG(ENABLE_FEED_V2)
#if BUILDFLAG(IS_ANDROID)
feed::prefs::RegisterFeedSharedProfilePrefs(registry);
feed::RegisterProfilePrefs(registry);
#endif
#if BUILDFLAG(IS_ANDROID)
cdm::MediaDrmStorageImpl::RegisterProfilePrefs(registry);
KnownInterceptionDisclosureInfoBarDelegate::RegisterProfilePrefs(registry);
MediaDrmOriginIdManager::RegisterProfilePrefs(registry);
@@ -1926,7 +1962,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
DeviceServiceImpl::RegisterProfilePrefs(registry);
DevToolsWindow::RegisterProfilePrefs(registry);
DriveService::RegisterProfilePrefs(registry);
enterprise_connectors::RegisterProfilePrefs(registry);
extensions::CommandService::RegisterProfilePrefs(registry);
extensions::TabsCaptureVisibleTabFunction::RegisterProfilePrefs(registry);
first_run::RegisterProfilePrefs(registry);
@@ -2070,7 +2105,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
ProjectorAppClientImpl::RegisterProfilePrefs(registry);
ash::floating_workspace_util::RegisterProfilePrefs(registry);
policy::RebootNotificationsScheduler::RegisterProfilePrefs(registry);
ash::KioskChromeAppManager::RegisterProfilePrefs(registry);
ash::KioskController::RegisterProfilePrefs(registry);
file_manager::file_tasks::RegisterProfilePrefs(registry);
file_manager::prefs::RegisterProfilePrefs(registry);
bruschetta::prefs::RegisterProfilePrefs(registry);
@@ -2151,6 +2186,9 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
registry->RegisterIntegerPref(prefs::kMemorySaverChipExpandedCount, 0);
registry->RegisterTimePref(prefs::kLastMemorySaverChipExpandedTimestamp,
base::Time());
registry->RegisterBooleanPref(
prefs::kAccessibilityMainNodeAnnotationsEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
#endif
#if BUILDFLAG(IS_ANDROID)
@@ -2158,12 +2196,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
false);
#endif
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
registry->RegisterBooleanPref(
prefs::kAccessibilityMainNodeAnnotationsEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
#endif // BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
registry->RegisterBooleanPref(
prefs::kManagedPrivateNetworkAccessRestrictionsEnabled, false);
@@ -2189,6 +2221,8 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
registry->RegisterIntegerPref(prefs::kLensOverlayStartCount, 0);
registry->RegisterDictionaryPref(prefs::kReportingEndpoints);
registry->RegisterBooleanPref(prefs::kCompactModeEnabled, false);
}
void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
@@ -2346,37 +2380,12 @@ void MigrateObsoleteProfilePrefs(PrefService* profile_prefs,
chrome_browser_net::secure_dns::MigrateProbesSettingToOrFromBackup(
profile_prefs);
// Once this migration is complete, the tracked preference
// `kGoogleServicesLastSyncingAccountIdDeprecated` can be removed.
if (profile_prefs->HasPrefPath(
prefs::kGoogleServicesLastSyncingAccountIdDeprecated)) {
std::string account_id = profile_prefs->GetString(
prefs::kGoogleServicesLastSyncingAccountIdDeprecated);
profile_prefs->ClearPref(
prefs::kGoogleServicesLastSyncingAccountIdDeprecated);
bool is_email = account_id.find('@') != std::string::npos;
if (!is_email && !account_id.empty()) {
profile_prefs->SetString(prefs::kGoogleServicesLastSyncingGaiaId,
account_id);
}
}
// TODO(326079444): After experiment is over, update the deprecated date and
// allow this to be cleaned up.
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)
MigrateDefaultBrowserLastDeclinedPref(profile_prefs);
#endif
// Added 08/2023.
invalidation::InvalidatorRegistrarWithMemory::ClearDeprecatedPrefs(
profile_prefs);
invalidation::PerUserTopicSubscriptionManager::ClearDeprecatedPrefs(
profile_prefs);
invalidation::FCMInvalidationService::ClearDeprecatedPrefs(profile_prefs);
// Added 08/2023.
profile_prefs->ClearPref(kDriveFsBulkPinningMaxQueueSize);
// Added 09/2023.
profile_prefs->ClearPref(kPrivacySandboxM1Unrestricted);
#if BUILDFLAG(IS_WIN)
@@ -2638,10 +2647,8 @@ void MigrateObsoleteProfilePrefs(PrefService* profile_prefs,
#if !BUILDFLAG(IS_ANDROID)
profile_prefs->ClearPref(
kAccessibilityReadAnythingOmniboxIconLabelShownCount);
#endif
// Added 06/2024.
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
// Added 06/2024.
profile_prefs->ClearPref(kAccessibilityPdfOcrAlwaysActive);
#endif
@@ -2710,6 +2717,26 @@ void MigrateObsoleteProfilePrefs(PrefService* profile_prefs,
profile_prefs->ClearPref(kShowTunaScreenEnabled);
#endif
// Added 08/2024
#if BUILDFLAG(IS_CHROMEOS)
profile_prefs->ClearPref(kStandaloneWindowMigrationNudgeShown);
#endif
#if BUILDFLAG(IS_ANDROID)
// All of these were added 08/2024.
profile_prefs->ClearPref(
kObsoleteUnenrolledFromGoogleMobileServicesAfterApiErrorCode);
profile_prefs->ClearPref(kObsoleteRequiresMigrationAfterSyncStatusChange);
profile_prefs->ClearPref(
kObsoleteUnenrolledFromGoogleMobileServicesWithErrorListVersion);
profile_prefs->ClearPref(kObsoleteTimesReenrolledToGoogleMobileServices);
profile_prefs->ClearPref(
kObsoleteTimesAttemptedToReenrollToGoogleMobileServices);
profile_prefs->ClearPref(kObsoleteUserReceivedGMSCoreError);
#endif
// Added 08/2024.
profile_prefs->ClearPref(kSafeBrowsingEsbOptInWithFriendlierSettings);
// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_PROFILE_PREFS
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/time/default_tick_clock.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
@@ -28,7 +29,6 @@
#include "chrome/browser/content_settings/sound_content_setting_observer.h"
#include "chrome/browser/dips/dips_bounce_detector.h"
#include "chrome/browser/dips/dips_service.h"
#include "chrome/browser/enterprise/data_protection/data_protection_navigation_controller.h"
#include "chrome/browser/external_protocol/external_protocol_observer.h"
#include "chrome/browser/favicon/favicon_utils.h"
#include "chrome/browser/file_system_access/file_system_access_features.h"
@@ -73,9 +73,9 @@
#include "chrome/browser/safe_browsing/trigger_creator.h"
#include "chrome/browser/sessions/session_tab_helper_factory.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/connection_help_tab_helper.h"
#include "chrome/browser/ssl/https_only_mode_tab_helper.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
#include "chrome/browser/storage_access_api/storage_access_api_service_factory.h"
#include "chrome/browser/storage_access_api/storage_access_api_service_impl.h"
#include "chrome/browser/storage_access_api/storage_access_api_tab_helper.h"
@@ -132,7 +132,6 @@
#include "components/download/content/factory/navigation_monitor_factory.h"
#include "components/download/content/public/download_navigation_observer.h"
#include "components/enterprise/buildflags/buildflags.h"
#include "components/feed/buildflags.h"
#include "components/fingerprinting_protection_filter/common/fingerprinting_protection_filter_features.h"
#include "components/history/content/browser/web_contents_top_sites_observer.h"
#include "components/history/core/browser/top_sites.h"
@@ -165,6 +164,7 @@
#include "content/public/browser/web_contents.h"
#include "extensions/buildflags/buildflags.h"
#include "media/base/media_switches.h"
#include "net/base/features.h"
#include "pdf/buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
@@ -196,19 +196,18 @@
#include "chrome/browser/preloading/prefetch/zero_suggest_prefetch/zero_suggest_prefetch_tab_helper.h"
#include "chrome/browser/tab_contents/form_interaction_tab_helper.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/commerce/commerce_ui_tab_helper.h"
#include "chrome/browser/ui/intent_picker_tab_helper.h"
#include "chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.h"
#include "chrome/browser/ui/sad_tab_helper.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/search_engine_choice/search_engine_choice_tab_helper.h"
#include "chrome/browser/ui/views/side_panel/companion/companion_tab_helper.h"
#include "chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer.h"
#include "chrome/browser/ui/views/side_panel/history_clusters/history_clusters_tab_helper.h"
#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_tab_helper.h"
#include "chrome/browser/ui/sync/browser_synced_tab_delegate.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/uma_browsing_activity_observer.h"
#include "chrome/browser/ui/views/side_panel/companion/companion_tab_helper.h"
#include "chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer.h"
#include "chrome/browser/ui/views/side_panel/history_clusters/history_clusters_tab_helper.h"
#include "chrome/browser/ui/views/side_panel/read_anything/read_anything_side_panel_controller.h"
#include "components/commerce/content/browser/hint/commerce_hint_tab_helper.h"
#include "components/image_fetcher/core/image_fetcher_service.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
@@ -223,7 +222,7 @@
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/boot_times_recorder_tab_helper.h"
#include "chrome/browser/ash/boot_times_recorder/boot_times_recorder_tab_helper.h"
#include "chrome/browser/ash/growth/campaigns_manager_session_tab_helper.h"
#include "chrome/browser/ui/ash/google_one_offer_iph_tab_helper.h"
#endif
@@ -266,7 +265,7 @@
#include "chrome/browser/web_applications/policy/pre_redirection_url_observer.h"
#include "chrome/browser/web_applications/web_app_tab_helper.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "extensions/browser/view_type_utils.h"
#include "extensions/browser/view_type_utils.h" // nogncheck
#include "extensions/common/extension_features.h"
#include "extensions/common/mojom/view_type.mojom.h"
#endif
@@ -286,11 +285,6 @@
#include "chrome/browser/printing/printing_init.h"
#endif
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/privacy_sandbox/tracking_protection_notice_service.h"
#endif
#if BUILDFLAG(ENABLE_COMPOSE)
#include "chrome/browser/compose/chrome_compose_client.h"
#include "chrome/browser/compose/compose_enabling.h"
@@ -302,6 +296,10 @@
#include "chrome/browser/rlz/chrome_rlz_tracker_web_contents_observer.h"
#endif
#if BUILDFLAG(ENABLE_REPORTING)
#include "components/tpcd/enterprise_reporting/enterprise_reporting_tab_helper.h"
#endif
using content::WebContents;
namespace {
@@ -348,8 +346,7 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
// observer list.
content_settings::PageSpecificContentSettings::CreateForWebContents(
web_contents,
std::make_unique<chrome::PageSpecificContentSettingsDelegate>(
web_contents));
std::make_unique<PageSpecificContentSettingsDelegate>(web_contents));
// RedirectChainDetector comes before common tab helpers since
// DIPSWebContentsObserver has it as a dependency.
@@ -389,6 +386,7 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
ChromeRLZTrackerWebContentsObserver::CreateForWebContentsIfNeeded(
web_contents);
#endif
ChromeSecurityStateTabHelper::CreateForWebContents(web_contents);
ChromeTranslateClient::CreateForWebContents(web_contents);
client_hints::ClientHintsWebContentsObserver::CreateForWebContents(
web_contents);
@@ -399,17 +397,25 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
ConnectionHelpTabHelper::CreateForWebContents(web_contents);
CoreTabHelper::CreateForWebContents(web_contents);
DIPSWebContentsObserver::MaybeCreateForWebContents(web_contents);
#if BUILDFLAG(ENABLE_REPORTING)
if (base::FeatureList::IsEnabled(
net::features::kReportingApiEnableEnterpriseCookieIssues)) {
tpcd::enterprise_reporting::EnterpriseReportingTabHelper::
CreateForWebContents(web_contents);
}
#endif
ExternalProtocolObserver::CreateForWebContents(web_contents);
favicon::CreateContentFaviconDriverForWebContents(web_contents);
FileSystemAccessPermissionRequestManager::CreateForWebContents(web_contents);
FileSystemAccessTabHelper::CreateForWebContents(web_contents);
FindBarState::ConfigureWebContents(web_contents);
if (base::FeatureList::IsEnabled(fingerprinting_protection_filter::features::
kEnableFingerprintingProtectionFilter)) {
if (fingerprinting_protection_filter::features::
IsFingerprintingProtectionFeatureEnabled()) {
// TODO(https://crbug.com/40280666): Move this to TabFeatures.
CreateFingerprintingProtectionWebContentsHelper(
web_contents, profile->GetPrefs(),
TrackingProtectionSettingsFactory::GetForProfile(profile));
TrackingProtectionSettingsFactory::GetForProfile(profile),
profile->IsIncognitoProfile());
}
download::DownloadNavigationObserver::CreateForWebContents(
web_contents,
@@ -529,7 +535,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
profile, web_contents);
SafetyTipWebContentsObserver::CreateForWebContents(web_contents);
SearchEngineTabHelper::CreateForWebContents(web_contents);
SecurityStateTabHelper::CreateForWebContents(web_contents);
if (site_engagement::SiteEngagementService::IsEnabled()) {
site_engagement::SiteEngagementService::Helper::CreateForWebContents(
web_contents,
@@ -627,10 +632,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
FormInteractionTabHelper::CreateForWebContents(web_contents);
FramebustBlockTabHelper::CreateForWebContents(web_contents);
IntentPickerTabHelper::CreateForWebContents(web_contents);
#if BUILDFLAG(ENTERPRISE_WATERMARK)
enterprise_data_protection::DataProtectionNavigationController::
MaybeCreateForWebContents(web_contents);
#endif
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
web_contents,
std::make_unique<JavaScriptTabModalDialogManagerDelegateDesktop>(
@@ -647,11 +648,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
SadTabHelper::CreateForWebContents(web_contents);
SearchTabHelper::CreateForWebContents(web_contents);
TabDialogs::CreateForWebContents(web_contents);
if (privacy_sandbox::TrackingProtectionNoticeService::TabHelper::
IsHelperNeeded(profile)) {
privacy_sandbox::TrackingProtectionNoticeService::TabHelper::
CreateForWebContents(web_contents);
}
MemorySaverChipTabHelper::CreateForWebContents(web_contents);
TabResourceUsageTabHelper::CreateForWebContents(web_contents);
if (base::FeatureList::IsEnabled(features::kTabHoverCardImages) ||
@@ -673,9 +669,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
if (companion::IsCompanionFeatureEnabled()) {
companion::CompanionTabHelper::CreateForWebContents(web_contents);
}
if (features::IsReadAnythingLocalSidePanelEnabled()) {
ReadAnythingTabHelper::CreateForWebContents(web_contents);
}
if (base::FeatureList::IsEnabled(
companion::features::internal::
kCompanionEnabledByObservingExpsNavigations)) {
@@ -743,16 +736,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
HatsHelper::CreateForWebContents(web_contents);
}
SharedHighlightingPromo::CreateForWebContents(web_contents);
if (!profile->IsIncognitoProfile()) {
// TODO(crbug.com/40863325): Consider using the in-memory cache instead.
commerce::CommerceUiTabHelper::CreateForWebContents(
web_contents,
commerce::ShoppingServiceFactory::GetForBrowserContext(profile),
BookmarkModelFactory::GetForBrowserContext(profile),
ImageFetcherServiceFactory::GetForKey(profile->GetProfileKey())
->GetImageFetcher(image_fetcher::ImageFetcherConfig::kNetworkOnly));
}
#endif
#if BUILDFLAG(IS_WIN)
@@ -783,12 +766,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
extensions::TabHelper::CreateForWebContents(web_contents);
extensions::NavigationExtensionEnabler::CreateForWebContents(web_contents);
if (base::FeatureList::IsEnabled(
extensions_features::kExtensionSidePanelIntegration)) {
extensions::side_panel_util::CreateSidePanelManagerForWebContents(
profile, web_contents);
}
extensions::WebNavigationTabObserver::CreateForWebContents(web_contents);
if (web_app::AreWebAppsEnabled(profile)) {
web_app::WebAppTabHelper::CreateForWebContents(web_contents);
@@ -692,6 +692,14 @@ namespace autotestPrivate {
callback StopFrameCountingCallback = void (FrameCountingPerSinkData[] data);
dictionary OverdrawData {
// Average overdraw as percentage of the display size grouped by
// `bucketSizeInSeconds` arg of `startOverdrawTracking` call.
double[] averageOverdraws;
};
callback StopOverdrawTrackingCallback = void (OverdrawData data);
// Result of calling setWindowBounds, which returns the actual bounds and
// display the window was set to. This may be different than the requested
// bounds and display, for example if the window is showing an ARC app and
@@ -718,8 +726,10 @@ namespace autotestPrivate {
long jankCount;
// Display throughput percentage at fixed intervals.
long[] throughput;
// The timestamps of the janks during this animation in milllisecond.
long[] jankTimestamps;
// The durations of the janks during this animation in millisecond.
double[] jankDurations;
long[] jankDurations;
};
// Callback invoked to report the smoothness after StopSmoothnessTracking is
@@ -1626,6 +1636,23 @@ namespace autotestPrivate {
static void stopFrameCounting(
StopFrameCountingCallback callback);
// Starts overdraw tracking for the display associated with
// `displayId` in viz. `bucketSizeInSeconds` decides the bucket size
// of the overdraw records.
// If it is X seconds, each record is the average overdraw of the
// frames presented on the display in X seconds.
static void startOverdrawTracking(
long bucketSizeInSeconds,
optional DOMString displayId,
VoidCallback callback
);
// Ends overdraw tracking in viz and return the collected data.
static void stopOverdrawTracking(
optional DOMString displayId,
StopOverdrawTrackingCallback callback
);
// Install a bruschetta VM.
static void installBruschetta(
DOMString vm_name, VoidCallback callback);
@@ -19,6 +19,7 @@
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/process/current_process.h"
#include "base/profiler/process_type.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -42,6 +43,7 @@
#include "chrome/common/secure_origin_allowlist.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/common/webui_util.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/renderer_resources.h"
@@ -86,7 +88,6 @@
#include "components/dom_distiller/core/url_constants.h"
#include "components/error_page/common/error.h"
#include "components/error_page/common/localized_error.h"
#include "components/feed/buildflags.h"
#include "components/feed/feed_feature_list.h"
#include "components/grit/components_scaled_resources.h"
#include "components/heap_profiling/in_process/heap_profiler_controller.h"
@@ -122,6 +123,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/page_visibility_state.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/webplugininfo.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_visitor.h"
@@ -141,6 +143,7 @@
#include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-shared.h"
#include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h"
#include "third_party/blink/public/platform/platform.h"
@@ -177,6 +180,8 @@
#include "chrome/renderer/wallet/boarding_pass_extractor.h"
#include "components/facilitated_payments/content/renderer/facilitated_payments_agent.h"
#include "components/facilitated_payments/core/features/features.h"
#include "components/feed/content/renderer/rss_link_reader.h"
#include "components/feed/feed_feature_list.h"
#else
#include "chrome/renderer/searchbox/searchbox.h"
#include "chrome/renderer/searchbox/searchbox_extension.h"
@@ -191,11 +196,6 @@
#include "chrome/renderer/render_frame_font_family_accessor.h"
#endif
#if BUILDFLAG(ENABLE_FEED_V2)
#include "components/feed/content/renderer/rss_link_reader.h"
#include "components/feed/feed_feature_list.h"
#endif
#if BUILDFLAG(ENABLE_NACL)
#include "components/nacl/common/nacl_constants.h"
#include "components/nacl/renderer/nacl_helper.h"
@@ -385,8 +385,7 @@ ChromeContentRendererClient::ChromeContentRendererClient()
) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
EnsureExtensionsClientInitialized();
extensions::ExtensionsRendererClient::Set(
ChromeExtensionsRendererClient::GetInstance());
ChromeExtensionsRendererClient::Create();
#endif
#if BUILDFLAG(ENABLE_PLUGINS)
for (const char* origin : kPredefinedAllowedCameraDeviceOrigins)
@@ -435,16 +434,16 @@ void ChromeContentRendererClient::RenderThreadStarted() {
web_cache_impl_ = std::make_unique<web_cache::WebCacheImpl>();
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient* chrome_extensions_renderer_client =
ChromeExtensionsRendererClient::GetInstance();
chrome_extensions_renderer_client->AddAPIProvider(
auto* extensions_renderer_client =
extensions::ExtensionsRendererClient::Get();
extensions_renderer_client->AddAPIProvider(
std::make_unique<extensions::CoreExtensionsRendererAPIProvider>());
chrome_extensions_renderer_client->AddAPIProvider(
extensions_renderer_client->AddAPIProvider(
std::make_unique<extensions::ChromeExtensionsRendererAPIProvider>());
chrome_extensions_renderer_client->AddAPIProvider(
extensions_renderer_client->AddAPIProvider(
std::make_unique<
controlled_frame::ControlledFrameExtensionsRendererAPIProvider>());
chrome_extensions_renderer_client->RenderThreadStarted();
extensions_renderer_client->RenderThreadStarted();
WebSecurityPolicy::RegisterURLSchemeAsExtension(
WebString::FromASCII(extensions::kExtensionScheme));
WebSecurityPolicy::RegisterURLSchemeAsCodeCacheWithHashing(
@@ -594,7 +593,7 @@ void ChromeContentRendererClient::RenderFrameCreated(
std::make_unique<ChromeContentSettingsAgentDelegate>(render_frame);
#if BUILDFLAG(ENABLE_EXTENSIONS)
content_settings_delegate->SetExtensionDispatcher(
ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher());
extensions::ExtensionsRendererClient::Get()->dispatcher());
#endif
content_settings::ContentSettingsAgentImpl* content_settings =
new content_settings::ContentSettingsAgentImpl(
@@ -610,8 +609,8 @@ void ChromeContentRendererClient::RenderFrameCreated(
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()->RenderFrameCreated(
render_frame, registry);
extensions::ExtensionsRendererClient::Get()->RenderFrameCreated(render_frame,
registry);
#endif
#if BUILDFLAG(ENABLE_PPAPI)
@@ -761,7 +760,7 @@ void ChromeContentRendererClient::RenderFrameCreated(
new SpellCheckPanel(render_frame, registry, this);
#endif // BUILDFLAG(HAS_SPELLCHECK_PANEL)
#endif
#if BUILDFLAG(ENABLE_FEED_V2)
#if BUILDFLAG(IS_ANDROID)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(feed::switches::kEnableRssLinkReader) &&
render_frame->IsMainFrame()) {
@@ -797,8 +796,8 @@ void ChromeContentRendererClient::WebViewCreated(
new prerender::NoStatePrefetchClient(web_view);
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()->WebViewCreated(
web_view, outermost_origin);
extensions::ExtensionsRendererClient::Get()->WebViewCreated(web_view,
outermost_origin);
#endif
}
@@ -890,7 +889,7 @@ v8::Local<v8::Object> ChromeContentRendererClient::GetScriptableObject(
const blink::WebElement& plugin_element,
v8::Isolate* isolate) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
return ChromeExtensionsRendererClient::GetInstance()->GetScriptableObject(
return extensions::ExtensionsRendererClient::Get()->GetScriptableObject(
plugin_element, isolate);
#else
return v8::Local<v8::Object>();
@@ -903,7 +902,7 @@ bool ChromeContentRendererClient::OverrideCreatePlugin(
WebPlugin** plugin) {
std::string orig_mime_type = params.mime_type.Utf8();
#if BUILDFLAG(ENABLE_EXTENSIONS)
if (!ChromeExtensionsRendererClient::GetInstance()->OverrideCreatePlugin(
if (!extensions::ExtensionsRendererClient::Get()->OverrideCreatePlugin(
render_frame, params)) {
return false;
}
@@ -1392,15 +1391,14 @@ void ChromeContentRendererClient::PostIOThreadCreated(
base::SingleThreadTaskRunner* io_thread_task_runner) {
io_thread_task_runner->PostTask(
FROM_HERE, base::BindOnce(&ThreadProfiler::StartOnChildThread,
metrics::CallStackProfileParams::Thread::kIo));
base::ProfilerThreadType::kIo));
}
void ChromeContentRendererClient::PostCompositorThreadCreated(
base::SingleThreadTaskRunner* compositor_thread_task_runner) {
compositor_thread_task_runner->PostTask(
FROM_HERE,
base::BindOnce(&ThreadProfiler::StartOnChildThread,
metrics::CallStackProfileParams::Thread::kCompositor));
FROM_HERE, base::BindOnce(&ThreadProfiler::StartOnChildThread,
base::ProfilerThreadType::kCompositor));
// Enable stack sampling for tracing.
// We pass in CreateCoreUnwindersFactory here since it lives in the chrome/
// layer while TracingSamplerProfiler is outside of chrome/.
@@ -1423,7 +1421,7 @@ bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() {
bool ChromeContentRendererClient::AllowPopup() {
#if BUILDFLAG(ENABLE_EXTENSIONS)
return ChromeExtensionsRendererClient::GetInstance()->AllowPopup();
return extensions::ExtensionsRendererClient::Get()->AllowPopup();
#else
return false;
#endif
@@ -1446,7 +1444,7 @@ ChromeContentRendererClient::GetProtocolHandlerSecurityLevel(
return blink::ProtocolHandlerSecurityLevel::kSameOrigin;
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
return ChromeExtensionsRendererClient::GetInstance()
return extensions::ExtensionsRendererClient::Get()
->GetProtocolHandlerSecurityLevel();
#else
return blink::ProtocolHandlerSecurityLevel::kStrict;
@@ -1464,7 +1462,7 @@ void ChromeContentRendererClient::WillSendRequest(
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Check whether the request should be allowed. If not allowed, we reset the
// URL to something invalid to prevent the request and cause an error.
ChromeExtensionsRendererClient::GetInstance()->WillSendRequest(
extensions::ExtensionsRendererClient::Get()->WillSendRequest(
frame, transition_type, upstream_url, target_url, site_for_cookies,
initiator_origin, new_url);
if (!new_url->is_empty())
@@ -1603,6 +1601,14 @@ ChromeContentRendererClient::CreateWebSocketHandshakeThrottleProvider() {
browser_interface_broker_.get());
}
bool ChromeContentRendererClient::ShouldUseCodeCacheWithHashing(
const blink::WebURL& request_url) const {
if (content::HasWebUIScheme(request_url)) {
return chrome::ShouldUseCodeCacheForWebUIUrl(GURL(request_url));
}
return true;
}
std::unique_ptr<media::KeySystemSupportRegistration>
ChromeContentRendererClient::GetSupportedKeySystems(
content::RenderFrame* render_frame,
@@ -1657,7 +1663,7 @@ bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI(
void ChromeContentRendererClient::RunScriptsAtDocumentStart(
content::RenderFrame* render_frame) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentStart(
extensions::ExtensionsRendererClient::Get()->RunScriptsAtDocumentStart(
render_frame);
// |render_frame| might be dead by now.
#endif
@@ -1666,7 +1672,7 @@ void ChromeContentRendererClient::RunScriptsAtDocumentStart(
void ChromeContentRendererClient::RunScriptsAtDocumentEnd(
content::RenderFrame* render_frame) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentEnd(
extensions::ExtensionsRendererClient::Get()->RunScriptsAtDocumentEnd(
render_frame);
// |render_frame| might be dead by now.
#endif
@@ -1675,7 +1681,7 @@ void ChromeContentRendererClient::RunScriptsAtDocumentEnd(
void ChromeContentRendererClient::RunScriptsAtDocumentIdle(
content::RenderFrame* render_frame) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()->RunScriptsAtDocumentIdle(
extensions::ExtensionsRendererClient::Get()->RunScriptsAtDocumentIdle(
render_frame);
// |render_frame| might be dead by now.
#endif
@@ -1723,8 +1729,7 @@ bool ChromeContentRendererClient::AllowScriptExtensionForServiceWorker(
void ChromeContentRendererClient::
WillInitializeServiceWorkerContextOnWorkerThread() {
// This is called on the service worker thread.
ThreadProfiler::StartOnChildThread(
metrics::CallStackProfileParams::Thread::kServiceWorker);
ThreadProfiler::StartOnChildThread(base::ProfilerThreadType::kServiceWorker);
}
void ChromeContentRendererClient::
@@ -1733,8 +1738,8 @@ void ChromeContentRendererClient::
const GURL& service_worker_scope,
const GURL& script_url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()
->extension_dispatcher()
extensions::ExtensionsRendererClient::Get()
->dispatcher()
->DidInitializeServiceWorkerContextOnWorkerThread(
context_proxy, service_worker_scope, script_url);
#endif
@@ -1745,13 +1750,14 @@ void ChromeContentRendererClient::WillEvaluateServiceWorkerOnWorkerThread(
v8::Local<v8::Context> v8_context,
int64_t service_worker_version_id,
const GURL& service_worker_scope,
const GURL& script_url) {
const GURL& script_url,
const blink::ServiceWorkerToken& service_worker_token) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()
->extension_dispatcher()
extensions::ExtensionsRendererClient::Get()
->dispatcher()
->WillEvaluateServiceWorkerOnWorkerThread(
context_proxy, v8_context, service_worker_version_id,
service_worker_scope, script_url);
service_worker_scope, script_url, service_worker_token);
#endif
}
@@ -1760,8 +1766,8 @@ void ChromeContentRendererClient::DidStartServiceWorkerContextOnWorkerThread(
const GURL& service_worker_scope,
const GURL& script_url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()
->extension_dispatcher()
extensions::ExtensionsRendererClient::Get()
->dispatcher()
->DidStartServiceWorkerContextOnWorkerThread(
service_worker_version_id, service_worker_scope, script_url);
#endif
@@ -1773,8 +1779,8 @@ void ChromeContentRendererClient::WillDestroyServiceWorkerContextOnWorkerThread(
const GURL& service_worker_scope,
const GURL& script_url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
ChromeExtensionsRendererClient::GetInstance()
->extension_dispatcher()
extensions::ExtensionsRendererClient::Get()
->dispatcher()
->WillDestroyServiceWorkerContextOnWorkerThread(
context, service_worker_version_id, service_worker_scope, script_url);
#endif
@@ -1806,7 +1812,8 @@ blink::WebFrame* ChromeContentRendererClient::FindFrame(
blink::WebLocalFrame* relative_to_frame,
const std::string& name) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
return ChromeExtensionsRendererClient::FindFrame(relative_to_frame, name);
return extensions::ExtensionsRendererClient::FindFrame(relative_to_frame,
name);
#else
return nullptr;
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
@@ -16,7 +16,7 @@
#include <utility>
#include <vector>
#include "base/allocator/partition_allocator/src/partition_alloc/buildflags.h"
#include "base/base_switches.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
@@ -42,6 +42,7 @@
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/to_string.h"
#include "base/system/sys_info.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
@@ -111,6 +112,7 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/renderer_host/spare_render_process_host_manager.h"
#include "content/browser/renderer_host/text_input_manager.h"
#include "content/browser/renderer_host/visible_time_request_trigger.h"
#include "content/browser/screen_details/screen_change_monitor.h"
@@ -164,6 +166,7 @@
#include "net/base/url_util.h"
#include "net/http/http_util.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "partition_alloc/buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/device/public/mojom/wake_lock.mojom.h"
#include "services/network/public/cpp/request_destination.h"
@@ -267,6 +270,19 @@ enum class PrimaryPointerType {
kMaxValue = kFine
};
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(CrashRepHandlingOutcome)
enum class CrashRepHandlingOutcome {
// Dialog wasn't suppressed and the crash report will be potentially queued.
kPotentiallyQueued = 0,
// Dialog was suppressed so the crash report was dropped.
kDropped = 1,
kMaxValue = kDropped,
};
// LINT.ThenChange(//tools/metrics/histograms/enums.xml:CrashRepHandlingOutcome)
// The window which we dobounce load info updates in.
constexpr auto kUpdateLoadStatesInterval = base::Milliseconds(250);
@@ -518,10 +534,6 @@ bool IsWindowManagementGranted(RenderFrameHost* host) {
// Returns true if `host` has the Automatic Fullscreen permission granted.
bool IsAutomaticFullscreenGranted(RenderFrameHost* host) {
if (!base::FeatureList::IsEnabled(
blink::features::kAutomaticFullscreenPermissionsQuery)) {
return false;
}
content::PermissionController* permission_controller =
host->GetBrowserContext()->GetPermissionController();
CHECK(permission_controller);
@@ -792,22 +804,14 @@ WebContentsImpl* WebContentsImpl::FromRenderWidgetHostImpl(
return static_cast<WebContentsImpl*>(rwh->delegate());
}
std::optional<double> WebContentsImpl::AdjustedChildZoom(
const RenderWidgetHostViewChildFrame* render_widget) {
// <webview> permits zoom level to be set programmatically by script:
// https://developer.chrome.com/docs/apps/reference/webviewTag#method-setZoom
if (IsGuest() && GetRenderWidgetHostView() == render_widget) {
return GetPendingPageZoomLevel();
}
// Signals zoom level should be inherited from the parent
return std::nullopt;
}
bool WebContentsImpl::IsPopup() const {
return is_popup_;
}
RenderFrameHostImpl* WebContentsImpl::PartitionedPopinOpener() const {
return partitioned_popin_opener_.get();
}
void WebContents::SetScreenOrientationDelegate(
ScreenOrientationDelegate* delegate) {
ScreenOrientationProvider::SetDelegate(delegate);
@@ -1189,7 +1193,8 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
notify_disconnection_(false),
dialog_manager_(nullptr),
is_showing_before_unload_dialog_(false),
last_active_time_(base::TimeTicks::Now()),
last_active_time_ticks_(base::TimeTicks::Now()),
last_active_time_(base::Time::Now()),
closed_by_user_gesture_(false),
minimum_zoom_percent_(
static_cast<int>(blink::kMinimumBrowserZoomFactor * 100)),
@@ -1895,14 +1900,6 @@ WebContentsView* WebContentsImpl::GetView() const {
void WebContentsImpl::OnScreensChange(bool is_multi_screen_changed) {
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::OnScreensChange",
"is_multi_screen_changed", is_multi_screen_changed);
// Allow fullscreen requests shortly after user-generated screens changes.
// TODO(crbug.com/40165350): Mac should not activate this on local process
// display::Screen signals, but via RenderWidgetHostViewMac screen updates.
if (base::FeatureList::IsEnabled(
blink::features::kWindowPlacementFullscreenOnScreensChange)) {
transient_allow_fullscreen_.Activate();
}
// Mac display info may originate from a remote process hosting the NSWindow;
// this local process display::Screen signal should not trigger updates.
// TODO(crbug.com/40165350): Unify screen info plumbing, caching, etc.
@@ -2742,7 +2739,11 @@ void WebContentsImpl::OnAudioStateChanged() {
is_currently_audible_);
}
base::TimeTicks WebContentsImpl::GetLastActiveTime() {
base::TimeTicks WebContentsImpl::GetLastActiveTimeTicks() {
return last_active_time_ticks_;
}
base::Time WebContentsImpl::GetLastActiveTime() {
return last_active_time_;
}
@@ -2780,6 +2781,14 @@ WebContents::ScopedIgnoreInputEvents WebContentsImpl::IgnoreInputEvents(
} while (web_input_event_audit_callbacks_.contains(callback_id));
web_input_event_audit_callbacks_[callback_id] = std::move(*audit_callback);
} else {
#if BUILDFLAG(IS_ANDROID)
CHECK(ignore_input_events_count_ != 0 ||
!GetPrimaryMainFrame()
->GetRenderWidgetHost()
->GetRenderInputRouter()
->IsAnyScrollGestureInProgress())
<< "Input suppression started mid gesture";
#endif
++ignore_input_events_count_;
}
@@ -2794,17 +2803,23 @@ WebContents::ScopedIgnoreInputEvents WebContentsImpl::IgnoreInputEvents(
CHECK(wc->web_input_event_audit_callbacks_.contains(*callback_id));
wc->web_input_event_audit_callbacks_.erase(*callback_id);
} else {
--wc->ignore_input_events_count_;
#if BUILDFLAG(IS_ANDROID)
// Reset gesture detection so that we don't continue to generate new
// gestures from suppressed touches. These suppressed gestures would
// otherwise confuse the event stream validator when input is
// re-enabled.
if (wc->ignore_input_events_count_ == 0) {
//
// This needs to be done while input is still suppressed since
// resetting can generate gesture end events for a gesture sequence
// which was being suppressed.
if (wc->ignore_input_events_count_ == 1) {
if (auto* view = wc->GetRenderWidgetHostView()) {
static_cast<RenderWidgetHostViewBase*>(view)
->ResetGestureDetection();
}
}
#endif
--wc->ignore_input_events_count_;
}
}
},
@@ -3587,9 +3602,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
// it should be hidden.
visibility_ =
params.initially_hidden ? Visibility::HIDDEN : Visibility::VISIBLE;
GetController().SetActive(visibility_ == Visibility::VISIBLE);
enable_wake_locks_ = params.enable_wake_locks;
if (!params.last_active_time_ticks.is_null()) {
last_active_time_ticks_ = params.last_active_time_ticks;
}
if (!params.last_active_time.is_null()) {
last_active_time_ = params.last_active_time;
}
@@ -4023,7 +4042,8 @@ bool WebContentsImpl::CanEnterFullscreenMode(
// the screen, or that it was downstream from a WebContents when UI was
// blocked. Therefore, disqualify it from fullscreen if it or any upstream
// WebContents has an active blocker.
return base::ranges::all_of(GetAllOpeningWebContents(this),
return delegate_ &&
base::ranges::all_of(GetAllOpeningWebContents(this),
[](auto* opener) {
return opener->fullscreen_blocker_count_ == 0;
}) &&
@@ -4301,7 +4321,10 @@ void WebContentsImpl::UpdateVisibilityAndNotifyPageAndView(
render_view_host->SetFrameTreeVisibility(page_visibility);
},
page_visibility);
if (page_visibility != PageVisibilityState::kHidden) {
if (page_visibility == PageVisibilityState::kHidden) {
GetController().SetActive(false);
} else {
// We cannot show a page or capture video unless there is a valid renderer
// associated with this web contents. The navigation controller for this
// page must be set to active (allowing navigation to complete, a renderer
@@ -4347,7 +4370,8 @@ void WebContentsImpl::UpdateVisibilityAndNotifyPageAndView(
// the CrossProcessFrameConnector.
if (new_visibility == Visibility::VISIBLE) {
if (is_activity) {
last_active_time_ = base::TimeTicks::Now();
last_active_time_ticks_ = base::TimeTicks::Now();
last_active_time_ = base::Time::Now();
}
SetVisibilityAndNotifyObservers(new_visibility);
}
@@ -4640,6 +4664,9 @@ FrameTree* WebContentsImpl::CreateNewWindow(
}
web_contents_impl->is_popup_ =
params.disposition == WindowOpenDisposition::NEW_POPUP;
if (params.features->is_partitioned_popin && web_contents_impl->is_popup_) {
web_contents_impl->partitioned_popin_opener_ = opener->GetWeakPtr();
}
return &web_contents_impl->GetPrimaryFrameTree();
}
@@ -4725,6 +4752,9 @@ FrameTree* WebContentsImpl::CreateNewWindow(
auto* new_contents_impl = new_contents.get();
new_contents_impl->is_popup_ =
params.disposition == WindowOpenDisposition::NEW_POPUP;
if (params.features->is_partitioned_popin && new_contents_impl->is_popup_) {
new_contents_impl->partitioned_popin_opener_ = opener->GetWeakPtr();
}
// If the new frame has a name, make sure any SiteInstances that can find
// this named frame have proxies for it. Must be called after
@@ -6021,6 +6051,16 @@ void WebContentsImpl::SaveFrameWithHeaders(
params->set_download_source(download::DownloadSource::WEB_CONTENTS_API);
params->set_isolation_info(rfhi.ComputeIsolationInfoForNavigation(url));
FrameTreeNode* frame_tree_node = rfhi.frame_tree_node();
FrameNavigationEntry* frame_navigation_entry =
frame_tree_node->frame_tree()
.controller()
.GetLastCommittedEntry()
->GetFrameEntry(frame_tree_node);
if (frame_navigation_entry) {
params->set_initiator(frame_navigation_entry->initiator_origin());
}
GetBrowserContext()->GetDownloadManager()->DownloadUrl(std::move(params));
}
@@ -6219,9 +6259,10 @@ bool WebContentsImpl::GotResponseToKeyboardLockRequest(bool allowed) {
if (!keyboard_lock_widget_) {
return false;
}
// Exits early here if GotResponseToKeyboardLockRequest() was called from
// the dtor for `this`.
if (WebContentsImpl::FromRenderWidgetHostImpl(keyboard_lock_widget_) !=
this) {
NOTREACHED_IN_MIGRATION();
return false;
}
// KeyboardLock is only supported when called by the top-level browsing
@@ -6272,6 +6313,42 @@ void WebContentsImpl::DidEndColorChooser() {
}
#endif
int WebContentsImpl::DownloadImageFromAxNode(const ui::AXTreeID tree_id,
const ui::AXNodeID node_id,
const gfx::Size& preferred_size,
uint32_t max_bitmap_size,
bool bypass_cache,
ImageDownloadCallback callback) {
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::DownloadImage",
"tree_id,node_id",
tree_id.ToString() + "," + base::ToString(node_id));
DCHECK_CURRENTLY_ON(BrowserThread::UI);
const int download_id = GetNextDownloadId();
// Always use the main frame when downloading via A11y ids.
RenderFrameHostImpl* main_frame = GetPrimaryMainFrame();
if (!main_frame->IsRenderFrameLive()) {
// If the renderer process is dead (i.e. crash, or memory pressure on
// Android), the downloader service will be invalid. Pre-Mojo, this would
// hang the callback indefinitely since the IPC would be dropped. Now,
// respond with a 400 HTTP error code to indicate that something went wrong.
// Additionally for A11y requests, send an empty URL back since it won't be
// used anyways.
GetUIThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(&WebContentsImpl::OnDidDownloadImage,
weak_factory_.GetWeakPtr(), main_frame->GetWeakPtr(),
std::move(callback), download_id, GURL(), 400,
std::vector<SkBitmap>(), std::vector<gfx::Size>()));
return download_id;
}
CHECK_EQ(main_frame->GetAXTreeID(), tree_id);
main_frame->GetMojoImageDownloader()->DownloadImageFromAxNode(
node_id, preferred_size, max_bitmap_size, bypass_cache,
base::BindOnce(&WebContentsImpl::OnDidDownloadImage,
weak_factory_.GetWeakPtr(), main_frame->GetWeakPtr(),
std::move(callback), download_id, GURL()));
return download_id;
}
int WebContentsImpl::DownloadImage(
const GURL& url,
bool is_favicon,
@@ -6296,8 +6373,7 @@ int WebContentsImpl::DownloadImageInFrame(
WebContents::ImageDownloadCallback callback) {
OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::DownloadImageInFrame");
DCHECK_CURRENTLY_ON(BrowserThread::UI);
static int next_image_download_id = 0;
const int download_id = ++next_image_download_id;
const int download_id = GetNextDownloadId();
RenderFrameHostImpl* initiator_frame =
initiator_frame_routing_id.child_id
@@ -7615,6 +7691,14 @@ void WebContentsImpl::OnFirstVisuallyNonEmptyPaint(PageImpl& page) {
observers_.NotifyObservers(&WebContentsObserver::OnBackgroundColorChanged);
last_sent_background_color_ = page.background_color();
}
#if BUILDFLAG(IS_ANDROID)
if (base::FeatureList::IsEnabled(
features::kAndroidWarmUpSpareRendererWithTimeout) &&
features::kAndroidSpareRendererCreationTiming.Get() ==
features::kAndroidSpareRendererCreationAfterFirstPaint) {
WarmUpAndroidSpareRenderer();
}
#endif
}
bool WebContentsImpl::IsGuest() {
@@ -8593,6 +8677,15 @@ void WebContentsImpl::DidStopLoading() {
manager->DidStopLoading();
}
});
#if BUILDFLAG(IS_ANDROID)
if (base::FeatureList::IsEnabled(
features::kAndroidWarmUpSpareRendererWithTimeout) &&
features::kAndroidSpareRendererCreationTiming.Get() ==
features::kAndroidSpareRendererCreationAfterLoading) {
WarmUpAndroidSpareRenderer();
}
#endif
}
void WebContentsImpl::DidChangeLoadProgressForPrimaryMainFrame() {
@@ -9259,6 +9352,14 @@ void WebContentsImpl::RendererUnresponsive(
return;
}
CrashRepHandlingOutcome outcome =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNoErrorDialogs)
? CrashRepHandlingOutcome::kDropped
: CrashRepHandlingOutcome::kPotentiallyQueued;
base::UmaHistogramEnumeration(
"ReportingAndNEL.UnresponsiveRenderer.CrashReportOutcome", outcome);
if (base::FeatureList::IsEnabled(features::kCrashReporting) &&
base::FeatureList::IsEnabled(
blink::features::kDocumentPolicyIncludeJSCallStacksInCrashReports) &&
@@ -9567,6 +9668,11 @@ void WebContentsImpl::OnDidDownloadImage(
original_image_sizes);
}
int WebContentsImpl::GetNextDownloadId() {
static int next_image_download_id = 0;
return ++next_image_download_id;
}
void WebContentsImpl::OnDialogClosed(int render_process_id,
int render_frame_id,
JavaScriptDialogCallback response_callback,
@@ -10354,15 +10460,8 @@ bool WebContentsImpl::IsTransientActivationRequiredForHtmlFullscreen() {
return false;
}
RenderFrameHostImpl* host = GetPrimaryMainFrame();
if (base::FeatureList::IsEnabled(
blink::features::kWindowPlacementFullscreenOnScreensChange) &&
IsWindowManagementGranted(host) &&
transient_allow_fullscreen_.IsActive()) {
return false;
}
// Require transient activation shortly after a same-origin WebContents exit.
RenderFrameHostImpl* host = GetPrimaryMainFrame();
auto* last_exits = GetFullscreenUserData(GetBrowserContext())->last_exits();
auto last_exit = last_exits->find(host->GetLastCommittedOrigin());
constexpr base::TimeDelta kCooldown = base::Seconds(5);
@@ -10376,9 +10475,7 @@ bool WebContentsImpl::IsTransientActivationRequiredForHtmlFullscreen() {
return false;
}
return GetContentClient()
->browser()
->IsTransientActivationRequiredForHtmlFullscreen(host);
return true;
}
bool WebContentsImpl::IsBackForwardCacheSupported() {
@@ -10948,7 +11045,9 @@ std::unique_ptr<PrerenderHandle> WebContentsImpl::StartPrerendering(
bool should_warm_up_compositor,
PreloadingHoldbackStatus holdback_status_override,
PreloadingAttempt* preloading_attempt,
base::RepeatingCallback<bool(const GURL&)> url_match_predicate,
base::RepeatingCallback<bool(const GURL&,
const std::optional<UrlMatchType>&)>
url_match_predicate,
base::RepeatingCallback<void(NavigationHandle&)>
prerender_navigation_handle_callback) {
PrerenderAttributes attributes(
@@ -11143,4 +11242,17 @@ void WebContentsImpl::GetMediaCaptureRawDeviceIdsOpened(
base::BindPostTaskToCurrentDefault(std::move(callback)));
}
void WebContentsImpl::WarmUpAndroidSpareRenderer() {
int renderer_timeout_seconds =
features::kAndroidSpareRendererTimeoutSeconds.Get();
if (renderer_timeout_seconds < 0) {
SpareRenderProcessHostManager::GetInstance().WarmupSpareRenderProcessHost(
GetBrowserContext());
} else {
base::TimeDelta timeout = base::Seconds(renderer_timeout_seconds);
SpareRenderProcessHostManager::GetInstance().WarmupSpareRenderProcessHost(
GetBrowserContext(), timeout);
}
}
} // namespace content
@@ -389,7 +389,8 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
{"LegacyWindowsDWriteFontFallback",
raw_ref(features::kLegacyWindowsDWriteFontFallback)},
{"MachineLearningNeuralNetwork",
raw_ref(webnn::mojom::features::kWebMachineLearningNeuralNetwork)},
raw_ref(webnn::mojom::features::kWebMachineLearningNeuralNetwork),
kSetOnlyIfOverridden},
{"OriginIsolationHeader", raw_ref(features::kOriginIsolationHeader)},
{"ReduceAcceptLanguage",
raw_ref(network::features::kReduceAcceptLanguage)},
@@ -412,6 +413,10 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
raw_ref(features::kMediaStreamTrackTransfer)},
{"PrivateNetworkAccessPermissionPrompt",
raw_ref(network::features::kPrivateNetworkAccessPermissionPrompt),
kSetOnlyIfOverridden},
{"ExperimentalMachineLearningNeuralNetwork",
raw_ref(webnn::mojom::features::
kExperimentalWebMachineLearningNeuralNetwork),
kSetOnlyIfOverridden}};
for (const auto& mapping : runtimeFeatureNameToChromiumFeatureMapping) {
SetRuntimeFeatureFromChromiumFeature(
@@ -556,7 +556,8 @@ bool ContentBrowserClient::IsPrivacySandboxReportingDestinationAttested(
void ContentBrowserClient::OnAuctionComplete(
RenderFrameHost* render_frame_host,
InterestGroupManager::InterestGroupDataKey data_key) {}
std::optional<content::InterestGroupManager::InterestGroupDataKey>
winner_data_key) {}
network::mojom::AttributionSupport ContentBrowserClient::GetAttributionSupport(
AttributionReportingOsApiState state,
@@ -1163,6 +1164,11 @@ bool ContentBrowserClient::ShouldOverrideUrlLoading(
}
#endif
bool ContentBrowserClient::ShouldAllowSameSiteRenderFrameHostChange(
const RenderFrameHost& rfh) {
return true;
}
bool ContentBrowserClient::AllowRenderingMhtmlOverHttp(
NavigationUIData* navigation_ui_data) {
return false;
@@ -1510,6 +1516,12 @@ bool ContentBrowserClient::IsJitDisabledForSite(BrowserContext* browser_context,
return false;
}
bool ContentBrowserClient::AreV8OptimizationsDisabledForSite(
BrowserContext* browser_context,
const GURL& site_url) {
return false;
}
ukm::UkmService* ContentBrowserClient::GetUkmService() {
return nullptr;
}
@@ -1656,11 +1668,6 @@ bool ContentBrowserClient::
return true;
}
bool ContentBrowserClient::IsTransientActivationRequiredForHtmlFullscreen(
content::RenderFrameHost* render_frame_host) {
return true;
}
bool ContentBrowserClient::ShouldUseFirstPartyStorageKey(
const url::Origin& origin) {
return false;
@@ -1751,8 +1758,9 @@ bool ContentBrowserClient::ShouldSuppressAXLoadComplete(RenderFrameHost* rfh) {
void ContentBrowserClient::BindAIManager(
BrowserContext* browser_context,
std::variant<RenderFrameHost*, base::SupportsUserData*> context,
mojo::PendingReceiver<blink::mojom::AIManager> receiver) {
EchoAIManagerImpl::Create(browser_context, std::move(receiver));
EchoAIManagerImpl::Create(browser_context, context, std::move(receiver));
}
#if !BUILDFLAG(IS_ANDROID)
@@ -1766,4 +1774,9 @@ void ContentBrowserClient::QueryInstalledWebAppsByManifestId(
}
#endif // !BUILDFLAG(IS_ANDROID)
bool ContentBrowserClient::IsSaveableNavigation(
NavigationHandle* navigation_handle) {
return false;
}
} // namespace content
@@ -229,7 +229,6 @@
figcaption,
figure,
footer,
footerAsNonLandmark,
form,
genericContainer,
// --------------------------------------------------------------
@@ -244,7 +243,6 @@
gridCell,
group,
header,
headerAsNonLandmark,
heading,
iframe,
iframePresentational,
@@ -326,6 +324,8 @@
search,
searchBox,
section,
sectionFooter,
sectionHeader,
sectionWithoutName,
slider,
spinButton,
@@ -478,6 +478,7 @@
placeholder,
popoverAttribute,
prohibited,
prohibitedAndRedundant,
relatedElement,
title,
value
@@ -528,6 +528,15 @@ namespace declarativeNetRequest {
// not need to correspond to a real tab ID. Default is -1, meaning that
// the request isn't related to a tab.
long? tabId;
// The headers provided by a hypothetical response if the request does not
// get blocked or redirected before it is sent. Represented as an object
// which maps a header name to a list of string values. If not specified,
// the hypothetical response would return empty response headers, which can
// match rules which match on the non-existence of headers.
// E.g. <code>{"content-type": ["text/html; charset=utf-8",
// "multipart/form-data"]}</code>
object? responseHeaders;
};
dictionary MatchedRuleInfoDebug {
@@ -65,6 +65,14 @@ namespace networkingPrivate {
Direct, Manual, PAC, WPAD
};
enum ApnType {
Default, Attach, Tether
};
enum ApnSource {
Modem, Modb, Ui, Admin
};
// Managed property types. These types all share a common structure:
// Active: For properties that are translated from the configuration
// manager (e.g. Shill), the 'active' value currently in use by the
@@ -160,6 +168,8 @@ namespace networkingPrivate {
DOMString? Name;
DOMString? Password;
DOMString? Username;
ApnType[]? ApnTypes;
ApnSource? Source;
};
dictionary ManagedAPNProperties {
@@ -25,7 +25,7 @@
// and is generated each session. The corresponding dynamic extension URL
// is available through $(ref:runtime.getURL).
// Dynamic resources can be loaded regardless of the value. However, if
// true, resources must be can only be loaded using the dynamic URL.
// true, resources can only be loaded using the dynamic URL.
boolean? use_dynamic_url;
};
@@ -15,8 +15,6 @@
#include <utility>
#include <vector>
#include "base/allocator/partition_allocator/src/partition_alloc/page_allocator.h"
#include "base/allocator/partition_allocator/src/partition_alloc/partition_address_space.h"
#include "base/bits.h"
#include "base/check.h"
#include "base/check_op.h"
@@ -41,6 +39,8 @@
#include "build/build_config.h"
#include "gin/array_buffer.h"
#include "gin/gin_features.h"
#include "partition_alloc/page_allocator.h"
#include "partition_alloc/partition_address_space.h"
#include "tools/v8_context_snapshot/buildflags.h"
#include "v8/include/v8-initialization.h"
#include "v8/include/v8-snapshot.h"
@@ -66,7 +66,7 @@ std::optional<gin::V8SnapshotFileType> g_snapshot_file_type;
bool GenerateEntropy(unsigned char* buffer, size_t amount) {
base::RandBytes(
// SAFETY: This depends on callers providing a valid pointer/size pair.
// SAFETY: This depends on v8 providing a valid pointer/size pair.
//
// TODO(crbug.com/338574383): The signature is fixed as it's a callback
// from v8, but maybe v8 can use a span.
@@ -444,11 +444,10 @@ void SetFlags(IsolateHolder::ScriptMode mode,
SetV8Flags("--use_strict");
}
SetV8FlagsIfOverridden(features::kJavaScriptCompileHintsMagic,
"--compile-hints-magic", "--no-compile-hints-magic");
// WebAssembly features.
SetV8FlagsIfOverridden(features::kWebAssemblyDeopt, "--wasm-deopt",
"--no-wasm-deopt");
SetV8FlagsIfOverridden(features::kWebAssemblyInlining,
"--experimental-wasm-inlining",
"--no-experimental-wasm-inlining");
@@ -105,6 +105,7 @@
#include "services/network/http_server_properties_pref_delegate.h"
#include "services/network/ignore_errors_cert_verifier.h"
#include "services/network/ip_protection/ip_protection_config_cache_impl.h"
#include "services/network/ip_protection/ip_protection_config_getter_mojo_impl.h"
#include "services/network/ip_protection/ip_protection_proxy_delegate.h"
#include "services/network/ip_protection/ip_protection_token_cache_manager_impl.h"
#include "services/network/is_browser_initiated.h"
@@ -1090,6 +1091,25 @@ void NetworkContext::GetStoredTrustTokenCounts(
}
}
void NetworkContext::GetPrivateStateTokenRedemptionRecords(
GetPrivateStateTokenRedemptionRecordsCallback callback) {
// The Trust Tokens feature is disabled, return immediately with an empty
// map.
if (!trust_token_store_) {
base::flat_map<url::Origin, std::vector<mojom::ToplevelRedemptionRecordPtr>>
empty_result;
std::move(callback).Run(std::move(empty_result));
return;
}
auto get_redemption_records_from_store =
[](NetworkContext::GetPrivateStateTokenRedemptionRecordsCallback callback,
TrustTokenStore* trust_token_store) {
std::move(callback).Run(trust_token_store->GetRedemptionRecords());
};
trust_token_store_->ExecuteOrEnqueue(
base::BindOnce(get_redemption_records_from_store, std::move(callback)));
}
void NetworkContext::DeleteStoredTrustTokens(
const url::Origin& issuer,
DeleteStoredTrustTokensCallback callback) {
@@ -1385,6 +1405,15 @@ void NetworkContext::SetDocumentReportingEndpoints(
#endif // BUILDFLAG(ENABLE_REPORTING)
}
void NetworkContext::SetEnterpriseReportingEndpoints(
const base::flat_map<std::string, GURL>& endpoints) {
#if BUILDFLAG(ENABLE_REPORTING)
if (auto* reporting_service = url_request_context()->reporting_service()) {
reporting_service->SetEnterpriseReportingEndpoints(endpoints);
}
#endif // BUILDFLAG(ENABLE_REPORTING)
}
void NetworkContext::SendReportsAndRemoveSource(
const base::UnguessableToken& reporting_source) {
#if BUILDFLAG(ENABLE_REPORTING)
@@ -1869,6 +1898,23 @@ void NetworkContext::ResolveHost(
const net::NetworkAnonymizationKey& network_anonymization_key,
mojom::ResolveHostParametersPtr optional_parameters,
mojo::PendingRemote<mojom::ResolveHostClient> response_client) {
// Dns request is disallowed if network access is disabled for the nonce.
if (network_anonymization_key.GetNonce().has_value() &&
!IsNetworkForNonceAndUrlAllowed(
/*nonce=*/network_anonymization_key.GetNonce().value(),
/*url=*/host->is_host_port_pair()
? GURL(host->get_host_port_pair().ToString())
: host->get_scheme_host_port().GetURL())) {
mojo::Remote<mojom::ResolveHostClient> remote_response_client(
std::move(response_client));
remote_response_client->OnComplete(
net::ERR_NETWORK_ACCESS_REVOKED,
net::ResolveErrorInfo(net::ERR_NETWORK_ACCESS_REVOKED),
/*resolved_addresses=*/std::nullopt,
/*endpoint_results_with_metadata=*/std::nullopt);
return;
}
if (!internal_host_resolver_) {
internal_host_resolver_ = std::make_unique<HostResolver>(
url_request_context_->host_resolver(), url_request_context_->net_log());
@@ -2130,6 +2176,13 @@ void NetworkContext::PreconnectSockets(
if (num_streams == 0)
return;
// Preconnect is disallowed if network access is disabled for the nonce.
if (network_anonymization_key.GetNonce().has_value() &&
!IsNetworkForNonceAndUrlAllowed(
network_anonymization_key.GetNonce().value(), url)) {
return;
}
std::string user_agent;
if (url_request_context_->http_user_agent_settings()) {
user_agent =
@@ -2150,7 +2203,7 @@ void NetworkContext::PreconnectSockets(
case mojom::CredentialsMode::kSameOrigin:
// Not yet implemented. If you need this credentials mode please update
// this branch to set the correct request_info fields.
NOTREACHED_NORETURN() << "kSameOrigin not yet implemented";
NOTREACHED() << "kSameOrigin not yet implemented";
case mojom::CredentialsMode::kInclude:
request_info.load_flags = net::LOAD_NORMAL;
@@ -2483,10 +2536,11 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
// `params_->ip_protection_config_getter` is set (to avoid creating proxy
// delegates for network contexts that don't participate in IP Protection, or
// for any network context when the IP Protection feature is disabled).
auto* nspal = network_service_->network_service_proxy_allow_list();
auto* nspal = network_service_->masked_domain_list_manager();
if (!params_->initial_custom_proxy_config && nspal->IsEnabled()) {
auto ipp_config_cache = std::make_unique<IpProtectionConfigCacheImpl>(
std::move(params_->ip_protection_config_getter));
std::make_unique<IpProtectionConfigGetterMojoImpl>(
std::move(params_->ip_protection_config_getter)));
std::unique_ptr<IpProtectionProxyDelegate> proxy_delegate =
std::make_unique<IpProtectionProxyDelegate>(
nspal, std::move(ipp_config_cache), params_->enable_ip_protection);
@@ -2723,6 +2777,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
builder.set_persistent_reporting_and_nel_store(nullptr);
}
if (params_->enterprise_reporting_endpoints.has_value()) {
builder.set_enterprise_reporting_endpoints(
params_->enterprise_reporting_endpoints.value());
}
#endif // BUILDFLAG(ENABLE_REPORTING)
net::HttpNetworkSessionParams session_params;
File diff suppressed because it is too large Load Diff
@@ -3001,7 +3001,7 @@ enum WebFeature {
kThirdPartyAccess = 3698,
kThirdPartyActivation = 3699,
kThirdPartyAccessAndActivation = 3700,
kFullscreenAllowedByScreensChange = 3701,
kOBSOLETE_FullscreenAllowedByScreensChange = 3701,
kNewLayoutOverflowDifferentBlock = 3702,
kNewLayoutOverflowDifferentFlex = 3703,
kNewLayoutOverflowDifferentAndAlreadyScrollsBlock = 3704,
@@ -3388,8 +3388,8 @@ enum WebFeature {
kScriptWebBundle = 4074,
// The items above roughly this point are available in the M97 branch.
kRunAdAuction = 4075,
kJoinAdInterestGroup = 4076,
kOBSOLETE_kRunAdAuction = 4075,
kOBSOLETE_kJoinAdInterestGroup = 4076,
kFileSystemUrlNavigation = 4077,
kV8Navigator_AdAuctionComponents_Method = 4078,
kClientHintsUAFullVersionList = 4079,
@@ -3613,8 +3613,8 @@ enum WebFeature {
kTabSharingBarSwitchToCapturer = 4284,
kTabSharingBarSwitchToCapturee = 4285,
kAutomaticLazyAds = 4286,
kAutomaticLazyEmbeds = 4287,
kOBSOLATE_AutomaticLazyAds = 4286,
kOBSOLATE_AutomaticLazyEmbeds = 4287,
kOBSOLETE_TouchActionChangedAtPointerDown = 4288,
kDeviceOrientationPermissionRequested = 4289,
kDeviceOrientationUsedWithoutPermissionRequest = 4290,
@@ -4063,7 +4063,7 @@ enum WebFeature {
kStorageAccessAPI_requestStorageAccess_BeyondCookies_locks = 4706,
kStorageAccessAPI_requestStorageAccess_BeyondCookies_locks_Use = 4707,
kOBSOLETE_RubyElementWithDisplayBlockAndRt = 4708,
kCSSDeclarationAfterNestedRule = 4709,
kOBSOLETE_CSSDeclarationAfterNestedRule = 4709,
kThirdPartyCookieAdAccessBlockByExperiment = 4710,
// The items above roughly this point are available in the M120 branch.
@@ -4354,7 +4354,7 @@ enum WebFeature {
kV8AITextSession_PromptStreaming_Method = 4985,
kV8AI_CanCreateTextSession_Method = 4986,
kV8AI_CreateTextSession_Method = 4987,
kV8AI_DefaultTextSessionOptions_Method = 4988,
kOBSOLETE_V8AI_DefaultTextSessionOptions_Method = 4988,
kV8AITextSession_Destroy_Method = 4989,
kImportMapIntegrity = 4990,
kSelectElementAppearanceNone = 4991,
@@ -4404,7 +4404,40 @@ enum WebFeature {
kWebGPUSubgroupsFeatures = 5035,
kAudioContextOnError = 5036,
kNoVarySearchPrerender = 5037,
kV8AITextSession_Clone_Method = 5038,
kGamepadHapticActuatorType = 5039,
kSelectionDirection = 5040,
kSelectionGetComposedRanges = 5041,
kEyeDropperOpen = 5042,
kFlexNewColumnWrapIntrinsicSize = 5043,
kV8AI_TextModelInfo_Method = 5044,
kEventTimingSimulatedClickWithNoKeyboardInteraction = 5045,
kViewTransitionGroupNesting = 5046,
kV8LanguageDetector_Detect_Method = 5047,
kV8Translation_CanDetect_Method = 5048,
kV8Translation_CreateDetector_Method = 5049,
kV8AI_Summarizer_AttributeGetter = 5050,
kV8AISummarizer_Summarize_Method = 5051,
kV8AISummarizer_SummarizeStreaming_Method = 5052,
kV8AISummarizer_Destroy_Method = 5053,
kV8AISummarizerFactory_Capabilities_Method = 5054,
kV8AISummarizerFactory_Create_Method = 5055,
kSharedStorageWriteFromBidderGenerateBid = 5056,
kSharedStorageWriteFromBidderReportWin = 5057,
kSharedStorageWriteFromSellerScoreAd = 5058,
kSharedStorageWriteFromSellerReportResult = 5059,
kCSSInsetAreaProperty = 5060,
kStructuredCloneMethod = 5061,
kV8AI_Writer_AttributeGetter = 5062,
kV8AIWriterFactory_Create_Method = 5063,
kV8AIWriter_Write_Method = 5064,
kV8AIWriter_WriteStreaming_Method = 5065,
kV8AIWriter_Destroy_Method = 5066,
kV8AI_Rewriter_AttributeGetter = 5067,
kV8AIRewriterFactory_Create_Method = 5068,
kV8AIRewriter_Rewrite_Method = 5069,
kV8AIRewriter_RewriteStreaming_Method = 5070,
kV8AIRewriter_Destroy_Method = 5071,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. Also don't add extra
@@ -408,10 +408,6 @@ struct WebPreferences {
// policy.
bool require_transient_activation_for_show_file_or_directory_picker;
// HTML Fullscreen (e.g. `Element.requestFullscreen()`)'s transient activation
// requirement can be bypassed via the "Automatic Fullscreen" content setting.
bool require_transient_activation_for_html_fullscreen;
// `navigator.subApps.{add|remove|list}()`'s user gesture and authorization
// can be bypassed via
// `SubAppsAPIsAllowedWithoutGestureAndAuthorizationForOrigins` policy.
@@ -4,7 +4,7 @@
// https://drafts.csswg.org/css-anchor-position-1/#om-position-try
[Exposed=Window, RuntimeEnabled=CSSAnchorPositioning]
[Exposed=Window]
interface CSSPositionTryDescriptors : CSSStyleDeclaration {
[SetterCallWith=ExecutionContext, RaisesException=Setter] attribute CSSOMString margin;
[SetterCallWith=ExecutionContext, RaisesException=Setter] attribute CSSOMString marginTop;
@@ -74,6 +74,9 @@ interface CSSPositionTryDescriptors : CSSStyleDeclaration {
[SetterCallWith=ExecutionContext, RaisesException=Setter, ImplementedAs=justifySelf] attribute CSSOMString justify-self;
[SetterCallWith=ExecutionContext, RaisesException=Setter] attribute CSSOMString positionAnchor;
[SetterCallWith=ExecutionContext, RaisesException=Setter, ImplementedAs=positionAnchor] attribute CSSOMString position-anchor;
[SetterCallWith=ExecutionContext, RaisesException=Setter] attribute CSSOMString insetArea;
[SetterCallWith=ExecutionContext, RaisesException=Setter, ImplementedAs=insetArea] attribute CSSOMString inset-area;
[RuntimeEnabled=CSSPositionAreaProperty, SetterCallWith=ExecutionContext, RaisesException=Setter] attribute CSSOMString positionArea;
[RuntimeEnabled=CSSPositionAreaProperty, SetterCallWith=ExecutionContext, RaisesException=Setter, ImplementedAs=positionArea] attribute CSSOMString position-area;
// TODO(crbug.com/352360007): these can be removed when inset-area is removed.
[RuntimeEnabled=CSSInsetAreaProperty, SetterCallWith=ExecutionContext, RaisesException=Setter] attribute CSSOMString insetArea;
[RuntimeEnabled=CSSInsetAreaProperty, SetterCallWith=ExecutionContext, RaisesException=Setter, ImplementedAs=insetArea] attribute CSSOMString inset-area;
};
@@ -4,7 +4,7 @@
// https://drafts.csswg.org/css-anchor-position-1/#idl-index
[Exposed=Window, RuntimeEnabled=CSSAnchorPositioning]
[Exposed=Window]
interface CSSPositionTryRule : CSSRule {
readonly attribute CSSOMString name;
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
@@ -4,7 +4,6 @@
dictionary CSSStyleSheetInit {
(MediaList or DOMString) media = "";
DOMString title = "";
boolean alternate = false;
boolean disabled = false;
};
@@ -6,50 +6,50 @@
// which is defined in AriaRelationshipAttributes.
// https://w3c.github.io/aria/#idl-interface
interface mixin AriaAttributes {
[CEReactions, Reflect=aria_atomic] attribute DOMString? ariaAtomic;
[CEReactions, Reflect=aria_autocomplete] attribute DOMString? ariaAutoComplete;
[CEReactions, Reflect=aria_busy] attribute DOMString? ariaBusy;
[CEReactions, Reflect=aria_braillelabel] attribute DOMString? ariaBrailleLabel;
[CEReactions, Reflect=aria_brailleroledescription] attribute DOMString? ariaBrailleRoleDescription;
[CEReactions, Reflect=aria_checked] attribute DOMString? ariaChecked;
[CEReactions, Reflect=aria_colcount] attribute DOMString? ariaColCount;
[CEReactions, Reflect=aria_colindex] attribute DOMString? ariaColIndex;
[RuntimeEnabled=AriaRowColIndexText, CEReactions, Reflect=aria_colindextext] attribute DOMString? ariaColIndexText;
[CEReactions, Reflect=aria_colspan] attribute DOMString? ariaColSpan;
[CEReactions, Reflect=aria_current] attribute DOMString? ariaCurrent;
[CEReactions, Reflect=aria_description] attribute DOMString? ariaDescription;
[CEReactions, Reflect=aria_disabled] attribute DOMString? ariaDisabled;
[CEReactions, Reflect=aria_expanded] attribute DOMString? ariaExpanded;
[CEReactions, Reflect=aria_haspopup] attribute DOMString? ariaHasPopup;
[CEReactions, Reflect=aria_hidden] attribute DOMString? ariaHidden;
[CEReactions, Reflect=aria_invalid] attribute DOMString? ariaInvalid;
[CEReactions, Reflect=aria_keyshortcuts] attribute DOMString? ariaKeyShortcuts;
[CEReactions, Reflect=aria_label] attribute DOMString? ariaLabel;
[CEReactions, Reflect=aria_level] attribute DOMString? ariaLevel;
[CEReactions, Reflect=aria_live] attribute DOMString? ariaLive;
[CEReactions, Reflect=aria_modal] attribute DOMString? ariaModal;
[CEReactions, Reflect=aria_multiline] attribute DOMString? ariaMultiLine;
[CEReactions, Reflect=aria_multiselectable] attribute DOMString? ariaMultiSelectable;
[CEReactions, Reflect=aria_orientation] attribute DOMString? ariaOrientation;
[CEReactions, Reflect=aria_placeholder] attribute DOMString? ariaPlaceholder;
[CEReactions, Reflect=aria_posinset] attribute DOMString? ariaPosInSet;
[CEReactions, Reflect=aria_pressed] attribute DOMString? ariaPressed;
[CEReactions, Reflect=aria_readonly] attribute DOMString? ariaReadOnly;
[CEReactions, Reflect=aria_relevant] attribute DOMString? ariaRelevant;
[CEReactions, Reflect=aria_required] attribute DOMString? ariaRequired;
[CEReactions, Reflect=aria_roledescription] attribute DOMString? ariaRoleDescription;
[CEReactions, Reflect=aria_rowcount] attribute DOMString? ariaRowCount;
[CEReactions, Reflect=aria_rowindex] attribute DOMString? ariaRowIndex;
[RuntimeEnabled=AriaRowColIndexText, CEReactions, Reflect=aria_rowindextext] attribute DOMString? ariaRowIndexText;
[CEReactions, Reflect=aria_rowspan] attribute DOMString? ariaRowSpan;
[CEReactions, Reflect=aria_selected] attribute DOMString? ariaSelected;
[CEReactions, Reflect=aria_setsize] attribute DOMString? ariaSetSize;
[CEReactions, Reflect=aria_sort] attribute DOMString? ariaSort;
[CEReactions, Reflect=aria_valuemax] attribute DOMString? ariaValueMax;
[CEReactions, Reflect=aria_valuemin] attribute DOMString? ariaValueMin;
[CEReactions, Reflect=aria_valuenow] attribute DOMString? ariaValueNow;
[CEReactions, Reflect=aria_valuetext] attribute DOMString? ariaValueText;
[RuntimeEnabled=AccessibilityAriaVirtualContent, CEReactions, Reflect=aria_virtualcontent] attribute DOMString? ariaVirtualContent;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_atomic] attribute DOMString? ariaAtomic;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_autocomplete] attribute DOMString? ariaAutoComplete;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_busy] attribute DOMString? ariaBusy;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_braillelabel] attribute DOMString? ariaBrailleLabel;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_brailleroledescription] attribute DOMString? ariaBrailleRoleDescription;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_checked] attribute DOMString? ariaChecked;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_colcount] attribute DOMString? ariaColCount;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_colindex] attribute DOMString? ariaColIndex;
[RuntimeEnabled=AriaRowColIndexText, CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_colindextext] attribute DOMString? ariaColIndexText;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_colspan] attribute DOMString? ariaColSpan;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_current] attribute DOMString? ariaCurrent;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_description] attribute DOMString? ariaDescription;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_disabled] attribute DOMString? ariaDisabled;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_expanded] attribute DOMString? ariaExpanded;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_haspopup] attribute DOMString? ariaHasPopup;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_hidden] attribute DOMString? ariaHidden;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_invalid] attribute DOMString? ariaInvalid;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_keyshortcuts] attribute DOMString? ariaKeyShortcuts;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_label] attribute DOMString? ariaLabel;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_level] attribute DOMString? ariaLevel;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_live] attribute DOMString? ariaLive;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_modal] attribute DOMString? ariaModal;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_multiline] attribute DOMString? ariaMultiLine;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_multiselectable] attribute DOMString? ariaMultiSelectable;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_orientation] attribute DOMString? ariaOrientation;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_placeholder] attribute DOMString? ariaPlaceholder;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_posinset] attribute DOMString? ariaPosInSet;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_pressed] attribute DOMString? ariaPressed;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_readonly] attribute DOMString? ariaReadOnly;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_relevant] attribute DOMString? ariaRelevant;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_required] attribute DOMString? ariaRequired;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_roledescription] attribute DOMString? ariaRoleDescription;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_rowcount] attribute DOMString? ariaRowCount;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_rowindex] attribute DOMString? ariaRowIndex;
[RuntimeEnabled=AriaRowColIndexText, CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_rowindextext] attribute DOMString? ariaRowIndexText;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_rowspan] attribute DOMString? ariaRowSpan;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_selected] attribute DOMString? ariaSelected;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_setsize] attribute DOMString? ariaSetSize;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_sort] attribute DOMString? ariaSort;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_valuemax] attribute DOMString? ariaValueMax;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_valuemin] attribute DOMString? ariaValueMin;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_valuenow] attribute DOMString? ariaValueNow;
[CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_valuetext] attribute DOMString? ariaValueText;
[RuntimeEnabled=AccessibilityAriaVirtualContent, CEReactions, MeasureAs="WebDXFeature::kAriaAttributeReflection", Reflect=aria_virtualcontent] attribute DOMString? ariaVirtualContent;
};
Element includes AriaAttributes;
@@ -144,7 +144,7 @@ dictionary CheckVisibilityOptions {
[RuntimeEnabled=StandardizedBrowserZoom] readonly attribute double currentCSSZoom;
// Used by both Anchor Positioning and Popover
[CEReactions,RuntimeEnabled=HTMLAnchorAttribute] attribute Element? anchorElement;
[CEReactions,RuntimeEnabled=HTMLAnchorAttribute,ImplementedAs=anchorElementForBinding] attribute Element? anchorElement;
// Non-standard API
[MeasureAs=ElementScrollIntoViewIfNeeded] void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
@@ -32,5 +32,5 @@ dictionary ObservableEventListenerOptions {
void addEventListener(DOMString type, EventListener? listener, optional (AddEventListenerOptions or boolean) options);
void removeEventListener(DOMString type, EventListener? listener, optional (EventListenerOptions or boolean) options);
[ImplementedAs=dispatchEventForBindings, RaisesException, RuntimeCallStatsCounter=EventTargetDispatchEvent] boolean dispatchEvent(Event event);
[MeasureAs=EventTargetOnObservable, RuntimeEnabled=ObservableAPI] Observable on(DOMString type, optional ObservableEventListenerOptions options = {});
[MeasureAs=EventTargetOnObservable, RuntimeEnabled=ObservableAPI] Observable when(DOMString type, optional ObservableEventListenerOptions options = {});
};
@@ -56,6 +56,12 @@ interface ShadowRoot : DocumentFragment {
// cloned by DOM cloning operations.
readonly attribute boolean clonable;
// The referenceTarget attribute is the ID of an element in the shadow tree.
// When the host element is the target of an IDREF attribute like
// aria-activedescendant, the reference resolves to the referenceTarget.
// See https://crbug.com/346835896
[RuntimeEnabled=ShadowRootReferenceTarget] attribute DOMString referenceTarget;
// Scoped element creation APIs
// https://wicg.github.io/webcomponents/proposals/Scoped-Custom-Element-Registries#scoped-element-creation-apis
[
@@ -0,0 +1,7 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
dictionary GetComposedRangesOptions {
sequence<ShadowRoot> shadowRoots = [];
};
@@ -58,7 +58,8 @@
[MeasureAs=SelectionContainsNode] boolean containsNode(Node node, optional boolean allowPartialContainment = false);
[MeasureAs=SelectionDOMString] stringifier;
[RuntimeEnabled=SelectionAcrossShadowDOM] readonly attribute DOMString direction;
[MeasureAs=SelectionDirection, RuntimeEnabled=SelectionAcrossShadowDOM] readonly attribute DOMString direction;
[MeasureAs=SelectionGetComposedRanges, RuntimeEnabled=SelectionAcrossShadowDOM] sequence<StaticRange> getComposedRanges(optional GetComposedRangesOptions options = {});
// Non-standard APIs
@@ -275,6 +275,8 @@
"resourcetimingbufferfull",
"result",
"resume",
"rtcrtptransportprocessor",
"rtctransform",
"samplebufferfull",
"screenschange",
"scroll",
@@ -23,6 +23,6 @@
[Measure, RuntimeEnabled=PointerEventDeviceId] readonly attribute long persistentDeviceId;
// https://w3c.github.io/pointerevents/extension.html#extensions-to-the-pointerevent-interface
[Measure] sequence<PointerEvent> getCoalescedEvents();
[Measure, SecureContext] sequence<PointerEvent> getCoalescedEvents();
[Measure] sequence<PointerEvent> getPredictedEvents();
};
@@ -401,7 +401,7 @@ ui::mojom::blink::WindowOpenDisposition NavigationPolicyToDisposition(
case kNavigationPolicyPictureInPicture:
return ui::mojom::blink::WindowOpenDisposition::NEW_PICTURE_IN_PICTURE;
case kNavigationPolicyLinkPreview:
NOTREACHED_NORETURN();
NOTREACHED();
}
NOTREACHED_IN_MIGRATION() << "Unexpected NavigationPolicy";
return ui::mojom::blink::WindowOpenDisposition::IGNORE_ACTION;
@@ -477,6 +477,17 @@ void ForEachFrameWidgetControlledByView(
}
}
void MaybePreloadSystemFonts(Page* page) {
static bool is_first_run = true;
if (!is_first_run) {
return;
}
is_first_run = false;
page->GetAgentGroupScheduler().DefaultTaskRunner()->PostTask(
FROM_HERE, WTF::BindOnce([]() { FontCache::MaybePreloadSystemFonts(); }));
}
} // namespace
// WebView ----------------------------------------------------------------
@@ -666,11 +677,6 @@ WebViewImpl::~WebViewImpl() {
DCHECK(!page_);
}
WebDevToolsAgentImpl* WebViewImpl::MainFrameDevToolsAgentImpl() {
WebLocalFrameImpl* main_frame = MainFrameImpl();
return main_frame ? main_frame->DevToolsAgentImpl() : nullptr;
}
void WebViewImpl::SetTabKeyCyclesThroughElements(bool value) {
if (page_)
page_->SetTabKeyCyclesThroughElements(value);
@@ -1789,8 +1795,6 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
prefs.require_transient_activation_for_get_display_media);
settings->SetRequireTransientActivationForShowFileOrDirectoryPicker(
prefs.require_transient_activation_for_show_file_or_directory_picker);
settings->SetRequireTransientActivationForHtmlFullscreen(
prefs.require_transient_activation_for_html_fullscreen);
settings->SetViewportEnabled(prefs.viewport_enabled);
settings->SetViewportMetaEnabled(prefs.viewport_meta_enabled);
settings->SetViewportStyle(prefs.viewport_style);
@@ -2309,31 +2313,11 @@ double WebViewImpl::ClampZoomLevel(double zoom_level) const {
std::min(maximum_zoom_level_, zoom_level));
}
double WebViewImpl::ZoomLevelToZoomFactor(double zoom_level,
bool for_main_frame) const {
double zoom_factor = blink::ZoomLevelToZoomFactor(zoom_level);
if (for_main_frame && zoom_factor_override_) {
zoom_factor = zoom_factor_override_;
double WebViewImpl::ZoomLevelToZoomFactor(double zoom_level) const {
if (zoom_factor_override_) {
return zoom_factor_override_;
}
if (zoom_factor_for_device_scale_factor_) {
if (compositor_device_scale_factor_override_) {
zoom_factor *= compositor_device_scale_factor_override_;
} else {
zoom_factor *= zoom_factor_for_device_scale_factor_;
}
}
return zoom_factor;
}
double WebViewImpl::ZoomFactorToZoomLevel(double zoom_factor) const {
if (zoom_factor_for_device_scale_factor_) {
if (compositor_device_scale_factor_override_) {
zoom_factor /= compositor_device_scale_factor_override_;
} else {
zoom_factor /= zoom_factor_for_device_scale_factor_;
}
}
return blink::ZoomFactorToZoomLevel(zoom_factor);
return blink::ZoomLevelToZoomFactor(zoom_level);
}
void WebViewImpl::UpdateWidgetZoomFactors() {
@@ -2343,14 +2327,12 @@ void WebViewImpl::UpdateWidgetZoomFactors() {
}
void WebViewImpl::UpdateInspectorDeviceScaleFactorOverride() {
if (zoom_factor_for_device_scale_factor_) {
if (compositor_device_scale_factor_override_) {
page_->SetInspectorDeviceScaleFactorOverride(
zoom_factor_for_device_scale_factor_ /
compositor_device_scale_factor_override_);
} else {
page_->SetInspectorDeviceScaleFactorOverride(1.0f);
}
if (compositor_device_scale_factor_override_) {
page_->SetInspectorDeviceScaleFactorOverride(
zoom_factor_for_device_scale_factor_ /
compositor_device_scale_factor_override_);
} else {
page_->SetInspectorDeviceScaleFactorOverride(1.0f);
}
}
@@ -2948,6 +2930,10 @@ void WebViewImpl::UpdatePageDefinedViewportConstraints(
}
UpdateMainFrameLayoutSize();
if (RuntimeEnabledFeatures::ViewportChangesUpdateTextAutosizingEnabled()) {
TextAutosizer::UpdatePageInfoInAllFrames(GetPage()->MainFrame());
}
}
void WebViewImpl::UpdateMainFrameLayoutSize() {
@@ -3079,12 +3065,17 @@ void WebViewImpl::Show(const LocalFrameToken& opener_frame_token,
window_features->has_width = web_window_features.width_set;
window_features->has_height = web_window_features.height_set;
window_features->is_popup = web_window_features.is_popup;
window_features->is_partitioned_popin =
web_window_features.is_partitioned_popin;
local_main_frame_host_remote_->ShowCreatedWindow(
opener_frame_token, NavigationPolicyToDisposition(policy),
std::move(window_features), opened_by_user_gesture,
WTF::BindOnce(&WebViewImpl::DidShowCreatedWindow, WTF::Unretained(this)));
MainFrameDevToolsAgentImpl()->DidShowNewWindow();
if (auto* dev_tools_agent =
MainFrameImpl()->DevToolsAgentImpl(/*create_if_necessary=*/false)) {
dev_tools_agent->DidShowNewWindow();
}
}
void WebViewImpl::DidShowCreatedWindow() {
@@ -3254,10 +3245,8 @@ void WebViewImpl::SetCompositorDeviceScaleFactorOverride(
float device_scale_factor) {
if (compositor_device_scale_factor_override_ != device_scale_factor) {
compositor_device_scale_factor_override_ = device_scale_factor;
if (zoom_factor_for_device_scale_factor_) {
UpdateWidgetZoomFactors();
UpdateInspectorDeviceScaleFactorOverride();
}
UpdateWidgetZoomFactors();
UpdateInspectorDeviceScaleFactorOverride();
}
}
@@ -3555,6 +3544,8 @@ void WebViewImpl::UpdateRendererPreferences(
renderer_preferences_.prefixed_fullscreen_video_api_availability
.value());
}
MaybePreloadSystemFonts(GetPage());
}
void WebViewImpl::SetHistoryOffsetAndLength(int32_t history_offset,
@@ -4075,6 +4066,10 @@ bool WebViewImpl::SupportsDraggableRegions() {
}
void WebViewImpl::DraggableRegionsChanged() {
if (!MainFrameImpl()) {
return;
}
WebVector<WebDraggableRegion> web_regions =
MainFrameImpl()->GetDocument().DraggableRegions();
@@ -7,5 +7,5 @@
Exposed=Window,
RuntimeEnabled=TextFragmentAPI
] interface SelectorDirective : Directive {
[CallWith=ScriptState, NewObject] Promise<Range> getMatchingRange();
[CallWith=ScriptState, NewObject, RaisesException] Promise<Range> getMatchingRange();
};
@@ -976,14 +976,6 @@
initial: true,
},
// HTML Fullscreen (e.g. `Element.requestFullscreen()`)'s transient
// activation requirement can be bypassed via the "Automatic Fullscreen"
// content setting.
{
name: "requireTransientActivationForHtmlFullscreen",
initial: true,
},
//
// Dark mode
//
@@ -38,5 +38,5 @@
[RuntimeEnabled=CoepReflection]
readonly attribute DOMString crossOriginEmbedderPolicy;
[RaisesException, CallWith=ScriptState] any structuredClone(any value, optional StructuredSerializeOptions options = {});
[RaisesException, CallWith=ScriptState, MeasureAs=StructuredCloneMethod] any structuredClone(any value, optional StructuredSerializeOptions options = {});
};
@@ -37,9 +37,9 @@ interface TextMetrics {
readonly attribute double fontBoundingBoxDescent;
readonly attribute double actualBoundingBoxAscent;
readonly attribute double actualBoundingBoxDescent;
[RuntimeEnabled=TextMetricsBaselines] readonly attribute double hangingBaseline;
[RuntimeEnabled=TextMetricsBaselines] readonly attribute double alphabeticBaseline;
[RuntimeEnabled=TextMetricsBaselines] readonly attribute double ideographicBaseline;
[RuntimeEnabled=TextMetricsBaselines, MeasureAs="WebDXFeature::kCanvasTextBaselines"] readonly attribute double hangingBaseline;
[RuntimeEnabled=TextMetricsBaselines, MeasureAs="WebDXFeature::kCanvasTextBaselines"] readonly attribute double alphabeticBaseline;
[RuntimeEnabled=TextMetricsBaselines, MeasureAs="WebDXFeature::kCanvasTextBaselines"] readonly attribute double ideographicBaseline;
[RuntimeEnabled=ExtendedTextMetrics] readonly attribute double emHeightAscent;
[RuntimeEnabled=ExtendedTextMetrics] readonly attribute double emHeightDescent;
@@ -14,7 +14,5 @@ interface FencedFrameConfig {
// For more information on why this is needed please see:
// https://github.com/WICG/fenced-frame/issues/48#issuecomment-1245809738
[RuntimeEnabled=FencedFramesDefaultMode] constructor(USVString url);
readonly attribute FencedFrameConfigSize? width;
readonly attribute FencedFrameConfigSize? height;
void setSharedStorageContext(DOMString contextString);
};
@@ -46,7 +46,7 @@ enum SelectionMode { "select", "start", "end", "preserve" };
[CEReactions, Reflect] attribute DOMString formTarget;
[CEReactions] attribute unsigned long height;
attribute boolean indeterminate;
readonly attribute HTMLElement? list;
[ImplementedAs=listForBinding] readonly attribute HTMLElement? list;
[CEReactions, Reflect] attribute DOMString max;
[CEReactions, RaisesException=Setter] attribute long maxLength;
[CEReactions, Reflect] attribute DOMString min;
@@ -25,5 +25,5 @@
] interface HTMLLabelElement : HTMLElement {
readonly attribute HTMLFormElement? form;
[CEReactions, Reflect=for] attribute DOMString htmlFor;
readonly attribute HTMLElement? control;
[ImplementedAs=controlForBinding] readonly attribute HTMLElement? control;
};
@@ -60,4 +60,6 @@
// https://html.spec.whatwg.org/multipage/input.html#dom-select-showpicker
[RaisesException, RuntimeEnabled=HTMLSelectElementShowPicker] void showPicker();
[RuntimeEnabled=StylableSelect] attribute HTMLSelectedOptionElement? selectedOptionElement;
};
@@ -0,0 +1,9 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
Exposed=Window,
HTMLConstructor,
RuntimeEnabled=StylableSelect
] interface HTMLSelectedOptionElement : HTMLElement {};
@@ -60,7 +60,7 @@
[RuntimeEnabled=TopicsAPI, SecureContext, CEReactions, Reflect] attribute boolean browsingTopics;
// Protected Audience (https://wicg.github.io/turtledove)
[RuntimeEnabled=FledgeNegativeTargeting, SecureContext, CEReactions, Reflect] attribute boolean adAuctionHeaders;
[SecureContext, CEReactions, Reflect] attribute boolean adAuctionHeaders;
// Iframes credentialless
// https://github.com/WICG/anonymous-iframe
@@ -19,6 +19,6 @@ enum AncestorStatus {
ImplementedAs=DOMScheduler
] interface Scheduler {
[CallWith=ScriptState, MeasureAs=SchedulerPostTask, RaisesException] Promise<any> postTask(SchedulerPostTaskCallback callback, optional SchedulerPostTaskOptions options = {});
[RuntimeEnabled=SchedulerYield, MeasureAs=SchedulerYield, CallWith=ScriptState, RaisesException] Promise<undefined> yield(optional SchedulerYieldOptions options = {});
[RuntimeEnabled=SchedulerYield, MeasureAs=SchedulerYield, CallWith=ScriptState, RaisesException] Promise<undefined> yield();
[RuntimeEnabled=UnexposedTaskIds, CallWith=ScriptState, Exposed=Window] attribute unsigned long taskId;
};
@@ -1,20 +0,0 @@
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
enum SchedulerYieldPriority {
"user-blocking",
"user-visible",
"background",
"inherit"
};
enum SchedulerSignalInherit {
"inherit"
};
// https://github.com/WICG/scheduling-apis/blob/main/explainers/yield-and-continuation.md
dictionary SchedulerYieldOptions {
(AbortSignal or SchedulerSignalInherit) signal;
SchedulerYieldPriority priority;
};
@@ -201,9 +201,7 @@ interface Internals {
[RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags);
DOMString scrollingStateTreeAsText(Document document);
[RaisesException] DOMString mainThreadScrollingReasons(Document document);
[RaisesException] DOMRectList nonFastScrollableRects(Document document);
void evictAllResources();
@@ -35,7 +35,7 @@
// should have a default value.
[Exposed=(Window,Worker)]
interface Performance : EventTarget {
[Affects=Nothing] DOMHighResTimeStamp now();
[Affects=Nothing, NoAllocDirectCall] DOMHighResTimeStamp now();
readonly attribute DOMHighResTimeStamp timeOrigin;
// Performance Timeline
@@ -78,6 +78,5 @@ typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) XMLHt
[RaisesException=Setter] attribute XMLHttpRequestResponseType responseType;
[CallWith=ScriptState, RaisesException=Getter] readonly attribute any response;
[RaisesException=Getter] readonly attribute USVString responseText;
// TODO(foolip): responseXML should be [Exposed=Window].
[MeasureAs=XMLHttpRequestResponseXML, RaisesException=Getter] readonly attribute Document? responseXML;
[Exposed=Window, MeasureAs=XMLHttpRequestResponseXML, RaisesException=Getter] readonly attribute Document? responseXML;
};
@@ -13,6 +13,8 @@ dictionary AuctionAd {
USVString sizeGroup;
USVString buyerReportingId;
USVString buyerAndSellerReportingId;
[RuntimeEnabled=FledgeAuctionDealSupport]
sequence<USVString> selectableBuyerAndSellerReportingIds;
any metadata;
DOMString adRenderId;
sequence<USVString> allowedReportingOrigins;
@@ -90,13 +90,10 @@ dictionary AuctionAdConfig {
sequence<DOMString> requiredSellerCapabilities;
AuctionAdInterestGroupSize requestedSize;
[RuntimeEnabled=FledgeTrustedBiddingSignalsSlotSize]
sequence<AuctionAdInterestGroupSize> allSlotsRequestedSizes;
[RuntimeEnabled=FledgeNegativeTargeting]
Promise<undefined> additionalBids;
[RuntimeEnabled=FledgeNegativeTargeting]
DOMString auctionNonce;
ProtectedAudiencePrivateAggregationConfig privateAggregationConfig;
@@ -65,6 +65,8 @@ dictionary AuctionAdInterestGroup {
sequence<USVString> trustedBiddingSignalsKeys;
DOMString trustedBiddingSignalsSlotSizeMode;
long maxTrustedBiddingSignalsURLLength;
[RuntimeEnabled=FledgeTrustedSignalsKVv2Support]
USVString trustedBiddingSignalsCoordinator;
any userBiddingSignals;
sequence<AuctionAd> ads;
sequence<AuctionAd> adComponents;
@@ -22,13 +22,13 @@ typedef (USVString or FencedFrameConfig) UrnOrConfig;
[CallWith=ScriptState, Measure, RaisesException]
Promise<undefined> leaveAdInterestGroup(optional AuctionAdInterestGroupKey group);
[RuntimeEnabled=FledgeClearOriginJoinedAdInterestGroups, CallWith=ScriptState, RaisesException]
[CallWith=ScriptState, RaisesException]
Promise<undefined> clearOriginJoinedAdInterestGroups(USVString owner, optional sequence<USVString> groupsToKeep);
[CallWith=ScriptState, Measure, RaisesException]
void updateAdInterestGroups();
[RuntimeEnabled=FledgeNegativeTargeting, CallWith=ScriptState, Measure, RaisesException]
[CallWith=ScriptState, Measure, RaisesException]
Promise<DOMString> createAuctionNonce();
[RuntimeEnabled=Fledge, CallWith=ScriptState, Measure, RaisesException]
@@ -4,37 +4,37 @@
// https://github.com/explainers-by-googlers/prompt-api
enum AIModelAvailability {
enum AICapabilityAvailability {
"readily",
"after-download",
"no"
};
[
Exposed=Window,
Exposed=(Window,Worker),
RuntimeEnabled=BuiltInAIAPI
]
interface AI {
[
Measure,
CallWith=ScriptState,
RaisesException,
// TODO: Add Measure
RuntimeEnabled=AIPromptAPI
]
Promise<AIModelAvailability> canCreateTextSession();
readonly attribute AIAssistantFactory assistant;
[
Measure,
CallWith=ScriptState,
RaisesException,
RuntimeEnabled=AIPromptAPI
RuntimeEnabled=AISummarizationAPI
]
Promise<AITextSession> createTextSession(
optional AITextSessionOptions options = {}
);
readonly attribute AISummarizerFactory summarizer;
[
Measure,
CallWith=ScriptState,
RaisesException
RuntimeEnabled=AIWriterAPI
]
Promise<AITextSessionOptions> defaultTextSessionOptions();
readonly attribute AIWriterFactory writer;
[
Measure,
RuntimeEnabled=AIRewriterAPI
]
readonly attribute AIRewriterFactory rewriter;
};
@@ -0,0 +1,39 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://github.com/explainers-by-googlers/prompt-api
[
Exposed=(Window,Worker),
RuntimeEnabled=AIPromptAPI
]
interface AIAssistantCapabilities {
readonly attribute AICapabilityAvailability available;
// Always null if available === "no"
readonly attribute unsigned long? defaultTopK;
readonly attribute unsigned long? maxTopK;
readonly attribute float? defaultTemperature;
};
[
Exposed=(Window,Worker),
RuntimeEnabled=AIPromptAPI
]
interface AIAssistantFactory {
[
// TODO: Add Measure
CallWith=ScriptState,
RaisesException
]
Promise<AIAssistantCapabilities> capabilities();
[
// TODO: Add Measure
CallWith=ScriptState,
RaisesException
]
Promise<AITextSession> create(
optional AITextSessionOptions options = {}
);
};
@@ -0,0 +1,46 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Rewriter API
// https://github.com/explainers-by-googlers/writing-assistance-apis
dictionary AIRewriterRewriteOptions {
DOMString context;
AbortSignal signal;
};
[
Exposed=(Window,Worker),
RuntimeEnabled=AIRewriterAPI
]
interface AIRewriter {
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<DOMString> rewrite(
DOMString input,
optional AIRewriterRewriteOptions options = {});
[
Measure,
CallWith=ScriptState,
RaisesException
]
ReadableStream rewriteStreaming(
DOMString input,
optional AIRewriterRewriteOptions options = {});
[
Measure,
CallWith=ScriptState,
RaisesException
]
void destroy();
readonly attribute DOMString sharedContext;
readonly attribute AIRewriterTone tone;
readonly attribute AIRewriterLength length;
};
@@ -0,0 +1,30 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Rewriter API
// https://github.com/explainers-by-googlers/writing-assistance-apis
enum AIRewriterTone { "as-is", "more-formal", "more-casual" };
enum AIRewriterLength { "as-is", "shorter", "longer" };
dictionary AIRewriterCreateOptions {
AbortSignal signal;
DOMString sharedContext;
AIRewriterTone tone = "as-is";
AIRewriterLength length = "as-is";
};
[
Exposed=(Window,Worker),
RuntimeEnabled=AIRewriterAPI
]
interface AIRewriterFactory {
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<AIRewriter> create(optional AIRewriterCreateOptions options = {});
};
@@ -0,0 +1,30 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(crbug.com/356058864): Add explainer link
[
Exposed=(Window,Worker),
RuntimeEnabled=AISummarizationAPI
]
interface AISummarizer {
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<DOMString> summarize(DOMString input);
[
Measure,
CallWith=ScriptState,
RaisesException
]
ReadableStream summarizeStreaming(DOMString input);
[
Measure,
CallWith=ScriptState,
RaisesException
]
void destroy();
};
@@ -0,0 +1,32 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(crbug.com/356058864): Add explainer link
[
Exposed=(Window,Worker),
RuntimeEnabled=AISummarizationAPI
]
interface AISummarizerCapabilities {
readonly attribute AICapabilityAvailability available;
};
[
Exposed=(Window,Worker),
RuntimeEnabled=AISummarizationAPI
]
interface AISummarizerFactory {
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<AISummarizer> create();
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<AISummarizerCapabilities> capabilities();
};
@@ -5,7 +5,7 @@
// https://github.com/explainers-by-googlers/prompt-api
[
Exposed=Window,
Exposed=(Window,Worker),
RuntimeEnabled=AIPromptAPI
]
interface AITextSession {
@@ -23,6 +23,20 @@ interface AITextSession {
RuntimeEnabled=AIPromptAPI
]
ReadableStream promptStreaming(DOMString input);
readonly attribute unsigned long long maxTokens;
readonly attribute unsigned long long tokensSoFar;
readonly attribute unsigned long long tokensLeft;
readonly attribute unsigned long topK;
readonly attribute float temperature;
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<AITextSession> clone();
[
Measure,
CallWith=ScriptState,
@@ -7,4 +7,5 @@
dictionary AITextSessionOptions {
[EnforceRange] unsigned long topK;
float temperature;
DOMString systemPrompt;
};
@@ -0,0 +1,44 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Writer API
// https://github.com/explainers-by-googlers/writing-assistance-apis
dictionary AIWriterWriteOptions {
DOMString context;
AbortSignal signal;
};
[
Exposed=(Window,Worker),
RuntimeEnabled=AIWriterAPI
]
interface AIWriter {
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<DOMString> write(
DOMString input,
optional AIWriterWriteOptions options = {});
[
Measure,
CallWith=ScriptState,
RaisesException
]
ReadableStream writeStreaming(
DOMString input,
optional AIWriterWriteOptions options = {});
[
Measure,
CallWith=ScriptState,
RaisesException
]
void destroy();
readonly attribute DOMString sharedContext;
};
@@ -0,0 +1,24 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Writer API
// https://github.com/explainers-by-googlers/writing-assistance-apis
dictionary AIWriterCreateOptions {
AbortSignal signal;
DOMString sharedContext;
};
[
Exposed=(Window,Worker),
RuntimeEnabled=AIWriterAPI
]
interface AIWriterFactory {
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<AIWriter> create(optional AIWriterCreateOptions options = {});
};
@@ -115,7 +115,6 @@ interface CanvasRenderingContext2D {
void drawFocusIfNeeded(Element element);
void drawFocusIfNeeded(Path2D path, Element element);
[RuntimeEnabled=Canvas2dScrollPathIntoView] void scrollPathIntoView(optional Path2D path);
void clip(optional CanvasFillRule winding);
void clip(Path2D path, optional CanvasFillRule winding);
[HighEntropy] boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasFillRule winding);
@@ -128,14 +127,15 @@ interface CanvasRenderingContext2D {
[HighEntropy] void strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
[HighEntropy] TextMetrics measureText(DOMString text);
// Render entire FormattedText with line wrapping (one-shot)
[RuntimeEnabled=FormattedText, RaisesException] void drawFormattedText(FormattedText formattedText, double x, double y);
// drawing images
[RaisesException] void drawImage(CanvasImageSource image, unrestricted double x, unrestricted double y);
[RaisesException] void drawImage(CanvasImageSource image, unrestricted double x, unrestricted double y, unrestricted double width, unrestricted double height);
[RaisesException] void drawImage(CanvasImageSource image, unrestricted double sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
// placeElement: https://github.com/Igalia/explainers/blob/main/canvas-formatted-text/html-in-canvas.md
[RuntimeEnabled=CanvasPlaceElement, RaisesException] void placeElement(Element element, unrestricted double x,
unrestricted double y);
// triangle mesh API
[MeasureAs=Canvas2DMesh, RuntimeEnabled=Canvas2dMesh, RaisesException] Mesh2DVertexBuffer createMesh2DVertexBuffer(Float32Array buffer);
[MeasureAs=Canvas2DMesh, RuntimeEnabled=Canvas2dMesh, RaisesException] Mesh2DUVBuffer createMesh2DUVBuffer(Float32Array buffer);
@@ -0,0 +1,9 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Represents the optional parameters described in
// https://w3c.github.io/compute-pressure/#create-virtual-pressure-source
dictionary CreateVirtualPressureSourceOptions {
boolean available = true;
};
@@ -0,0 +1,11 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
ImplementedAs=InternalsComputePressure
] partial interface Internals {
[CallWith=ScriptState] Promise<undefined> createVirtualPressureSource(PressureSource source, CreateVirtualPressureSourceOptions options);
[CallWith=ScriptState] Promise<undefined> removeVirtualPressureSource(PressureSource source);
[CallWith=ScriptState] Promise<undefined> updateVirtualPressureSource(PressureSource source, PressureState state);
};
@@ -5,7 +5,7 @@
// https://w3c.github.io/webauthn/#dictdef-authenticationresponsejson
dictionary AuthenticationResponseJSON {
required Base64URLString id;
required DOMString id;
required Base64URLString rawId;
required AuthenticatorAssertionResponseJSON response;
DOMString authenticatorAttachment;
@@ -23,4 +23,8 @@ dictionary IdentityCredentialRequestOptions {
[RuntimeEnabled=FedCmButtonMode, MeasureAs=FedCmButtonMode] IdentityCredentialRequestOptionsMode mode = "widget";
// A querying language that allows an RP to ask what it wants from the IdPs.
[RuntimeEnabled=FedCmSelectiveDisclosure] IdentityStandardClaims claims;
// This is a debugging aid string instead of an actual member of this dictionary.
// `mediation` could be accidentally set by web developers here and this helps
// with showing debugging info to developers when it happens.
USVString mediation;
};
@@ -14,5 +14,6 @@ dictionary PublicKeyCredentialCreationOptions {
sequence<DOMString> hints = [];
// https://w3c.github.io/webauthn/#enumdef-attestationconveyancepreference
DOMString attestation;
[RuntimeEnabled=WebAuthenticationAttestationFormats] sequence<DOMString> attestationFormats = [];
AuthenticationExtensionsClientInputs extensions;
};
@@ -4,5 +4,18 @@
dictionary PublicKeyCredentialReportOptions {
USVString rpId;
BufferSource unknownCredentialId;
DOMString unknownCredentialId;
AllAcceptedCredentialsOptions allAcceptedCredentials;
CurrentUserDetailsOptions currentUserDetails;
};
dictionary AllAcceptedCredentialsOptions {
required DOMString userId;
required sequence<DOMString> allAcceptedCredentialsIds;
};
dictionary CurrentUserDetailsOptions {
required DOMString userId;
required DOMString name;
required DOMString displayName;
};
@@ -5,7 +5,7 @@
// https://w3c.github.io/webauthn/#dictdef-registrationresponsejson
dictionary RegistrationResponseJSON {
required Base64URLString id;
required DOMString id;
required Base64URLString rawId;
required AuthenticatorAttestationResponseJSON response;
DOMString authenticatorAttachment;
@@ -49,7 +49,7 @@ typedef (object or DOMString) AlgorithmIdentifier;
[CallWith=ScriptState, MeasureAs=SubtleCryptoDeriveBits, RaisesException] Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, CryptoKey baseKey, unsigned long length);
[CallWith=ScriptState, MeasureAs=SubtleCryptoImportKey, RaisesException] Promise<CryptoKey> importKey(KeyFormat format, (BufferSource or JsonWebKey) keyData, AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
[CallWith=ScriptState, MeasureAs=SubtleCryptoExportKey] Promise<any> exportKey(KeyFormat format, CryptoKey key);
[CallWith=ScriptState, MeasureAs=SubtleCryptoExportKey, RaisesException] Promise<any> exportKey(KeyFormat format, CryptoKey key);
[CallWith=ScriptState, MeasureAs=SubtleCryptoWrapKey, RaisesException] Promise<any> wrapKey(KeyFormat format, CryptoKey key, CryptoKey wrappingKey, AlgorithmIdentifier wrapAlgorithm);
[CallWith=ScriptState, MeasureAs=SubtleCryptoUnwrapKey, RaisesException] Promise<CryptoKey> unwrapKey(KeyFormat format, BufferSource wrappedKey, CryptoKey unwrappingKey, AlgorithmIdentifier unwrapAlgorithm, AlgorithmIdentifier unwrappedKeyAlgorithm, boolean extractable, sequence<KeyUsage> keyUsages);
@@ -33,6 +33,6 @@
] interface TextEncoder {
[CallWith=ExecutionContext, RaisesException, MeasureAs=TextEncoderConstructor] constructor();
readonly attribute DOMString encoding;
[MeasureAs=TextEncoderEncode] Uint8Array encode(optional USVString input = "");
[MeasureAs=TextEncoderEncode, RaisesException] Uint8Array encode(optional USVString input = "");
[MeasureAs=TextEncoderEncodeInto] TextEncoderEncodeIntoResult encodeInto(USVString source, Uint8Array destination);
};
@@ -11,6 +11,6 @@
] interface EyeDropper {
[CallWith=ExecutionContext] constructor();
[CallWith=ScriptState, RaisesException] Promise<ColorSelectionResult> open(
[CallWith=ScriptState, RaisesException, MeasureAs=EyeDropperOpen] Promise<ColorSelectionResult> open(
optional ColorSelectionOptions options = {});
};
@@ -1,20 +0,0 @@
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
dictionary FormattedTextRun {
DOMString? text;
DOMString? style;
};
typedef (DOMString or FormattedTextRun) FormattedTextRunSingle;
typedef sequence<FormattedTextRunSingle> FormattedTextRunList;
[
RuntimeEnabled=FormattedText,
Exposed=Window
]
interface FormattedText {
[CallWith=ExecutionContext, RaisesException] static FormattedText? format((FormattedTextRunList or FormattedTextRunSingle) text_runs, optional DOMString? style = null, optional double inline_constraint, optional double block_constraint);
};
@@ -26,7 +26,7 @@ enum GamepadHapticsResult {
] interface GamepadHapticActuator {
[RuntimeEnabled=WGIGamepadTriggerRumble, SameObject]
readonly attribute FrozenArray<GamepadHapticEffectType> effects;
readonly attribute GamepadHapticActuatorType type;
[MeasureAs=GamepadHapticActuatorType] readonly attribute GamepadHapticActuatorType type;
[CallWith=ScriptState] Promise<GamepadHapticsResult> playEffect(
GamepadHapticEffectType type,
GamepadEffectParameters params);
@@ -31,6 +31,13 @@ interface CaptureController : EventTarget {
// https://screen-share.github.io/mouse-events/#capture-controller-extensions
[RuntimeEnabled=CapturedMouseEvents] attribute EventHandler oncapturedmousechange;
[
RuntimeEnabled = CapturedSurfaceControl,
MeasureAs = CapturedSurfaceControl,
CallWith = ScriptState
]
Promise<undefined> captureWheel(HTMLElement? element);
[
RuntimeEnabled = CapturedSurfaceControl,
MeasureAs = CapturedSurfaceControl,
@@ -41,6 +41,7 @@ dictionary MediaTrackCapabilities {
boolean torch;
// W3C Media Capture Extensions
[RuntimeEnabled=MediaCaptureBackgroundBlur] sequence<boolean> backgroundBlur;
[RuntimeEnabled=MediaCaptureCameraControls] sequence<boolean> backgroundSegmentationMask;
[RuntimeEnabled=MediaCaptureCameraControls] sequence<boolean> eyeGazeCorrection;
[RuntimeEnabled=MediaCaptureCameraControls] sequence<boolean> faceFraming;
// Screen Capture API
@@ -51,6 +51,7 @@ dictionary MediaTrackConstraintSet {
// W3C Media Capture Extensions
[RuntimeEnabled=MediaCaptureBackgroundBlur] ConstrainBoolean backgroundBlur;
[RuntimeEnabled=MediaCaptureCameraControls] ConstrainBoolean backgroundSegmentationMask;
[RuntimeEnabled=MediaCaptureCameraControls] ConstrainBoolean eyeGazeCorrection;
[RuntimeEnabled=MediaCaptureCameraControls] ConstrainBoolean faceFraming;
@@ -46,6 +46,7 @@ dictionary MediaTrackSettings {
// W3C Media Capture Extensions
[RuntimeEnabled=MediaCaptureBackgroundBlur] boolean backgroundBlur;
[RuntimeEnabled=MediaCaptureCameraControls] boolean backgroundSegmentationMask;
[RuntimeEnabled=MediaCaptureCameraControls] boolean eyeGazeCorrection;
[RuntimeEnabled=MediaCaptureCameraControls] boolean faceFraming;
@@ -49,6 +49,7 @@ dictionary MediaTrackSupportedConstraints {
// W3C Media Capture Extensions
[RuntimeEnabled=MediaCaptureBackgroundBlur] boolean backgroundBlur = true;
[RuntimeEnabled=MediaCaptureCameraControls] boolean backgroundSegmentationMask = true;
[RuntimeEnabled=MediaCaptureCameraControls] boolean eyeGazeCorrection = true;
[RuntimeEnabled=MediaCaptureCameraControls] boolean faceFraming = true;
@@ -32,6 +32,12 @@ dictionary MLArgMinMaxSupportLimits {
MLSupportLimits output;
};
dictionary MLBinarySupportLimits {
MLSupportLimits a;
MLSupportLimits b;
MLSupportLimits output;
};
dictionary MLConcatSupportLimits {
MLSupportLimits inputs;
};
@@ -41,6 +47,16 @@ dictionary MLGatherSupportLimits {
MLSupportLimits indices;
};
dictionary MLLogicalNotSupportLimits {
MLSupportLimits a;
MLSupportLimits output;
};
dictionary MLSingleInputSupportLimits {
MLSupportLimits input;
MLSupportLimits output;
};
dictionary MLWhereSupportLimits {
MLSupportLimits condition;
MLSupportLimits trueValue;
@@ -48,6 +64,7 @@ dictionary MLWhereSupportLimits {
};
dictionary MLOpSupportLimits {
MLInputOperandLayout preferredInputLayout;
MLSupportLimits input;
MLSupportLimits constant;
MLSupportLimits output;
@@ -55,7 +72,50 @@ dictionary MLOpSupportLimits {
MLArgMinMaxSupportLimits argMin;
MLArgMinMaxSupportLimits argMax;
MLConcatSupportLimits concat;
// Element-wise binary ops.
MLBinarySupportLimits add;
MLBinarySupportLimits sub;
MLBinarySupportLimits mul;
MLBinarySupportLimits div;
MLBinarySupportLimits max;
MLBinarySupportLimits min;
MLBinarySupportLimits pow;
// Element-wise logical ops.
MLBinarySupportLimits equal;
MLBinarySupportLimits greater;
MLBinarySupportLimits greaterOrEqual;
MLBinarySupportLimits lesser;
MLBinarySupportLimits lesserOrEqual;
MLLogicalNotSupportLimits logicalNot;
// Element-wise unary ops.
MLSingleInputSupportLimits abs;
MLSingleInputSupportLimits ceil;
MLSingleInputSupportLimits cos;
MLSingleInputSupportLimits erf;
MLSingleInputSupportLimits exp;
MLSingleInputSupportLimits floor;
MLSingleInputSupportLimits identity;
MLSingleInputSupportLimits log;
MLSingleInputSupportLimits neg;
MLSingleInputSupportLimits reciprocal;
MLSingleInputSupportLimits sin;
MLSingleInputSupportLimits sqrt;
MLSingleInputSupportLimits tan;
MLSingleInputSupportLimits elu;
MLGatherSupportLimits gather;
MLSingleInputSupportLimits gelu;
MLSingleInputSupportLimits leakyRelu;
MLSingleInputSupportLimits relu;
MLSingleInputSupportLimits sigmoid;
MLSingleInputSupportLimits slice;
MLSingleInputSupportLimits softmax;
MLSingleInputSupportLimits softplus;
MLSingleInputSupportLimits softsign;
MLSingleInputSupportLimits split;
MLWhereSupportLimits where;
};
@@ -71,6 +131,12 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
CallWith=ScriptState
] readonly attribute Promise<MLContextLostInfo> lost;
[
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] void destroy();
[
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
@@ -83,7 +149,7 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] MLBuffer createBuffer(MLBufferDescriptor descriptor);
] Promise<MLBuffer> createBuffer(MLBufferDescriptor descriptor);
// TODO(crbug.com/328105506): enable partial MLBuffer reads/writes.
// TODO(crbug.com/40278771): consider moving arguments into a dictonary
@@ -109,7 +175,6 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
optional MLSize64 srcByteOffset = 0,
optional MLSize64 srcByteSize);
// TODO(crbug.com/328102504): enable transferable view to avoid copy.
[
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
@@ -117,6 +182,22 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
] Promise<ArrayBuffer> readBuffer(
MLBuffer srcBuffer);
[
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] Promise<void> readBuffer(
MLBuffer srcBuffer,
[AllowShared] ArrayBufferView dstData);
[
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] Promise<void> readBuffer(
MLBuffer srcBuffer,
[AllowShared] ArrayBuffer dstData);
// TODO(crbug.com/1273291): enable partial buffer dispatches.
[
RuntimeEnabled=MachineLearningNeuralNetwork,
@@ -2,21 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This will be a shared interface by two APIs:
// - The Model Loader API,
// https://github.com/webmachinelearning/model-loader/blob/main/explainer.md
// - The WebNN API,
// https://github.com/webmachinelearning/webnn/blob/main/explainer.md
enum MLDevicePreference {
// Let the backend selects the most suitable device.
"auto",
// The backend will use GPU to do model inference. If some operator is not
// supported by GPU, it will fall back to CPU.
"gpu",
// The backend will use CPU to do model inference.
"cpu"
};
// https://www.w3.org/TR/webnn/#api-mlcontextoptions
// Corresponds to WebNN MLDeviceType enum
// https://www.w3.org/TR/webnn/#enumdef-mldevicetype
@@ -27,8 +13,8 @@ enum MLDeviceType {
};
enum MLPowerPreference {
// Let the backend selects the most suitable behavior.
"auto",
// Let the user agent select the most suitable behavior.
"default",
// Prioritizes execution speed over power consumption.
"high-performance",
// Prioritizes power consumption over other considerations such as execution
@@ -36,25 +22,18 @@ enum MLPowerPreference {
"low-power",
};
enum MLModelFormat {
// Tensorflow-lite flatbuffer.
"tflite"
};
dictionary MLContextOptions {
// Preferred kind of device used for model loader API.
MLDevicePreference devicePreference = "auto";
// Specified type of device used for WebNN API.
MLDeviceType deviceType = "cpu";
// Preference as related to power consumption.
MLPowerPreference powerPreference = "auto";
// Model format for the model loader API.
MLModelFormat modelFormat = "tflite";
MLPowerPreference powerPreference = "default";
// Number of thread to use.
// "0" means the backend can determine it automatically.
//
// TODO(crbug.com/338162119): Figure out why the TFLite XNNPACK delegate
// choosing its own thread count is not resulting in good performance, then
// remove this.
unsigned long numThreads = 0;
};
@@ -1,10 +0,0 @@
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://www.w3.org/TR/webnn/#api-mlactivation
[
RuntimeEnabled=MachineLearningNeuralNetwork,
Exposed=(Window, DedicatedWorker)
] interface MLActivation {};
@@ -12,6 +12,8 @@ enum MLConv2dFilterOperandLayout { "oihw", "hwio", "ohwi", "ihwo" };
enum MLConvTranspose2dFilterOperandLayout { "iohw", "hwoi", "ohwi" };
enum MLRecurrentNetworkActivation { "relu", "sigmoid", "tanh" };
enum MLRecurrentNetworkDirection { "forward", "backward", "both" };
enum MLLstmWeightLayout { "iofg", "ifgo" };
@@ -22,8 +24,7 @@ dictionary MLOperatorOptions {
USVString label = "";
};
dictionary MLArgMinMaxOptions {
sequence<[EnforceRange] unsigned long> axes;
dictionary MLArgMinMaxOptions : MLOperatorOptions {
boolean keepDimensions = false;
// See spec issue https://github.com/webmachinelearning/webnn/issues/653.
MLOperandDataType outputDataType = "int32";
@@ -33,14 +34,14 @@ dictionary MLArgMinMaxOptions {
// https://github.com/webmachinelearning/webnn/issues/481.
// TODO(crbug.com/1502361): Revisit whether the scale and bias operands
// should be required inputs based on WG's consensus.
dictionary MLBatchNormalizationOptions : MLOperatorOptions{
dictionary MLBatchNormalizationOptions : MLOperatorOptions {
MLOperand scale;
MLOperand bias;
[EnforceRange] unsigned long axis = 1;
float epsilon = 1e-5;
};
dictionary MLConv2dOptions : MLOperatorOptions{
dictionary MLConv2dOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> padding;
sequence<[EnforceRange] unsigned long> strides;
sequence<[EnforceRange] unsigned long> dilations;
@@ -50,7 +51,7 @@ dictionary MLConv2dOptions : MLOperatorOptions{
MLOperand bias;
};
dictionary MLConvTranspose2dOptions : MLOperatorOptions{
dictionary MLConvTranspose2dOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> padding;
sequence<[EnforceRange] unsigned long> strides;
sequence<[EnforceRange] unsigned long> dilations;
@@ -62,11 +63,11 @@ dictionary MLConvTranspose2dOptions : MLOperatorOptions{
MLOperand bias;
};
dictionary MLGatherOptions {
dictionary MLGatherOptions : MLOperatorOptions {
[EnforceRange] unsigned long axis = 0;
};
dictionary MLGemmOptions {
dictionary MLGemmOptions : MLOperatorOptions {
MLOperand c;
float alpha = 1.0;
float beta = 1.0;
@@ -74,7 +75,7 @@ dictionary MLGemmOptions {
boolean bTranspose = false;
};
dictionary MLGruOptions {
dictionary MLGruOptions : MLOperatorOptions {
MLOperand bias;
MLOperand recurrentBias;
MLOperand initialHiddenState;
@@ -82,39 +83,39 @@ dictionary MLGruOptions {
boolean returnSequence = false;
MLRecurrentNetworkDirection direction = "forward";
MLGruWeightLayout layout = "zrn";
sequence<MLActivation> activations;
sequence<MLRecurrentNetworkActivation> activations;
};
dictionary MLGruCellOptions {
dictionary MLGruCellOptions : MLOperatorOptions {
MLOperand bias;
MLOperand recurrentBias;
boolean resetAfter = true;
MLGruWeightLayout layout = "zrn";
sequence<MLActivation> activations;
sequence<MLRecurrentNetworkActivation> activations;
};
dictionary MLHardSigmoidOptions {
dictionary MLHardSigmoidOptions : MLOperatorOptions {
float alpha = 0.2;
float beta = 0.5;
};
dictionary MLLayerNormalizationOptions {
dictionary MLLayerNormalizationOptions : MLOperatorOptions {
MLOperand scale;
MLOperand bias;
sequence<[EnforceRange] unsigned long> axes;
float epsilon = 1e-5;
};
dictionary MLLeakyReluOptions {
dictionary MLLeakyReluOptions : MLOperatorOptions {
float alpha = 0.01;
};
dictionary MLLinearOptions {
dictionary MLLinearOptions : MLOperatorOptions {
float alpha = 1.0;
float beta = 0;
};
dictionary MLLstmOptions {
dictionary MLLstmOptions : MLOperatorOptions {
MLOperand bias;
MLOperand recurrentBias;
MLOperand peepholeWeight;
@@ -123,15 +124,15 @@ dictionary MLLstmOptions {
boolean returnSequence = false;
MLRecurrentNetworkDirection direction = "forward";
MLLstmWeightLayout layout = "iofg";
sequence<MLActivation> activations;
sequence<MLRecurrentNetworkActivation> activations;
};
dictionary MLLstmCellOptions {
dictionary MLLstmCellOptions : MLOperatorOptions {
MLOperand bias;
MLOperand recurrentBias;
MLOperand peepholeWeight;
MLLstmWeightLayout layout = "iofg";
sequence<MLActivation> activations;
sequence<MLRecurrentNetworkActivation> activations;
};
enum MLPaddingMode {
@@ -141,7 +142,7 @@ enum MLPaddingMode {
"symmetric"
};
dictionary MLPadOptions {
dictionary MLPadOptions : MLOperatorOptions {
MLPaddingMode mode = "constant";
float value = 0;
};
@@ -151,7 +152,7 @@ enum MLRoundingType {
"ceil"
};
dictionary MLPool2dOptions {
dictionary MLPool2dOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> windowDimensions;
sequence<[EnforceRange] unsigned long> padding;
sequence<[EnforceRange] unsigned long> strides;
@@ -161,45 +162,45 @@ dictionary MLPool2dOptions {
sequence<[EnforceRange] unsigned long> outputSizes;
};
dictionary MLClampOptions {
dictionary MLClampOptions : MLOperatorOptions {
float minValue;
float maxValue;
};
dictionary MLEluOptions {
dictionary MLEluOptions : MLOperatorOptions {
float alpha = 1;
};
dictionary MLInstanceNormalizationOptions {
dictionary MLInstanceNormalizationOptions : MLOperatorOptions {
MLOperand scale;
MLOperand bias;
float epsilon = 1e-5;
MLInputOperandLayout layout = "nchw";
};
dictionary MLReduceOptions {
dictionary MLReduceOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> axes;
boolean keepDimensions = false;
};
enum MLInterpolationMode {"nearest-neighbor", "linear" };
dictionary MLResample2dOptions : MLOperatorOptions{
dictionary MLResample2dOptions : MLOperatorOptions {
MLInterpolationMode mode = "nearest-neighbor";
sequence<float> scales;
sequence<[EnforceRange] unsigned long> sizes;
sequence<[EnforceRange] unsigned long> axes;
};
dictionary MLTransposeOptions {
dictionary MLTransposeOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> permutation;
};
dictionary MLSplitOptions {
dictionary MLSplitOptions : MLOperatorOptions {
[EnforceRange] unsigned long axis = 0;
};
dictionary MLTriangularOptions {
dictionary MLTriangularOptions : MLOperatorOptions {
boolean upper = true;
[EnforceRange] long diagonal = 0;
};
@@ -208,20 +209,23 @@ dictionary MLTriangularOptions {
RuntimeEnabled=MachineLearningNeuralNetwork,
Exposed=(Window, DedicatedWorker)
] interface MLGraphBuilder {
constructor(MLContext context);
[
CallWith=ScriptState,
RaisesException
] constructor(MLContext context);
[RaisesException] MLOperand input(USVString name, MLOperandDescriptor desc);
[RaisesException] MLOperand constant(MLOperandDescriptor desc, ArrayBufferView bufferView);
[RaisesException] MLOperand argMin(MLOperand input, optional MLArgMinMaxOptions options = {});
[RaisesException] MLOperand argMax(MLOperand input, optional MLArgMinMaxOptions options = {});
[RaisesException] MLOperand argMin(MLOperand input, [EnforceRange] unsigned long axis, optional MLArgMinMaxOptions options = {});
[RaisesException] MLOperand argMax(MLOperand input, [EnforceRange] unsigned long axis, optional MLArgMinMaxOptions options = {});
[RaisesException] MLOperand batchNormalization(MLOperand input, MLOperand mean, MLOperand variance, optional MLBatchNormalizationOptions options = {});
[RaisesException] MLOperand clamp(MLOperand input, optional MLClampOptions options = {});
[RaisesException] MLOperand concat(sequence<MLOperand> inputs, [EnforceRange] unsigned long axis);
[RaisesException] MLOperand concat(sequence<MLOperand> inputs, [EnforceRange] unsigned long axis, optional MLOperatorOptions options = {});
[RaisesException] MLOperand conv2d(MLOperand input, MLOperand filter, optional MLConv2dOptions options = {});
[RaisesException] MLOperand convTranspose2d(MLOperand input, MLOperand filter, optional MLConvTranspose2dOptions options = {});
@@ -241,32 +245,30 @@ dictionary MLTriangularOptions {
[RaisesException] MLOperand lesserOrEqual(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
// Element-wise unary operations
[RaisesException] MLOperand abs(MLOperand x);
[RaisesException] MLOperand ceil(MLOperand x);
[RaisesException] MLOperand cos(MLOperand x);
[RaisesException] MLOperand exp(MLOperand x);
[RaisesException] MLOperand floor(MLOperand x);
[RaisesException] MLOperand log(MLOperand x);
[RaisesException] MLOperand neg(MLOperand x);
[RaisesException] MLOperand sin(MLOperand x);
[RaisesException] MLOperand tan(MLOperand x);
[RaisesException] MLOperand erf(MLOperand x);
[RaisesException] MLOperand identity(MLOperand x);
[RaisesException] MLOperand logicalNot(MLOperand x);
[RaisesException] MLOperand reciprocal(MLOperand x);
[RaisesException] MLOperand sqrt(MLOperand x);
[RaisesException] MLOperand abs(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand ceil(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand cos(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand exp(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand floor(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand log(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand neg(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand sin(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand tan(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand erf(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand identity(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand logicalNot(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand reciprocal(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand sqrt(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand cast(MLOperand input, MLOperandDataType outputDataType);
[RaisesException] MLOperand cast(MLOperand input, MLOperandDataType outputDataType, optional MLOperatorOptions options = {});
[RaisesException] MLOperand elu(MLOperand x, optional MLEluOptions options = {});
[RaisesException] MLActivation elu(optional MLEluOptions options = {});
[RaisesException] MLOperand expand(MLOperand input, sequence<[EnforceRange] unsigned long> newShape);
[RaisesException] MLOperand expand(MLOperand input, sequence<[EnforceRange] unsigned long> newShape, optional MLOperatorOptions options = {});
[RaisesException] MLOperand gather(MLOperand input, MLOperand indices, optional MLGatherOptions options = {});
[RaisesException] MLOperand gelu(MLOperand input);
[RaisesException] MLActivation gelu();
[RaisesException] MLOperand gelu(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand gemm(MLOperand a, MLOperand b, optional MLGemmOptions options = {});
@@ -278,22 +280,18 @@ dictionary MLTriangularOptions {
[EnforceRange] unsigned long hiddenSize, optional MLGruCellOptions options = {});
[RaisesException] MLOperand hardSigmoid(MLOperand x, optional MLHardSigmoidOptions options = {});
[RaisesException] MLActivation hardSigmoid(optional MLHardSigmoidOptions options = {});
[RaisesException] MLOperand hardSwish(MLOperand x);
[RaisesException] MLActivation hardSwish();
[RaisesException] MLOperand hardSwish(MLOperand x, optional MLOperatorOptions options = {});
[RaisesException] MLOperand instanceNormalization(MLOperand input, optional MLInstanceNormalizationOptions options = {});
[RaisesException] MLOperand matmul(MLOperand a, MLOperand b);
[RaisesException] MLOperand matmul(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
[RaisesException] MLOperand layerNormalization(MLOperand input, optional MLLayerNormalizationOptions options = {});
[RaisesException] MLOperand leakyRelu(MLOperand x, optional MLLeakyReluOptions options = {});
[RaisesException] MLActivation leakyRelu(optional MLLeakyReluOptions options = {});
[RaisesException] MLOperand linear(MLOperand input, optional MLLinearOptions options = {});
[RaisesException] MLActivation linear(optional MLLinearOptions options = {});
[RaisesException] sequence<MLOperand> lstm(MLOperand input, MLOperand weight, MLOperand recurrentWeight,
[EnforceRange] unsigned long steps, [EnforceRange] unsigned long hiddenSize,
@@ -327,43 +325,38 @@ dictionary MLTriangularOptions {
[RaisesException] MLOperand reduceSum(MLOperand input, optional MLReduceOptions options = {});
[RaisesException] MLOperand reduceSumSquare(MLOperand input, optional MLReduceOptions options = {});
[RaisesException] MLOperand relu(MLOperand input);
[RaisesException] MLActivation relu();
[RaisesException] MLOperand relu(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand reshape(MLOperand input, sequence<[EnforceRange] unsigned long> newShape);
[RaisesException] MLOperand reshape(MLOperand input, sequence<[EnforceRange] unsigned long> newShape, optional MLOperatorOptions options = {});
[
CallWith=ScriptState,
RaisesException
] MLOperand resample2d(MLOperand input, optional MLResample2dOptions options = {});
[RaisesException] MLOperand sigmoid(MLOperand input);
[RaisesException] MLActivation sigmoid();
[RaisesException] MLOperand sigmoid(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand slice(MLOperand input, sequence<[EnforceRange] unsigned long> starts, sequence<[EnforceRange] unsigned long> sizes);
[RaisesException] MLOperand slice(MLOperand input, sequence<[EnforceRange] unsigned long> starts, sequence<[EnforceRange] unsigned long> sizes, optional MLOperatorOptions options = {});
// TODO: crbug.com/342919187 - Remove the deprecated version once ort-web 1.18.* supporting softmax(input, aixs) is released.
[RaisesException] MLOperand softmax(MLOperand input);
[RaisesException] MLOperand softmax(MLOperand input, [EnforceRange] unsigned long axis);
[RaisesException] MLOperand softmax(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand softmax(MLOperand input, [EnforceRange] unsigned long axis, optional MLOperatorOptions options = {});
[RaisesException] MLOperand softplus(MLOperand input);
[RaisesException] MLActivation softplus();
[RaisesException] MLOperand softplus(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand softsign(MLOperand input);
[RaisesException] MLActivation softsign();
[RaisesException] MLOperand softsign(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] sequence<MLOperand> split(MLOperand input, [EnforceRange] unsigned long splits, optional MLSplitOptions options = {});
[RaisesException] sequence<MLOperand> split(MLOperand input, sequence<[EnforceRange] unsigned long> splits, optional MLSplitOptions options = {});
[RaisesException] MLOperand tanh(MLOperand input);
[RaisesException] MLActivation tanh();
[RaisesException] MLOperand tanh(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand transpose(
MLOperand input, optional MLTransposeOptions options = {});
[RaisesException] MLOperand triangular(MLOperand input, optional MLTriangularOptions options = {});
[RaisesException] MLOperand where(MLOperand condition, MLOperand trueValue, MLOperand falseValue);
[RaisesException] MLOperand where(MLOperand condition, MLOperand trueValue, MLOperand falseValue, optional MLOperatorOptions options = {});
[
CallWith=ScriptState,
@@ -0,0 +1,23 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Explainer: https://github.com/WICG/translation-api/blob/5151a1b1b37cd604542715141b0a203a8c6e9061/README.md
// TODO(https://crbug.com/349927087): Migrate to latest API when it is decided.
dictionary LanguageDetectionResult {
DOMString? detectedLanguage;
double confidence;
};
[
RuntimeEnabled=LanguageDetectionAPI,
Exposed=(Window,Worker)
]
interface LanguageDetector {
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<sequence<LanguageDetectionResult>> detect(DOMString input);
};
@@ -9,7 +9,7 @@ enum TranslationAvailability {
};
[
RuntimeEnabled=TranslationAPI,
RuntimeEnabled=TranslationAPIEntryPoint,
Exposed=(Window,Worker)
]
interface Translation {
@@ -31,4 +31,18 @@ interface Translation {
Promise<LanguageTranslator> createTranslator(
TranslationLanguageOptions options
);
[
RuntimeEnabled=LanguageDetectionAPI,
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<TranslationAvailability> canDetect();
[
RuntimeEnabled=LanguageDetectionAPI,
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<LanguageDetector> createDetector();
};
@@ -4,7 +4,7 @@
[
ImplementedAs=DOMTranslation,
RuntimeEnabled=TranslationAPI,
RuntimeEnabled=TranslationAPIEntryPoint,
Exposed=(Window,Worker)
] partial interface mixin WindowOrWorkerGlobalScope {
[Replaceable] readonly attribute Translation translation;
@@ -0,0 +1,8 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[ImplementedAs=DedicatedWorkerGlobalScopeRTCRtpTransportProcessor, RuntimeEnabled=RTCRtpTransport]
partial interface DedicatedWorkerGlobalScope {
attribute EventHandler onrtcrtptransportprocessor;
};
@@ -0,0 +1,10 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/webrtc-encoded-transform/#ref-for-dedicatedworkerglobalscope
[ImplementedAs=DedicatedWorkerGlobalScopeRTCTransform, RuntimeEnabled=RTCRtpScriptTransform]
partial interface DedicatedWorkerGlobalScope {
attribute EventHandler onrtctransform;
};
@@ -36,7 +36,7 @@ enum RTCDataChannelState {
[
ActiveScriptWrappable,
Exposed=Window
Exposed(Window StableBlinkFeatures, DedicatedWorker TransferableRTCDataChannel)
] interface RTCDataChannel : EventTarget {
readonly attribute USVString label;
readonly attribute boolean ordered;
@@ -61,6 +61,9 @@ enum RTCDataChannelState {
[RaisesException] void send(ArrayBuffer data);
[RaisesException] void send(ArrayBufferView data);
// https://w3c.github.io/webrtc-priority/#datachannel
[RuntimeEnabled=RTCDataChannelPriority] readonly attribute RTCPriorityType priority;
// Non-standard APIs
[Measure] readonly attribute boolean reliable;
};
@@ -11,4 +11,7 @@ dictionary RTCDataChannelInit {
USVString protocol = "";
boolean negotiated = false;
[EnforceRange] unsigned short id;
// https://w3c.github.io/webrtc-priority/#datachannel
[RuntimeEnabled=RTCDataChannelPriority] RTCPriorityType priority = "low";
};
@@ -11,9 +11,9 @@
[Measure, RaisesException]
constructor (RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameOptions options = {});
readonly attribute unsigned long timestamp; // RTP timestamp.
attribute ArrayBuffer data;
[CallWith=ExecutionContext] attribute ArrayBuffer data;
RTCEncodedAudioFrameMetadata getMetadata();
stringifier;
[CallWith=ExecutionContext] stringifier;
[RuntimeEnabled=RTCEncodedFrameSetMetadata, Measure, RaisesException]
void setMetadata(RTCEncodedAudioFrameMetadata metadata);
};
@@ -18,9 +18,9 @@ enum RTCEncodedVideoFrameType {
constructor (RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameOptions options = {});
readonly attribute RTCEncodedVideoFrameType type;
readonly attribute unsigned long timestamp; // RTP timestamp.
attribute ArrayBuffer data;
[CallWith=ExecutionContext] attribute ArrayBuffer data;
RTCEncodedVideoFrameMetadata getMetadata();
[RuntimeEnabled=RTCEncodedFrameSetMetadata, Measure, RaisesException]
void setMetadata(RTCEncodedVideoFrameMetadata metadata);
stringifier;
[CallWith=ExecutionContext] stringifier;
};
@@ -20,4 +20,6 @@ interface RTCRtpReceiver {
[Measure,
CallWith=ScriptState,
RaisesException] RTCInsertableStreams createEncodedStreams();
[RuntimeEnabled=RTCRtpScriptTransform, RaisesException=Setter]
attribute RTCRtpScriptTransform? transform;
};
@@ -0,0 +1,10 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/webrtc-encoded-transform/#rtcrtpscripttransform
[Exposed=Window, RuntimeEnabled=RTCRtpScriptTransform]
interface RTCRtpScriptTransform {
[CallWith=ScriptState, RaisesException] constructor(Worker worker, optional any options, optional sequence<object> transfer);
};
@@ -0,0 +1,15 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/webrtc-encoded-transform/#rtcrtpscripttransformer
// TODO(crbug.com/354881878): implement the rest of the spec
[Exposed=DedicatedWorker, RuntimeEnabled=RTCRtpScriptTransform]
interface RTCRtpScriptTransformer : EventTarget {
readonly attribute ReadableStream readable;
[CallWith=ScriptState] Promise<undefined> sendKeyFrameRequest();
readonly attribute WritableStream writable;
// Additional context added by the application to configure its transform.
[CachedAttribute=IsOptionsDirty, CallWith=ScriptState] readonly attribute any options;
};
@@ -10,9 +10,9 @@ interface RTCRtpSender {
readonly attribute RTCDtlsTransport? rtcpTransport;
[CallWith=ScriptState, HighEntropy, Measure] static RTCRtpCapabilities? getCapabilities(DOMString kind);
// options argument is defined by https://w3c.github.io/webrtc-extensions/#rtcrtpsender-setparameters-keyframe
[CallWith=ScriptState] Promise<undefined> setParameters(RTCRtpSendParameters parameters, optional RTCSetParameterOptions options = {});
[CallWith=ScriptState, RaisesException] Promise<undefined> setParameters(RTCRtpSendParameters parameters, optional RTCSetParameterOptions options = {});
RTCRtpSendParameters getParameters();
[Measure, CallWith=ScriptState] Promise<undefined> replaceTrack(MediaStreamTrack? withTrack);
[Measure, CallWith=ScriptState, RaisesException] Promise<undefined> replaceTrack(MediaStreamTrack? withTrack);
[Measure] readonly attribute RTCDTMFSender? dtmf;
[Measure, RaisesException] void setStreams(MediaStream... streams);
[CallWith=ScriptState] Promise<RTCStatsReport> getStats();
@@ -22,4 +22,7 @@ interface RTCRtpSender {
[RuntimeEnabled=RTCRtpTransport]
Promise<sequence<RTCRtpSendStream>> replaceSendStreams();
[RuntimeEnabled=RTCRtpScriptTransform, RaisesException=Setter]
attribute RTCRtpScriptTransform? transform;
};
@@ -4,13 +4,24 @@
[Exposed=Window, RuntimeEnabled=RTCRtpTransport]
interface RTCRtpTransport {
// TODO(crbug.com/345101934): This needs to actually be on some
// Worker-exposed object. Being discussed in
// https://github.com/w3c/webrtc-rtptransport/issues/33.
sequence<RTCRtpAcks> readReceivedAcks(long maxCount);
// TODO(crbug.com/345101934): This needs to actually be on some
// Worker-exposed object. Being discussed in
// https://github.com/w3c/webrtc-rtptransport/issues/33.
sequence<RTCRtpSent> readSentRtp(long maxCount);
[CallWith=ScriptState, RaisesException]
undefined createProcessor(Worker worker, optional any options, optional sequence<object> transfer);
};
[Exposed=DedicatedWorker, RuntimeEnabled=RTCRtpTransport]
interface RTCRtpTransportProcessor {
sequence<RTCRtpAcks> readReceivedAcks(long maxCount);
sequence<RTCRtpSent> readSentRtp(long maxCount);
attribute unsigned long customMaxBandwidth; // bps
};
[Exposed=DedicatedWorker, RuntimeEnabled=RTCRtpTransport]
interface RTCRtpTransportProcessorEvent : Event {
readonly attribute RTCRtpTransportProcessor processor;
};
[ImplementedAs=DedicatedWorkerGlobalScopeRTCRtpTransportProcessor, RuntimeEnabled=RTCRtpTransport]
partial interface DedicatedWorkerGlobalScope {
attribute EventHandler onrtcrtptransportprocessor;
};

Some files were not shown because too many files have changed in this diff Show More