[AUTO][FILECONTROL] - version 130.0.6723.44 (#1544)

[AUTO][FILECONTROL] - version 130.0.6723.44
This commit is contained in:
uazo
2024-10-15 02:47:01 -12:00
committed by GitHub
108 changed files with 4109 additions and 2907 deletions
+1 -1
View File
@@ -1 +1 @@
129.0.6668.101
130.0.6723.44
@@ -89,6 +89,7 @@
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/file_url_loader.h"
#include "content/public/browser/frame_type.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/network_service_instance.h"
@@ -132,6 +133,7 @@
#include "ui/resources/grit/ui_resources.h"
using content::BrowserThread;
using content::FrameType;
using content::WebContents;
using safe_browsing::AsyncCheckTracker;
using safe_browsing::hash_realtime_utils::HashRealTimeSelection;
@@ -183,7 +185,7 @@ class XrwNavigationThrottle : public content::NavigationThrottle {
// Get async check tracker to make Safe Browsing v5 check asynchronous
base::WeakPtr<AsyncCheckTracker> GetAsyncCheckTracker(
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
int frame_tree_node_id) {
content::FrameTreeNodeId frame_tree_node_id) {
if (!base::FeatureList::IsEnabled(
safe_browsing::kSafeBrowsingAsyncRealTimeCheck)) {
return nullptr;
@@ -196,9 +198,12 @@ base::WeakPtr<AsyncCheckTracker> GetAsyncCheckTracker(
return nullptr;
}
// Setting should_sync_checker_check_allowlist to false since the allowlist
// is not available on WebView.
return AsyncCheckTracker::GetOrCreateForWebContents(
web_contents,
AwBrowserProcess::GetInstance()->GetSafeBrowsingUIManager())
AwBrowserProcess::GetInstance()->GetSafeBrowsingUIManager(),
/*should_sync_checker_check_allowlist=*/false)
->GetWeakPtr();
}
@@ -520,9 +525,7 @@ base::FilePath AwContentBrowserClient::GetDefaultDownloadDirectory() {
}
std::string AwContentBrowserClient::GetDefaultDownloadName() {
NOTREACHED_IN_MIGRATION()
<< "Android WebView does not use chromium downloads";
return std::string();
NOTREACHED() << "Android WebView does not use chromium downloads";
}
std::optional<base::FilePath>
@@ -538,7 +541,7 @@ AwContentBrowserClient::GetLocalTracesDirectory() {
void AwContentBrowserClient::DidCreatePpapiPlugin(
content::BrowserPpapiHost* browser_host) {
NOTREACHED_IN_MIGRATION() << "Android WebView does not support plugins";
NOTREACHED() << "Android WebView does not support plugins";
}
bool AwContentBrowserClient::AllowPepperSocketAPI(
@@ -546,15 +549,13 @@ bool AwContentBrowserClient::AllowPepperSocketAPI(
const GURL& url,
bool private_api,
const content::SocketPermissionRequest* params) {
NOTREACHED_IN_MIGRATION() << "Android WebView does not support plugins";
return false;
NOTREACHED() << "Android WebView does not support plugins";
}
bool AwContentBrowserClient::IsPepperVpnProviderAPIAllowed(
content::BrowserContext* browser_context,
const GURL& url) {
NOTREACHED_IN_MIGRATION() << "Android WebView does not support plugins";
return false;
NOTREACHED() << "Android WebView does not support plugins";
}
std::unique_ptr<content::TracingDelegate>
@@ -645,6 +646,19 @@ AwContentBrowserClient::CreateThrottlesForNavigation(
throttles.push_back(
std::make_unique<XrwNavigationThrottle>(navigation_handle));
}
if ((navigation_handle->GetNavigatingFrameType() ==
FrameType::kPrimaryMainFrame ||
navigation_handle->GetNavigatingFrameType() == FrameType::kSubframe) &&
navigation_handle->GetURL().SchemeIsHTTPOrHTTPS()) {
AwSupervisedUserUrlClassifier* urlClassifier =
AwSupervisedUserUrlClassifier::GetInstance();
if (urlClassifier->ShouldCreateThrottle()) {
throttles.push_back(std::make_unique<AwSupervisedUserThrottle>(
navigation_handle, urlClassifier));
}
}
return throttles;
}
@@ -659,7 +673,7 @@ AwContentBrowserClient::CreateURLLoaderThrottles(
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
std::optional<int64_t> navigation_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -705,17 +719,6 @@ AwContentBrowserClient::CreateURLLoaderThrottles(
}
}
if ((request.destination == network::mojom::RequestDestination::kDocument ||
request.destination == network::mojom::RequestDestination::kIframe) &&
request.url.SchemeIsHTTPOrHTTPS()) {
AwSupervisedUserUrlClassifier* urlClassifier =
AwSupervisedUserUrlClassifier::GetInstance();
if (urlClassifier->ShouldCreateThrottle()) {
result.push_back(
std::make_unique<AwSupervisedUserThrottle>(urlClassifier));
}
}
return result;
}
@@ -724,7 +727,7 @@ AwContentBrowserClient::CreateURLLoaderThrottlesForKeepAlive(
const network::ResourceRequest& request,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
int frame_tree_node_id) {
content::FrameTreeNodeId frame_tree_node_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Set lookup mechanism based on feature flag
HashRealTimeSelection hash_real_time_selection =
@@ -768,7 +771,7 @@ AwContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate() {
}
bool AwContentBrowserClient::ShouldOverrideUrlLoading(
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
bool browser_initiated,
const GURL& gurl,
const std::string& request_method,
@@ -846,6 +849,9 @@ bool AwContentBrowserClient::ShouldOverrideUrlLoading(
bool AwContentBrowserClient::ShouldAllowSameSiteRenderFrameHostChange(
const content::RenderFrameHost& rfh) {
if (!base::FeatureList::IsEnabled(features::kWebViewRenderDocument)) {
return false;
}
content::RenderFrameHost* rfh_ptr =
const_cast<content::RenderFrameHost*>(&rfh);
content::WebContents* web_contents =
@@ -877,7 +883,7 @@ AwContentBrowserClient::CreateLoginDelegate(
bool AwContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::WebContents::Getter wc_getter,
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool /* is_in_fenced_frame_tree */,
@@ -926,7 +932,7 @@ bool AwContentBrowserClient::HandleExternalProtocol(
FROM_HERE,
base::BindOnce(
[](mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver,
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
scoped_refptr<AwBrowserContextIoThreadHandle>
browser_context_handle) {
// Manages its own lifetime.
@@ -1126,8 +1132,7 @@ void AwContentBrowserClient::WillCreateURLLoaderFactory(
FROM_HERE,
base::BindOnce(
&AwProxyingURLLoaderFactory::CreateProxy, std::move(cookie_manager),
cookie_access_policy, isolation_info,
content::RenderFrameHost::kNoFrameTreeNodeId,
cookie_access_policy, isolation_info, content::FrameTreeNodeId(),
std::move(proxied_receiver), std::move(target_factory_remote),
std::nullopt /* security_options */,
aw_browser_context->service_worker_xrw_allowlist_matcher(),
@@ -96,7 +96,7 @@ void AwFieldTrials::OnVariationsSetupComplete() {
if (base::PathService::Get(base::DIR_ANDROID_APP_DATA, &metrics_dir)) {
InstantiatePersistentHistogramsWithFeaturesAndCleanup(metrics_dir);
} else {
NOTREACHED_IN_MIGRATION();
NOTREACHED();
}
}
@@ -236,6 +236,12 @@ void AwFieldTrials::RegisterFeatureOverrides(base::FeatureList* feature_list) {
// enabling site isolation. See crbug.com/356170748.
aw_feature_overrides.DisableFeature(blink::features::kPaintHoldingForIframes);
// Since Default Nav Transition does not support WebView yet, disable the
// LocalSurfaceId increment flag. TODO(crbug.com/361600214): Re-enable for
// WebView when we start introducing this feature.
aw_feature_overrides.DisableFeature(
blink::features::kIncrementLocalSurfaceIdForMainframeSameDocNavigation);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kDebugBsa)) {
// Feature parameters can only be set via a field trial.
const char kTrialName[] = "StudyDebugBsa";
@@ -272,9 +278,4 @@ void AwFieldTrials::RegisterFeatureOverrides(base::FeatureList* feature_list) {
// 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.
aw_feature_overrides.DisableFeature(blink::features::kPlzDedicatedWorker);
}
@@ -193,7 +193,7 @@ by a child template that "extends" this file.
android:zygotePreloadName="{{ zygote_preload_class }}"
{% if backup_key is defined %}
android:allowBackup="true"
android:backupAgent="org.chromium.chrome.browser.ChromeBackupAgent"
android:backupAgent="org.chromium.chrome.browser.backup.ChromeBackupAgent"
android:fullBackupOnly="false"
android:restoreAnyVersion="true"
{% else %}
@@ -1199,7 +1199,9 @@ by a child template that "extends" this file.
<property android:name="android.window.PROPERTY_ACTIVITY_STARTS_IN_IMMERSIVE_XR"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.XR" />
<category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />
</intent-filter>
</activity>
{% endif %}
@@ -1329,6 +1331,11 @@ by a child template that "extends" this file.
android:name="androidx.startup.InitializationProvider"
tools:node="remove">
</provider>
<!-- We call FirebaseApp.initializeApp() explicitly rather than relying on this hook for better control over when it happens. -->
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
tools:node="remove">
</provider>
<!-- The Play Core library added support for Play Asset Delivery (PAD), which is primarily
used by game apps to allow dynamic delivery of resource bundles. Since chrome does not
@@ -85,10 +85,13 @@
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/ui/find_bar/find_bar_state.h"
#include "chrome/browser/ui/find_bar/find_bar_state_factory.h"
#include "chrome/browser/user_annotations/user_annotations_service_factory.h"
#include "chrome/browser/webauthn/chrome_authenticator_request_delegate.h"
#include "chrome/browser/webdata_services/web_data_service_factory.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/url_constants.h"
#include "components/autofill/core/browser/address_data_manager.h"
#include "components/autofill/core/browser/payments_data_manager.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/strike_databases/strike_database.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
@@ -139,6 +142,7 @@
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_user_settings.h"
#include "components/tpcd/metadata/browser/manager.h"
#include "components/user_annotations/user_annotations_service.h"
#include "components/web_cache/browser/web_cache_manager.h"
#include "components/webrtc_logging/browser/log_cleanup.h"
#include "components/webrtc_logging/browser/text_log_list.h"
@@ -505,27 +509,6 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
prerender::NoStatePrefetchManager::CLEAR_PRERENDER_HISTORY);
}
// The saved Autofill profiles and credit cards can include the origin from
// which these profiles and credit cards were learned. These are a form of
// history, so clear them as well.
// TODO(dmurph): Support all backends with filter (crbug.com/113621).
scoped_refptr<autofill::AutofillWebDataService> web_data_service =
WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (web_data_service.get()) {
web_data_service->RemoveOriginURLsModifiedBetween(delete_begin_,
delete_end_);
// Ask for a call back when the above call is finished.
web_data_service->GetDBTaskRunner()->PostTaskAndReply(
FROM_HERE, base::DoNothing(),
CreateTaskCompletionClosure(TracingDataType::kAutofillOrigins));
autofill::PersonalDataManager* data_manager =
autofill::PersonalDataManagerFactory::GetForBrowserContext(profile_);
if (data_manager)
data_manager->Refresh();
}
base::ThreadPool::PostTaskAndReply(
FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()},
base::BindOnce(
@@ -745,7 +728,6 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
browsing_data::RemoveSiteSettingsData(delete_begin, delete_end,
host_content_settings_map_);
#if !BUILDFLAG(IS_ANDROID)
// The active permission does not have timestamps, so the all active grants
// will be revoked regardless of the time range because all the are expected
// to be recent.
@@ -753,7 +735,6 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
FileSystemAccessPermissionContextFactory::GetForProfile(profile_)) {
permission_context->RevokeAllActiveGrants();
}
#endif
auto* handler_registry =
ProtocolHandlerRegistryFactory::GetForBrowserContext(profile_);
@@ -883,15 +864,15 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
ContentSettingsType::NOTIFICATION_PERMISSION_REVIEW, delete_begin_,
delete_end_, website_settings_filter);
host_content_settings_map_->ClearSettingsForOneTypeWithPredicate(
ContentSettingsType::FILE_SYSTEM_LAST_PICKED_DIRECTORY, delete_begin,
delete_end, website_settings_filter);
#if !BUILDFLAG(IS_ANDROID)
host_content_settings_map_->ClearSettingsForOneTypeWithPredicate(
ContentSettingsType::INTENT_PICKER_DISPLAY, delete_begin_, delete_end_,
website_settings_filter);
host_content_settings_map_->ClearSettingsForOneTypeWithPredicate(
ContentSettingsType::FILE_SYSTEM_LAST_PICKED_DIRECTORY, delete_begin,
delete_end, website_settings_filter);
host_content_settings_map_->ClearSettingsForOneTypeWithPredicate(
ContentSettingsType::PRIVATE_NETWORK_GUARD, delete_begin_, delete_end_,
website_settings_filter);
@@ -1066,8 +1047,6 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
if (web_data_service.get()) {
web_data_service->RemoveFormElementsAddedBetween(delete_begin_,
delete_end_);
web_data_service->RemoveAutofillDataModifiedBetween(delete_begin_,
delete_end_);
// Clear out the Autofill StrikeDatabase in its entirety.
// TODO(crbug.com/40594007): Respect |delete_begin_| and |delete_end_| and
// only clear out entries whose last strikes were created in that
@@ -1077,15 +1056,22 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
if (strike_database)
strike_database->ClearAllStrikes();
autofill::PersonalDataManager* data_manager =
autofill::PersonalDataManagerFactory::GetForBrowserContext(profile_);
data_manager->address_data_manager().RemoveLocalProfilesModifiedBetween(
delete_begin_, delete_end_);
data_manager->payments_data_manager().RemoveLocalDataModifiedBetween(
delete_begin_, delete_end_);
// Ask for a call back when the above calls are finished.
web_data_service->GetDBTaskRunner()->PostTaskAndReply(
FROM_HERE, base::DoNothing(),
CreateTaskCompletionClosure(TracingDataType::kAutofillData));
autofill::PersonalDataManager* data_manager =
autofill::PersonalDataManagerFactory::GetForBrowserContext(profile_);
if (data_manager)
data_manager->Refresh();
}
if (auto* user_annotations_service =
UserAnnotationsServiceFactory::GetForProfile(profile_)) {
user_annotations_service->RemoveAnnotationsInRange(delete_begin_,
delete_end_);
}
}
@@ -44,7 +44,7 @@
#include "chrome/browser/ui/webui/location_internals/location_internals.mojom.h"
#include "chrome/browser/ui/webui/location_internals/location_internals_ui.h"
#include "chrome/browser/ui/webui/media/media_engagement_ui.h"
#include "chrome/browser/ui/webui/omnibox/omnibox.mojom.h"
#include "chrome/browser/ui/webui/omnibox/omnibox_internals.mojom.h"
#include "chrome/browser/ui/webui/omnibox/omnibox_ui.h"
#include "chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_internals_ui.h"
#include "chrome/browser/ui/webui/segmentation_internals/segmentation_internals_ui.h"
@@ -58,6 +58,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/services/speech/buildflags/buildflags.h"
#include "chromeos/ash/components/boca/boca_role_util.h"
#include "components/browsing_topics/mojom/browsing_topics_internals.mojom.h"
#include "components/commerce/content/browser/commerce_internals_ui.h"
#include "components/commerce/core/internals/mojom/commerce_internals.mojom.h"
@@ -72,6 +73,7 @@
#include "components/history_clusters/core/history_clusters_service.h"
#include "components/history_clusters/history_clusters_internals/webui/history_clusters_internals_ui.h"
#include "components/history_embeddings/history_embeddings_features.h"
#include "components/language_detection/content/common/language_detection.mojom.h"
#include "components/lens/lens_features.h"
#include "components/live_caption/caption_util.h"
#include "components/live_caption/pref_names.h"
@@ -83,7 +85,6 @@
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/reading_list/features/reading_list_switches.h"
#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"
@@ -139,7 +140,7 @@
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/android/dom_distiller/distiller_ui_handle_android.h"
#include "chrome/browser/facilitated_payments/payment_link_handler_factory.h"
#include "chrome/browser/facilitated_payments/payment_link_handler_binder.h"
#include "chrome/browser/offline_pages/android/offline_page_auto_fetcher.h"
#include "chrome/browser/ui/webui/feed_internals/feed_internals.mojom.h"
#include "chrome/browser/ui/webui/feed_internals/feed_internals_ui.h"
@@ -154,7 +155,6 @@
#include "chrome/browser/new_tab_page/modules/file_suggestion/file_suggestion.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"
#include "chrome/browser/new_tab_page/new_tab_page_util.h"
#include "chrome/browser/payments/payment_request_factory.h"
#include "chrome/browser/ui/webui/access_code_cast/access_code_cast.mojom.h"
@@ -169,7 +169,8 @@
#if !defined(OFFICIAL_BUILD)
#include "chrome/browser/ui/webui/new_tab_page/foo/foo.mojom.h" // nogncheck crbug.com/1125897
#endif
#include "chrome/browser/ui/lens/lens_untrusted_ui.h"
#include "chrome/browser/ui/lens/lens_overlay_untrusted_ui.h"
#include "chrome/browser/ui/lens/lens_side_panel_untrusted_ui.h"
#include "chrome/browser/ui/lens/search_bubble_ui.h"
#include "chrome/browser/ui/views/side_panel/customize_chrome/customize_chrome_utils.h"
#include "chrome/browser/ui/webui/commerce/product_specifications_ui.h"
@@ -201,6 +202,7 @@
#include "chrome/browser/ui/webui/tab_search/tab_search.mojom.h"
#include "chrome/browser/ui/webui/tab_search/tab_search_ui.h"
#include "chrome/browser/ui/webui/webui_gallery/webui_gallery_ui.h"
#include "chrome/browser/web_applications/web_install_service_impl.h"
#include "chrome/common/webui_url_constants.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/page_image_service/mojom/page_image_service.mojom.h"
@@ -302,6 +304,7 @@
#include "ash/webui/projector_app/untrusted_projector_ui.h"
#include "ash/webui/recorder_app_ui/mojom/recorder_app.mojom.h"
#include "ash/webui/recorder_app_ui/recorder_app_ui.h"
#include "ash/webui/sanitize_ui/mojom/sanitize_ui.mojom.h"
#include "ash/webui/sanitize_ui/sanitize_ui.h"
#include "ash/webui/scanning/mojom/scanning.mojom.h"
#include "ash/webui/scanning/scanning_ui.h"
@@ -321,7 +324,7 @@
#include "chrome/browser/ui/webui/ash/app_install/app_install_ui.h"
#include "chrome/browser/ui/webui/ash/audio/audio.mojom.h"
#include "chrome/browser/ui/webui/ash/audio/audio_ui.h"
#include "chrome/browser/ui/webui/ash/bluetooth_pairing_dialog.h"
#include "chrome/browser/ui/webui/ash/bluetooth/bluetooth_pairing_dialog.h"
#include "chrome/browser/ui/webui/ash/borealis_installer/borealis_installer.mojom.h"
#include "chrome/browser/ui/webui/ash/borealis_installer/borealis_installer_ui.h"
#include "chrome/browser/ui/webui/ash/cloud_upload/cloud_upload.mojom.h"
@@ -331,6 +334,7 @@
#include "chrome/browser/ui/webui/ash/crostini_installer/crostini_installer_ui.h"
#include "chrome/browser/ui/webui/ash/crostini_upgrader/crostini_upgrader.mojom.h"
#include "chrome/browser/ui/webui/ash/crostini_upgrader/crostini_upgrader_ui.h"
#include "chrome/browser/ui/webui/ash/curtain_ui/remote_maintenance_curtain_ui.h"
#include "chrome/browser/ui/webui/ash/emoji/emoji_picker.mojom.h"
#include "chrome/browser/ui/webui/ash/emoji/emoji_search_proxy.h"
#include "chrome/browser/ui/webui/ash/emoji/emoji_ui.h"
@@ -340,8 +344,8 @@
#include "chrome/browser/ui/webui/ash/enterprise_reporting/enterprise_reporting_ui.h"
#include "chrome/browser/ui/webui/ash/extended_updates/extended_updates.mojom.h"
#include "chrome/browser/ui/webui/ash/extended_updates/extended_updates_ui.h"
#include "chrome/browser/ui/webui/ash/internet_config_dialog.h"
#include "chrome/browser/ui/webui/ash/internet_detail_dialog.h"
#include "chrome/browser/ui/webui/ash/internet/internet_config_dialog.h"
#include "chrome/browser/ui/webui/ash/internet/internet_detail_dialog.h"
#include "chrome/browser/ui/webui/ash/launcher_internals/launcher_internals.mojom.h"
#include "chrome/browser/ui/webui/ash/launcher_internals/launcher_internals_ui.h"
#include "chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_ui.h"
@@ -351,15 +355,14 @@
#include "chrome/browser/ui/webui/ash/manage_mirrorsync/manage_mirrorsync.mojom.h"
#include "chrome/browser/ui/webui/ash/manage_mirrorsync/manage_mirrorsync_ui.h"
#include "chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_dialog.h"
#include "chrome/browser/ui/webui/ash/network_ui.h"
#include "chrome/browser/ui/webui/ash/network_ui/network_ui.h"
#include "chrome/browser/ui/webui/ash/office_fallback/office_fallback.mojom.h"
#include "chrome/browser/ui/webui/ash/office_fallback/office_fallback_ui.h"
#include "chrome/browser/ui/webui/ash/parent_access/parent_access_ui.h"
#include "chrome/browser/ui/webui/ash/parent_access/parent_access_ui.mojom.h"
#include "chrome/browser/ui/webui/ash/remote_maintenance_curtain_ui.h"
#include "chrome/browser/ui/webui/ash/sensor_info/sensor.mojom.h"
#include "chrome/browser/ui/webui/ash/sensor_info/sensor_info_ui.h"
#include "chrome/browser/ui/webui/ash/set_time_ui.h"
#include "chrome/browser/ui/webui/ash/set_time/set_time_ui.h"
#include "chrome/browser/ui/webui/ash/settings/os_settings_ui.h"
#include "chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_notification_handler.mojom.h"
#include "chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_parental_controls_handler.mojom.h"
@@ -369,8 +372,11 @@
#include "chrome/browser/ui/webui/ash/settings/pages/files/mojom/google_drive_handler.mojom.h"
#include "chrome/browser/ui/webui/ash/settings/pages/files/mojom/one_drive_handler.mojom.h"
#include "chrome/browser/ui/webui/ash/settings/pages/privacy/mojom/app_permission_handler.mojom.h"
#include "chrome/browser/ui/webui/ash/settings/pages/search/mojom/magic_boost_handler.mojom.h"
#include "chrome/browser/ui/webui/ash/settings/search/mojom/search.mojom.h"
#include "chrome/browser/ui/webui/ash/settings/search/mojom/user_action_recorder.mojom.h"
#include "chrome/browser/ui/webui/ash/skyvault/local_files_migration.mojom.h"
#include "chrome/browser/ui/webui/ash/skyvault/local_files_migration_ui.h"
#include "chrome/browser/ui/webui/ash/smb_shares/smb_credentials_dialog.h"
#include "chrome/browser/ui/webui/ash/smb_shares/smb_share_dialog.h"
#include "chrome/browser/ui/webui/ash/vm/vm.mojom.h"
@@ -396,6 +402,7 @@
#include "chromeos/ash/services/orca/public/mojom/orca_service.mojom.h"
#include "chromeos/components/print_management/mojom/printing_manager.mojom.h" // nogncheck
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/crosapi/mojom/structured_metrics_service.mojom.h"
#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" // nogncheck
#include "chromeos/services/network_health/public/mojom/network_diagnostics.mojom.h" // nogncheck
#include "chromeos/services/network_health/public/mojom/network_health.mojom.h" // nogncheck
@@ -490,6 +497,12 @@
#include "ui/webui/resources/cr_components/certificate_manager/certificate_manager_v2.mojom.h"
#endif // BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI)
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
#include "chrome/browser/ui/webui/signin/batch_upload/batch_upload.mojom.h"
#include "chrome/browser/ui/webui/signin/batch_upload_ui.h"
#include "components/signin/public/base/signin_switches.h"
#endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
namespace chrome::internal {
using content::RegisterWebUIControllerInterfaceBinder;
@@ -967,6 +980,8 @@ void PopulateChromeFrameBinders(
map->Add<translate::mojom::ContentTranslateDriver>(
base::BindRepeating(&translate::BindContentTranslateDriver));
map->Add<language_detection::mojom::ContentLanguageDetectionDriver>(
base::BindRepeating(&translate::BindContentLanguageDetectionDriver));
map->Add<blink::mojom::CredentialManager>(
base::BindRepeating(&ChromePasswordManagerClient::BindCredentialManager));
@@ -1005,6 +1020,11 @@ void PopulateChromeFrameBinders(
map->Add<payments::mojom::PaymentRequest>(
base::BindRepeating(&payments::CreatePaymentRequest));
}
if (base::FeatureList::IsEnabled(blink::features::kWebAppInstallation) &&
!render_frame_host->GetParentOrOuterDocument()) {
map->Add<blink::mojom::WebInstallService>(
base::BindRepeating(&web_app::WebInstallServiceImpl::CreateIfAllowed));
}
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
@@ -1108,7 +1128,7 @@ void PopulateChromeFrameBinders(
#if BUILDFLAG(IS_ANDROID)
if (base::FeatureList::IsEnabled(blink::features::kPaymentLinkDetection)) {
map->Add<payments::facilitated::mojom::PaymentLinkHandler>(
base::BindRepeating(&CreatePaymentLinkHandler));
base::BindRepeating(&BindPaymentLinkHandler));
}
#endif
}
@@ -1176,12 +1196,9 @@ void PopulateChromeWebUIFrameBinders(
#endif
#if !BUILDFLAG(IS_ANDROID)
if (search_engines::IsChoiceScreenFlagEnabled(
search_engines::ChoicePromo::kAny)) {
RegisterWebUIControllerInterfaceBinder<
search_engine_choice::mojom::PageHandlerFactory, SearchEngineChoiceUI>(
map);
}
RegisterWebUIControllerInterfaceBinder<
search_engine_choice::mojom::PageHandlerFactory, SearchEngineChoiceUI>(
map);
RegisterWebUIControllerInterfaceBinder<downloads::mojom::PageHandlerFactory,
DownloadsUI>(map);
@@ -1191,8 +1208,11 @@ void PopulateChromeWebUIFrameBinders(
NewTabPageThirdPartyUI>(map);
if (lens::features::IsLensOverlayEnabled()) {
RegisterWebUIControllerInterfaceBinder<
lens::mojom::LensSidePanelPageHandlerFactory,
lens::LensSidePanelUntrustedUI>(map);
RegisterWebUIControllerInterfaceBinder<lens::mojom::LensPageHandlerFactory,
lens::LensUntrustedUI>(map);
lens::LensOverlayUntrustedUI>(map);
}
if (lens::features::IsLensOverlayEnabled() &&
@@ -1314,11 +1334,6 @@ void PopulateChromeWebUIFrameBinders(
file_suggestion::mojom::FileSuggestionHandler, NewTabPageUI>(map);
}
if (base::FeatureList::IsEnabled(ntp_features::kNtpTabResumptionModule)) {
RegisterWebUIControllerInterfaceBinder<
ntp::tab_resumption::mojom::PageHandler, NewTabPageUI>(map);
}
if (base::FeatureList::IsEnabled(
ntp_features::kNtpMostRelevantTabResumptionModule)) {
RegisterWebUIControllerInterfaceBinder<
@@ -1688,6 +1703,13 @@ void PopulateChromeWebUIFrameBinders(
ash::settings::OSSettingsUI>(map);
}
if (chromeos::features::IsOrcaEnabled() ||
chromeos::features::IsMahiEnabled()) {
RegisterWebUIControllerInterfaceBinder<
ash::settings::magic_boost_handler::mojom::PageHandlerFactory,
ash::settings::OSSettingsUI>(map);
}
RegisterWebUIControllerInterfaceBinder<audio::mojom::PageHandlerFactory,
ash::AudioUI>(map);
@@ -1747,6 +1769,13 @@ void PopulateChromeWebUIFrameBinders(
new_window_proxy::mojom::NewWindowProxy, ash::EmojiUI>(map);
RegisterWebUIControllerInterfaceBinder<seal::mojom::SealService,
ash::EmojiUI>(map);
if (base::FeatureList::IsEnabled(features::kSkyVault) &&
base::FeatureList::IsEnabled(features::kSkyVaultV2)) {
RegisterWebUIControllerInterfaceBinder<
policy::local_user_files::mojom::PageHandlerFactory,
policy::local_user_files::LocalFilesMigrationUI>(map);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
@@ -1836,12 +1865,24 @@ void PopulateChromeWebUIFrameBinders(
}
#endif
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
if (base::FeatureList::IsEnabled(switches::kBatchUploadDesktop)) {
RegisterWebUIControllerInterfaceBinder<
batch_upload::mojom::PageHandlerFactory, BatchUploadUI>(map);
}
#endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (ash::features::IsFocusModeEnabled()) {
RegisterWebUIControllerInterfaceBinder<
ash::focus_mode::mojom::TrackProvider, ash::FocusModeUI>(map);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS_ASH)
RegisterWebUIControllerInterfaceBinder<
ash::sanitize_ui::mojom::SettingsResetter, ash::SanitizeDialogUI>(map);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}
void PopulateChromeWebUIFrameInterfaceBrokers(
@@ -1862,7 +1903,8 @@ void PopulateChromeWebUIFrameInterfaceBrokers(
#if BUILDFLAG(IS_CHROMEOS_ASH)
registry.ForWebUI<ash::RecorderAppUI>()
.Add<ash::recorder_app::mojom::PageHandler>()
.Add<color_change_listener::mojom::PageHandler>();
.Add<color_change_listener::mojom::PageHandler>()
.Add<crosapi::mojom::StructuredMetricsService>();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS_ASH)
@@ -1888,7 +1930,7 @@ void PopulateChromeWebUIFrameInterfaceBrokers(
// --- Section 2: chrome-untrusted:// WebUIs:
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (ash::features::IsBocaEnabled()) {
if (ash::boca_util::IsEnabled()) {
registry.ForWebUI<ash::boca::BocaUI>()
.Add<ash::boca::mojom::BocaPageHandlerFactory>()
.Add<color_change_listener::mojom::PageHandler>();
@@ -1932,11 +1974,17 @@ void PopulateChromeWebUIFrameInterfaceBrokers(
#endif // BUILDFLAG(ENABLE_COMPOSE)
#if !BUILDFLAG(IS_ANDROID)
if (lens::features::IsLensOverlayEnabled()) {
registry.ForWebUI<lens::LensUntrustedUI>()
.Add<lens::mojom::LensPageHandlerFactory>()
registry.ForWebUI<lens::LensSidePanelUntrustedUI>()
.Add<lens::mojom::LensSidePanelPageHandlerFactory>()
.Add<searchbox::mojom::PageHandler>()
.Add<color_change_listener::mojom::PageHandler>();
}
if (lens::features::IsLensOverlayEnabled()) {
registry.ForWebUI<lens::LensOverlayUntrustedUI>()
.Add<lens::mojom::LensPageHandlerFactory>()
.Add<color_change_listener::mojom::PageHandler>()
.Add<searchbox::mojom::PageHandler>();
}
if (lens::features::IsLensOverlaySearchBubbleEnabled()) {
registry.ForWebUI<lens::SearchBubbleUI>()
.Add<lens::mojom::SearchBubblePageHandlerFactory>()
@@ -1956,7 +2004,8 @@ void PopulateChromeWebUIFrameInterfaceBrokers(
if (base::FeatureList::IsEnabled(
data_sharing::features::kDataSharingFeature)) {
registry.ForWebUI<DataSharingUI>()
.Add<data_sharing::mojom::PageHandlerFactory>();
.Add<data_sharing::mojom::PageHandlerFactory>()
.Add<color_change_listener::mojom::PageHandler>();
}
#endif // !BUILDFLAG(IS_ANDROID)
@@ -51,6 +51,7 @@
#include "chrome/browser/after_startup_task_utils.h"
#include "chrome/browser/ai/ai_manager_keyed_service_factory.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/bluetooth/chrome_bluetooth_delegate.h"
#include "chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.h"
#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/browser_features.h"
@@ -277,7 +278,6 @@
#include "components/payments/content/payment_request_display_manager.h"
#include "components/pdf/common/pdf_util.h"
#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "components/permissions/bluetooth_delegate_impl.h"
#include "components/permissions/permission_context_base.h"
#include "components/policy/content/policy_blocklist_navigation_throttle.h"
#include "components/policy/content/policy_blocklist_service.h"
@@ -370,6 +370,7 @@
#include "media/media_buildflags.h"
#include "media/mojo/buildflags.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/data_url.h"
#include "net/base/features.h"
#include "net/cookies/site_for_cookies.h"
#include "net/ssl/client_cert_store.h"
@@ -447,11 +448,13 @@
#include "ash/webui/help_app_ui/url_constants.h"
#include "ash/webui/media_app_ui/url_constants.h"
#include "ash/webui/print_management/url_constants.h"
#include "ash/webui/recorder_app_ui/url_constants.h"
#include "ash/webui/scanning/url_constants.h"
#include "ash/webui/shortcut_customization_ui/url_constants.h"
#include "chrome/app/chrome_crash_reporter_client.h"
#include "chrome/browser/ash/arc/fileapi/arc_content_file_system_backend_delegate.h"
#include "chrome/browser/ash/arc/fileapi/arc_documents_provider_backend_delegate.h"
#include "chrome/browser/ash/boca/on_task/on_task_locked_session_navigation_throttle.h"
#include "chrome/browser/ash/chrome_browser_main_parts_ash.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/browser/ash/drive/fileapi/drivefs_file_system_backend_delegate.h"
@@ -460,7 +463,6 @@
#include "chrome/browser/ash/fileapi/external_file_url_loader_factory.h"
#include "chrome/browser/ash/fileapi/file_system_backend.h"
#include "chrome/browser/ash/fileapi/mtp_file_system_backend_delegate.h"
#include "chrome/browser/ash/http_auth_dialog.h"
#include "chrome/browser/ash/login/signin/merge_session_navigation_throttle.h"
#include "chrome/browser/ash/login/signin/merge_session_throttling_utils.h"
#include "chrome/browser/ash/login/signin_partition_manager.h"
@@ -470,16 +472,17 @@
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/ash/smb_client/fileapi/smbfs_file_system_backend_delegate.h"
#include "chrome/browser/ash/system/input_device_settings.h"
#include "chrome/browser/ash/url_handler/url_handler.h"
#include "chrome/browser/chromeos/app_mode/kiosk_settings_navigation_throttle.h"
#include "chrome/browser/speech/tts_chromeos.h"
#include "chrome/browser/speech/tts_controller_delegate_impl.h"
#include "chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.h"
#include "chrome/browser/ui/ash/main_extra_parts/chrome_browser_main_extra_parts_ash.h"
#include "chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/webui/ash/kerberos/kerberos_in_browser_dialog.h"
#include "chrome/common/webui_url_constants.h"
#include "chromeos/ash/components/boca/boca_role_util.h"
#include "chromeos/ash/components/browser_context_helper/browser_context_types.h"
#include "chromeos/ash/components/http_auth_dialog/http_auth_dialog.h"
#include "chromeos/ash/components/settings/cros_settings.h"
#include "chromeos/ash/services/network_health/public/cpp/network_health_helper.h"
#include "components/user_manager/user.h"
@@ -662,26 +665,14 @@
#include "components/nacl/common/nacl_switches.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/apps/platform_apps/platform_app_navigation_redirector.h"
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/user_script_listener.h"
#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "content/public/browser/site_isolation_policy.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/api/web_request/web_request_proxying_webtransport.h"
#include "extensions/browser/extension_navigation_throttle.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#include "extensions/browser/extension_web_contents_observer.h"
#include "extensions/browser/process_map.h"
#include "extensions/browser/script_injection_tracker.h"
#include "extensions/common/constants.h"
@@ -690,8 +681,29 @@
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/user_script_listener.h"
#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "content/public/browser/site_isolation_policy.h"
#include "extensions/browser/api/web_request/web_request_proxying_webtransport.h"
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_GUEST_VIEW)
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#endif
#if BUILDFLAG(ENABLE_PLATFORM_APPS)
#include "chrome/browser/apps/platform_apps/platform_app_navigation_redirector.h"
#endif
#if BUILDFLAG(ENABLE_PLUGINS)
#include "chrome/browser/plugins/chrome_content_browser_client_plugins_part.h"
#include "chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h"
@@ -702,9 +714,6 @@
#include "components/pdf/browser/pdf_navigation_throttle.h"
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
#include "components/pdf/common/constants.h"
#if BUILDFLAG(IS_WIN)
#include "pdf/pdf_features.h"
#endif // BUILDFLAG(IS_WIN)
#endif // BUILDFLAG(ENABLE_PDF)
@@ -810,7 +819,7 @@ using content::WebContents;
using content::PosixFileDescriptorInfo;
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
using extensions::APIPermission;
using extensions::ChromeContentBrowserClientExtensionsPart;
using extensions::Extension;
@@ -1046,7 +1055,7 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
GetIOThreadApplicationLocale() = locale;
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
// Returns true if there is is an extension matching `url` in
// `render_process_id` with `permission`.
@@ -1081,7 +1090,7 @@ bool IsExtensionIdAllowedToUseIsolatedContext(std::string_view extension_id) {
return base::Contains(kAllowedIsolatedContextExtensionIds, extension_id);
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
mojo::PendingRemote<prerender::mojom::PrerenderCanceler> GetPrerenderCanceler(
base::OnceCallback<content::WebContents*()> wc_getter) {
@@ -1558,7 +1567,7 @@ ChromeContentBrowserClient::ChromeContentBrowserClient() {
std::make_unique<ChromeContentBrowserClientWebUiPart>());
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extra_parts_.push_back(
std::make_unique<ChromeContentBrowserClientExtensionsPart>());
#endif
@@ -1589,6 +1598,8 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
registry->RegisterBooleanPref(prefs::kSitePerProcess, false);
registry->RegisterBooleanPref(prefs::kTabFreezingEnabled, true);
registry->RegisterIntegerPref(prefs::kSCTAuditingHashdanceReportCount, 0);
registry->RegisterBooleanPref(prefs::kDataURLWhitespacePreservationEnabled,
true);
#if BUILDFLAG(IS_CHROMEOS)
registry->RegisterBooleanPref(prefs::kNativeClientForceAllowed, false);
#endif // BUILDFLAG(IS_CHROMEOS)
@@ -1934,14 +1945,16 @@ ChromeContentBrowserClient::GetStoragePartitionConfigForSite(
//
// In general, those use cases aren't considered part of the user's normal
// browsing activity.
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (site.SchemeIs(extensions::kExtensionScheme)) {
// The host in an extension site URL is the extension_id.
CHECK(site.has_host());
return extensions::util::GetStoragePartitionConfigForExtensionId(
site.host(), browser_context);
}
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
if (content::SiteIsolationPolicy::ShouldUrlUseApplicationIsolationLevel(
browser_context, site)) {
CHECK(site.SchemeIs(chrome::kIsolatedAppScheme));
@@ -1960,10 +1973,6 @@ ChromeContentBrowserClient::GetStoragePartitionConfigForSite(
std::unique_ptr<content::WebContentsViewDelegate>
ChromeContentBrowserClient::GetWebContentsViewDelegate(
content::WebContents* web_contents) {
if (auto* registry =
performance_manager::PerformanceManagerRegistry::GetInstance()) {
registry->MaybeCreatePageNodeForWebContents(web_contents);
}
return CreateWebContentsViewDelegate(web_contents);
}
@@ -2041,7 +2050,7 @@ GURL ChromeContentBrowserClient::GetEffectiveURL(
return search::GetEffectiveURLForInstant(url, profile);
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
profile))
return url;
@@ -2062,7 +2071,7 @@ bool ChromeContentBrowserClient::
const GURL& destination_url) {
DCHECK(browser_context);
DCHECK(candidate_site_instance);
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
browser_context)) {
return true;
@@ -2096,7 +2105,7 @@ bool ChromeContentBrowserClient::ShouldUseProcessPerSite(
return true;
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (ChromeContentBrowserClientExtensionsPart::ShouldUseProcessPerSite(
profile, site_url))
return true;
@@ -2169,7 +2178,7 @@ ChromeContentBrowserClient::ShouldUseSpareRenderProcessHost(
}
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (!ChromeContentBrowserClientExtensionsPart::
ShouldUseSpareRenderProcessHost(profile, site_url)) {
return SpareProcessRefusedByEmbedderReason::ExtensionProcess;
@@ -2182,7 +2191,7 @@ bool ChromeContentBrowserClient::DoesSiteRequireDedicatedProcess(
content::BrowserContext* browser_context,
const GURL& effective_site_url) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess(
browser_context, effective_site_url)) {
return true;
@@ -2197,7 +2206,7 @@ bool ChromeContentBrowserClient::
const GURL& precursor,
const GURL& url) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (!ChromeContentBrowserClientExtensionsPart::
ShouldAllowCrossProcessSandboxedFrameForPrecursor(browser_context,
precursor, url)) {
@@ -2235,7 +2244,7 @@ bool ChromeContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
// a list of available accounts on the NTP (chrome://new-tab-page), etc.
if (is_embedded_origin_secure && scheme == content::kChromeUIScheme)
return true;
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return scheme == extensions::kExtensionScheme;
#else
return false;
@@ -2283,7 +2292,7 @@ void ChromeContentBrowserClient::OverrideURLLoaderFactoryParams(
factory_params->provide_loading_state_updates = false;
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
browser_context)) {
return;
@@ -2307,7 +2316,7 @@ void ChromeContentBrowserClient::GetAdditionalViewSourceSchemes(
std::vector<std::string>* additional_schemes) {
GetAdditionalWebUISchemes(additional_schemes);
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
additional_schemes->push_back(extensions::kExtensionScheme);
#endif
}
@@ -2318,7 +2327,7 @@ ChromeContentBrowserClient::DetermineAddressSpaceFromURL(const GURL& url) {
return network::mojom::IPAddressSpace::kLocal;
if (url.SchemeIs(dom_distiller::kDomDistillerScheme))
return network::mojom::IPAddressSpace::kPublic;
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (url.SchemeIs(extensions::kExtensionScheme))
return network::mojom::IPAddressSpace::kLocal;
#endif
@@ -2355,7 +2364,7 @@ bool ChromeContentBrowserClient::HasCustomSchemeHandler(
bool ChromeContentBrowserClient::CanCommitURL(
content::RenderProcessHost* process_host,
const GURL& url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return ChromeContentBrowserClientExtensionsPart::CanCommitURL(process_host,
url);
#else
@@ -2433,7 +2442,7 @@ bool ChromeContentBrowserClient::IsSuitableHost(
}
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return ChromeContentBrowserClientExtensionsPart::IsSuitableHost(
profile, process_host, site_url);
#else
@@ -2458,7 +2467,7 @@ bool ChromeContentBrowserClient::MayReuseHost(
}
size_t ChromeContentBrowserClient::GetProcessCountToIgnoreForLimit() {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return ChromeContentBrowserClientExtensionsPart::
GetProcessCountToIgnoreForLimit();
#else
@@ -2509,7 +2518,7 @@ bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost(
bool ChromeContentBrowserClient::ShouldEmbeddedFramesTryToReuseExistingProcess(
content::RenderFrameHost* outermost_main_frame) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return ChromeContentBrowserClientExtensionsPart::
ShouldEmbeddedFramesTryToReuseExistingProcess(outermost_main_frame);
#else
@@ -2547,7 +2556,7 @@ bool ChromeContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
SiteInstance* site_instance,
const GURL& current_effective_url,
const GURL& destination_effective_url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return ChromeContentBrowserClientExtensionsPart::
ShouldSwapBrowsingInstancesForNavigation(
site_instance, current_effective_url, destination_effective_url);
@@ -2570,7 +2579,7 @@ ChromeContentBrowserClient::GetOriginsRequiringDedicatedProcess() {
isolated_origin_list.push_back(GaiaUrls::GetInstance()->gaia_origin());
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
auto origins_from_extensions = ChromeContentBrowserClientExtensionsPart::
GetOriginsRequiringDedicatedProcess();
std::move(std::begin(origins_from_extensions),
@@ -2646,7 +2655,7 @@ bool ChromeContentBrowserClient::IsIsolatedContextAllowedForUrl(
}
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
browser_context)) {
return false;
@@ -3099,6 +3108,13 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
command_line, GetProfilerProcessType(*command_line),
child_process_id);
}
// Enterprise policies may set the local state. `g_browser_process` is only
// available for non-zygote processes.
if (!g_browser_process->local_state()->GetBoolean(
prefs::kDataURLWhitespacePreservationEnabled)) {
command_line->AppendSwitch(net::kRemoveWhitespaceForDataURLs);
}
}
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
@@ -3173,7 +3189,7 @@ ChromeContentBrowserClient::AllowServiceWorker(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
GURL first_party_url = top_frame_origin ? top_frame_origin->GetURL() : GURL();
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
// Check if this is an extension-related service worker, and, if so, if it's
// allowed (this can return false if, e.g., the extension is disabled).
// If it's not allowed, return immediately. We deliberately do *not* report
@@ -3200,7 +3216,7 @@ bool ChromeContentBrowserClient::MayDeleteServiceWorkerRegistration(
DCHECK(browser_context);
DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (!ChromeContentBrowserClientExtensionsPart::
MayDeleteServiceWorkerRegistration(scope, browser_context)) {
return false;
@@ -3216,7 +3232,7 @@ bool ChromeContentBrowserClient::ShouldTryToUpdateServiceWorkerRegistration(
DCHECK(browser_context);
DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (!ChromeContentBrowserClientExtensionsPart::
ShouldTryToUpdateServiceWorkerRegistration(scope, browser_context)) {
return false;
@@ -3250,7 +3266,7 @@ bool ChromeContentBrowserClient::AllowSharedWorker(
bool ChromeContentBrowserClient::DoesSchemeAllowCrossOriginSharedWorker(
const std::string& scheme) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
// Extensions are allowed to start cross-origin shared workers.
if (scheme == extensions::kExtensionScheme)
return true;
@@ -3307,14 +3323,14 @@ void ChromeContentBrowserClient::AllowWorkerFileSystem(
Profile::FromBrowserContext(browser_context));
bool allow =
embedder_support::AllowWorkerFileSystem(url, {}, cookie_settings.get());
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_GUEST_VIEW)
GuestPermissionRequestHelper(url, render_frames, std::move(callback), allow);
#else
FileSystemAccessed(url, render_frames, std::move(callback), allow);
#endif
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_GUEST_VIEW)
void ChromeContentBrowserClient::GuestPermissionRequestHelper(
const GURL& url,
const std::vector<content::GlobalRenderFrameHostId>& render_frames,
@@ -3511,7 +3527,10 @@ bool ChromeContentBrowserClient::IsPrivacySandboxReportingDestinationAttested(
void ChromeContentBrowserClient::OnAuctionComplete(
content::RenderFrameHost* render_frame_host,
std::optional<content::InterestGroupManager::InterestGroupDataKey>
winner_data_key) {
winner_data_key,
bool is_server_auction,
bool is_on_device_auction,
content::AuctionResult result) {
if (winner_data_key) {
content_settings::PageSpecificContentSettings::BrowsingDataAccessed(
render_frame_host, winner_data_key.value(),
@@ -3521,7 +3540,8 @@ void ChromeContentBrowserClient::OnAuctionComplete(
if (auto* observer =
page_load_metrics::MetricsWebContentsObserver::FromWebContents(
WebContents::FromRenderFrameHost(render_frame_host))) {
observer->OnAdAuctionComplete(render_frame_host);
observer->OnAdAuctionComplete(render_frame_host, is_server_auction,
is_on_device_auction, result);
}
}
@@ -3912,11 +3932,21 @@ bool ShouldDisableForcedColorsForWebContent(content::WebContents* contents,
return false;
}
bool IsForcedColorsEnabledForWebContent(content::WebContents* contents,
const ui::NativeTheme* native_theme) {
return native_theme->InForcedColorsMode() &&
!ShouldDisableForcedColorsForWebContent(contents,
/*in_forced_colors=*/true);
bool UpdateForcedColorsForWebContent(WebPreferences* web_prefs,
WebContents* web_contents,
const ui::NativeTheme* native_theme) {
auto old_in_forced_colors = web_prefs->in_forced_colors;
auto old_forced_colors_disabled = web_prefs->is_forced_colors_disabled;
bool in_forced_colors = native_theme->InForcedColorsMode();
bool should_disable_forced_colors =
ShouldDisableForcedColorsForWebContent(web_contents, in_forced_colors);
web_prefs->in_forced_colors =
in_forced_colors && !should_disable_forced_colors;
web_prefs->is_forced_colors_disabled = should_disable_forced_colors;
return old_in_forced_colors != web_prefs->in_forced_colors ||
old_forced_colors_disabled != web_prefs->is_forced_colors_disabled;
}
#if !BUILDFLAG(IS_ANDROID)
@@ -4183,9 +4213,9 @@ base::OnceClosure ChromeContentBrowserClient::SelectClientCertificate(
!matching_certificates.empty() ? std::move(matching_certificates)
: std::move(nonmatching_certificates);
return chrome::ShowSSLClientCertificateSelector(
web_contents, cert_request_info, std::move(client_cert_choices),
std::move(delegate));
return ShowSSLClientCertificateSelector(web_contents, cert_request_info,
std::move(client_cert_choices),
std::move(delegate));
}
content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() {
@@ -4222,17 +4252,10 @@ bool ChromeContentBrowserClient::CanCreateWindow(
DCHECK(profile);
*no_javascript_access = false;
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Try to intercept the request and open the URL with Lacros.
if (ash::TryOpenUrl(target_url, disposition)) {
return false;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
// If the opener is trying to create a background window but doesn't have
// the appropriate permission, fail the attempt.
if (container_type == content::mojom::WindowContainerType::BACKGROUND) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
auto* process_map = extensions::ProcessMap::Get(profile);
auto* registry = extensions::ExtensionRegistry::Get(profile);
if (!URLHasExtensionPermission(process_map, registry, opener_url,
@@ -4256,12 +4279,14 @@ bool ChromeContentBrowserClient::CanCreateWindow(
return true;
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_GUEST_VIEW)
if (extensions::WebViewRendererState::GetInstance()->IsGuest(
opener->GetProcess()->GetID())) {
return true;
}
#endif
#if BUILDFLAG(ENABLE_PLATFORM_APPS)
if (target_url.SchemeIs(extensions::kExtensionScheme)) {
// Intentionally duplicating |registry| code from above because we want to
// reduce calls to retrieve them as this function is a SYNC IPC handler.
@@ -4591,11 +4616,7 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
break;
}
web_prefs->in_forced_colors =
IsForcedColorsEnabledForWebContent(web_contents, GetWebTheme());
web_prefs->is_forced_colors_disabled = ShouldDisableForcedColorsForWebContent(
web_contents, GetWebTheme()->InForcedColorsMode());
UpdateForcedColorsForWebContent(web_prefs, web_contents, GetWebTheme());
UpdatePreferredColorScheme(
web_prefs,
@@ -4683,16 +4704,8 @@ bool ChromeContentBrowserClient::OverrideWebPreferencesAfterNavigation(
parts->OverrideWebPreferencesAfterNavigation(web_contents, web_prefs);
}
const bool in_forced_colors =
IsForcedColorsEnabledForWebContent(web_contents, GetWebTheme());
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, GetWebTheme()->InForcedColorsMode());
prefs_changed |=
(web_prefs->is_forced_colors_disabled != is_forced_colors_disabled);
web_prefs->is_forced_colors_disabled = is_forced_colors_disabled;
UpdateForcedColorsForWebContent(web_prefs, web_contents, GetWebTheme());
prefs_changed |=
UpdatePreferredColorScheme(web_prefs, web_contents->GetLastCommittedURL(),
@@ -5064,6 +5077,7 @@ std::wstring ChromeContentBrowserClient::GetAppContainerSidForSandboxType(
case sandbox::mojom::Sandbox::kPrintCompositor:
case sandbox::mojom::Sandbox::kAudio:
case sandbox::mojom::Sandbox::kScreenAI:
case sandbox::mojom::Sandbox::kVideoEffects:
case sandbox::mojom::Sandbox::kSpeechRecognition:
case sandbox::mojom::Sandbox::kPdfConversion:
case sandbox::mojom::Sandbox::kService:
@@ -5166,6 +5180,7 @@ bool ChromeContentBrowserClient::PreSpawnChild(
#if !BUILDFLAG(IS_ANDROID)
case sandbox::mojom::Sandbox::kScreenAI:
#endif
case sandbox::mojom::Sandbox::kVideoEffects:
case sandbox::mojom::Sandbox::kAudio:
case sandbox::mojom::Sandbox::kOnDeviceModelExecution:
case sandbox::mojom::Sandbox::kSpeechRecognition:
@@ -5220,15 +5235,6 @@ bool ChromeContentBrowserClient::IsRendererCodeIntegrityEnabled() {
local_state->GetBoolean(prefs::kRendererCodeIntegrityEnabled);
}
bool ChromeContentBrowserClient::IsPdfFontProxyEnabled() {
#if BUILDFLAG(ENABLE_PDF)
return base::FeatureList::IsEnabled(
chrome_pdf::features::kWinPdfUseFontProxy);
#else
return false;
#endif
}
// Note: Only use sparingly to add Chrome specific sandbox functionality here.
// Other code should reside in the content layer. Changes to this function
// should be reviewed by the security team.
@@ -5387,7 +5393,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
&throttles);
#endif // BUILDFLAG(DFMIFY_DEV_UI)
#elif BUILDFLAG(ENABLE_EXTENSIONS)
#elif BUILDFLAG(ENABLE_PLATFORM_APPS)
// Redirect some navigations to apps that have registered matching URL
// handlers ('url_handlers' in the manifest).
MaybeAddThrottle(
@@ -5587,6 +5593,12 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
MaybeAddThrottle(
chromeos::KioskSettingsNavigationThrottle::MaybeCreateThrottleFor(handle),
&throttles);
if (ash::boca_util::IsEnabled()) {
MaybeAddThrottle(
ash::OnTaskLockedSessionNavigationThrottle::MaybeCreateThrottleFor(
handle),
&throttles);
}
#endif
#if BUILDFLAG(IS_MAC)
@@ -5951,7 +5963,7 @@ ChromeContentBrowserClient::MaybeCreateSafeBrowsingURLLoaderThrottle(
const network::ResourceRequest& request,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
std::optional<int64_t> navigation_id,
Profile* profile) {
bool matches_enterprise_allowlist = safe_browsing::IsURLAllowlistedByPolicy(
@@ -6016,10 +6028,10 @@ ChromeContentBrowserClient::MaybeCreateSafeBrowsingURLLoaderThrottle(
#if BUILDFLAG(IS_ANDROID)
std::tuple<std::string /*client_data_header*/, bool /*is_custom_tab*/>
GetClientDataHeader(int frame_tree_node_id) {
GetClientDataHeader(content::FrameTreeNodeId frame_tree_node_id) {
std::string client_data_header;
bool is_custom_tab = false;
if (frame_tree_node_id != content::RenderFrameHost::kNoFrameTreeNodeId) {
if (frame_tree_node_id) {
auto* web_contents = WebContents::FromFrameTreeNodeId(frame_tree_node_id);
// Could be null if the FrameTreeNode's RenderFrameHost is shutting down.
if (web_contents) {
@@ -6092,7 +6104,7 @@ ChromeContentBrowserClient::CreateURLLoaderThrottles(
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
std::optional<int64_t> navigation_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -6186,7 +6198,7 @@ ChromeContentBrowserClient::CreateURLLoaderThrottlesForKeepAlive(
const network::ResourceRequest& request,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
int frame_tree_node_id) {
content::FrameTreeNodeId frame_tree_node_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> result;
@@ -6224,25 +6236,29 @@ ChromeContentBrowserClient::CreateURLLoaderThrottlesForKeepAlive(
mojo::PendingRemote<network::mojom::URLLoaderFactory>
ChromeContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory(
const std::string& scheme,
int frame_tree_node_id) {
#if BUILDFLAG(ENABLE_EXTENSIONS) || BUILDFLAG(IS_CHROMEOS_ASH) || \
content::FrameTreeNodeId frame_tree_node_id) {
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE) || BUILDFLAG(IS_CHROMEOS_ASH) || \
!BUILDFLAG(IS_ANDROID)
content::WebContents* web_contents =
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
content::BrowserContext* browser_context = web_contents->GetBrowserContext();
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (scheme == extensions::kExtensionScheme) {
if (!ChromeContentBrowserClientExtensionsPart::
AreExtensionsDisabledForProfile(browser_context)) {
bool is_guest = false;
#if BUILDFLAG(ENABLE_GUEST_VIEW)
is_guest = !!extensions::WebViewGuest::FromWebContents(web_contents);
#endif
return extensions::CreateExtensionNavigationURLLoaderFactory(
browser_context,
!!extensions::WebViewGuest::FromWebContents(web_contents));
browser_context, is_guest);
}
return {};
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
Profile* profile = Profile::FromBrowserContext(browser_context);
// KeyedServices could be disabled based on the profile type, e.g. System
@@ -6268,7 +6284,7 @@ ChromeContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory(
return {};
}
#endif // !BUILDFLAG(IS_ANDROID)
#endif // BUILDFLAG(ENABLE_EXTENSIONS) || BUILDFLAG(IS_CHROMEOS_ASH) ||
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE) || BUILDFLAG(IS_CHROMEOS_ASH) ||
// !BUILDFLAG(IS_ANDROID)
return {};
@@ -6291,7 +6307,7 @@ void ChromeContentBrowserClient::
}
#endif // !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
DCHECK(!ChromeContentBrowserClientExtensionsPart::
AreExtensionsDisabledForProfile(browser_context));
@@ -6299,7 +6315,7 @@ void ChromeContentBrowserClient::
extensions::kExtensionScheme,
extensions::CreateExtensionWorkerMainResourceURLLoaderFactory(
browser_context));
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
}
void ChromeContentBrowserClient::
@@ -6319,7 +6335,7 @@ void ChromeContentBrowserClient::
}
#endif // !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
browser_context)) {
return;
@@ -6329,7 +6345,7 @@ void ChromeContentBrowserClient::
extensions::kExtensionScheme,
extensions::CreateExtensionServiceWorkerScriptURLLoaderFactory(
browser_context));
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
}
namespace {
@@ -6451,13 +6467,17 @@ bool IsSystemFeatureURLDisabled(const GURL& url) {
return IsSystemFeatureDisabled(policy::SystemFeature::kKeyShortcuts);
}
if (url.DomainIs(ash::kChromeUIRecorderAppHost)) {
return IsSystemFeatureDisabled(policy::SystemFeature::kRecorder);
}
#endif
return false;
}
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
void InitializeFileURLLoaderFactoryForExtension(
int render_process_id,
content::BrowserContext* browser_context,
@@ -6475,7 +6495,9 @@ void InitializeFileURLLoaderFactoryForExtension(
SpecialAccessFileURLLoaderFactory::Create(render_process_id));
}
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#if BUILDFLAG(ENABLE_EXTENSIONS)
void AddChromeSchemeFactories(
int render_process_id,
content::RenderFrameHost* frame_host,
@@ -6501,11 +6523,10 @@ void AddChromeSchemeFactories(
/*allowed_webui_hosts=*/base::flat_set<std::string>()));
}
extensions::ChromeExtensionWebContentsObserver* web_observer =
extensions::ChromeExtensionWebContentsObserver::FromWebContents(
web_contents);
extensions::ExtensionWebContentsObserver* web_observer =
extensions::ExtensionWebContentsObserver::GetForWebContents(web_contents);
// There is nothing to do if no ChromeExtensionWebContentsObserver is attached
// There is nothing to do if no ExtensionWebContentsObserver is attached
// to the |web_contents| or no enabled extension exists.
if (!web_observer || !extension)
return;
@@ -6592,7 +6613,7 @@ void ChromeContentBrowserClient::
}
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
content::BrowserContext* browser_context =
content::RenderProcessHost::FromID(render_process_id)
->GetBrowserContext();
@@ -6624,6 +6645,7 @@ void ChromeContentBrowserClient::
render_process_id, browser_context, extension, factories);
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
// This logic should match
// ChromeExtensionWebContentsObserver::RenderFrameCreated.
if (web_contents) {
@@ -6631,6 +6653,7 @@ void ChromeContentBrowserClient::
extension, factories);
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
}
void ChromeContentBrowserClient::WillCreateURLLoaderFactory(
@@ -6649,7 +6672,7 @@ void ChromeContentBrowserClient::WillCreateURLLoaderFactory(
bool* disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
auto* web_request_api =
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
browser_context);
@@ -6694,7 +6717,7 @@ void ChromeContentBrowserClient::WillCreateURLLoaderFactory(
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
int64_t navigation_id,
bool force_no_https_upgrade,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) {
@@ -6734,7 +6757,7 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
content::ContentBrowserClient::URLLoaderRequestHandler
ChromeContentBrowserClient::
CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
const network::ResourceRequest& resource_request) {
SearchPrefetchURLLoader::RequestHandler prefetch_handler =
SearchPrefetchURLLoaderInterceptor::MaybeCreateLoaderForRequest(
@@ -6961,7 +6984,7 @@ bool ChromeContentBrowserClient::ShouldForceDownloadResource(
content::BluetoothDelegate* ChromeContentBrowserClient::GetBluetoothDelegate() {
if (!bluetooth_delegate_) {
bluetooth_delegate_ = std::make_unique<permissions::BluetoothDelegateImpl>(
bluetooth_delegate_ = std::make_unique<ChromeBluetoothDelegate>(
std::make_unique<ChromeBluetoothDelegateImplClient>());
}
return bluetooth_delegate_.get();
@@ -6991,7 +7014,7 @@ bool ChromeContentBrowserClient::IsSecurityLevelAcceptableForWebAuthn(
webauthn::pref_names::kAllowWithBrokenCerts)) {
return true;
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (caller_origin.scheme() == extensions::kExtensionScheme) {
return true;
}
@@ -7141,7 +7164,7 @@ ChromeContentBrowserClient::CreateLoginDelegate(
bool ChromeContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::FrameTreeNodeId frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
@@ -7427,7 +7450,7 @@ ChromeContentBrowserClient::GetAsyncCheckTracker(
bool is_consumer_lookup_enabled,
safe_browsing::hash_realtime_utils::HashRealTimeSelection
hash_realtime_selection,
int frame_tree_node_id) {
content::FrameTreeNodeId frame_tree_node_id) {
content::WebContents* contents = wc_getter.Run();
if (!contents || !safe_browsing_service_ ||
!safe_browsing_service_->ui_manager()) {
@@ -7453,7 +7476,9 @@ ChromeContentBrowserClient::GetAsyncCheckTracker(
return nullptr;
}
return safe_browsing::AsyncCheckTracker::GetOrCreateForWebContents(
contents, safe_browsing_service_->ui_manager().get());
contents, safe_browsing_service_->ui_manager().get(),
safe_browsing::AsyncCheckTracker::
IsPlatformEligibleForSyncCheckerCheckAllowlist());
}
void ChromeContentBrowserClient::ReportLegacyTechEvent(
@@ -7590,7 +7615,7 @@ std::optional<gfx::ImageSkia> ChromeContentBrowserClient::GetProductLogo() {
bool ChromeContentBrowserClient::IsBuiltinComponent(
content::BrowserContext* browser_context,
const url::Origin& origin) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return ChromeContentBrowserClientExtensionsPart::IsBuiltinComponent(
browser_context, origin);
#else
@@ -7814,7 +7839,7 @@ bool ChromeContentBrowserClient::IsClipboardPasteAllowed(
if (status == blink::mojom::PermissionStatus::GRANTED)
return true;
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
// (3) origination directly from a Chrome extension, ...
Profile* profile = Profile::FromBrowserContext(browser_context);
DCHECK(profile);
@@ -7843,7 +7868,7 @@ bool ChromeContentBrowserClient::IsClipboardPasteAllowed(
return true;
}
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return false;
}
@@ -7909,7 +7934,7 @@ void ChromeContentBrowserClient::BindBrowserControlInterface(
bool ChromeContentBrowserClient::
ShouldInheritCrossOriginEmbedderPolicyImplicitly(const GURL& url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return url.SchemeIs(extensions::kExtensionScheme);
#else
return false;
@@ -7921,7 +7946,7 @@ bool ChromeContentBrowserClient::
if (url.SchemeIsLocal()) {
return true;
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return url.SchemeIs(extensions::kExtensionScheme);
#else
return false;
@@ -8250,7 +8275,7 @@ bool ChromeContentBrowserClient::ShouldPreconnectNavigation(
content::RenderFrameHost* render_frame_host) {
content::BrowserContext* browser_context =
render_frame_host->GetBrowserContext();
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
// An extension could be blocking connections for privacy reasons, so skip
// optimization if there are any extensions with WebRequest permissions.
const auto* web_request_api =
@@ -8361,7 +8386,7 @@ void ChromeContentBrowserClient::OnSharedStorageSelectURLCalled(
bool ChromeContentBrowserClient::ShouldSendOutermostOriginToRenderer(
const url::Origin& outermost_origin) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
// We only want to send the outermost origin if it is an extension scheme.
// We do not send the outermost origin to every renderer to avoid leaking
// additional information into the renderer about the embedder. For
@@ -8377,7 +8402,7 @@ bool ChromeContentBrowserClient::ShouldSendOutermostOriginToRenderer(
bool ChromeContentBrowserClient::IsFileSystemURLNavigationAllowed(
content::BrowserContext* browser_context,
const GURL& url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_PLATFORM_APPS)
// filesystem: URLs for Chrome Apps are in the following format:
// `filesystem:chrome-extension://<extension-id>/...`
if (!url.SchemeIsFileSystem())
@@ -8394,7 +8419,7 @@ bool ChromeContentBrowserClient::IsFileSystemURLNavigationAllowed(
DCHECK(extension);
return extension->is_platform_app();
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_PLATFORM_APPS)
return false;
}
@@ -8459,11 +8484,11 @@ std::string ChromeContentBrowserClient::GetChildProcessSuffix(int child_flags) {
bool ChromeContentBrowserClient::ShouldUseFirstPartyStorageKey(
const url::Origin& origin) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return origin.scheme() == extensions::kExtensionScheme;
#else
return false;
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
}
std::unique_ptr<content::ResponsivenessCalculatorDelegate>
@@ -101,6 +101,7 @@
#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/ash/net/secure_dns_manager.h"
#include "chrome/browser/ui/webui/settings/reset_settings_handler.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/updates/announcement_notification/announcement_notification_service.h"
@@ -169,6 +170,7 @@
#include "components/safe_browsing/content/common/file_type_policies_prefs.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/saved_tab_groups/pref_names.h"
#include "components/search_engines/search_engine_choice/search_engine_choice_service.h"
#include "components/search_engines/template_url_prepopulate_data.h"
#include "components/security_interstitials/content/insecure_form_blocking_page.h"
#include "components/security_interstitials/content/stateful_ssl_host_state_delegate.h"
@@ -205,6 +207,12 @@
#include "chrome/browser/background/background_mode_manager.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/permissions_manager.h"
#include "extensions/browser/pref_names.h"
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/apps/platform_apps/shortcut_manager.h"
@@ -217,9 +225,6 @@
#include "chrome/browser/ui/webui/extensions/extensions_ui.h"
#include "extensions/browser/api/audio/audio_api.h"
#include "extensions/browser/api/runtime/runtime_api.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/permissions_manager.h"
#include "extensions/browser/pref_names.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/crosapi/browser_data_migrator.h"
#include "chrome/browser/ash/device_name/device_name_store.h"
@@ -266,7 +271,6 @@
#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"
#include "components/webapps/browser/android/install_prompt_prefs.h"
#else // BUILDFLAG(IS_ANDROID)
#include "chrome/browser/cart/cart_service.h"
@@ -282,14 +286,15 @@
#include "chrome/browser/new_tab_page/modules/safe_browsing/safe_browsing_handler.h"
#include "chrome/browser/new_tab_page/modules/v2/calendar/google_calendar_page_handler.h"
#include "chrome/browser/new_tab_page/modules/v2/most_relevant_tab_resumption/most_relevant_tab_resumption_page_handler.h"
#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/on_device_translation/pref_names.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"
#include "chrome/browser/signin/signin_promo.h"
#include "chrome/browser/themes/theme_syncable_service.h"
#include "chrome/browser/ui/commerce/commerce_ui_tab_helper.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/webui/cr_components/theme_color_picker/theme_color_picker_handler.h"
@@ -379,7 +384,6 @@
#include "chrome/browser/ash/guest_os/guest_os_pref_names.h"
#include "chrome/browser/ash/guest_os/guest_os_terminal.h"
#include "chrome/browser/ash/lock_screen_apps/state_controller.h"
#include "chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.h"
#include "chrome/browser/ash/login/demo_mode/demo_session.h"
#include "chrome/browser/ash/login/demo_mode/demo_setup_controller.h"
#include "chrome/browser/ash/login/quick_unlock/fingerprint_storage.h"
@@ -403,7 +407,6 @@
#include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h"
#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h"
#include "chrome/browser/ash/policy/core/device_cloud_policy_manager_ash.h"
#include "chrome/browser/ash/policy/core/dm_token_storage.h"
#include "chrome/browser/ash/policy/enrollment/auto_enrollment_client_impl.h"
#include "chrome/browser/ash/policy/enrollment/enrollment_requisition_manager.h"
#include "chrome/browser/ash/policy/external_data/handlers/device_wallpaper_image_external_data_handler.h"
@@ -1007,6 +1010,9 @@ constexpr char kNtpPhotosSoftOptOutCountPrefName[] =
"NewTabPage.Photos.SoftOptOutCount";
constexpr char kNtpPhotosLastSoftOptedOutTimePrefName[] =
"NewTabPage.Photos.LastSoftOptedoutTime";
// Deprecated 08/2024
constexpr char kDismissedTabsPrefName[] =
"NewTabPage.TabResumption.DismissedTabs";
#endif
// Deprecated 07/2024.
@@ -1047,6 +1053,44 @@ constexpr char kObsoleteUserReceivedGMSCoreError[] =
constexpr char kSafeBrowsingEsbOptInWithFriendlierSettings[] =
"safebrowsing.esb_opt_in_with_friendlier_settings";
// Deprecated 08/2024.
#if BUILDFLAG(IS_CHROMEOS_ASH)
constexpr char kDeviceDMTokenV1[] = "device_dm_token";
constexpr char kDeviceDMTokenV2[] = "device_dm_token_v2";
#endif
// Deprecated 08/2024
#if BUILDFLAG(IS_ANDROID)
constexpr char kBackoffEntryKey[] = "query_tiles.backoff_entry_key";
constexpr char kFirstScheduleTimeKey[] = "query_tiles.first_schedule_time_key";
#endif
// Deprecated 09/2024.
constexpr char kContentSettingsWindowLastTabIndex[] =
"content_settings_window.last_tab_index";
constexpr char kSyncPasswordHash[] = "profile.sync_password_hash";
constexpr char kSyncPasswordLengthAndHashSalt[] =
"profile.sync_password_length_and_hash_salt";
// Deprecated 09/2024
#if BUILDFLAG(IS_CHROMEOS_ASH)
constexpr char kDemoModeResourcesRemoved[] = "demo_mode_resources_removed";
constexpr char kAccumulatedUsagePref[] =
"demo_mode_resources_remover.accumulated_device_usage_s";
#endif
// Deprecated 09/2024
#if !BUILDFLAG(IS_ANDROID)
constexpr char kPasswordGenerationNudgePasswordDismissCount[] =
"password_generation_nudge_password_dismiss_count";
#endif // !BUILDFLAG(IS_ANDROID)
// Deprecated 09/2024.
#if !BUILDFLAG(IS_ANDROID)
const char kTabResumeDismissedTabsPrefName[] =
"NewTabPage.MostRelevantTabResumption.DismissedTabs";
#endif // !BUILDFLAG(IS_ANDROID)
// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
@@ -1129,6 +1173,18 @@ void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
// Deprecated 07/2024.
registry->RegisterStringPref(kFirstRunStudyGroup, std::string());
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Deprecated 08/2024.
registry->RegisterStringPref(kDeviceDMTokenV1, std::string());
registry->RegisterStringPref(kDeviceDMTokenV2, std::string());
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Deprecated 08/2024.
registry->RegisterBooleanPref(kDemoModeResourcesRemoved, false);
registry->RegisterIntegerPref(kAccumulatedUsagePref, 0);
#endif
}
// Register prefs used only for migration (clearing or moving to a new key).
@@ -1414,6 +1470,8 @@ void RegisterProfilePrefsForMigration(
registry->RegisterTimePref(kNtpPhotosLastSoftOptedOutTimePrefName,
base::Time());
registry->RegisterIntegerPref(kNtpPhotosSoftOptOutCountPrefName, 0);
// Deprecated 08/2024
registry->RegisterListPref(kDismissedTabsPrefName);
#endif
// Deprecated 07/2024.
@@ -1449,6 +1507,29 @@ void RegisterProfilePrefsForMigration(
// Deprecated 08/2024.
registry->RegisterBooleanPref(kSafeBrowsingEsbOptInWithFriendlierSettings,
false);
#if BUILDFLAG(IS_ANDROID)
// Deprecated 08/2024
registry->RegisterListPref(kBackoffEntryKey);
registry->RegisterTimePref(kFirstScheduleTimeKey, base::Time());
#endif
// Deprecated 09/2024.
registry->RegisterIntegerPref(kContentSettingsWindowLastTabIndex, 0);
registry->RegisterStringPref(kSyncPasswordHash, std::string());
registry->RegisterStringPref(kSyncPasswordLengthAndHashSalt, std::string());
// Deprecated 09/2024.
#if !BUILDFLAG(IS_ANDROID)
registry->RegisterIntegerPref(kPasswordGenerationNudgePasswordDismissCount,
0);
#endif // !BUILDFLAG(IS_ANDROID)
// Deprecated 09/2024
#if !BUILDFLAG(IS_ANDROID)
registry->RegisterListPref(kTabResumeDismissedTabsPrefName,
base::Value::List());
#endif // !BUILDFLAG(IS_ANDROID)
}
void ClearSyncRequestedPrefAndMaybeMigrate(PrefService* profile_prefs) {
@@ -1525,6 +1606,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
#endif
RegisterScreenshotPrefs(registry);
safe_browsing::RegisterLocalStatePrefs(registry);
search_engines::SearchEngineChoiceService::RegisterLocalStatePrefs(registry);
secure_origin_allowlist::RegisterPrefs(registry);
segmentation_platform::SegmentationPlatformService::RegisterLocalStatePrefs(
registry);
@@ -1593,6 +1675,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
task_manager::TaskManagerInterface::RegisterPrefs(registry);
UpgradeDetector::RegisterPrefs(registry);
registry->RegisterIntegerPref(prefs::kLastWhatsNewVersion, 0);
on_device_translation::RegisterLocalStatePrefs(registry);
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
@@ -1620,7 +1703,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
registry);
ash::bluetooth_config::DeviceNameManagerImpl::RegisterLocalStatePrefs(
registry);
ash::DemoModeResourcesRemover::RegisterLocalStatePrefs(registry);
ash::DemoSession::RegisterLocalStatePrefs(registry);
ash::DemoSetupController::RegisterLocalStatePrefs(registry);
ash::DeviceNameStore::RegisterLocalStatePrefs(registry);
@@ -1649,6 +1731,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
ash::Preferences::RegisterPrefs(registry);
ash::ResetScreen::RegisterPrefs(registry);
ash::SchedulerConfigurationManager::RegisterLocalStatePrefs(registry);
ash::SecureDnsManager::RegisterLocalStatePrefs(registry);
ash::ServicesCustomizationDocument::RegisterPrefs(registry);
ash::standalone_browser::migrator_util::RegisterLocalStatePrefs(registry);
ash::StartupUtils::RegisterPrefs(registry);
@@ -1675,7 +1758,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
registry);
policy::DeviceStatusCollector::RegisterPrefs(registry);
policy::DeviceWallpaperImageExternalDataHandler::RegisterPrefs(registry);
policy::DMTokenStorage::RegisterPrefs(registry);
policy::EnrollmentRequisitionManager::RegisterPrefs(registry);
policy::EuiccStatusUploader::RegisterLocalStatePrefs(registry);
policy::MinimumVersionPolicyHandler::RegisterPrefs(registry);
@@ -1898,17 +1980,20 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
SessionDataService::RegisterProfilePrefs(registry);
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::PermissionsManager::RegisterProfilePrefs(registry);
extensions::ExtensionPrefs::RegisterProfilePrefs(registry);
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#if BUILDFLAG(ENABLE_EXTENSIONS)
ExtensionWebUI::RegisterProfilePrefs(registry);
RegisterAnimationPolicyPrefs(registry);
extensions::ActivityLog::RegisterProfilePrefs(registry);
extensions::AudioAPI::RegisterUserPrefs(registry);
extensions::ExtensionPrefs::RegisterProfilePrefs(registry);
extensions::ExtensionsUI::RegisterProfilePrefs(registry);
#if BUILDFLAG(IS_CHROMEOS_ASH)
extensions::shared_storage::RegisterProfilePrefs(registry);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
extensions::PermissionsManager::RegisterProfilePrefs(registry);
extensions::RuntimeAPI::RegisterPrefs(registry);
// TODO(devlin): This would be more inline with the other calls here if it
// were nested in either a class or separate namespace with a simple
@@ -1944,7 +2029,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
PartnerBookmarksShim::RegisterProfilePrefs(registry);
permissions::GeolocationPermissionContextAndroid::RegisterProfilePrefs(
registry);
query_tiles::RegisterPrefs(registry);
readaloud::RegisterProfilePrefs(registry);
RecentTabsPagePrefs::RegisterProfilePrefs(registry);
usage_stats::UsageStatsBridge::RegisterProfilePrefs(registry);
@@ -1984,7 +2068,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
send_tab_to_self::RegisterProfilePrefs(registry);
signin::RegisterProfilePrefs(registry);
StartupBrowserCreator::RegisterProfilePrefs(registry);
TabResumptionPageHandler::RegisterProfilePrefs(registry);
MostRelevantTabResumptionPageHandler::RegisterProfilePrefs(registry);
tab_groups::saved_tab_groups::prefs::RegisterProfilePrefs(registry);
tab_organization_prefs::RegisterProfilePrefs(registry);
@@ -2083,6 +2166,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
ash::EduCoexistenceLoginHandler::RegisterProfilePrefs(registry);
ash::SigninErrorNotifier::RegisterPrefs(registry);
ash::ServicesCustomizationDocument::RegisterProfilePrefs(registry);
ash::SecureDnsManager::RegisterProfilePrefs(registry);
ash::settings::OSSettingsUI::RegisterProfilePrefs(registry);
ash::StartupUtils::RegisterOobeProfilePrefs(registry);
ash::user_image::prefs::RegisterProfilePrefs(registry);
@@ -2346,6 +2430,18 @@ void MigrateObsoleteLocalStatePrefs(PrefService* local_state) {
local_state->ClearPref(kFirstRunStudyGroup);
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Added 08/2024.
local_state->ClearPref(kDeviceDMTokenV1);
local_state->ClearPref(kDeviceDMTokenV2);
#endif
// Added 08/2024.
#if BUILDFLAG(IS_CHROMEOS_ASH)
local_state->ClearPref(kDemoModeResourcesRemoved);
local_state->ClearPref(kAccumulatedUsagePref);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_LOCAL_STATE_PREFS
@@ -2705,6 +2801,8 @@ void MigrateObsoleteProfilePrefs(PrefService* profile_prefs,
profile_prefs->ClearPref(kNtpPhotosLastMemoryOpenTimePrefName);
profile_prefs->ClearPref(kNtpPhotosLastSoftOptedOutTimePrefName);
profile_prefs->ClearPref(kNtpPhotosSoftOptOutCountPrefName);
// Added 08/2024
profile_prefs->ClearPref(kDismissedTabsPrefName);
#endif
// Added 07/2024.
@@ -2737,6 +2835,34 @@ void MigrateObsoleteProfilePrefs(PrefService* profile_prefs,
// Added 08/2024.
profile_prefs->ClearPref(kSafeBrowsingEsbOptInWithFriendlierSettings);
#if !BUILDFLAG(IS_ANDROID)
// Added 08/2024, but DO NOT REMOVE after the usual year.
// TODO(crbug.com/356148174): Remove once kMoveThemePrefsToSpecifics has been
// enabled for an year.
MigrateSyncingThemePrefsToNonSyncingIfNeeded(profile_prefs);
#endif // !BUILDFLAG(IS_ANDROID)
// Added 08/2024.
#if BUILDFLAG(IS_ANDROID)
profile_prefs->ClearPref(kBackoffEntryKey);
profile_prefs->ClearPref(kFirstScheduleTimeKey);
#endif
// Added 09/2024.
profile_prefs->ClearPref(kContentSettingsWindowLastTabIndex);
profile_prefs->ClearPref(kSyncPasswordHash);
profile_prefs->ClearPref(kSyncPasswordLengthAndHashSalt);
// Added 09/2024
#if !BUILDFLAG(IS_ANDROID)
profile_prefs->ClearPref(kPasswordGenerationNudgePasswordDismissCount);
#endif // !BUILDFLAG(IS_ANDROID)
// Added 09/2024
#if !BUILDFLAG(IS_ANDROID)
profile_prefs->ClearPref(kTabResumeDismissedTabsPrefName);
#endif // !BUILDFLAG(IS_ANDROID)
// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_PROFILE_PREFS
@@ -34,7 +34,6 @@
#include "chrome/browser/file_system_access/file_system_access_features.h"
#include "chrome/browser/file_system_access/file_system_access_permission_request_manager.h"
#include "chrome/browser/file_system_access/file_system_access_tab_helper.h"
#include "chrome/browser/fingerprinting_protection/chrome_fingerprinting_protection_web_contents_helper_factory.h"
#include "chrome/browser/history/history_tab_helper.h"
#include "chrome/browser/history/top_sites_factory.h"
#include "chrome/browser/history_clusters/history_clusters_tab_helper.h"
@@ -60,7 +59,6 @@
#include "chrome/browser/predictors/loading_predictor_tab_helper.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_manager_factory.h"
#include "chrome/browser/preloading/prefetch/no_state_prefetch/no_state_prefetch_tab_helper.h"
#include "chrome/browser/privacy_sandbox/tracking_protection_settings_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/resource_coordinator/tab_helper.h"
@@ -72,6 +70,7 @@
#include "chrome/browser/safe_browsing/tailored_security/tailored_security_url_observer.h"
#include "chrome/browser/safe_browsing/trigger_creator.h"
#include "chrome/browser/sessions/session_tab_helper_factory.h"
#include "chrome/browser/site_protection/site_protection_metrics_observer.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"
@@ -132,7 +131,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/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"
#include "components/infobars/content/content_infobar_manager.h"
@@ -169,9 +167,11 @@
#include "ppapi/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "rlz/buildflags/buildflags.h"
#include "third_party/blink/public/common/features.h"
#include "ui/accessibility/accessibility_features.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h"
@@ -187,6 +187,8 @@
#include "chrome/browser/ui/android/context_menu_helper.h"
#include "chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_android.h"
#include "components/facilitated_payments/core/features/features.h"
#include "components/sensitive_content/android/android_sensitive_content_client.h"
#include "components/sensitive_content/features.h"
#include "components/webapps/browser/android/app_banner_manager_android.h"
#include "content/public/common/content_features.h"
#else
@@ -213,7 +215,6 @@
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "components/zoom/zoom_controller.h"
#include "third_party/blink/public/common/features.h"
#endif // BUILDFLAG(IS_ANDROID)
#if defined(TOOLKIT_VIEWS)
@@ -224,7 +225,7 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
#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"
#include "chrome/browser/ui/ash/google_one/google_one_offer_iph_tab_helper.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -370,6 +371,18 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
autofill::AutofillClientProvider& autofill_client_provider =
autofill::AutofillClientProviderFactory::GetForProfile(profile);
autofill_client_provider.CreateClientForWebContents(web_contents);
#if BUILDFLAG(IS_ANDROID)
// The sensitive content client has to be instantiated after the autofill
// client, because the sensitive content client starts a flow which uses
// `ScopedAutofillManagersObservation`.
if (base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SdkVersion::SDK_VERSION_V &&
base::FeatureList::IsEnabled(
sensitive_content::features::kSensitiveContent)) {
sensitive_content::AndroidSensitiveContentClient::CreateForWebContents(
web_contents, "SensitiveContent.Chrome.");
}
#endif // BUILDFLAG(IS_ANDROID)
if (breadcrumbs::IsEnabled(g_browser_process->local_state())) {
BreadcrumbManagerTabHelper::CreateForWebContents(web_contents);
}
@@ -409,14 +422,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
FileSystemAccessPermissionRequestManager::CreateForWebContents(web_contents);
FileSystemAccessTabHelper::CreateForWebContents(web_contents);
FindBarState::ConfigureWebContents(web_contents);
if (fingerprinting_protection_filter::features::
IsFingerprintingProtectionFeatureEnabled()) {
// TODO(https://crbug.com/40280666): Move this to TabFeatures.
CreateFingerprintingProtectionWebContentsHelper(
web_contents, profile->GetPrefs(),
TrackingProtectionSettingsFactory::GetForProfile(profile),
profile->IsIncognitoProfile());
}
download::DownloadNavigationObserver::CreateForWebContents(
web_contents,
download::NavigationMonitorFactory::GetForKey(profile->GetProfileKey()));
@@ -512,6 +517,9 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
safe_browsing::SafeBrowsingNavigationObserverManagerFactory::
GetForBrowserContext(profile),
profile->GetPrefs(), g_browser_process->safe_browsing_service());
site_protection::SiteProtectionMetricsObserver::CreateForWebContents(
web_contents);
if (base::FeatureList::IsEnabled(
safe_browsing::kTailoredSecurityIntegration)) {
safe_browsing::TailoredSecurityUrlObserver::CreateForWebContents(
@@ -522,7 +530,9 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
safe_browsing::kSafeBrowsingAsyncRealTimeCheck) &&
g_browser_process->safe_browsing_service()) {
safe_browsing::AsyncCheckTracker::CreateForWebContents(
web_contents, g_browser_process->safe_browsing_service()->ui_manager());
web_contents, g_browser_process->safe_browsing_service()->ui_manager(),
safe_browsing::AsyncCheckTracker::
IsPlatformEligibleForSyncCheckerCheckAllowlist());
}
// SafeBrowsingTabObserver creates a ClientSideDetectionHost, which observes
// events from PermissionRequestManager and AsyncCheckTracker in its
@@ -609,8 +619,8 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
PolicyAuditorBridge::CreateForWebContents(web_contents);
PluginObserverAndroid::CreateForWebContents(web_contents);
if (base::FeatureList::IsEnabled(
payments::facilitated::kEnablePixDetection)) {
if (base::FeatureList::IsEnabled(payments::facilitated::kEnablePixPayments) ||
base::FeatureList::IsEnabled(blink::features::kPaymentLinkDetection)) {
if (auto* optimization_guide_decider =
OptimizationGuideKeyedServiceFactory::GetForProfile(profile)) {
ChromeFacilitatedPaymentsClient::CreateForWebContents(
@@ -663,9 +673,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
if (commerce::isContextualConsentEnabled()) {
commerce_hint::CommerceHintTabHelper::CreateForWebContents(web_contents);
}
if (base::FeatureList::IsEnabled(ntp_features::kNtpHistoryClustersModule)) {
side_panel::HistoryClustersTabHelper::CreateForWebContents(web_contents);
}
if (companion::IsCompanionFeatureEnabled()) {
companion::CompanionTabHelper::CreateForWebContents(web_contents);
}
@@ -760,8 +767,15 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
extensions::SetViewType(web_contents,
extensions::mojom::ViewType::kTabContents);
// If the web contents already have a view type, don't overwrite it here. One
// case where this can happen is when the user opens undocked developer tools.
// For all developer tools web contents, the view type is set to
// `kDeveloperTools` by the `DevToolsWindow` before tab helpers are attached.
if (extensions::GetViewType(web_contents) ==
extensions::mojom::ViewType::kInvalid) {
extensions::SetViewType(web_contents,
extensions::mojom::ViewType::kTabContents);
}
extensions::TabHelper::CreateForWebContents(web_contents);
extensions::NavigationExtensionEnabler::CreateForWebContents(web_contents);
@@ -6,7 +6,7 @@
// browser.
[platforms=("chromeos", "lacros"),
implemented_in="chrome/browser/chromeos/extensions/accessibility_service_private.h"]
implemented_in="chrome/browser/chromeos/extensions/accessibility_service_private/accessibility_service_private.h"]
namespace accessibilityServicePrivate {
callback VoidCallback = void();
@@ -121,11 +121,12 @@ namespace autofillPrivate {
ADDRESS_HOME_APT_TYPE,
ADDRESS_HOME_HOUSE_NUMBER_AND_APT,
SINGLE_USERNAME_WITH_INTERMEDIATE_VALUES,
IMPROVED_PREDICTION,
MAX_VALID_FIELD_TYPE
};
// The address source origin. Describes where the address is stored.
enum AddressSource {
// The address record type. Describes where the address is stored.
enum AddressRecordType {
// The address is stored in the Chrome infrastructure (locally and
// possibly synced between devices).
LOCAL_OR_SYNCABLE,
@@ -148,15 +149,12 @@ namespace autofillPrivate {
DOMString? summarySublabel;
// For addresses. Describes where the address is stored.
AddressSource? source;
AddressRecordType? recordType;
// For credit cards, whether the entry is locally owned by Chrome (as opposed to
// being synced down from the server). Non-local entries may not be editable.
boolean? isLocal;
// For credit cards, whether this is a full copy of the card
boolean? isCached;
// For credit cards, whether this is migratable (both the card number and
// expiration date valid and does not have the duplicated server card).
boolean? isMigratable;
@@ -295,6 +293,14 @@ namespace autofillPrivate {
AutofillMetadata? metadata;
};
// User annotations entry data. Corresponds to the eponymous message from
// components/optimization_guide/proto/features/common_quality_data.proto.
dictionary UserAnnotationsEntry {
long entryId;
DOMString key;
DOMString value;
};
callback GetAccountInfoCallback = void(optional AccountInfo accountInfo);
callback GetCountryListCallback = void(CountryEntry[] countries);
callback GetAddressComponentsCallback = void(AddressComponents components);
@@ -304,6 +310,7 @@ namespace autofillPrivate {
callback IsValidIbanCallback = void(boolean isValid);
callback GetCreditCardCallback = void(optional CreditCardEntry card);
callback CheckForDeviceAuthCallback = void(boolean isDeviceAuthAvailable);
callback GetUserAnnotationsEntriesCallback = void(UserAnnotationsEntry[] items);
interface Functions {
// Gets currently signed-in user profile info, no value is returned if
@@ -409,6 +416,16 @@ namespace autofillPrivate {
// Sets the Sync Autofill toggle value, which corresponds to
// `syncer::UserSelectableType::kAutofill` in `SyncUserSettings`.
static void setAutofillSyncToggleEnabled(boolean enabled);
// Returns the list of user annotations entries.
static void getUserAnnotationsEntries(
GetUserAnnotationsEntriesCallback callback);
// Deletes the user annotations entry by its id.
static void deleteUserAnnotationsEntry(long entryId);
// Deletes all user annotations entries.
static void deleteAllUserAnnotationsEntries();
};
interface Events {
@@ -1040,16 +1040,6 @@ namespace autotestPrivate {
// Remove printer.
static void removePrinter(DOMString printerId);
// Start ARC directly, note this differs from |setPlayStoreEnabled|. It is
// used to restart ARC in tests.
// |callback|: Called when the operation has completed.
static void startArc(VoidCallback callback);
// Stop ARC directly, note this differs from |setPlayStoreEnabled|. It is
// used to restart ARC in tests. Note, this preserves ARC data.
// |callback|: Called when the operation has completed.
static void stopArc(VoidCallback callback);
// Enable/disable the Play Store.
// |enabled|: if set, enable the Play Store.
// |callback|: Called when the operation has completed.
@@ -1696,6 +1686,12 @@ namespace autotestPrivate {
// A restart is required for this change to take effect.
// |value|: the locale of the language.
static void setDeviceLanguage(DOMString locale, VoidCallback callback);
// Gets the chrome://device-log entries for a given type or all types.
// |type|: A string like "printer" to fetch a specific type, or an empty
// string to fetch all entries.
// |callback|: Called with the logs as a single string.
static void getDeviceEventLog(DOMString type, DOMStringCallback callback);
};
interface Events {
@@ -70,7 +70,8 @@ namespace developerPrivate {
EXTENSION_SERVICE_WORKER_BACKGROUND,
TAB_CONTENTS,
OFFSCREEN_DOCUMENT,
EXTENSION_SIDE_PANEL
EXTENSION_SIDE_PANEL,
DEVELOPER_TOOLS
};
enum ErrorType {
@@ -88,7 +89,7 @@ namespace developerPrivate {
ENABLED,
DISABLED,
TERMINATED,
BLACKLISTED
BLOCKLISTED
};
enum CommandScope {
@@ -241,7 +242,7 @@ namespace developerPrivate {
};
dictionary ExtensionInfo {
DOMString? blacklistText;
DOMString? blocklistText;
SafetyCheckStrings? safetyCheckText;
Command[] commands;
ControlledInfo? controlledInfo;
@@ -312,6 +312,34 @@ namespace enterprise.reportingPrivate {
callback SettingsCallback =
void(GetSettingsResponse[] settings);
// Indicates what resulted from an event sent through a `DataMaskingEvent`.
enum EventResult { EVENT_RESULT_DATA_MASKED, EVENT_RESULT_DATA_UNMASKED };
// Indicates the type of detector that was used match against data by the data
// masking extension.
enum DetectorType { PREDEFINED_DLP, USER_DEFINED };
// Information for a data detector used to apply data masking functionality.
dictionary MatchedDetector {
DOMString detectorId;
DOMString displayName;
DetectorType detectorType;
};
// Information for a data leak prevention rule that was used to mask data.
dictionary TriggeredRuleInfo {
DOMString ruleId;
DOMString ruleName;
MatchedDetector[] matchedDetectors;
};
// Event representing that something happened in the data masking extension.
dictionary DataMaskingEvent {
DOMString url;
EventResult eventResult;
TriggeredRuleInfo[] triggeredRuleInfo;
};
interface Functions {
// Gets the identity of device that Chrome browser is running on. The ID is
// retrieved from the local device and used by the Google admin console.
@@ -402,6 +430,12 @@ namespace enterprise.reportingPrivate {
// results will be returned.
[platforms = ("win")]
static void getHotfixes(UserContext userContext, HotfixesCallback callback);
// Sends the passed `event` to the reporting service if the browser or
// profile is managed and the "OnSecurityEventEnterpriseConnector" policy is
// enabled.
static void reportDataMaskingEvent(DataMaskingEvent event,
DoneCallback callback);
};
};
@@ -0,0 +1,17 @@
// 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.
// Experimental API to handle data collection in the browser process for
// AI features.
[implemented_in="chrome/browser/extensions/api/experimental_ai_data/experimental_ai_data_api.h"]
namespace experimentalAiData {
callback DataCallback = void(ArrayBuffer data);
interface Functions {
static void getAiData(long domNodeId,
DOMString frameId,
DOMString userInput,
DataCallback callback);
};
};
@@ -427,6 +427,12 @@ enum DefaultLocation {
onedrive
};
enum CloudProvider {
not_specified,
google_drive,
onedrive
};
// These three fields together uniquely identify a task.
dictionary FileTaskDescriptor {
DOMString appId;
@@ -865,6 +871,7 @@ dictionary Preferences {
boolean driveFsBulkPinningEnabled;
boolean localUserFilesAllowed;
DefaultLocation defaultLocation;
CloudProvider skyVaultMigrationDestination;
};
dictionary PreferencesChange {
@@ -554,7 +554,7 @@ namespace passwordsPrivate {
// successful authentication.
// |callback|: The callback that gets invoked with the authentication
// result.
[platforms = ("win", "mac")] static void
[platforms = ("win", "mac", "chromeos")] static void
switchBiometricAuthBeforeFillingState(
AuthenticationResultCallback callback);
@@ -13,6 +13,7 @@
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/debug/crash_logging.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/user_metrics_action.h"
@@ -38,7 +39,8 @@
#include "chrome/common/crash_keys.h"
#include "chrome/common/pepper_permission_util.h"
#include "chrome/common/ppapi_utils.h"
#include "chrome/common/profiler/thread_profiler.h"
#include "chrome/common/profiler/chrome_thread_profiler_client.h"
#include "chrome/common/profiler/thread_profiler_configuration.h"
#include "chrome/common/profiler/unwind_util.h"
#include "chrome/common/secure_origin_allowlist.h"
#include "chrome/common/url_constants.h"
@@ -108,6 +110,8 @@
#include "components/permissions/features.h"
#include "components/safe_browsing/buildflags.h"
#include "components/safe_browsing/content/renderer/threat_dom_details.h"
#include "components/sampling_profiler/thread_profiler.h"
#include "components/security_interstitials/content/renderer/security_interstitial_page_controller_delegate_impl.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "components/subresource_filter/content/renderer/subresource_filter_agent.h"
#include "components/subresource_filter/content/renderer/unverified_ruleset_dealer.h"
@@ -143,6 +147,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/features_generated.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"
@@ -201,9 +206,8 @@
#include "components/nacl/renderer/nacl_helper.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#include "chrome/common/initialize_extensions_client.h"
#include "chrome/renderer/extensions/api/chrome_extensions_renderer_api_provider.h"
#include "chrome/renderer/extensions/chrome_extensions_renderer_client.h"
#include "extensions/common/constants.h"
#include "extensions/common/context_data.h"
@@ -213,11 +217,18 @@
#include "extensions/common/switches.h"
#include "extensions/renderer/api/core_extensions_renderer_api_provider.h"
#include "extensions/renderer/dispatcher.h"
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.h"
#include "extensions/renderer/renderer_extension_registry.h"
#include "third_party/blink/public/mojom/css/preferred_color_scheme.mojom.h"
#include "third_party/blink/public/web/web_settings.h"
#endif
#endif // BUIDFLAG(ENABLE_EXTENSIONS_CORE)
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/renderer/extensions/api/chrome_extensions_renderer_api_provider.h"
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_GUEST_VIEW)
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.h"
#endif // BUILDFLAG(ENABLE_GUEST_VIEW)
#if BUILDFLAG(ENABLE_PDF)
#include "chrome/renderer/pdf/chrome_pdf_internal_plugin_delegate.h"
@@ -330,7 +341,7 @@ void AppendParams(
#endif // BUILDFLAG(ENABLE_PLUGINS)
bool IsStandaloneContentExtensionProcess() {
#if !BUILDFLAG(ENABLE_EXTENSIONS)
#if !BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return false;
#else
return base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -369,21 +380,21 @@ bool IsTerminalSystemWebAppNaClPage(GURL url) {
} // namespace
ChromeContentRendererClient::ChromeContentRendererClient()
:
#if BUILDFLAG(IS_WIN)
remote_module_watcher_(nullptr, base::OnTaskRunnerDeleter(nullptr)),
: remote_module_watcher_(nullptr, base::OnTaskRunnerDeleter(nullptr))
#endif
main_thread_profiler_(
#if BUILDFLAG(IS_CHROMEOS)
// The profiler can't start before the sandbox is initialized on
// ChromeOS due to ChromeOS's sandbox initialization code's use of
// AssertSingleThreaded().
nullptr
#else
ThreadProfiler::CreateAndStartOnMainThread()
{
sampling_profiler::ThreadProfiler::SetClient(
std::make_unique<ChromeThreadProfilerClient>());
// The profiler can't start before the sandbox is initialized on
// ChromeOS due to ChromeOS's sandbox initialization code's use of
// AssertSingleThreaded().
#if !BUILDFLAG(IS_CHROMEOS)
main_thread_profiler_ =
sampling_profiler::ThreadProfiler::CreateAndStartOnMainThread();
#endif
) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
EnsureExtensionsClientInitialized();
ChromeExtensionsRendererClient::Create();
#endif
@@ -433,22 +444,26 @@ void ChromeContentRendererClient::RenderThreadStarted() {
chrome_observer_ = std::make_unique<ChromeRenderThreadObserver>();
web_cache_impl_ = std::make_unique<web_cache::WebCacheImpl>();
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
auto* extensions_renderer_client =
extensions::ExtensionsRendererClient::Get();
extensions_renderer_client->AddAPIProvider(
std::make_unique<extensions::CoreExtensionsRendererAPIProvider>());
#if BUILDFLAG(ENABLE_EXTENSIONS)
extensions_renderer_client->AddAPIProvider(
std::make_unique<extensions::ChromeExtensionsRendererAPIProvider>());
extensions_renderer_client->AddAPIProvider(
std::make_unique<
controlled_frame::ControlledFrameExtensionsRendererAPIProvider>());
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
extensions_renderer_client->RenderThreadStarted();
WebSecurityPolicy::RegisterURLSchemeAsExtension(
WebString::FromASCII(extensions::kExtensionScheme));
WebSecurityPolicy::RegisterURLSchemeAsCodeCacheWithHashing(
WebString::FromASCII(extensions::kExtensionScheme));
#endif
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#if BUILDFLAG(ENABLE_SPELLCHECK)
if (!spellcheck_)
@@ -558,9 +573,10 @@ void ChromeContentRendererClient::RenderThreadStarted() {
// The HeapProfilerController should have been created in
// ChromeMainDelegate::PostEarlyInitialization.
CHECK(heap_profiler_controller);
if (ThreadProfiler::ShouldCollectProfilesForChildProcess() ||
if (ThreadProfilerConfiguration::Get()
->IsProfilerEnabledForCurrentProcess() ||
heap_profiler_controller->IsEnabled()) {
ThreadProfiler::SetMainThreadTaskRunner(
sampling_profiler::ThreadProfiler::SetMainThreadTaskRunner(
base::SingleThreadTaskRunner::GetCurrentDefault());
mojo::PendingRemote<metrics::mojom::CallStackProfileCollector> collector;
thread->BindHostReceiver(collector.InitWithNewPipeAndPassReceiver());
@@ -586,9 +602,6 @@ void ChromeContentRendererClient::RenderFrameCreated(
new prerender::PrerenderRenderFrameObserver(render_frame);
bool should_allow_for_content_settings =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kInstantProcess);
auto content_settings_delegate =
std::make_unique<ChromeContentSettingsAgentDelegate>(render_frame);
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -597,8 +610,7 @@ void ChromeContentRendererClient::RenderFrameCreated(
#endif
content_settings::ContentSettingsAgentImpl* content_settings =
new content_settings::ContentSettingsAgentImpl(
render_frame, should_allow_for_content_settings,
std::move(content_settings_delegate));
render_frame, std::move(content_settings_delegate));
if (chrome_observer_.get()) {
if (chrome_observer_->content_settings_manager()) {
mojo::Remote<content_settings::mojom::ContentSettingsManager> manager;
@@ -608,7 +620,7 @@ void ChromeContentRendererClient::RenderFrameCreated(
}
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::ExtensionsRendererClient::Get()->RenderFrameCreated(render_frame,
registry);
#endif
@@ -653,6 +665,9 @@ void ChromeContentRendererClient::RenderFrameCreated(
new NetErrorHelper(render_frame);
new security_interstitials::SecurityInterstitialPageControllerDelegateImpl(
render_frame);
new SupervisedUserErrorPageControllerDelegateImpl(render_frame);
if (!render_frame->IsMainFrame()) {
@@ -714,7 +729,7 @@ void ChromeContentRendererClient::RenderFrameCreated(
associated_interfaces);
}
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_GUEST_VIEW)
associated_interfaces
->AddInterface<extensions::mojom::MimeHandlerViewContainerManager>(
base::BindRepeating(
@@ -1362,6 +1377,9 @@ void ChromeContentRendererClient::PrepareErrorPage(
http_method == "POST", std::move(alternative_error_page_info),
error_html);
security_interstitials::SecurityInterstitialPageControllerDelegateImpl::Get(
render_frame)
->PrepareForErrorPage();
SupervisedUserErrorPageControllerDelegateImpl::Get(render_frame)
->PrepareForErrorPage();
}
@@ -1383,22 +1401,25 @@ void ChromeContentRendererClient::PrepareErrorPageForHttpStatusError(
void ChromeContentRendererClient::PostSandboxInitialized() {
#if BUILDFLAG(IS_CHROMEOS)
DCHECK(!main_thread_profiler_);
main_thread_profiler_ = ThreadProfiler::CreateAndStartOnMainThread();
main_thread_profiler_ =
sampling_profiler::ThreadProfiler::CreateAndStartOnMainThread();
#endif // BUILDFLAG(IS_CHROMEOS)
}
void ChromeContentRendererClient::PostIOThreadCreated(
base::SingleThreadTaskRunner* io_thread_task_runner) {
io_thread_task_runner->PostTask(
FROM_HERE, base::BindOnce(&ThreadProfiler::StartOnChildThread,
base::ProfilerThreadType::kIo));
FROM_HERE,
base::BindOnce(&sampling_profiler::ThreadProfiler::StartOnChildThread,
base::ProfilerThreadType::kIo));
}
void ChromeContentRendererClient::PostCompositorThreadCreated(
base::SingleThreadTaskRunner* compositor_thread_task_runner) {
compositor_thread_task_runner->PostTask(
FROM_HERE, base::BindOnce(&ThreadProfiler::StartOnChildThread,
base::ProfilerThreadType::kCompositor));
FROM_HERE,
base::BindOnce(&sampling_profiler::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/.
@@ -1406,11 +1427,7 @@ void ChromeContentRendererClient::PostCompositorThreadCreated(
FROM_HERE,
base::BindOnce(&tracing::TracingSamplerProfiler::
CreateOnChildThreadWithCustomUnwinders,
#if BUILDFLAG(IS_ANDROID)
base::BindRepeating(&CreateCoreUnwindersFactory, false)));
#else
base::BindRepeating(&CreateCoreUnwindersFactory)));
#endif // BUILDFLAG(IS_ANDROID)
}
bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() {
@@ -1662,7 +1679,7 @@ bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI(
void ChromeContentRendererClient::RunScriptsAtDocumentStart(
content::RenderFrame* render_frame) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::ExtensionsRendererClient::Get()->RunScriptsAtDocumentStart(
render_frame);
// |render_frame| might be dead by now.
@@ -1671,7 +1688,7 @@ void ChromeContentRendererClient::RunScriptsAtDocumentStart(
void ChromeContentRendererClient::RunScriptsAtDocumentEnd(
content::RenderFrame* render_frame) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::ExtensionsRendererClient::Get()->RunScriptsAtDocumentEnd(
render_frame);
// |render_frame| might be dead by now.
@@ -1680,7 +1697,7 @@ void ChromeContentRendererClient::RunScriptsAtDocumentEnd(
void ChromeContentRendererClient::RunScriptsAtDocumentIdle(
content::RenderFrame* render_frame) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::ExtensionsRendererClient::Get()->RunScriptsAtDocumentIdle(
render_frame);
// |render_frame| might be dead by now.
@@ -1719,7 +1736,7 @@ void ChromeContentRendererClient::
bool ChromeContentRendererClient::AllowScriptExtensionForServiceWorker(
const url::Origin& script_origin) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return script_origin.scheme() == extensions::kExtensionScheme;
#else
return false;
@@ -1729,7 +1746,8 @@ bool ChromeContentRendererClient::AllowScriptExtensionForServiceWorker(
void ChromeContentRendererClient::
WillInitializeServiceWorkerContextOnWorkerThread() {
// This is called on the service worker thread.
ThreadProfiler::StartOnChildThread(base::ProfilerThreadType::kServiceWorker);
sampling_profiler::ThreadProfiler::StartOnChildThread(
base::ProfilerThreadType::kServiceWorker);
}
void ChromeContentRendererClient::
@@ -1737,7 +1755,7 @@ void ChromeContentRendererClient::
blink::WebServiceWorkerContextProxy* context_proxy,
const GURL& service_worker_scope,
const GURL& script_url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::ExtensionsRendererClient::Get()
->dispatcher()
->DidInitializeServiceWorkerContextOnWorkerThread(
@@ -1752,7 +1770,7 @@ void ChromeContentRendererClient::WillEvaluateServiceWorkerOnWorkerThread(
const GURL& service_worker_scope,
const GURL& script_url,
const blink::ServiceWorkerToken& service_worker_token) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::ExtensionsRendererClient::Get()
->dispatcher()
->WillEvaluateServiceWorkerOnWorkerThread(
@@ -1765,7 +1783,7 @@ void ChromeContentRendererClient::DidStartServiceWorkerContextOnWorkerThread(
int64_t service_worker_version_id,
const GURL& service_worker_scope,
const GURL& script_url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::ExtensionsRendererClient::Get()
->dispatcher()
->DidStartServiceWorkerContextOnWorkerThread(
@@ -1778,7 +1796,7 @@ void ChromeContentRendererClient::WillDestroyServiceWorkerContextOnWorkerThread(
int64_t service_worker_version_id,
const GURL& service_worker_scope,
const GURL& script_url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
extensions::ExtensionsRendererClient::Get()
->dispatcher()
->WillDestroyServiceWorkerContextOnWorkerThread(
@@ -1811,17 +1829,17 @@ ChromeContentRendererClient::CreateURLLoaderThrottleProvider(
blink::WebFrame* ChromeContentRendererClient::FindFrame(
blink::WebLocalFrame* relative_to_frame,
const std::string& name) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return extensions::ExtensionsRendererClient::FindFrame(relative_to_frame,
name);
#else
return nullptr;
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
}
bool ChromeContentRendererClient::IsSafeRedirectTarget(const GURL& upstream_url,
const GURL& target_url) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
if (target_url.SchemeIs(extensions::kExtensionScheme)) {
const extensions::Extension* extension =
extensions::RendererExtensionRegistry::Get()->GetByID(
@@ -1837,7 +1855,7 @@ bool ChromeContentRendererClient::IsSafeRedirectTarget(const GURL& upstream_url,
}
return extension->guid() == upstream_url.host();
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
return true;
}
@@ -1851,7 +1869,7 @@ void ChromeContentRendererClient::DidSetUserAgent(
void ChromeContentRendererClient::AppendContentSecurityPolicy(
const blink::WebURL& url,
blink::WebVector<blink::WebContentSecurityPolicyHeader>* csp) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
#if BUILDFLAG(ENABLE_PDF)
// Don't apply default CSP to PDF renderers.
// TODO(crbug.com/40792950): Lock down the CSP once style and script are no
@@ -59,7 +59,6 @@
#include "components/url_formatter/url_formatter.h"
#include "components/viz/common/features.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/accessibility/browser_accessibility.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/attribution_reporting/attribution_host.h"
#include "content/browser/attribution_reporting/attribution_manager.h"
@@ -194,7 +193,9 @@
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/accessibility/ax_tree_combiner.h"
#include "ui/accessibility/platform/browser_accessibility.h"
#include "ui/base/ime/mojom/virtual_keyboard_types.mojom.h"
#include "ui/base/mojom/window_show_state.mojom.h"
#include "ui/base/pointer/pointer_device.h"
#include "ui/base/ui_base_types.h"
#include "ui/base/window_open_disposition.h"
@@ -784,7 +785,8 @@ WebContentsImpl* WebContentsImpl::FromRenderFrameHostImpl(
return static_cast<WebContentsImpl*>(rfh->delegate());
}
WebContents* WebContents::FromFrameTreeNodeId(int frame_tree_node_id) {
WebContents* WebContents::FromFrameTreeNodeId(
FrameTreeNodeId frame_tree_node_id) {
OPTIONAL_TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("content.verbose"),
"WebContents::FromFrameTreeNodeId",
"frame_tree_node_id", frame_tree_node_id);
@@ -808,10 +810,36 @@ bool WebContentsImpl::IsPopup() const {
return is_popup_;
}
bool WebContentsImpl::IsPartitionedPopin() const {
// The feature must be enabled if a popin was opened.
DCHECK(base::FeatureList::IsEnabled(blink::features::kPartitionedPopins) ||
!partitioned_popin_opener_);
return !!partitioned_popin_opener_;
}
RenderFrameHostImpl* WebContentsImpl::PartitionedPopinOpener() const {
// A popin cannot open a popin so at most one could be set at a time.
DCHECK(!partitioned_popin_opener_ || !opened_partitioned_popin_);
// The feature must be enabled if the popin opener is set.
DCHECK(base::FeatureList::IsEnabled(blink::features::kPartitionedPopins) ||
!partitioned_popin_opener_);
return partitioned_popin_opener_.get();
}
WebContents* WebContentsImpl::OpenedPartitionedPopin() const {
// A popin cannot open a popin so at most one could be set at a time.
DCHECK(!partitioned_popin_opener_ || !opened_partitioned_popin_);
// The feature must be enabled if a popin was opened.
DCHECK(base::FeatureList::IsEnabled(blink::features::kPartitionedPopins) ||
!opened_partitioned_popin_);
return opened_partitioned_popin_.get();
}
void WebContents::SetScreenOrientationDelegate(
ScreenOrientationDelegate* delegate) {
ScreenOrientationProvider::SetDelegate(delegate);
@@ -928,9 +956,7 @@ class WebContentsImpl::ColorChooserHolder : public blink::mojom::ColorChooser {
WebContentsImpl::WebContentsTreeNode::WebContentsTreeNode(
WebContentsImpl* current_web_contents)
: current_web_contents_(current_web_contents),
outer_web_contents_(nullptr),
outer_contents_frame_tree_node_id_(
FrameTreeNode::kFrameTreeNodeInvalidId) {}
outer_web_contents_(nullptr) {}
WebContentsImpl::WebContentsTreeNode::~WebContentsTreeNode() = default;
@@ -1652,15 +1678,15 @@ RenderFrameHostImpl* WebContentsImpl::GetFocusedFrame() {
// If an inner frame tree has focus, we should return a RenderFrameHost from
// the inner frame tree and not the placeholder RenderFrameHost.
DCHECK_EQ(
focused_node->current_frame_host()->inner_tree_main_frame_tree_node_id(),
FrameTreeNode::kFrameTreeNodeInvalidId);
DCHECK(focused_node->current_frame_host()
->inner_tree_main_frame_tree_node_id()
.is_null());
return focused_node->current_frame_host();
}
bool WebContentsImpl::IsPrerenderedFrame(int frame_tree_node_id) {
if (frame_tree_node_id == RenderFrameHost::kNoFrameTreeNodeId) {
bool WebContentsImpl::IsPrerenderedFrame(FrameTreeNodeId frame_tree_node_id) {
if (frame_tree_node_id.is_null()) {
return false;
}
@@ -1684,7 +1710,7 @@ bool WebContentsImpl::IsPrerenderedFrame(int frame_tree_node_id) {
}
RenderFrameHostImpl* WebContentsImpl::UnsafeFindFrameByFrameTreeNodeId(
int frame_tree_node_id) {
FrameTreeNodeId frame_tree_node_id) {
OPTIONAL_TRACE_EVENT1("content",
"WebContentsImpl::UnsafeFindFrameByFrameTreeNodeId",
"frame_tree_node_id", frame_tree_node_id);
@@ -2046,7 +2072,7 @@ class AXTreeSnapshotCombiner : public base::RefCounted<AXTreeSnapshotCombiner> {
is_root);
}
void ReceiveSnapshot(bool is_root, const ui::AXTreeUpdate& snapshot) {
void ReceiveSnapshot(bool is_root, ui::AXTreeUpdate& snapshot) {
combiner_.AddTree(snapshot, is_root);
}
@@ -2064,7 +2090,9 @@ class AXTreeSnapshotCombiner : public base::RefCounted<AXTreeSnapshotCombiner> {
// when there are no more references to this object.
~AXTreeSnapshotCombiner() {
combiner_.Combine();
std::move(callback_).Run(combiner_.combined());
CHECK(combiner_.combined());
ui::AXTreeUpdate update = std::move(combiner_.combined().value());
std::move(callback_).Run(update);
}
ui::AXTreeCombiner combiner_;
@@ -2343,7 +2371,7 @@ const std::u16string& WebContentsImpl::GetTitle() {
return GetNavigationEntryForTitle()->GetTitleForDisplay();
}
const std::u16string& WebContentsImpl::GetAppTitle() {
const std::optional<std::u16string>& WebContentsImpl::GetAppTitle() {
return GetNavigationEntryForTitle()->GetAppTitle();
}
@@ -2404,6 +2432,18 @@ const std::string& WebContentsImpl::GetEncoding() {
return GetPrimaryPage().GetEncoding();
}
void WebContentsImpl::Discard() {
if (!base::FeatureList::IsEnabled(features::kWebContentsDiscard)) {
NOTREACHED_NORETURN();
}
AboutToBeDiscarded(this);
notify_disconnection_ = false;
CancelAllPrerendering();
primary_frame_tree_.Discard();
NotifyWasDiscarded();
}
bool WebContentsImpl::WasDiscarded() {
return GetPrimaryFrameTree().root()->was_discarded();
}
@@ -2782,12 +2822,16 @@ WebContents::ScopedIgnoreInputEvents WebContentsImpl::IgnoreInputEvents(
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";
if (ignore_input_events_count_ == 0) {
// Reset gesture detection before starting input suppression so that any
// ongoing scroll gesture is correctly finished.
//
// TODO(crbug.com/362301376): This might be a side-effect of the
// referenced bug. Revisit restoring the CHECK when it's resolved.
if (auto* view = GetRenderWidgetHostView()) {
static_cast<RenderWidgetHostViewBase*>(view)->ResetGestureDetection();
}
}
#endif
++ignore_input_events_count_;
}
@@ -2931,9 +2975,6 @@ bool WebContentsImpl::IsInnerWebContentsForGuest() {
void WebContentsImpl::AttachInnerWebContents(
std::unique_ptr<WebContents> inner_web_contents,
RenderFrameHost* render_frame_host,
mojo::PendingAssociatedRemote<blink::mojom::RemoteFrame> remote_frame,
mojo::PendingAssociatedReceiver<blink::mojom::RemoteFrameHost>
remote_frame_host_receiver,
bool is_full_page) {
OPTIONAL_TRACE_EVENT2("content", "WebContentsImpl::AttachInnerWebContents",
"inner_web_contents",
@@ -3010,10 +3051,9 @@ void WebContentsImpl::AttachInnerWebContents(
inner_main_frame->browsing_context_state()->CreateOuterDelegateProxy(
render_frame_host_impl->GetSiteInstance()->group(),
inner_main_frame->frame_tree_node(), blink::RemoteFrameToken());
if (remote_frame && remote_frame_host_receiver) {
proxy->BindRemoteFrameInterfaces(std::move(remote_frame),
std::move(remote_frame_host_receiver));
}
// Since the inner WebContents is created from the browser side we do
// not have RemoteFrame mojo channels. New channels will be bound when the
// `CreateView` IPC is sent.
// When attaching a GuestView as an inner WebContents, there should already be
// a live RenderFrame, which has to be swapped.
@@ -3040,8 +3080,7 @@ void WebContentsImpl::AttachInnerWebContents(
}
observers_.NotifyObservers(&WebContentsObserver::InnerWebContentsAttached,
inner_web_contents_impl, render_frame_host,
is_full_page);
inner_web_contents_impl, render_frame_host);
// Make sure that the inner web contents and its outer delegate get properly
// linked via the embedding token now that inner web contents are attached.
@@ -4220,10 +4259,10 @@ void WebContentsImpl::Restore() {
}
// TODO(laurila, crbug.com/1466855): Map into new `ui::DisplayState` enum
// instead of `ui::WindowShowState`.
ui::WindowShowState WebContentsImpl::GetWindowShowState() {
// instead of `ui::mojom::WindowShowState`.
ui::mojom::WindowShowState WebContentsImpl::GetWindowShowState() {
return GetDelegate() ? GetDelegate()->GetWindowShowState()
: ui::SHOW_STATE_DEFAULT;
: ui::mojom::WindowShowState::kDefault;
}
blink::mojom::DevicePostureProvider*
@@ -4664,9 +4703,8 @@ 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();
}
SetPartitionedPopinOpenerOnNewWindowIfNeeded(web_contents_impl, params,
opener);
return &web_contents_impl->GetPrimaryFrameTree();
}
@@ -4752,9 +4790,8 @@ 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();
}
SetPartitionedPopinOpenerOnNewWindowIfNeeded(new_contents_impl, params,
opener);
// 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
@@ -4810,71 +4847,89 @@ FrameTree* WebContentsImpl::CreateNewWindow(
false, // started_from_context_menu
true); // renderer_initiated
if (params.opener_suppressed) {
// When the opener is suppressed, the original renderer cannot access the
// new window. As a result, we need to show and navigate the window here.
bool was_blocked = false;
if (!params.opener_suppressed) {
return &new_contents_impl->GetPrimaryFrameTree();
}
if (delegate_) {
base::WeakPtr<WebContentsImpl> weak_new_contents =
new_contents_impl->weak_factory_.GetWeakPtr();
// When the opener is suppressed, the original renderer cannot access the
// new window. As a result, we need to show and navigate the window here.
bool was_blocked = false;
base::WeakPtr<WebContentsImpl> weak_new_contents =
new_contents_impl->weak_factory_.GetWeakPtr();
WebContentsImpl* contents_to_load = new_contents_impl;
if (delegate_) {
WebContents* web_contents_navigated = delegate_->AddNewContents(
this, std::move(new_contents), params.target_url, params.disposition,
*params.features, has_user_gesture, &was_blocked);
delegate_->AddNewContents(
this, std::move(new_contents), params.target_url, params.disposition,
*params.features, has_user_gesture, &was_blocked);
if (base::FeatureList::IsEnabled(features::kPwaNavigationCapturing)) {
// The delegate may delete |new_contents_impl| during AddNewContents().
// If that occurs and there isn't a replacement contents returned, exit.
// Otherwise, use the replacement web contents that was navigated in.
if (web_contents_navigated != nullptr && weak_new_contents) {
CHECK(web_contents_navigated == weak_new_contents.get());
}
if (!weak_new_contents) {
return nullptr;
}
}
if (!was_blocked) {
std::unique_ptr<NavigationController::LoadURLParams> load_params =
std::make_unique<NavigationController::LoadURLParams>(
params.target_url);
load_params->initiator_origin = opener->GetLastCommittedOrigin();
load_params->initiator_process_id = opener->GetProcess()->GetID();
load_params->initiator_frame_token = opener->GetFrameToken();
// Avoiding setting |load_params->source_site_instance| when
// |opener_suppressed| is true, because in that case we do not want to use
// the old SiteInstance and/or BrowsingInstance. See also the test here:
// NewPopupCOOP_SameOriginPolicyAndCrossOriginIframeSetsNoopener.
load_params->referrer = params.referrer.To<Referrer>();
load_params->transition_type = ui::PAGE_TRANSITION_LINK;
load_params->is_renderer_initiated = true;
load_params->was_opener_suppressed = true;
load_params->has_user_gesture = has_user_gesture;
load_params->is_form_submission = params.is_form_submission;
if (params.form_submission_post_data) {
load_params->load_type = NavigationController::LOAD_TYPE_HTTP_POST;
load_params->post_data = params.form_submission_post_data;
load_params->post_content_type =
params.form_submission_post_content_type;
}
load_params->impression = params.impression;
load_params->override_user_agent =
new_contents_impl->should_override_user_agent_in_new_tabs_
? NavigationController::UA_OVERRIDE_TRUE
: NavigationController::UA_OVERRIDE_FALSE;
load_params->download_policy = params.download_policy;
load_params->initiator_activation_and_ad_status =
params.initiator_activation_and_ad_status;
if (delegate_ && !is_guest &&
!delegate_->ShouldResumeRequestsForCreatedWindow()) {
// We are in asynchronous add new contents path, delay navigation.
DCHECK(!new_contents_impl->delayed_open_url_params_);
new_contents_impl->delayed_load_url_params_ = std::move(load_params);
} else {
new_contents_impl->GetController().LoadURLWithParams(
*load_params.get());
if (!is_guest) {
new_contents_impl->Focus();
if (web_contents_navigated == nullptr) {
return nullptr;
}
contents_to_load =
static_cast<WebContentsImpl*>(web_contents_navigated);
}
} else if (!weak_new_contents) {
return nullptr;
}
}
if (!was_blocked) {
std::unique_ptr<NavigationController::LoadURLParams> load_params =
std::make_unique<NavigationController::LoadURLParams>(
params.target_url);
load_params->initiator_origin = opener->GetLastCommittedOrigin();
load_params->initiator_process_id = opener->GetProcess()->GetID();
load_params->initiator_frame_token = opener->GetFrameToken();
// Avoiding setting |load_params->source_site_instance| when
// |opener_suppressed| is true, because in that case we do not want to use
// the old SiteInstance and/or BrowsingInstance. See also the test here:
// NewPopupCOOP_SameOriginPolicyAndCrossOriginIframeSetsNoopener.
load_params->referrer = params.referrer.To<Referrer>();
load_params->transition_type = ui::PAGE_TRANSITION_LINK;
load_params->is_renderer_initiated = true;
load_params->was_opener_suppressed = true;
load_params->has_user_gesture = has_user_gesture;
load_params->is_form_submission = params.is_form_submission;
if (params.form_submission_post_data) {
load_params->load_type = NavigationController::LOAD_TYPE_HTTP_POST;
load_params->post_data = params.form_submission_post_data;
load_params->post_content_type = params.form_submission_post_content_type;
}
load_params->impression = params.impression;
load_params->override_user_agent =
contents_to_load->should_override_user_agent_in_new_tabs_
? NavigationController::UA_OVERRIDE_TRUE
: NavigationController::UA_OVERRIDE_FALSE;
load_params->download_policy = params.download_policy;
load_params->initiator_activation_and_ad_status =
params.initiator_activation_and_ad_status;
if (delegate_ && !is_guest &&
!delegate_->ShouldResumeRequestsForCreatedWindow()) {
// We are in asynchronous add new contents path, delay navigation.
DCHECK(!contents_to_load->delayed_open_url_params_);
contents_to_load->delayed_load_url_params_ = std::move(load_params);
} else {
contents_to_load->GetController().LoadURLWithParams(*load_params.get());
if (!is_guest) {
contents_to_load->Focus();
}
}
}
return &new_contents_impl->GetPrimaryFrameTree();
if (weak_new_contents) {
return &new_contents_impl->GetPrimaryFrameTree();
}
return nullptr;
}
RenderWidgetHostImpl* WebContentsImpl::CreateNewPopupWidget(
@@ -5279,7 +5334,8 @@ void WebContentsImpl::AccessibilityLocationChangesReceived(
}
ui::AXNode* WebContentsImpl::GetAccessibilityRootNode() {
BrowserAccessibilityManager* manager = GetRootBrowserAccessibilityManager();
ui::BrowserAccessibilityManager* manager =
GetRootBrowserAccessibilityManager();
if (!manager || !manager->ax_tree()) {
return nullptr;
}
@@ -5452,14 +5508,14 @@ bool WebContentsImpl::IsWidgetForPrimaryMainFrame(
return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost();
}
BrowserAccessibilityManager*
ui::BrowserAccessibilityManager*
WebContentsImpl::GetRootBrowserAccessibilityManager() {
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(GetPrimaryMainFrame());
return rfh ? rfh->browser_accessibility_manager() : nullptr;
}
BrowserAccessibilityManager*
ui::BrowserAccessibilityManager*
WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() {
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(GetPrimaryMainFrame());
@@ -5591,7 +5647,7 @@ WebContents* WebContentsImpl::OpenURL(
return nullptr;
}
if (params.frame_tree_node_id != FrameTreeNode::kFrameTreeNodeInvalidId) {
if (params.frame_tree_node_id) {
if (auto* frame_tree_node =
FrameTreeNode::GloballyFindByID(params.frame_tree_node_id)) {
// If a frame tree node ID is specified and it exists, ensure it is for a
@@ -6557,6 +6613,10 @@ void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) {
navigation_handle->IsInMainFrame() ? "MainFrame" : "Subframe"}),
elapsed);
if (navigation_handle->IsInPrimaryMainFrame()) {
// `notify_disconnection_` may be reset during discard operations, ensure
// this is restored when the when contents is re-navigated.
notify_disconnection_ = true;
// When the browser is started with about:blank as the startup URL, focus
// the location bar (which will also select its contents) so people can
// simply begin typing to navigate elsewhere.
@@ -6588,7 +6648,7 @@ void WebContentsImpl::DidRedirectNavigation(
// BrowserAccessibilityManager associated with the old RFHI.
if (navigation_handle->GetReloadType() != ReloadType::NONE) {
NavigationRequest* request = NavigationRequest::From(navigation_handle);
BrowserAccessibilityManager* manager =
ui::BrowserAccessibilityManager* manager =
request->frame_tree_node()
->current_frame_host()
->browser_accessibility_manager();
@@ -6677,7 +6737,7 @@ void WebContentsImpl::DidFinishNavigation(NavigationHandle* navigation_handle) {
if (navigation_handle->HasCommitted()) {
// TODO(domfarolino, dmazzoni): Do this using WebContentsObserver. See
// https://crbug.com/981271.
BrowserAccessibilityManager* manager =
ui::BrowserAccessibilityManager* manager =
static_cast<RenderFrameHostImpl*>(
navigation_handle->GetRenderFrameHost())
->browser_accessibility_manager();
@@ -8314,8 +8374,7 @@ const blink::RendererPreferences& WebContentsImpl::GetRendererPrefs() const {
}
RenderFrameHostImpl* WebContentsImpl::GetOuterWebContentsFrame() {
if (GetOuterDelegateFrameTreeNodeId() ==
FrameTreeNode::kFrameTreeNodeInvalidId) {
if (GetOuterDelegateFrameTreeNodeId().is_null()) {
return nullptr;
}
@@ -8643,7 +8702,7 @@ void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node) {
// current document.
// TODO(domfarolino, dmazzoni): Do this using WebContentsObserver. See
// https://crbug.com/981271.
BrowserAccessibilityManager* manager =
ui::BrowserAccessibilityManager* manager =
frame_tree_node->current_frame_host()->browser_accessibility_manager();
if (manager) {
manager->UserIsNavigatingAway();
@@ -8671,7 +8730,7 @@ void WebContentsImpl::DidStopLoading() {
GetPrimaryMainFrame()->ForEachRenderFrameHost(
[](RenderFrameHostImpl* render_frame_host) {
BrowserAccessibilityManager* manager =
ui::BrowserAccessibilityManager* manager =
render_frame_host->browser_accessibility_manager();
if (manager) {
manager->DidStopLoading();
@@ -9044,9 +9103,8 @@ void WebContentsImpl::SetFocusedFrameTree(FrameTree* frame_tree_to_focus) {
->GetOutermostMainFrameOrEmbedder());
if (frame_tree_to_focus->GetFocusedFrame() &&
frame_tree_to_focus->GetFocusedFrame()
->current_frame_host()
->inner_tree_main_frame_tree_node_id() !=
FrameTreeNode::kFrameTreeNodeInvalidId) {
->current_frame_host()
->inner_tree_main_frame_tree_node_id()) {
// If an inner frame tree, in `frame_tree_to_focus`, had focus, the
// placeholder RenderFrameHost needs to be unset as the focused frame in
// `frame_tree_to_focus`.
@@ -9092,9 +9150,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
// An embedding frame focusing a fenced frame is not allowed since that would
// be an information leak. If a renderer attempts to do that, that should be
// blocked by `RenderFrameProxyHost::DidFocusFrame()`.
DCHECK(inner_contents ||
node->current_frame_host()->inner_tree_main_frame_tree_node_id() ==
FrameTreeNode::kFrameTreeNodeInvalidId);
DCHECK(inner_contents || node->current_frame_host()
->inner_tree_main_frame_tree_node_id()
.is_null());
if (inner_contents) {
// An inner WebContents is not created from Fenced Frames so we
@@ -9340,14 +9398,21 @@ void WebContentsImpl::RendererUnresponsive(
return;
}
bool visible = GetVisibility() == Visibility::VISIBLE;
base::UmaHistogramBoolean("Renderer.Unresponsive.Visibility", visible);
// Do not report hangs (to task manager, to hang renderer dialog, etc.) for
// invisible tabs (like extension background page, background tabs). See
// https://crbug.com/881812 for rationale and for choosing the visibility
// (rather than process priority) as the signal here.
if (GetVisibility() != Visibility::VISIBLE) {
if (!visible) {
return;
}
base::UmaHistogramBoolean(
"Renderer.Unresponsive.PageVisible.WidgetVisibility",
!render_widget_host->is_hidden());
if (!render_widget_host->renderer_initialized()) {
return;
}
@@ -10389,6 +10454,20 @@ void WebContentsImpl::OnFrameVisibilityChanged(
host, visibility);
}
void WebContentsImpl::OnRemoteSubframeViewportIntersectionStateChanged(
RenderFrameHostImpl* host,
const blink::mojom::ViewportIntersectionState&
viewport_intersection_state) {
OPTIONAL_TRACE_EVENT2(
"content",
"WebContentsImpl::OnRemoteSubframeViewportIntersectionStateChanged",
"render_frame_host", host, "viewport_intersection_state",
viewport_intersection_state);
observers_.NotifyObservers(
&WebContentsObserver::OnRemoteSubframeViewportIntersectionStateChanged,
host, viewport_intersection_state);
}
void WebContentsImpl::OnFrameIsCapturingMediaStreamChanged(
RenderFrameHostImpl* host,
bool is_capturing_media_stream) {
@@ -10825,7 +10904,7 @@ void WebContentsImpl::OnCanResizeFromWebAPIChanged() {
delegate_->OnCanResizeFromWebAPIChanged();
}
int WebContentsImpl::GetOuterDelegateFrameTreeNodeId() {
FrameTreeNodeId WebContentsImpl::GetOuterDelegateFrameTreeNodeId() {
return node_.outer_contents_frame_tree_node_id();
}
@@ -11007,6 +11086,16 @@ gfx::mojom::DelegatedInkPointRenderer* WebContentsImpl::GetDelegatedInkRenderer(
return delegated_ink_point_renderer_.get();
}
void WebContentsImpl::OnInputIgnored(const blink::WebInputEvent& event) {
#if BUILDFLAG(IS_ANDROID)
if (auto* animation_manager =
static_cast<BackForwardTransitionAnimationManagerAndroid*>(
GetBackForwardTransitionAnimationManager())) {
animation_manager->MaybeRecordIgnoredInput(event);
}
#endif
}
void WebContentsImpl::StartPrefetch(
const GURL& prefetch_url,
bool use_prefetch_proxy,
@@ -11058,16 +11147,17 @@ std::unique_ptr<PrerenderHandle> WebContentsImpl::StartPrerendering(
/*initiator_origin=*/std::nullopt,
content::ChildProcessHost::kInvalidUniqueID, GetWeakPtr(),
/*initiator_frame_token=*/std::nullopt,
/*initiator_frame_tree_node_id=*/RenderFrameHost::kNoFrameTreeNodeId,
ukm::kInvalidSourceId, page_transition, should_warm_up_compositor,
/*initiator_frame_tree_node_id=*/FrameTreeNodeId(), ukm::kInvalidSourceId,
page_transition, should_warm_up_compositor,
std::move(url_match_predicate),
std::move(prerender_navigation_handle_callback));
attributes.holdback_status_override = holdback_status_override;
int frame_tree_node_id = GetPrerenderHostRegistry()->CreateAndStartHost(
attributes, preloading_attempt);
FrameTreeNodeId frame_tree_node_id =
GetPrerenderHostRegistry()->CreateAndStartHost(attributes,
preloading_attempt);
if (frame_tree_node_id != FrameTreeNode::kFrameTreeNodeInvalidId) {
if (frame_tree_node_id) {
return std::make_unique<PrerenderHandleImpl>(
GetPrerenderHostRegistry()->GetWeakPtr(), frame_tree_node_id,
prerendering_url);
@@ -11113,6 +11203,10 @@ void WebContentsImpl::AboutToBeDiscarded(WebContents* new_contents) {
new_contents);
}
void WebContentsImpl::NotifyWasDiscarded() {
observers_.NotifyObservers(&WebContentsObserver::WasDiscarded);
}
base::ScopedClosureRunner WebContentsImpl::CreateDisallowCustomCursorScope(
int max_dimension_dips) {
auto* render_widget_host_base = GetPrimaryMainFrame()
@@ -11255,4 +11349,22 @@ void WebContentsImpl::WarmUpAndroidSpareRenderer() {
}
}
void WebContentsImpl::SetPartitionedPopinOpenerOnNewWindowIfNeeded(
WebContentsImpl* new_window,
const mojom::CreateNewWindowParams& params,
RenderFrameHostImpl* opener) {
// We should not take action if the feature is disabled.
if (!base::FeatureList::IsEnabled(blink::features::kPartitionedPopins)) {
return;
}
// All popins should be counted as popups to ensure proper UX treatment.
if (!params.features->is_partitioned_popin || !new_window->is_popup_) {
return;
}
new_window->partitioned_popin_opener_ = opener->GetWeakPtr();
opened_partitioned_popin_ = new_window->GetWeakPtr();
}
} // namespace content
@@ -325,8 +325,6 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
{wf::EnableWebXRSpecParity,
raw_ref(device::features::kWebXrIncubations)},
#endif
{wf::EnableRemoveMobileViewportDoubleTap,
raw_ref(features::kRemoveMobileViewportDoubleTap)},
{wf::EnableServiceWorkerStaticRouter,
raw_ref(features::kServiceWorkerStaticRouter)},
{wf::EnablePermissions, raw_ref(features::kWebPermissionsApi),
@@ -383,6 +381,8 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
kSetOnlyIfOverridden},
{"Fledge", raw_ref(features::kPrivacySandboxAdsAPIsM1Override),
kSetOnlyIfOverridden},
{"FledgeBiddingAndAuctionServerAPI",
raw_ref(blink::features::kFledgeBiddingAndAuctionServer), kDefault},
{"FontationsFontBackend",
raw_ref(blink::features::kFontationsFontBackend)},
{"FontSrcLocalMatching", raw_ref(features::kFontSrcLocalMatching)},
@@ -557,7 +557,10 @@ bool ContentBrowserClient::IsPrivacySandboxReportingDestinationAttested(
void ContentBrowserClient::OnAuctionComplete(
RenderFrameHost* render_frame_host,
std::optional<content::InterestGroupManager::InterestGroupDataKey>
winner_data_key) {}
winner_data_key,
bool is_server_auction,
bool is_on_device_auction,
AuctionResult result) {}
network::mojom::AttributionSupport ContentBrowserClient::GetAttributionSupport(
AttributionReportingOsApiState state,
@@ -987,10 +990,6 @@ bool ContentBrowserClient::IsRendererCodeIntegrityEnabled() {
return false;
}
bool ContentBrowserClient::IsPdfFontProxyEnabled() {
return false;
}
bool ContentBrowserClient::ShouldEnableAudioProcessHighPriority() {
// TODO(crbug.com/40242320): Delete this method when the
// kAudioProcessHighPriorityEnabled enterprise policy is deprecated.
@@ -1009,7 +1008,7 @@ ContentBrowserClient::CreateURLLoaderThrottles(
BrowserContext* browser_context,
const base::RepeatingCallback<WebContents*()>& wc_getter,
NavigationUIData* navigation_ui_data,
int frame_tree_node_id,
FrameTreeNodeId frame_tree_node_id,
std::optional<int64_t> navigation_id) {
return std::vector<std::unique_ptr<blink::URLLoaderThrottle>>();
}
@@ -1019,14 +1018,14 @@ ContentBrowserClient::CreateURLLoaderThrottlesForKeepAlive(
const network::ResourceRequest& request,
BrowserContext* browser_context,
const base::RepeatingCallback<WebContents*()>& wc_getter,
int frame_tree_node_id) {
FrameTreeNodeId frame_tree_node_id) {
return std::vector<std::unique_ptr<blink::URLLoaderThrottle>>();
}
mojo::PendingRemote<network::mojom::URLLoaderFactory>
ContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory(
const std::string& scheme,
int frame_tree_node_id) {
FrameTreeNodeId frame_tree_node_id) {
return {};
}
@@ -1111,7 +1110,7 @@ bool ContentBrowserClient::WillCreateRestrictedCookieManager(
std::vector<std::unique_ptr<URLLoaderRequestInterceptor>>
ContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id,
FrameTreeNodeId frame_tree_node_id,
int64_t navigation_id,
bool force_no_https_upgrade,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) {
@@ -1120,7 +1119,7 @@ ContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
ContentBrowserClient::URLLoaderRequestHandler
ContentBrowserClient::CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
int frame_tree_node_id,
FrameTreeNodeId frame_tree_node_id,
const network::ResourceRequest& resource_request) {
return ContentBrowserClient::URLLoaderRequestHandler();
}
@@ -1150,7 +1149,7 @@ base::Value::Dict ContentBrowserClient::GetNetLogConstants() {
#if BUILDFLAG(IS_ANDROID)
bool ContentBrowserClient::ShouldOverrideUrlLoading(
int frame_tree_node_id,
FrameTreeNodeId frame_tree_node_id,
bool browser_initiated,
const GURL& gurl,
const std::string& request_method,
@@ -1276,7 +1275,7 @@ std::unique_ptr<LoginDelegate> ContentBrowserClient::CreateLoginDelegate(
bool ContentBrowserClient::HandleExternalProtocol(
const GURL& url,
WebContents::Getter web_contents_getter,
int frame_tree_node_id,
FrameTreeNodeId frame_tree_node_id,
NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
@@ -475,6 +475,7 @@
attributeExplicitlyEmpty,
caption,
contents,
cssAltText,
placeholder,
popoverAttribute,
prohibited,
@@ -63,7 +63,9 @@ namespace bluetoothPrivate {
noMemory,
jniEnvironment,
jniThreadAttach,
wakelock
wakelock,
unexpectedState,
socketError
};
// Valid pairing responses.
@@ -371,16 +371,42 @@ namespace declarativeNetRequest {
HeaderInfo[]? excludedResponseHeaders;
};
// Options for regex filters and substitutions for headers.
[nodoc] dictionary HeaderRegexOptions {
// Whether the regex should match all groups for the value. This is only
// relevant if a regex substitution is present and would thus need to be
// applied onto all matching groups. Equivalent to the "g" flag.
// Defaults to false.
boolean? matchAll;
};
dictionary ModifyHeaderInfo {
// The name of the header to be modified.
DOMString header;
// The operation to be performed on a header.
// <!-- TODO(crbug.com/352093575): Make this field optional: It is ignored
// if `regexSubstitution` is specified but is required otherwise. -->
HeaderOperation operation;
// The new value for the header. Must be specified for <code>append</code>
// and <code>set</code> operations.
// <!-- TODO(crbug.com/352093575): Ignored if `regexSubstitution` is
// specified, -->
DOMString? value;
// A regular expression to match against the header value. This follows the
// RE2 syntax for consistency with the rest of the API.
[nodoc] DOMString? regexFilter;
// Substitution pattern for the response header. `regexFilter` must be
// specified for this to be valid. Takes precedence over `value` and
// `operation` if specified and valid.
[nodoc] DOMString? regexSubstitution;
// Options for the regex filter. If not specified, all options will be
// default.
[nodoc] HeaderRegexOptions? regexOptions;
};
[noinline_doc]
@@ -271,6 +271,10 @@ void SetFlags(IsolateHolder::ScriptMode mode,
features::kV8ExperimentalRegexpEngine,
"--enable-experimental-regexp-engine-on-excessive-backtracks",
"--no-enable-experimental-regexp-engine-on-excessive-backtracks");
SetV8FlagsIfOverridden(
features::kV8ExternalMemoryAccountedInGlobalLimit,
"--enable-external-memory-accounted-in-global-limit",
"--no-enable-external-memory-accounted-in-global-limit");
SetV8FlagsIfOverridden(features::kV8TurboFastApiCalls,
"--turbo-fast-api-calls", "--no-turbo-fast-api-calls");
SetV8FlagsIfOverridden(features::kV8MegaDomIC, "--mega-dom-ic",
@@ -283,17 +287,19 @@ void SetFlags(IsolateHolder::ScriptMode mode,
SetV8FlagsFormatted("--memory-reducer-gc-count=%i",
features::kV8MemoryReducerGCCount.Get());
}
SetV8FlagsIfOverridden(features::kV8IncrementalMarkingStartUserVisible,
"--incremental-marking-start-user-visible",
"--no-incremental-marking-start-user-visible");
SetV8FlagsIfOverridden(features::kV8IdleGcOnContextDisposal,
"--idle-gc-on-context-disposal",
"--no-idle-gc-on-context-disposal");
SetV8FlagsIfOverridden(features::kV8GCOptimizeSweepForMutator,
"--cppheap-optimize-sweep-for-mutator",
"--no-cppheap-optimize-sweep-for-mutator");
SetV8FlagsIfOverridden(features::kV8MinorMS, "--minor-ms", "--no-minor-ms");
if (base::FeatureList::IsEnabled(features::kV8ScavengerHigherCapacity)) {
SetV8FlagsFormatted("--scavenger-max-new-space-capacity-mb=%i",
features::kV8ScavengerMaxCapacity.Get());
}
SetV8FlagsIfOverridden(features::kV8SeparateGCPhases, "--separate-gc-phases",
"--no-separate-gc-phases");
SetV8FlagsIfOverridden(features::kV8Sparkplug, "--sparkplug",
"--no-sparkplug");
SetV8FlagsIfOverridden(features::kV8Turbofan, "--turbofan", "--no-turbofan");
@@ -44,8 +44,9 @@
#include "build/chromecast_buildflags.h"
#include "build/chromeos_buildflags.h"
#include "components/cookie_config/cookie_store_util.h"
#include "components/domain_reliability/features.h"
#include "components/domain_reliability/monitor.h"
#include "components/ip_protection/common/ip_protection_config_cache_impl.h"
#include "components/ip_protection/common/ip_protection_config_getter_mojo_impl.h"
#include "components/network_session_configurator/browser/network_session_configurator.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "components/os_crypt/async/common/encryptor.h"
@@ -104,10 +105,7 @@
#include "services/network/http_auth_cache_copier.h"
#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"
#include "services/network/net_log_exporter.h"
#include "services/network/network_service.h"
@@ -2533,14 +2531,16 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
// custom proxy configs, or IpProtection, using the proxy allowlist.
// TODO(https://crbug.com/40947771): Once the WebView traffic experiment is
// done, we should only create an IpProtectionProxyDelegate when
// `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).
// `params_->ip_protection_config_getter` is set (to avoid creating
// proxynetwork_conte 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_->masked_domain_list_manager();
if (!params_->initial_custom_proxy_config && nspal->IsEnabled()) {
auto ipp_config_cache = std::make_unique<IpProtectionConfigCacheImpl>(
std::make_unique<IpProtectionConfigGetterMojoImpl>(
std::move(params_->ip_protection_config_getter)));
auto ipp_config_cache =
std::make_unique<ip_protection::IpProtectionConfigCacheImpl>(
std::make_unique<ip_protection::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);
@@ -2838,12 +2838,12 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
// trigger another URLRequest are not set to respect NetworkAnonymizationKeys,
// the URLRequests that they create might not have a NAK, so only set the
// corresponding value in the URLRequestContext to true at the URLRequest
// layer if all those features are set to respect NAK.
// layer if all those features are set to respect NAK. The Domain Reliability
// feature, which is partitioned by NIK instead of NAK, triggers creation of
// URLRequests as well, so also check `net::HttpCache::IsSplitCacheEnabled()`.
if (require_network_anonymization_key_ &&
net::NetworkAnonymizationKey::IsPartitioningEnabled() &&
base::FeatureList::IsEnabled(
domain_reliability::features::
kPartitionDomainReliabilityByNetworkIsolationKey)) {
net::HttpCache::IsSplitCacheEnabled()) {
builder.set_require_network_anonymization_key(true);
}
@@ -3256,12 +3256,24 @@ void NetworkContext::RevokeNetworkForNonces(
}
}
void NetworkContext::ClearNonces(
const std::vector<base::UnguessableToken>& nonces) {
for (const auto& nonce : nonces) {
network_revocation_nonces_.erase(nonce);
network_revocation_exemptions_.erase(nonce);
}
}
void NetworkContext::ExemptUrlFromNetworkRevocationForNonce(
const GURL& exempted_url,
const base::UnguessableToken& nonce,
ExemptUrlFromNetworkRevocationForNonceCallback callback) {
GURL url_without_filename = exempted_url.GetWithoutFilename();
network_revocation_exemptions_[nonce].insert(url_without_filename);
if (url_without_filename.is_valid()) {
network_revocation_exemptions_[nonce].insert(url_without_filename);
}
std::move(callback).Run();
}
File diff suppressed because it is too large Load Diff
@@ -6,6 +6,9 @@ module blink.mojom;
// ============ Definition for WebFeature used for UseCounter ===============
//
// Documentation:
// https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/use_counter_wiki.md
//
// Do not change assigned numbers of existing items: add new features
// to the end of the list.
//
@@ -15,6 +18,9 @@ module blink.mojom;
//
// A WebFeature conceptually represents some particular web-exposed API
// or code path which can be used/triggered by a web page.
//
// LINT.IfChange(WebFeature)
enum WebFeature {
kOBSOLETE_PageDestruction = 0,
kWorkerStart = 4,
@@ -3770,8 +3776,8 @@ enum WebFeature {
kIDNA2008DeviationCharacterInHostnameOfIFrame = 4428,
kWindowOpenPopupOnMobile = 4429,
kWindowOpenedAsPopupOnMobile = 4430,
kPrivateNetworkAccessIgnoredCrossOriginPreflightError = 4431,
kPrivateNetworkAccessIgnoredCrossSitePreflightError = 4432,
kOBSOLETE_PrivateNetworkAccessIgnoredCrossOriginPreflightError = 4431,
kOBSOLETE_PrivateNetworkAccessIgnoredCrossSitePreflightError = 4432,
kLinkRelPrerenderSameOrigin = 4433,
kLinkRelPrerenderSameSiteCrossOrigin = 4434,
kLinkRelPrerenderCrossSite = 4435,
@@ -3959,8 +3965,8 @@ enum WebFeature {
kPaymentRequestActivationlessShow = 4607,
kWebAppTabbed = 4608,
kFetchLater = 4609,
kURLPatternReliantOnImplicitURLComponentsInString = 4610,
kURLPatternReliantOnLaterComponentFromBaseURL = 4611,
kOBSOLETE_URLPatternReliantOnImplicitURLComponentsInString = 4610,
kOBSOLETE_URLPatternReliantOnLaterComponentFromBaseURL = 4611,
kV8Navigator_CreateAuctionNonce_Method = 4612,
kCrossOriginWindowFrameElement = 4613,
kQuirksModeAboutBlankDocument = 4614,
@@ -4345,17 +4351,17 @@ enum WebFeature {
kLinkRelPayment = 4976,
kV8GPUAdapter_RequestAdapterInfo_Method = 4977,
kOBSOLETE_V8ModelGenericSession_Destroy_Method = 4978,
kV8AITextSession_Execute_Method = 4979,
kV8AITextSession_ExecuteStreaming_Method = 4980,
kV8AI_CanCreateGenericSession_Method = 4981,
kV8AI_CreateGenericSession_Method = 4982,
kV8AI_DefaultGenericSessionOptions_Method = 4983,
kV8AITextSession_Prompt_Method = 4984,
kV8AITextSession_PromptStreaming_Method = 4985,
kV8AI_CanCreateTextSession_Method = 4986,
kV8AI_CreateTextSession_Method = 4987,
kOBSOLETE_V8AITextSession_Execute_Method = 4979,
kOBSOLETE_V8AITextSession_ExecuteStreaming_Method = 4980,
kOBSOLETE_V8AI_CanCreateGenericSession_Method = 4981,
kOBSOLETE_V8AI_CreateGenericSession_Method = 4982,
kOBSOLETE_V8AI_DefaultGenericSessionOptions_Method = 4983,
kOBSOLETE_V8AITextSession_Prompt_Method = 4984,
kOBSOLETE_V8AITextSession_PromptStreaming_Method = 4985,
kOBSOLETE_V8AI_CanCreateTextSession_Method = 4986,
kOBSOLETE_V8AI_CreateTextSession_Method = 4987,
kOBSOLETE_V8AI_DefaultTextSessionOptions_Method = 4988,
kV8AITextSession_Destroy_Method = 4989,
kOBSOLETE_V8AITextSession_Destroy_Method = 4989,
kImportMapIntegrity = 4990,
kSelectElementAppearanceNone = 4991,
kRubyPositionAlternate = 4992,
@@ -4383,7 +4389,7 @@ enum WebFeature {
kARIAColIndexTextAttribute = 5014,
kARIARowIndexTextAttribute = 5015,
kV8PointerEvent_PersistentDeviceId_AttributeGetter = 5016,
kDelegatedInkExpectedImprovement = 5017,
kOBSOLETE_DelegatedInkExpectedImprovement = 5017,
kCSSSelectorNthChildOfSelector = 5018,
kDisableStandardizedBrowserZoom = 5019,
kV8FileSystemObserver_Constructor = 5020,
@@ -4404,13 +4410,13 @@ enum WebFeature {
kWebGPUSubgroupsFeatures = 5035,
kAudioContextOnError = 5036,
kNoVarySearchPrerender = 5037,
kV8AITextSession_Clone_Method = 5038,
kOBSOLETE_V8AITextSession_Clone_Method = 5038,
kGamepadHapticActuatorType = 5039,
kSelectionDirection = 5040,
kSelectionGetComposedRanges = 5041,
kEyeDropperOpen = 5042,
kFlexNewColumnWrapIntrinsicSize = 5043,
kV8AI_TextModelInfo_Method = 5044,
kOBSOLETE_V8AI_TextModelInfo_Method = 5044,
kEventTimingSimulatedClickWithNoKeyboardInteraction = 5045,
kViewTransitionGroupNesting = 5046,
kV8LanguageDetector_Detect_Method = 5047,
@@ -4438,6 +4444,36 @@ enum WebFeature {
kV8AIRewriter_Rewrite_Method = 5069,
kV8AIRewriter_RewriteStreaming_Method = 5070,
kV8AIRewriter_Destroy_Method = 5071,
kFencedFrameCanLoadOpaqueURL = 5072,
kV8Performance_Memory_AttributeGetter_NotLockedToSite = 5073,
kPartitionedPopin_OpenAttempt = 5074,
kPartitionedPopin_Opened = 5075,
kV8AISummarizer_SharedContext_AttributeGetter = 5076,
kV8AISummarizer_Type_AttributeGetter = 5077,
kV8AISummarizer_Format_AttributeGetter = 5078,
kV8AISummarizer_Length_AttributeGetter = 5079,
kV8AIAssistantCapabilities_Available_AttributeGetter = 5080,
kV8AIAssistantCapabilities_DefaultTopK_AttributeGetter = 5081,
kV8AIAssistantCapabilities_MaxTopK_AttributeGetter = 5082,
kV8AIAssistantCapabilities_DefaultTemperature_AttributeGetter = 5083,
kV8AIAssistantFactory_Capabilities_Method = 5084,
kV8AIAssistantFactory_Create_Method = 5085,
kV8AI_Assistant_AttributeGetter = 5086,
kV8AIAssistant_MaxTokens_AttributeGetter = 5087,
kV8AIAssistant_TokensSoFar_AttributeGetter = 5088,
kV8AIAssistant_TokensLeft_AttributeGetter = 5089,
kV8AIAssistant_TopK_AttributeGetter = 5090,
kV8AIAssistant_Temperature_AttributeGetter = 5091,
kV8AIAssistant_Clone_Method = 5092,
kV8AIAssistant_Destroy_Method = 5093,
kV8AIAssistant_Prompt_Method = 5094,
kV8AIAssistant_PromptStreaming_Method = 5095,
kV8Window_PopinContextTypesSupported_Method = 5096,
kV8Window_PopinContextType_Method = 5097,
kWebAuthentication_AttestationFormats = 5098,
kCssDisplayPropertyMultipleValues = 5099,
kDocumentPolicyExpectNoLinkedResources = 5100,
kSelectionIsCollapsedBehaviorChange = 5101,
// 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
@@ -4446,7 +4482,6 @@ enum WebFeature {
// Also, run update_use_counter_feature_enum.py in
// chromium/src/tools/metrics/histograms/ to update the UMA mapping.
// TODO(dcheng): Fix https://crbug.com/742517 and use the autogenerated
// constants.
kNumberOfFeatures, // This enum value must be last.
};
// LINT.ThenChange(//tools/metrics/histograms/enums.xml:FeatureObserver)
@@ -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.
[
Exposed=Window,
RuntimeEnabled=CSSNestedDeclarations,
ImplementedAs=CSSNestedDeclarationsRule
] interface CSSNestedDeclarations : CSSRule {
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};
@@ -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.
[
RuntimeFlag=CSSNestedDeclarationsRule
] interface CSSNestedDeclarationsRule : CSSRule {
[SetterCallWith=ExecutionContext] attribute DOMString selectorText;
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
[SameObject, MeasureAs=CSSTypedOMStylePropertyMap] readonly attribute StylePropertyMap styleMap;
};
@@ -32,8 +32,8 @@
enum FontFaceSetLoadStatus { "loading", "loaded" };
// TODO(foolip): This interface should have a constructor and thus not have
// [LegacyNoInterfaceObject]
// No constructor, see
// https://github.com/w3c/csswg-drafts/issues/10390#issuecomment-2233736229
[
LegacyNoInterfaceObject,
Exposed=(Window,Worker)
@@ -121,38 +121,32 @@ class MediaQueryFeatureSet : public MediaQueryParser::FeatureSet {
MediaQuerySet* MediaQueryParser::ParseMediaQuerySet(
const String& query_string,
const ExecutionContext* execution_context) {
CSSTokenizer tokenizer(query_string);
auto [tokens, raw_offsets] = tokenizer.TokenizeToEOFWithOffsets();
CSSParserTokenRange range(tokens);
CSSParserTokenOffsets offsets(tokens, std::move(raw_offsets), query_string);
return ParseMediaQuerySet(range, offsets, execution_context);
CSSParserTokenStream stream(query_string);
return ParseMediaQuerySet(stream, execution_context);
}
MediaQuerySet* MediaQueryParser::ParseMediaQuerySet(
CSSParserTokenRange range,
const CSSParserTokenOffsets& offsets,
CSSParserTokenStream& stream,
const ExecutionContext* execution_context) {
return MediaQueryParser(kMediaQuerySetParser, kHTMLStandardMode,
execution_context)
.ParseImpl(range, offsets);
.ParseImpl(stream);
}
MediaQuerySet* MediaQueryParser::ParseMediaQuerySetInMode(
CSSParserTokenRange range,
const CSSParserTokenOffsets& offsets,
CSSParserTokenStream& stream,
CSSParserMode mode,
const ExecutionContext* execution_context) {
return MediaQueryParser(kMediaQuerySetParser, mode, execution_context)
.ParseImpl(range, offsets);
.ParseImpl(stream);
}
MediaQuerySet* MediaQueryParser::ParseMediaCondition(
CSSParserTokenRange range,
const CSSParserTokenOffsets& offsets,
CSSParserTokenStream& stream,
const ExecutionContext* execution_context) {
return MediaQueryParser(kMediaConditionParser, kHTMLStandardMode,
execution_context)
.ParseImpl(range, offsets);
.ParseImpl(stream);
}
MediaQueryParser::MediaQueryParser(ParserType parser_type,
@@ -170,8 +164,6 @@ MediaQueryParser::MediaQueryParser(ParserType parser_type,
? DynamicTo<LocalDOMWindow>(execution_context)->document()
: nullptr)) {}
MediaQueryParser::~MediaQueryParser() = default;
namespace {
bool IsRestrictorOrLogicalOperator(const CSSParserToken& token) {
@@ -183,33 +175,38 @@ bool IsRestrictorOrLogicalOperator(const CSSParserToken& token) {
EqualIgnoringASCIICase(token.Value(), "layer");
}
bool ConsumeUntilCommaInclusive(CSSParserTokenRange& range) {
while (!range.AtEnd()) {
if (range.Peek().GetType() == kCommaToken) {
range.ConsumeIncludingWhitespace();
return true;
}
range.ConsumeComponentValue();
bool ConsumeUntilCommaInclusive(CSSParserTokenStream& stream) {
stream.SkipUntilPeekedTypeIs<kCommaToken>();
if (stream.Peek().GetType() == kCommaToken) {
stream.ConsumeIncludingWhitespace();
return true;
} else {
return false;
}
return false;
}
bool IsComparisonDelimiter(UChar c) {
return c == '<' || c == '>' || c == '=';
}
CSSParserTokenRange ConsumeUntilComparisonOrColon(CSSParserTokenRange& range) {
const CSSParserToken* first = range.begin();
while (!range.AtEnd()) {
const CSSParserToken& token = range.Peek();
if ((token.GetType() == kDelimiterToken &&
IsComparisonDelimiter(token.Delimiter())) ||
token.GetType() == kColonToken) {
break;
void SkipUntilComparisonOrColon(CSSParserTokenStream& stream) {
while (!stream.AtEnd()) {
stream.SkipUntilPeekedTypeIs<kDelimiterToken, kColonToken>();
if (stream.AtEnd()) {
return;
}
const CSSParserToken& token = stream.Peek();
if (token.GetType() == kDelimiterToken) {
if (IsComparisonDelimiter(token.Delimiter())) {
return;
} else {
stream.Consume();
}
} else {
DCHECK_EQ(token.GetType(), kColonToken);
return;
}
range.ConsumeComponentValue();
}
return range.MakeSubRange(first, range.begin());
}
bool IsLtLe(MediaQueryOperator op) {
@@ -223,50 +220,50 @@ bool IsGtGe(MediaQueryOperator op) {
} // namespace
MediaQuery::RestrictorType MediaQueryParser::ConsumeRestrictor(
CSSParserTokenRange& range) {
if (ConsumeIfIdent(range, "not")) {
CSSParserTokenStream& stream) {
if (ConsumeIfIdent(stream, "not")) {
return MediaQuery::RestrictorType::kNot;
}
if (ConsumeIfIdent(range, "only")) {
if (ConsumeIfIdent(stream, "only")) {
return MediaQuery::RestrictorType::kOnly;
}
return MediaQuery::RestrictorType::kNone;
}
String MediaQueryParser::ConsumeType(CSSParserTokenRange& range) {
if (range.Peek().GetType() != kIdentToken) {
String MediaQueryParser::ConsumeType(CSSParserTokenStream& stream) {
if (stream.Peek().GetType() != kIdentToken) {
return g_null_atom;
}
if (IsRestrictorOrLogicalOperator(range.Peek())) {
if (IsRestrictorOrLogicalOperator(stream.Peek())) {
return g_null_atom;
}
return range.ConsumeIncludingWhitespace().Value().ToString();
return stream.ConsumeIncludingWhitespace().Value().ToString();
}
MediaQueryOperator MediaQueryParser::ConsumeComparison(
CSSParserTokenRange& range) {
const CSSParserToken& first = range.Peek();
if (first.GetType() != kDelimiterToken) {
CSSParserTokenStream& stream) {
const CSSParserToken& first = stream.Peek();
if (first.GetType() != kDelimiterToken ||
!IsComparisonDelimiter(first.Delimiter())) {
return MediaQueryOperator::kNone;
}
DCHECK(IsComparisonDelimiter(first.Delimiter()));
switch (first.Delimiter()) {
case '=':
range.ConsumeIncludingWhitespace();
stream.ConsumeIncludingWhitespace();
return MediaQueryOperator::kEq;
case '<':
range.Consume();
if (ConsumeIfDelimiter(range, '=')) {
stream.Consume();
if (ConsumeIfDelimiter(stream, '=')) {
return MediaQueryOperator::kLe;
}
range.ConsumeWhitespace();
stream.ConsumeWhitespace();
return MediaQueryOperator::kLt;
case '>':
range.Consume();
if (ConsumeIfDelimiter(range, '=')) {
stream.Consume();
if (ConsumeIfDelimiter(stream, '=')) {
return MediaQueryOperator::kGe;
}
range.ConsumeWhitespace();
stream.ConsumeWhitespace();
return MediaQueryOperator::kGt;
}
@@ -274,12 +271,12 @@ MediaQueryOperator MediaQueryParser::ConsumeComparison(
return MediaQueryOperator::kNone;
}
String MediaQueryParser::ConsumeAllowedName(CSSParserTokenRange& range,
String MediaQueryParser::ConsumeAllowedName(CSSParserTokenStream& stream,
const FeatureSet& feature_set) {
if (range.Peek().GetType() != kIdentToken) {
if (stream.Peek().GetType() != kIdentToken) {
return g_null_atom;
}
String name = range.Peek().Value().ToString();
String name = stream.Peek().Value().ToString();
if (!feature_set.IsCaseSensitive(name)) {
name = name.LowerASCII();
}
@@ -287,13 +284,13 @@ String MediaQueryParser::ConsumeAllowedName(CSSParserTokenRange& range,
if (!feature_set.IsAllowed(name)) {
return g_null_atom;
}
range.ConsumeIncludingWhitespace();
stream.ConsumeIncludingWhitespace();
return name;
}
String MediaQueryParser::ConsumeUnprefixedName(CSSParserTokenRange& range,
String MediaQueryParser::ConsumeUnprefixedName(CSSParserTokenStream& stream,
const FeatureSet& feature_set) {
String name = ConsumeAllowedName(range, feature_set);
String name = ConsumeAllowedName(stream, feature_set);
if (name.IsNull()) {
return name;
}
@@ -303,83 +300,39 @@ String MediaQueryParser::ConsumeUnprefixedName(CSSParserTokenRange& range,
return name;
}
const MediaQueryExpNode* MediaQueryParser::ParseNameValueComparison(
CSSParserTokenRange lhs,
MediaQueryOperator op,
CSSParserTokenRange rhs,
const CSSParserTokenOffsets& offsets,
NameAffinity name_affinity,
const FeatureSet& feature_set) {
if (name_affinity == NameAffinity::kRight) {
std::swap(lhs, rhs);
}
String feature_name = ConsumeUnprefixedName(lhs, feature_set);
if (feature_name.IsNull() || !lhs.AtEnd()) {
return nullptr;
}
auto value =
MediaQueryExpValue::Consume(feature_name, rhs, offsets, fake_context_);
if (!value || !rhs.AtEnd()) {
return nullptr;
}
auto left = MediaQueryExpComparison();
auto right = MediaQueryExpComparison(*value, op);
if (name_affinity == NameAffinity::kRight) {
std::swap(left, right);
}
return MakeGarbageCollected<MediaQueryFeatureExpNode>(
MediaQueryExp::Create(feature_name, MediaQueryExpBounds(left, right)));
}
const MediaQueryExpNode* MediaQueryParser::ConsumeFeature(
CSSParserTokenRange& range,
const CSSParserTokenOffsets& offsets,
CSSParserTokenStream& stream,
const FeatureSet& feature_set) {
// Because we don't know exactly where <mf-name> appears in the grammar, we
// split |range| on top-level separators, and parse each segment
// individually.
// There are several possible grammars for media queries, and we don't
// know where <mf-name> appears. Thus, our only strategy is to just try them
// one by one and restart if we got it wrong.
//
// Local variables names in this function are chosen with the expectation
// that we are heading towards the most complicated form of <mf-range>:
//
// <mf-value> <mf-gt> <mf-name> <mf-gt> <mf-value>
//
// Which corresponds to the local variables:
//
// <segment1> <op1> <segment2> <op2> <segment3>
CSSParserTokenRange segment1 = ConsumeUntilComparisonOrColon(range);
CSSParserTokenStream::State start = stream.Save();
// <mf-boolean> = <mf-name>
if (range.AtEnd()) {
String feature_name = ConsumeAllowedName(segment1, feature_set);
if (feature_name.IsNull() || !segment1.AtEnd() ||
!feature_set.IsAllowedWithoutValue(feature_name, execution_context_)) {
return nullptr;
}
return MakeGarbageCollected<MediaQueryFeatureExpNode>(
MediaQueryExp::Create(feature_name, MediaQueryExpBounds()));
}
{
String feature_name = ConsumeAllowedName(stream, feature_set);
// <mf-plain> = <mf-name> : <mf-value>
if (range.Peek().GetType() == kColonToken) {
range.ConsumeIncludingWhitespace();
String feature_name = ConsumeAllowedName(segment1, feature_set);
if (feature_name.IsNull() || !segment1.AtEnd()) {
return nullptr;
// <mf-boolean> = <mf-name>
if (!feature_name.IsNull() && stream.AtEnd() &&
feature_set.IsAllowedWithoutValue(feature_name, execution_context_)) {
return MakeGarbageCollected<MediaQueryFeatureExpNode>(
MediaQueryExp::Create(feature_name, MediaQueryExpBounds()));
}
auto exp =
MediaQueryExp::Create(feature_name, range, offsets, fake_context_);
if (!exp.IsValid() || !range.AtEnd()) {
return nullptr;
// <mf-plain> = <mf-name> : <mf-value>
if (!feature_name.IsNull() && stream.Peek().GetType() == kColonToken) {
stream.ConsumeIncludingWhitespace();
// NOTE: We do not check for stream.AtEnd() here, as an empty mf-value is
// legal.
auto exp = MediaQueryExp::Create(feature_name, stream, fake_context_);
if (exp.IsValid() && stream.AtEnd()) {
return MakeGarbageCollected<MediaQueryFeatureExpNode>(exp);
}
}
return MakeGarbageCollected<MediaQueryFeatureExpNode>(exp);
stream.Restore(start);
}
if (!feature_set.SupportsRange()) {
@@ -393,38 +346,87 @@ const MediaQueryExpNode* MediaQueryParser::ConsumeFeature(
// | <mf-value> <mf-lt> <mf-name> <mf-lt> <mf-value>
// | <mf-value> <mf-gt> <mf-name> <mf-gt> <mf-value>
MediaQueryOperator op1 = ConsumeComparison(range);
DCHECK_NE(op1, MediaQueryOperator::kNone);
{
// Try: <mf-name> <mf-comparison> <mf-value> (e.g., “width <= 10px”)
String feature_name = ConsumeUnprefixedName(stream, feature_set);
if (!feature_name.IsNull() && !stream.AtEnd()) {
MediaQueryOperator op = ConsumeComparison(stream);
if (op != MediaQueryOperator::kNone) {
auto value =
MediaQueryExpValue::Consume(feature_name, stream, fake_context_);
if (value && stream.AtEnd()) {
auto left = MediaQueryExpComparison();
auto right = MediaQueryExpComparison(*value, op);
CSSParserTokenRange segment2 = ConsumeUntilComparisonOrColon(range);
// If the range ended, the feature must be on the following form:
//
// <segment1> <op1> <segment2>
//
// We don't know which of <segment1> and <segment2> should be interpreted as
// the <mf-name> and which should be interpreted as <mf-value>. We have to
// try both.
if (range.AtEnd()) {
// Try: <mf-name> <mf-comparison> <mf-value>
if (const MediaQueryExpNode* node =
ParseNameValueComparison(segment1, op1, segment2, offsets,
NameAffinity::kLeft, feature_set)) {
return node;
return MakeGarbageCollected<MediaQueryFeatureExpNode>(
MediaQueryExp::Create(feature_name,
MediaQueryExpBounds(left, right)));
}
}
}
// Otherwise: <mf-value> <mf-comparison> <mf-name>
return ParseNameValueComparison(segment1, op1, segment2, offsets,
NameAffinity::kRight, feature_set);
stream.Restore(start);
}
// Otherwise, the feature must be on the form:
// It must be one of these three:
//
// <segment1> <op1> <segment2> <op2> <segment3>
// <mf-value> <mf-comparison> <mf-name> (e.g., “10px = width”)
// <mf-value> <mf-lt> <mf-name> <mf-lt> <mf-value>
// <mf-value> <mf-gt> <mf-name> <mf-gt> <mf-value>
//
// This grammar is easier to deal with, since <mf-name> can only appear
// at <segment2>.
MediaQueryOperator op2 = ConsumeComparison(range);
// We don't know how to parse <mf-value> yet, so we need to skip it
// and parse <mf-name> first, then return to (the first) <mf-value>
// afterwards.
//
// Local variables names from here on are chosen with the expectation
// that we are heading towards the most complicated form of <mf-range>
// (the latter in the list), which corresponds to the local variables:
//
// <value1> <op1> <feature_name> <op2> <value2>
SkipUntilComparisonOrColon(stream);
if (stream.AtEnd()) {
return nullptr;
}
wtf_size_t offset_after_value1 = stream.LookAheadOffset();
MediaQueryOperator op1 = ConsumeComparison(stream);
if (op1 == MediaQueryOperator::kNone) {
return nullptr;
}
String feature_name = ConsumeUnprefixedName(stream, feature_set);
if (feature_name.IsNull()) {
return nullptr;
}
stream.ConsumeWhitespace();
CSSParserTokenStream::State after_feature_name = stream.Save();
stream.Restore(start);
auto value1 =
MediaQueryExpValue::Consume(feature_name, stream, fake_context_);
if (!value1) {
return nullptr;
}
if (stream.LookAheadOffset() != offset_after_value1) {
// There was junk between <value1> and <op1>.
return nullptr;
}
// Skip over the comparison and name again.
stream.Restore(after_feature_name);
if (stream.AtEnd()) {
// Must be: <mf-value> <mf-comparison> <mf-name>
auto left = MediaQueryExpComparison(*value1, op1);
auto right = MediaQueryExpComparison();
return MakeGarbageCollected<MediaQueryFeatureExpNode>(
MediaQueryExp::Create(feature_name, MediaQueryExpBounds(left, right)));
}
// Parse the last <mf-value>.
MediaQueryOperator op2 = ConsumeComparison(stream);
if (op2 == MediaQueryOperator::kNone) {
return nullptr;
}
@@ -436,56 +438,39 @@ const MediaQueryExpNode* MediaQueryParser::ConsumeFeature(
return nullptr;
}
if (range.AtEnd()) {
return nullptr;
}
String feature_name = ConsumeUnprefixedName(segment2, feature_set);
if (feature_name.IsNull() || !segment2.AtEnd()) {
return nullptr;
}
auto left_value = MediaQueryExpValue::Consume(feature_name, segment1, offsets,
fake_context_);
if (!left_value || !segment1.AtEnd()) {
return nullptr;
}
CSSParserTokenRange& segment3 = range;
auto right_value = MediaQueryExpValue::Consume(feature_name, segment3,
offsets, fake_context_);
if (!right_value || !segment3.AtEnd()) {
auto value2 =
MediaQueryExpValue::Consume(feature_name, stream, fake_context_);
if (!value2) {
return nullptr;
}
return MakeGarbageCollected<MediaQueryFeatureExpNode>(MediaQueryExp::Create(
feature_name,
MediaQueryExpBounds(MediaQueryExpComparison(*left_value, op1),
MediaQueryExpComparison(*right_value, op2))));
MediaQueryExpBounds(MediaQueryExpComparison(*value1, op1),
MediaQueryExpComparison(*value2, op2))));
}
const MediaQueryExpNode* MediaQueryParser::ConsumeCondition(
CSSParserTokenRange& range,
const CSSParserTokenOffsets& offsets,
CSSParserTokenStream& stream,
ConditionMode mode) {
// <media-not>
if (ConsumeIfIdent(range, "not")) {
return MediaQueryExpNode::Not(ConsumeInParens(range, offsets));
if (ConsumeIfIdent(stream, "not")) {
return MediaQueryExpNode::Not(ConsumeInParens(stream));
}
// Otherwise:
// <media-in-parens> [ <media-and>* | <media-or>* ]
const MediaQueryExpNode* result = ConsumeInParens(range, offsets);
const MediaQueryExpNode* result = ConsumeInParens(stream);
if (AtIdent(range.Peek(), "and")) {
while (result && ConsumeIfIdent(range, "and")) {
result = MediaQueryExpNode::And(result, ConsumeInParens(range, offsets));
if (AtIdent(stream.Peek(), "and")) {
while (result && ConsumeIfIdent(stream, "and")) {
result = MediaQueryExpNode::And(result, ConsumeInParens(stream));
}
} else if (result && AtIdent(range.Peek(), "or") &&
} else if (result && AtIdent(stream.Peek(), "or") &&
mode == ConditionMode::kNormal) {
while (result && ConsumeIfIdent(range, "or")) {
result = MediaQueryExpNode::Or(result, ConsumeInParens(range, offsets));
while (result && ConsumeIfIdent(stream, "or")) {
result = MediaQueryExpNode::Or(result, ConsumeInParens(stream));
}
}
@@ -493,129 +478,127 @@ const MediaQueryExpNode* MediaQueryParser::ConsumeCondition(
}
const MediaQueryExpNode* MediaQueryParser::ConsumeInParens(
CSSParserTokenRange& range,
const CSSParserTokenOffsets& offsets) {
CSSParserTokenRange original_range = range;
CSSParserTokenStream& stream) {
if (stream.Peek().GetType() == kLeftParenthesisToken) {
{
CSSParserTokenStream::RestoringBlockGuard guard(stream);
stream.ConsumeWhitespace();
if (range.Peek().GetType() == kLeftParenthesisToken) {
CSSParserTokenRange block = range.ConsumeBlock();
block.ConsumeWhitespace();
range.ConsumeWhitespace();
CSSParserTokenRange original_block = block;
// ( <media-condition> )
const MediaQueryExpNode* condition = ConsumeCondition(block, offsets);
if (condition && block.AtEnd()) {
return MediaQueryExpNode::Nested(condition);
// ( <media-condition> )
const MediaQueryExpNode* condition = ConsumeCondition(stream);
if (condition && guard.Release()) {
stream.ConsumeWhitespace();
return MediaQueryExpNode::Nested(condition);
}
}
block = original_block;
// ( <media-feature> )
const MediaQueryExpNode* feature =
ConsumeFeature(block, offsets, MediaQueryFeatureSet());
if (feature && block.AtEnd()) {
return MediaQueryExpNode::Nested(feature);
{
CSSParserTokenStream::RestoringBlockGuard guard(stream);
stream.ConsumeWhitespace();
// ( <media-feature> )
const MediaQueryExpNode* feature =
ConsumeFeature(stream, MediaQueryFeatureSet());
if (feature && guard.Release()) {
stream.ConsumeWhitespace();
return MediaQueryExpNode::Nested(feature);
}
}
}
range = original_range;
// <general-enclosed>
return ConsumeGeneralEnclosed(range);
return ConsumeGeneralEnclosed(stream);
}
const MediaQueryExpNode* MediaQueryParser::ConsumeGeneralEnclosed(
CSSParserTokenRange& range) {
if (range.Peek().GetType() != kLeftParenthesisToken &&
range.Peek().GetType() != kFunctionToken) {
CSSParserTokenStream& stream) {
if (stream.Peek().GetType() != kLeftParenthesisToken &&
stream.Peek().GetType() != kFunctionToken) {
return nullptr;
}
const CSSParserToken* first = range.begin();
wtf_size_t start_offset = stream.Offset();
StringView general_enclosed;
{
CSSParserTokenStream::BlockGuard guard(stream);
CSSParserTokenRange block = range.ConsumeBlock();
block.ConsumeWhitespace();
stream.ConsumeWhitespace();
// Note that <any-value> is optional in <general-enclosed>, so having an
// empty block is fine.
if (!block.AtEnd()) {
if (!ConsumeAnyValue(block) || !block.AtEnd()) {
// Note that <any-value> is optional in <general-enclosed>, so having an
// empty block is fine.
ConsumeAnyValue(stream);
if (!stream.AtEnd()) {
return nullptr;
}
}
wtf_size_t end_offset = stream.Offset();
// TODO(crbug.com/962417): This is not well specified.
String general_enclosed =
range.MakeSubRange(first, range.begin()).Serialize();
range.ConsumeWhitespace();
return MakeGarbageCollected<MediaQueryUnknownExpNode>(general_enclosed);
general_enclosed =
stream.StringRangeAt(start_offset, end_offset - start_offset);
stream.ConsumeWhitespace();
return MakeGarbageCollected<MediaQueryUnknownExpNode>(
general_enclosed.ToString());
}
MediaQuerySet* MediaQueryParser::ConsumeSingleCondition(
CSSParserTokenRange range,
const CSSParserTokenOffsets& offsets) {
CSSParserTokenStream& stream) {
DCHECK_EQ(parser_type_, kMediaConditionParser);
DCHECK(!range.AtEnd());
const MediaQueryExpNode* node = ConsumeCondition(range, offsets);
DCHECK(!stream.AtEnd());
HeapVector<Member<const MediaQuery>> queries;
if (!node || !range.AtEnd()) {
const MediaQueryExpNode* node = ConsumeCondition(stream);
if (!node) {
queries.push_back(MediaQuery::CreateNotAll());
} else {
queries.push_back(MakeGarbageCollected<MediaQuery>(
MediaQuery::RestrictorType::kNone, media_type_names::kAll, node));
}
return MakeGarbageCollected<MediaQuerySet>(std::move(queries));
}
MediaQuery* MediaQueryParser::ConsumeQuery(
CSSParserTokenRange& range,
const CSSParserTokenOffsets& offsets) {
MediaQuery* MediaQueryParser::ConsumeQuery(CSSParserTokenStream& stream) {
DCHECK_EQ(parser_type_, kMediaQuerySetParser);
CSSParserTokenRange original_range = range;
CSSParserTokenStream::State savepoint = stream.Save();
// First try to parse following grammar:
//
// [ not | only ]? <media-type> [ and <media-condition-without-or> ]?
MediaQuery::RestrictorType restrictor = ConsumeRestrictor(range);
String type = ConsumeType(range);
MediaQuery::RestrictorType restrictor = ConsumeRestrictor(stream);
String type = ConsumeType(stream);
if (!type.IsNull()) {
if (!ConsumeIfIdent(range, "and")) {
if (!ConsumeIfIdent(stream, "and")) {
return MakeGarbageCollected<MediaQuery>(restrictor, type, nullptr);
}
if (const MediaQueryExpNode* node =
ConsumeCondition(range, offsets, ConditionMode::kWithoutOr)) {
ConsumeCondition(stream, ConditionMode::kWithoutOr)) {
return MakeGarbageCollected<MediaQuery>(restrictor, type, node);
}
return nullptr;
}
range = original_range;
stream.Restore(savepoint);
// Otherwise, <media-condition>
if (const MediaQueryExpNode* node = ConsumeCondition(range, offsets)) {
if (const MediaQueryExpNode* node = ConsumeCondition(stream)) {
return MakeGarbageCollected<MediaQuery>(MediaQuery::RestrictorType::kNone,
media_type_names::kAll, node);
}
return nullptr;
}
MediaQuerySet* MediaQueryParser::ParseImpl(
CSSParserTokenRange range,
const CSSParserTokenOffsets& offsets) {
range.ConsumeWhitespace();
MediaQuerySet* MediaQueryParser::ParseImpl(CSSParserTokenStream& stream) {
stream.ConsumeWhitespace();
// Note that we currently expect an empty input to evaluate to an empty
// MediaQuerySet, rather than "not all".
if (range.AtEnd()) {
if (stream.AtEnd()) {
return MakeGarbageCollected<MediaQuerySet>();
}
if (parser_type_ == kMediaConditionParser) {
return ConsumeSingleCondition(range, offsets);
return ConsumeSingleCondition(stream);
}
DCHECK_EQ(parser_type_, kMediaQuerySetParser);
@@ -623,10 +606,11 @@ MediaQuerySet* MediaQueryParser::ParseImpl(
HeapVector<Member<const MediaQuery>> queries;
do {
MediaQuery* query = ConsumeQuery(range, offsets);
bool ok = query && (range.AtEnd() || range.Peek().GetType() == kCommaToken);
MediaQuery* query = ConsumeQuery(stream);
bool ok =
query && (stream.AtEnd() || stream.Peek().GetType() == kCommaToken);
queries.push_back(ok ? query : MediaQuery::CreateNotAll());
} while (!range.AtEnd() && ConsumeUntilCommaInclusive(range));
} while (!stream.AtEnd() && ConsumeUntilCommaInclusive(stream));
return MakeGarbageCollected<MediaQuerySet>(std::move(queries));
}
@@ -81,7 +81,7 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;
// https://html.spec.whatwg.org/C/#the-document-object
// https://github.com/whatwg/html/pull/9538
[RuntimeEnabled=HTMLUnsafeMethods,CallWith=ExecutionContext,MeasureAs=ParseHTMLUnsafe] static Document parseHTMLUnsafe(HTMLString html);
[CallWith=ExecutionContext,MeasureAs=ParseHTMLUnsafe] static Document parseHTMLUnsafe(HTMLString html);
// resource metadata management
@@ -101,7 +101,7 @@ dictionary CheckVisibilityOptions {
[CEReactions, RaisesException=Setter] attribute [LegacyNullToEmptyString, StringContext=TrustedHTML] DOMString outerHTML;
[CEReactions, RaisesException] void insertAdjacentHTML(DOMString position, HTMLString text);
// https://github.com/whatwg/html/pull/9538
[RuntimeEnabled=HTMLUnsafeMethods,RaisesException,MeasureAs=SetHTMLUnsafe,CEReactions] void setHTMLUnsafe(HTMLString html);
[RaisesException,MeasureAs=SetHTMLUnsafe,CEReactions] void setHTMLUnsafe(HTMLString html);
// Declarative Shadow DOM getInnerHTML() function. This version should be
// considered deprecated, as we work to standardize the version below,
@@ -114,7 +114,7 @@ dictionary CheckVisibilityOptions {
// Pointer Lock
// https://w3c.github.io/pointerlock/#extensions-to-the-element-interface
// https://github.com/w3c/pointerlock/pull/49
[MeasureAs=ElementRequestPointerLock, CallWith=ScriptState, RaisesException] any requestPointerLock(optional PointerLockOptions options = {});
[MeasureAs=ElementRequestPointerLock, CallWith=ScriptState, RaisesException] Promise<undefined> requestPointerLock(optional PointerLockOptions options = {});
// CSSOM View Module
// https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface
@@ -43,5 +43,5 @@
const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400;
const unsigned long SHOW_NOTATION = 0x800; // historical
unsigned short acceptNode(Node node);
unsigned short acceptNode([NodeWrapInOwnContext] Node node);
};
@@ -23,14 +23,14 @@
[
Exposed=Window
] interface NodeIterator {
[SameObject] readonly attribute Node root;
readonly attribute Node referenceNode;
[NodeWrapInOwnContext, SameObject] readonly attribute Node root;
[NodeWrapInOwnContext] readonly attribute Node referenceNode;
readonly attribute boolean pointerBeforeReferenceNode;
readonly attribute unsigned long whatToShow;
readonly attribute NodeFilter? filter;
[RaisesException] Node? nextNode();
[RaisesException] Node? previousNode();
[NodeWrapInOwnContext, RaisesException] Node? nextNode();
[NodeWrapInOwnContext, RaisesException] Node? previousNode();
[MeasureAs=NodeIteratorDetach] void detach();
};
@@ -8,6 +8,7 @@ callback SubscribeCallback = void (Subscriber subscriber);
callback ObserverCallback = void (any value);
callback ObserverCompleteCallback = void ();
callback Reducer = any (any accumulator, any currentValue, unsigned long long index);
callback Mapper = any (any element, unsigned long long index);
// Differs from Mapper only in return type, since this callback is exclusively
@@ -17,8 +18,11 @@ callback Visitor = undefined (any element, unsigned long long index);
// including the `index` parameter.
callback Predicate = boolean (any value, unsigned long long index);
callback ObservableInspectorAbortHandler = undefined (any value);
// This callback returns an `any` that must convert into an `Observable`, via
// the `Observable` conversion semantics.
callback CatchCallback = any (any value);
callback ObservableInspectorAbortHandler = undefined (any value);
dictionary ObservableInspector {
ObserverCallback next;
ObserverCallback error;
@@ -62,6 +66,7 @@ interface Observable {
[CallWith=ScriptState, RaisesException] Observable flatMap(Mapper mapper);
[CallWith=ScriptState, RaisesException] Observable switchMap(Mapper mapper);
[CallWith=ScriptState] Observable inspect(optional ObservableInspectorUnion inspect_observer = {});
[CallWith=ScriptState, RaisesException, ImplementedAs=catchImpl] Observable catch(CatchCallback callback);
// Promise-returning operators.
// See https://wicg.github.io/observable/#promise-returning-operators.
@@ -72,5 +77,6 @@ interface Observable {
[CallWith=ScriptState] Promise<boolean> some(Predicate predicate, optional SubscribeOptions options = {});
[CallWith=ScriptState] Promise<boolean> every(Predicate predicate, optional SubscribeOptions options = {});
[CallWith=ScriptState] Promise<any> find(Predicate predicate, optional SubscribeOptions options = {});
[CallWith=ScriptState] Promise<any> reduce(Reducer reducer, optional any initialValue, optional SubscribeOptions options = {});
};
@@ -88,7 +88,7 @@ interface ShadowRoot : DocumentFragment {
Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName,
(DOMString or ElementCreationOptions) options);
[RuntimeEnabled=HTMLUnsafeMethods,RaisesException,MeasureAs=SetHTMLUnsafe,CEReactions] void setHTMLUnsafe(HTMLString string);
[RaisesException,MeasureAs=SetHTMLUnsafe,CEReactions] void setHTMLUnsafe(HTMLString string);
};
ShadowRoot includes DocumentOrShadowRoot;
@@ -14,6 +14,7 @@ dictionary ShadowRootInit {
[RuntimeEnabled=ScopedCustomElementRegistry] CustomElementRegistry registry;
boolean serializable;
boolean clonable;
[RuntimeEnabled=ShadowRootReferenceTarget] DOMString referenceTarget;
// Note: if you add a parameter here, be sure to add it to the list of checks
// in Element::attachShadow() for existing declarative shadow roots.
};
@@ -23,16 +23,16 @@
[
Exposed=Window
] interface TreeWalker {
[SameObject] readonly attribute Node root;
[NodeWrapInOwnContext, SameObject] readonly attribute Node root;
readonly attribute unsigned long whatToShow;
readonly attribute NodeFilter? filter;
attribute Node currentNode;
[NodeWrapInOwnContext] attribute Node currentNode;
[RaisesException] Node? parentNode();
[RaisesException] Node? firstChild();
[RaisesException] Node? lastChild();
[RaisesException] Node? previousSibling();
[RaisesException] Node? nextSibling();
[RaisesException] Node? previousNode();
[RaisesException] Node? nextNode();
[NodeWrapInOwnContext, RaisesException] Node? parentNode();
[NodeWrapInOwnContext, RaisesException] Node? firstChild();
[NodeWrapInOwnContext, RaisesException] Node? lastChild();
[NodeWrapInOwnContext, RaisesException] Node? previousSibling();
[NodeWrapInOwnContext, RaisesException] Node? nextSibling();
[NodeWrapInOwnContext, RaisesException] Node? previousNode();
[NodeWrapInOwnContext, RaisesException] Node? nextNode();
};
@@ -58,6 +58,7 @@
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
#include "third_party/blink/public/mojom/page/draggable_region.mojom-blink.h"
#include "third_party/blink/public/mojom/page/prerender_page_param.mojom.h"
#include "third_party/blink/public/mojom/partitioned_popins/partitioned_popin_params.mojom.h"
#include "third_party/blink/public/mojom/window_features/window_features.mojom-blink.h"
#include "third_party/blink/public/platform/interface_registry.h"
#include "third_party/blink/public/platform/platform.h"
@@ -507,7 +508,8 @@ WebView* WebView::Create(
const SessionStorageNamespaceId& session_storage_namespace_id,
std::optional<SkColor> page_base_background_color,
const BrowsingContextGroupInfo& browsing_context_group_info,
const ColorProviderColorMaps* color_provider_colors) {
const ColorProviderColorMaps* color_provider_colors,
blink::mojom::PartitionedPopinParamsPtr partitioned_popin_params) {
return WebViewImpl::Create(
client,
is_hidden ? mojom::blink::PageVisibilityState::kHidden
@@ -516,7 +518,7 @@ WebView* WebView::Create(
widgets_never_composited, To<WebViewImpl>(opener), std::move(page_handle),
agent_group_scheduler, session_storage_namespace_id,
std::move(page_base_background_color), browsing_context_group_info,
color_provider_colors);
color_provider_colors, std::move(partitioned_popin_params));
}
WebViewImpl* WebViewImpl::Create(
@@ -533,13 +535,15 @@ WebViewImpl* WebViewImpl::Create(
const SessionStorageNamespaceId& session_storage_namespace_id,
std::optional<SkColor> page_base_background_color,
const BrowsingContextGroupInfo& browsing_context_group_info,
const ColorProviderColorMaps* color_provider_colors) {
const ColorProviderColorMaps* color_provider_colors,
blink::mojom::PartitionedPopinParamsPtr partitioned_popin_params) {
return new WebViewImpl(
client, visibility, std::move(prerender_param), fenced_frame_mode,
compositing_enabled, widgets_never_composited, opener,
std::move(page_handle), agent_group_scheduler,
session_storage_namespace_id, std::move(page_base_background_color),
browsing_context_group_info, color_provider_colors);
browsing_context_group_info, color_provider_colors,
std::move(partitioned_popin_params));
}
size_t WebView::GetWebViewCount() {
@@ -603,7 +607,8 @@ WebViewImpl::WebViewImpl(
const SessionStorageNamespaceId& session_storage_namespace_id,
std::optional<SkColor> page_base_background_color,
const BrowsingContextGroupInfo& browsing_context_group_info,
const ColorProviderColorMaps* color_provider_colors)
const ColorProviderColorMaps* color_provider_colors,
blink::mojom::PartitionedPopinParamsPtr partitioned_popin_params)
: widgets_never_composited_(widgets_never_composited),
web_view_client_(client),
chrome_client_(MakeGarbageCollected<ChromeClientImpl>(this)),
@@ -634,7 +639,8 @@ WebViewImpl::WebViewImpl(
page_ = Page::CreateOrdinary(
*chrome_client_, opener ? opener->GetPage() : nullptr,
agent_group_scheduler.GetAgentGroupScheduler(),
browsing_context_group_info, color_provider_colors);
browsing_context_group_info, color_provider_colors,
std::move(partitioned_popin_params));
CoreInitializer::GetInstance().ProvideModulesToPage(
*page_, session_storage_namespace_id_);
@@ -543,10 +543,10 @@
// Only used by web tests.
{
name: "windowShowState",
initial: "ui::WindowShowState::SHOW_STATE_DEFAULT",
initial: "ui::mojom::blink::WindowShowState::kDefault",
invalidate: ["MediaQuery"],
type: "ui::WindowShowState",
include_paths: ["ui/base/ui_base_types.h"],
type: "ui::mojom::blink::WindowShowState",
include_paths: ["ui/base/mojom/window_show_state.mojom-blink.h"],
},
// Only used by web tests.
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2024 Intel Corporation All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Viewport API
// https://drafts.csswg.org/css-viewport-1/
[
Exposed=Window,
ImplementedAs=DOMViewport,
RuntimeEnabled=ViewportSegments
] interface Viewport {
[
MeasureAs=ViewportSegments
] readonly attribute FrozenArray<DOMRect>? segments;
};
@@ -41,14 +41,6 @@
[HighEntropy=Direct, Measure] readonly attribute double scale;
// Segments API
// https://github.com/webscreens/window-segments
[
RuntimeEnabled=ViewportSegments,
MeasureAs=ViewportSegments
] readonly attribute FrozenArray<DOMRect>? segments;
attribute EventHandler onresize;
attribute EventHandler onscroll;
[RuntimeEnabled=VisualViewportOnScrollEnd] attribute EventHandler onscrollend;
@@ -147,6 +147,10 @@
// https://github.com/WICG/ViewportAPI
[Replaceable, SameObject] readonly attribute VisualViewport visualViewport;
// Viewport API
// https://drafts.csswg.org/css-viewport-1/
[Replaceable, SameObject, RuntimeEnabled=ViewportSegments] readonly attribute Viewport viewport;
// client
[HighEntropy=Direct, MeasureAs=WindowScreenX, Replaceable] readonly attribute long screenX;
[HighEntropy=Direct, MeasureAs=WindowScreenY, Replaceable] readonly attribute long screenY;
@@ -0,0 +1,27 @@
// 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.
// Popins are a type of pop-up for loading web content with a modal-like UI
// relative to its opener tab. The interface defined here helps developers to
// work with popins, e.g. to detect what popin types are available or tell
// if a window is a popin of a certain type.
// https://explainers-by-googlers.github.io/partitioned-popins/
enum PopinContextType {
// Popin with cookies/storage partitioned partitioned as though it were an
// iframe in the opener's context.
"partitioned",
};
[
ImplementedAs=WindowPopin,
Exposed=Window,
RuntimeEnabled=PartitionedPopins
] partial interface Window {
// Returns an empty array if no popin context types are supported.
[Measure] sequence<PopinContextType> popinContextTypesSupported();
// Returns null if this isn't a popin context.
[Measure] PopinContextType? popinContextType();
};
@@ -25,7 +25,7 @@
ImplementedAs=DocumentFullscreen
] partial interface Document {
[LegacyLenientSetter] readonly attribute boolean fullscreenEnabled;
[LegacyLenientSetter, Unscopable, ImplementedAs=fullscreenElement] readonly attribute boolean fullscreen;
[LegacyLenientSetter, Unscopable] readonly attribute boolean fullscreen;
[CallWith=ScriptState, RaisesException] Promise<undefined> exitFullscreen();
@@ -33,7 +33,7 @@
attribute EventHandler onfullscreenerror;
// Mozilla version
[MeasureAs=PrefixedDocumentIsFullscreen, ImplementedAs=fullscreenElement] readonly attribute boolean webkitIsFullScreen;
[MeasureAs=PrefixedDocumentIsFullscreen, ImplementedAs=fullscreen] readonly attribute boolean webkitIsFullScreen;
[MeasureAs=PrefixedDocumentCurrentFullScreenElement, ImplementedAs=fullscreenElement] readonly attribute Element webkitCurrentFullScreenElement;
[MeasureAs=PrefixedDocumentCancelFullScreen, ImplementedAs=webkitExitFullscreen] void webkitCancelFullScreen();
@@ -4,7 +4,7 @@
// https://drafts.fxtf.org/geometry/#DOMPoint
dictionary DOMPointInit {
[ConvertibleToObject] dictionary DOMPointInit {
unrestricted double x = 0;
unrestricted double y = 0;
unrestricted double z = 0;
@@ -4,8 +4,7 @@
// https://github.com/WICG/close-watcher
[
Exposed=Window,
RuntimeEnabled=CloseWatcher
Exposed=Window
] interface CloseWatcher : EventTarget {
[CallWith=ScriptState, RaisesException] constructor(optional CloseWatcherOptions options = {});
@@ -9,7 +9,7 @@ interface CustomElementRegistry {
[CallWith=ScriptState, RuntimeEnabled=ScopedCustomElementRegistry] constructor();
[CallWith=ScriptState, CEReactions, RaisesException, MeasureAs=CustomElementRegistryDefine] void define(DOMString name, CustomElementConstructor constructor, optional ElementDefinitionOptions options = {});
any get(DOMString name);
[RuntimeEnabled=CustomElementsGetName] DOMString? getName(CustomElementConstructor constructor);
DOMString? getName(CustomElementConstructor constructor);
[CallWith=ScriptState,RaisesException] Promise<CustomElementConstructor> whenDefined(DOMString name);
[CEReactions] void upgrade(Node root);
};
@@ -66,9 +66,10 @@
[ImplementedAs=offsetHeightForBinding] readonly attribute long offsetHeight;
// The Popover API
[MeasureAs=ElementTogglePopover,RaisesException] boolean togglePopover(optional boolean force);
[MeasureAs=ElementShowPopover,RaisesException] void showPopover();
[MeasureAs=ElementTogglePopover,RaisesException] boolean togglePopover(optional (TogglePopoverOptions or boolean) options);
[MeasureAs=ElementShowPopover,RaisesException] void showPopover(optional ShowPopoverOptions options);
[MeasureAs=ElementHidePopover,RaisesException] void hidePopover();
// See crbug.com/1418144. We need to change ReflectOnly based on a runtime flag, which isn't possible.
// See also crbug.com/1416284. When HTMLPopoverHint is removed as a flag, we should be able to go back to using [Reflect].
// [CEReactions,Reflect,ReflectOnly=("auto","hint","manual"),ReflectEmpty="auto",ReflectInvalid="manual"] attribute DOMString? popover;
@@ -78,7 +79,7 @@
[CEReactions, RaisesException=Setter, MeasureAs=HTMLElementInnerText, ImplementedAs=innerTextForBinding] attribute ([LegacyNullToEmptyString] DOMString or TrustedScript) innerText;
[CEReactions, RaisesException=Setter, MeasureAs=HTMLElementOuterText] attribute [LegacyNullToEmptyString] DOMString outerText;
[RuntimeEnabled=WritingSuggestions, CEReactions] attribute DOMString writingSuggestions;
[CEReactions] attribute DOMString writingSuggestions;
};
HTMLElement includes GlobalEventHandlers;
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
dictionary CredentialReportOptions {
PublicKeyCredentialReportOptions publicKey;
dictionary TogglePopoverOptions {
boolean force;
HTMLElement invoker;
};
dictionary ShowPopoverOptions {
HTMLElement invoker;
};
@@ -33,7 +33,7 @@
] interface URL {
[RaisesException] constructor(USVString url, optional USVString base);
[RuntimeEnabled=URLParse] static URL? parse(USVString url, optional USVString base);
static URL? parse(USVString url, optional USVString base);
static boolean canParse(USVString url, optional USVString base);
[RaisesException=Setter] stringifier attribute USVString href;
@@ -33,7 +33,7 @@ enum URLPatternComponent { "protocol", "username", "password", "hostname",
readonly attribute USVString search;
readonly attribute USVString hash;
[RuntimeEnabled=URLPatternHasRegExpGroups] readonly attribute boolean hasRegExpGroups;
readonly attribute boolean hasRegExpGroups;
[RuntimeEnabled=URLPatternCompareComponent, Measure]
static short compareComponent(URLPatternComponent component,
@@ -32,7 +32,5 @@ enum SupportedType {
] interface DOMParser {
[CallWith=ScriptState] constructor();
// TODO(crbug.com/329330085): remove the ParseFromStringOptions options
// entirely, once it has been disabled via DOMParserIncludeShadowRoots.
[NewObject] Document parseFromString(HTMLString str, SupportedType type, optional ParseFromStringOptions options = {});
[NewObject] Document parseFromString(HTMLString str, SupportedType type);
};
@@ -1,10 +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.
// TODO(crbug.com/329330085): remove the ParseFromStringOptions options
// entirely, once it has been disabled via DOMParserIncludeShadowRoots.
dictionary ParseFromStringOptions {
boolean includeShadowRoots = false;
};
@@ -49,6 +49,8 @@ dictionary AuctionAdConfig {
[ImplementedAs=trustedScoringSignalsUrlDeprecated]
USVString trustedScoringSignalsUrl;
long maxTrustedScoringSignalsURLLength;
[RuntimeEnabled=FledgeTrustedSignalsKVv2Support]
USVString trustedScoringSignalsCoordinator;
sequence<USVString> interestGroupBuyers;
Promise<any> auctionSignals;
Promise<any> sellerSignals;
@@ -49,7 +49,8 @@ typedef (USVString or FencedFrameConfig) UrnOrConfig;
[RuntimeEnabled=Parakeet, CallWith=ScriptState, Measure, RaisesException]
Promise<Ads> createAdRequest(AdRequestConfig config);
[RuntimeEnabled=Parakeet, CallWith=ScriptState, Measure, RaisesException]
// The implementation resolves with a DOMString instead of a URL object.
[RuntimeEnabled=Parakeet, CallWith=ScriptState, PromiseIDLTypeMismatch, Measure, RaisesException]
Promise<URL> finalizeAd(Ads ads, AuctionAdConfig config);
[RuntimeEnabled=FencedFrames, CallWith=ScriptState]
@@ -16,7 +16,7 @@ enum AICapabilityAvailability {
]
interface AI {
[
// TODO: Add Measure
Measure,
RuntimeEnabled=AIPromptAPI
]
readonly attribute AIAssistantFactory assistant;
@@ -0,0 +1,51 @@
// 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 AIAssistant {
[
Measure,
CallWith=ScriptState,
RaisesException,
RuntimeEnabled=AIPromptAPI
]
Promise<DOMString> prompt(DOMString input);
[
Measure,
CallWith=ScriptState,
RaisesException,
RuntimeEnabled=AIPromptAPI
]
ReadableStream promptStreaming(DOMString input);
[Measure]
readonly attribute unsigned long long maxTokens;
[Measure]
readonly attribute unsigned long long tokensSoFar;
[Measure]
readonly attribute unsigned long long tokensLeft;
[Measure]
readonly attribute unsigned long topK;
[Measure]
readonly attribute float temperature;
[
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<AIAssistant> clone();
[
Measure,
CallWith=ScriptState,
RaisesException
]
void destroy();
};
@@ -4,8 +4,14 @@
// https://github.com/explainers-by-googlers/prompt-api
dictionary AITextSessionOptions {
dictionary AIAssistantInitialPrompt {
required AIAssistantInitialPromptRole role;
required DOMString content;
};
dictionary AIAssistantCreateOptions {
[EnforceRange] unsigned long topK;
float temperature;
DOMString systemPrompt;
sequence<AIAssistantInitialPrompt> initialPrompts;
};
@@ -4,16 +4,23 @@
// https://github.com/explainers-by-googlers/prompt-api
enum AIAssistantInitialPromptRole { "system", "user", "assistant" };
enum AIAssistantPromptRole { "user", "assistant" };
[
Exposed=(Window,Worker),
RuntimeEnabled=AIPromptAPI
]
interface AIAssistantCapabilities {
[Measure]
readonly attribute AICapabilityAvailability available;
// Always null if available === "no"
[Measure]
readonly attribute unsigned long? defaultTopK;
[Measure]
readonly attribute unsigned long? maxTopK;
[Measure]
readonly attribute float? defaultTemperature;
};
@@ -23,17 +30,17 @@ interface AIAssistantCapabilities {
]
interface AIAssistantFactory {
[
// TODO: Add Measure
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<AIAssistantCapabilities> capabilities();
[
// TODO: Add Measure
Measure,
CallWith=ScriptState,
RaisesException
]
Promise<AITextSession> create(
optional AITextSessionOptions options = {}
Promise<AIAssistant> create(
optional AIAssistantCreateOptions options = {}
);
};
@@ -4,6 +4,11 @@
// TODO(crbug.com/356058864): Add explainer link
dictionary AISummarizerSummarizeOptions {
DOMString context;
AbortSignal signal;
};
[
Exposed=(Window,Worker),
RuntimeEnabled=AISummarizationAPI
@@ -14,17 +19,26 @@ interface AISummarizer {
CallWith=ScriptState,
RaisesException
]
Promise<DOMString> summarize(DOMString input);
Promise<DOMString> summarize(DOMString input, optional AISummarizerSummarizeOptions options = {});
[
Measure,
CallWith=ScriptState,
RaisesException
]
ReadableStream summarizeStreaming(DOMString input);
ReadableStream summarizeStreaming(DOMString input, optional AISummarizerSummarizeOptions options = {});
[
Measure,
CallWith=ScriptState,
RaisesException
]
void destroy();
[Measure]
readonly attribute DOMString sharedContext;
[Measure]
readonly attribute AISummarizerType type;
[Measure]
readonly attribute AISummarizerFormat format;
[Measure]
readonly attribute AISummarizerLength length;
};
@@ -10,6 +10,24 @@
]
interface AISummarizerCapabilities {
readonly attribute AICapabilityAvailability available;
AICapabilityAvailability supportsType(AISummarizerType type);
AICapabilityAvailability supportsFormat(AISummarizerFormat format);
AICapabilityAvailability supportsLength(AISummarizerLength length);
AICapabilityAvailability supportsInputLanguage(DOMString languageTag);
};
enum AISummarizerType { "tl;dr", "key-points", "teaser", "headline" };
enum AISummarizerFormat { "plain-text", "markdown" };
enum AISummarizerLength { "short", "medium", "long" };
dictionary AISummarizerCreateOptions {
AbortSignal signal;
DOMString sharedContext;
AISummarizerType type = "key-points";
AISummarizerFormat format = "markdown";
AISummarizerLength length = "medium";
};
[
@@ -22,7 +40,7 @@ interface AISummarizerFactory {
CallWith=ScriptState,
RaisesException
]
Promise<AISummarizer> create();
Promise<AISummarizer> create(optional AISummarizerCreateOptions options = {});
[
Measure,
CallWith=ScriptState,
@@ -62,7 +62,8 @@ interface CanvasRenderingContext2D {
// state
void save(); // push state on state stack
[NoAllocDirectCall, RaisesException] void restore(); // pop state stack if top state was pushed by save, and restore state
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayers, CallWith=ScriptState, RaisesException] void beginLayer(optional BeginLayerOptions options = {}); // push state on state stack and creates bitmap for subsequent draw ops
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayers, CallWith=ScriptState] void beginLayer(); // push state on state stack and creates bitmap for subsequent draw ops
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayersWithOptions, CallWith=ScriptState, RaisesException] void beginLayer(BeginLayerOptions options); // push state on state stack and creates bitmap for subsequent draw ops
[NoAllocDirectCall, RuntimeEnabled=Canvas2dLayers, RaisesException] void endLayer(); // pop state stack if top state was pushed by beginLayer, restore state and draw the bitmap
// Clear the canvas and reset the path
void reset();
@@ -107,9 +108,10 @@ interface CanvasRenderingContext2D {
// path API (see also CanvasPath)
[HighEntropy, NoAllocDirectCall] void beginPath();
[HighEntropy] void fill(optional CanvasFillRule winding);
[HighEntropy, NoAllocDirectCall] void fill();
[HighEntropy] void fill(CanvasFillRule winding);
[HighEntropy] void fill(Path2D path, optional CanvasFillRule winding);
[HighEntropy] void stroke();
[HighEntropy, NoAllocDirectCall] void stroke();
[HighEntropy] void stroke(Path2D path);
// Focus rings
void drawFocusIfNeeded(Element element);
@@ -14,7 +14,8 @@
// state
void save(); // push state on state stack
[NoAllocDirectCall, RaisesException] void restore(); // pop state stack if top state was pushed by save, and restore state
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayers, CallWith=ScriptState, RaisesException] void beginLayer(optional BeginLayerOptions options = {}); // push state on state stack and creates bitmap for subsequent draw ops
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayers, CallWith=ScriptState] void beginLayer(); // push state on state stack and creates bitmap for subsequent draw ops
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayersWithOptions, CallWith=ScriptState, RaisesException] void beginLayer(BeginLayerOptions options); // push state on state stack and creates bitmap for subsequent draw ops
[NoAllocDirectCall, RuntimeEnabled=Canvas2dLayers, RaisesException] void endLayer(); // pop state stack if top state was pushed by beginLayer, restore state and draw the bitmap
// Clear the canvas and reset the path
void reset();
@@ -10,5 +10,4 @@ interface CredentialsContainer {
[CallWith=ScriptState, RaisesException, MeasureAs=CredentialManagerStore] Promise<Credential> store(Credential credential);
[CallWith=ScriptState, RaisesException, MeasureAs=CredentialManagerCreate] Promise<Credential?> create(optional CredentialCreationOptions options = {});
[CallWith=ScriptState, MeasureAs=CredentialManagerPreventSilentAccess] Promise<undefined> preventSilentAccess();
[CallWith=ScriptState, RaisesException, RuntimeEnabled=CredentialManagerReport] Promise<undefined> report(CredentialReportOptions options);
};
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/webauthn/#typedefdef-publickeycredentialclientcapabilities
typedef record<DOMString, boolean> PublicKeyCredentialClientCapabilities;
// https://w3c.github.io/webauthn/#publickeycredential
[
@@ -13,9 +17,13 @@
[SameObject] readonly attribute AuthenticatorResponse response;
[SameObject] readonly attribute DOMString? authenticatorAttachment;
[CallWith=ScriptState] static Promise<boolean> isUserVerifyingPlatformAuthenticatorAvailable();
[RuntimeEnabled=WebAuthenticationClientCapabilities, CallWith=ScriptState] static Promise<PublicKeyCredentialClientCapabilities> getClientCapabilities();
AuthenticationExtensionsClientOutputs getClientExtensionResults();
[CallWith=ScriptState] static Promise<boolean> isConditionalMediationAvailable();
[RuntimeEnabled=WebAuthenticationJSONSerialization, CallWith=ScriptState] PublicKeyCredentialJSON toJSON();
[RuntimeEnabled=WebAuthenticationJSONSerialization, CallWith=ScriptState, RaisesException] static PublicKeyCredentialCreationOptions parseCreationOptionsFromJSON(PublicKeyCredentialCreationOptionsJSON options);
[RuntimeEnabled=WebAuthenticationJSONSerialization, CallWith=ScriptState, RaisesException] static PublicKeyCredentialRequestOptions parseRequestOptionsFromJSON(PublicKeyCredentialRequestOptionsJSON options);
[CallWith=ScriptState, RaisesException, RuntimeEnabled=CredentialManagerReport] static Promise<undefined> signalUnknownCredential(UnknownCredentialOptions options);
[CallWith=ScriptState, RaisesException, RuntimeEnabled=CredentialManagerReport] static Promise<undefined> signalAllAcceptedCredentials(AllAcceptedCredentialsOptions options);
[CallWith=ScriptState, RaisesException, RuntimeEnabled=CredentialManagerReport] static Promise<undefined> signalCurrentUserDetails(CurrentUserDetailsOptions options);
};
@@ -14,6 +14,6 @@ dictionary PublicKeyCredentialCreationOptions {
sequence<DOMString> hints = [];
// https://w3c.github.io/webauthn/#enumdef-attestationconveyancepreference
DOMString attestation;
[RuntimeEnabled=WebAuthenticationAttestationFormats] sequence<DOMString> attestationFormats = [];
[RuntimeEnabled=WebAuthenticationAttestationFormats, MeasureAs=WebAuthentication_AttestationFormats] sequence<DOMString> attestationFormats = [];
AuthenticationExtensionsClientInputs extensions;
};
@@ -1,21 +0,0 @@
// 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 PublicKeyCredentialReportOptions {
USVString rpId;
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;
};
@@ -0,0 +1,21 @@
// 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 UnknownCredentialOptions {
required DOMString rpId;
required Base64URLString credentialId;
};
dictionary AllAcceptedCredentialsOptions {
required DOMString rpId;
required Base64URLString userId;
required sequence<Base64URLString> allAcceptedCredentialIds;
};
dictionary CurrentUserDetailsOptions {
required DOMString rpId;
required Base64URLString userId;
required DOMString name;
required DOMString displayName;
};
@@ -46,7 +46,7 @@ typedef (object or DOMString) AlgorithmIdentifier;
[CallWith=ScriptState, MeasureAs=SubtleCryptoGenerateKey, RaisesException] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
[CallWith=ScriptState, MeasureAs=SubtleCryptoDeriveKey, RaisesException] Promise<any> deriveKey(AlgorithmIdentifier algorithm, CryptoKey baseKey, AlgorithmIdentifier derivedKeyType, boolean extractable, sequence<KeyUsage> keyUsages);
[CallWith=ScriptState, MeasureAs=SubtleCryptoDeriveBits, RaisesException] Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, CryptoKey baseKey, unsigned long length);
[CallWith=ScriptState, MeasureAs=SubtleCryptoDeriveBits, RaisesException] Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, CryptoKey baseKey, optional unsigned long? length = null);
[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, RaisesException] Promise<any> exportKey(KeyFormat format, CryptoKey key);
@@ -10,7 +10,8 @@
// state
void save(); // push state on state stack
[RaisesException] void restore(); // pop state stack if top state was pushed by save, and restore state
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayers, CallWith=ScriptState, RaisesException] void beginLayer(optional BeginLayerOptions options = {}); // push state on state stack and creates bitmap for subsequent draw ops
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayers, CallWith=ScriptState] void beginLayer(); // push state on state stack and creates bitmap for subsequent draw ops
[MeasureAs=Canvas2DLayers, RuntimeEnabled=Canvas2dLayersWithOptions, CallWith=ScriptState, RaisesException] void beginLayer(BeginLayerOptions options); // push state on state stack and creates bitmap for subsequent draw ops
[RuntimeEnabled=Canvas2dLayers, RaisesException] void endLayer(); // pop state stack if top state was pushed by beginLayer, restore state and draw the bitmap
// Clear the canvas and reset the path
void reset();
@@ -10,5 +10,4 @@
[CallWith=ScriptState, RaisesException] void updateInkTrailStartPoint(PointerEvent evt, InkTrailStyle style);
readonly attribute Element? presentationArea;
[DeprecateAs=DelegatedInkExpectedImprovement] readonly attribute unsigned long expectedImprovement;
};
@@ -13,7 +13,7 @@
[
CallWith=ScriptState,
RaisesException
] Promise<undefined> write((BufferSource or Blob or USVString or WriteParams) data);
] Promise<undefined> write([ConvertibleToObject] (BufferSource or Blob or USVString or WriteParams) data);
[
CallWith=ScriptState,
@@ -10,7 +10,7 @@ enum WriteCommandType {
};
// https://fs.spec.whatwg.org/#dictdef-writeparams
dictionary WriteParams {
[ConvertibleToObject] dictionary WriteParams {
required WriteCommandType type;
unsigned long long? size;
unsigned long long? position;
@@ -2,15 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Gamepad vibration is proposed as an extension to the Gamepad API.
// https://docs.google.com/document/d/1jPKzVRNzzU4dUsvLpSXm1VXPQZ8FP-0lKMT-R_p-s6g
// TODO(mattreynolds): Replace this with a link to w3c.github.io/gamepad
// https://www.w3.org/TR/gamepad/#gamepadeffectparameters-dictionary
dictionary GamepadEffectParameters {
double duration = 0.0;
double startDelay = 0.0;
double strongMagnitude = 0.0;
double weakMagnitude = 0.0;
// https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/GamepadHapticsActuatorTriggerRumble/explainer.md
[RuntimeEnabled=WGIGamepadTriggerRumble] double leftTrigger = 0.0;
[RuntimeEnabled=WGIGamepadTriggerRumble] double rightTrigger = 0.0;
double leftTrigger = 0.0;
double rightTrigger = 0.0;
};
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/gamepad/extensions.html#gamepadhapticactuatortype-enum
// https://www.w3.org/TR/gamepad/#gamepadhapticeffecttype-enum
enum GamepadHapticActuatorType {
"vibration",
"dual-rumble"
@@ -24,8 +24,7 @@ enum GamepadHapticsResult {
[
Exposed=Window
] interface GamepadHapticActuator {
[RuntimeEnabled=WGIGamepadTriggerRumble, SameObject]
readonly attribute FrozenArray<GamepadHapticEffectType> effects;
[SameObject] readonly attribute FrozenArray<GamepadHapticEffectType> effects;
[MeasureAs=GamepadHapticActuatorType] readonly attribute GamepadHapticActuatorType type;
[CallWith=ScriptState] Promise<GamepadHapticsResult> playEffect(
GamepadHapticEffectType type,
@@ -27,24 +27,113 @@ dictionary MLSupportLimits {
sequence<DOMString> dataTypes;
};
dictionary MLArgMinMaxSupportLimits {
MLSupportLimits input;
MLSupportLimits output;
};
dictionary MLBinarySupportLimits {
MLSupportLimits a;
MLSupportLimits b;
MLSupportLimits output;
};
dictionary MLBatchNormalizationSupportLimits {
MLSupportLimits input;
MLSupportLimits mean;
MLSupportLimits variance;
MLSupportLimits scale;
MLSupportLimits bias;
MLSupportLimits output;
};
dictionary MLConcatSupportLimits {
MLSupportLimits inputs;
MLSupportLimits output;
};
dictionary MLConv2dSupportLimits {
MLSupportLimits input;
MLSupportLimits filter;
MLSupportLimits bias;
MLSupportLimits output;
};
dictionary MLCumulativeSumSupportLimits {
MLSupportLimits input;
MLSupportLimits output;
};
dictionary MLGatherSupportLimits {
MLSupportLimits input;
MLSupportLimits indices;
MLSupportLimits output;
};
dictionary MLGemmSupportLimits {
MLSupportLimits a;
MLSupportLimits b;
MLSupportLimits c;
MLSupportLimits output;
};
dictionary MLGruSupportLimits {
MLSupportLimits input;
MLSupportLimits weight;
MLSupportLimits recurrentWeight;
MLSupportLimits bias;
MLSupportLimits recurrentBias;
MLSupportLimits initialHiddenState;
MLSupportLimits outputs;
};
dictionary MLGruCellSupportLimits {
MLSupportLimits input;
MLSupportLimits weight;
MLSupportLimits recurrentWeight;
MLSupportLimits hiddenState;
MLSupportLimits bias;
MLSupportLimits recurrentBias;
MLSupportLimits output;
};
dictionary MLLstmSupportLimits {
MLSupportLimits input;
MLSupportLimits weight;
MLSupportLimits recurrentWeight;
MLSupportLimits bias;
MLSupportLimits recurrentBias;
MLSupportLimits peepholeWeight;
MLSupportLimits initialHiddenState;
MLSupportLimits initialCellState;
MLSupportLimits outputs;
};
dictionary MLLstmCellSupportLimits {
MLSupportLimits input;
MLSupportLimits weight;
MLSupportLimits recurrentWeight;
MLSupportLimits hiddenState;
MLSupportLimits cellState;
MLSupportLimits bias;
MLSupportLimits recurrentBias;
MLSupportLimits peepholeWeight;
MLSupportLimits outputs;
};
dictionary MLNormalizationSupportLimits {
MLSupportLimits input;
MLSupportLimits scale;
MLSupportLimits bias;
MLSupportLimits output;
};
dictionary MLPreluSupportLimits {
MLSupportLimits input;
MLSupportLimits slope;
MLSupportLimits output;
};
dictionary MLQuantizeDequantizeLinearSupportLimits {
MLSupportLimits input;
MLSupportLimits scale;
MLSupportLimits zeroPoint;
MLSupportLimits output;
};
dictionary MLLogicalNotSupportLimits {
@@ -57,10 +146,18 @@ dictionary MLSingleInputSupportLimits {
MLSupportLimits output;
};
dictionary MLScatterSupportLimits {
MLSupportLimits input;
MLSupportLimits indices;
MLSupportLimits updates;
MLSupportLimits output;
};
dictionary MLWhereSupportLimits {
MLSupportLimits condition;
MLSupportLimits trueValue;
MLSupportLimits falseValue;
MLSupportLimits output;
};
dictionary MLOpSupportLimits {
@@ -69,9 +166,16 @@ dictionary MLOpSupportLimits {
MLSupportLimits constant;
MLSupportLimits output;
MLArgMinMaxSupportLimits argMin;
MLArgMinMaxSupportLimits argMax;
MLSingleInputSupportLimits argMin;
MLSingleInputSupportLimits argMax;
MLBatchNormalizationSupportLimits batchNormalization;
MLSingleInputSupportLimits cast;
MLSingleInputSupportLimits clamp;
MLConcatSupportLimits concat;
MLConv2dSupportLimits conv2d;
MLConv2dSupportLimits convTranspose2d;
MLSingleInputSupportLimits cumulativeSum;
MLQuantizeDequantizeLinearSupportLimits dequantizeLinear;
// Element-wise binary ops.
MLBinarySupportLimits add;
@@ -101,25 +205,67 @@ dictionary MLOpSupportLimits {
MLSingleInputSupportLimits log;
MLSingleInputSupportLimits neg;
MLSingleInputSupportLimits reciprocal;
MLSingleInputSupportLimits sign;
MLSingleInputSupportLimits sin;
MLSingleInputSupportLimits sqrt;
MLSingleInputSupportLimits tan;
MLSingleInputSupportLimits elu;
MLSingleInputSupportLimits expand;
MLGatherSupportLimits gather;
MLGatherSupportLimits gatherElements;
MLSingleInputSupportLimits gelu;
MLGemmSupportLimits gemm;
MLGruSupportLimits gru;
MLGruCellSupportLimits gruCell;
MLSingleInputSupportLimits hardSigmoid;
MLSingleInputSupportLimits hardSwish;
MLNormalizationSupportLimits instanceNormalization;
MLNormalizationSupportLimits layerNormalization;
MLSingleInputSupportLimits leakyRelu;
MLSingleInputSupportLimits linear;
MLLstmSupportLimits lstm;
MLLstmCellSupportLimits lstmCell;
MLBinarySupportLimits matmul;
MLSingleInputSupportLimits pad;
MLPreluSupportLimits prelu;
MLQuantizeDequantizeLinearSupportLimits quantizeLinear;
// Pool2d.
MLSingleInputSupportLimits averagePool2d;
MLSingleInputSupportLimits l2Pool2d;
MLSingleInputSupportLimits maxPool2d;
// Reduction ops.
MLSingleInputSupportLimits reduceL1;
MLSingleInputSupportLimits reduceL2;
MLSingleInputSupportLimits reduceLogSum;
MLSingleInputSupportLimits reduceLogSumExp;
MLSingleInputSupportLimits reduceMax;
MLSingleInputSupportLimits reduceMean;
MLSingleInputSupportLimits reduceMin;
MLSingleInputSupportLimits reduceProduct;
MLSingleInputSupportLimits reduceSum;
MLSingleInputSupportLimits reduceSumSquare;
MLSingleInputSupportLimits relu;
MLSingleInputSupportLimits resample2d;
MLSingleInputSupportLimits reshape;
MLScatterSupportLimits scatterND;
MLSingleInputSupportLimits sigmoid;
MLSingleInputSupportLimits slice;
MLSingleInputSupportLimits softmax;
MLSingleInputSupportLimits softplus;
MLSingleInputSupportLimits softsign;
MLSingleInputSupportLimits split;
MLSingleInputSupportLimits tanh;
MLSingleInputSupportLimits tile;
MLSingleInputSupportLimits transpose;
MLSingleInputSupportLimits triangular;
MLWhereSupportLimits where;
};
typedef record<DOMString, MLBuffer> MLNamedBuffers;
typedef record<DOMString, MLTensor> MLNamedTensors;
[
RuntimeEnabled=MachineLearningNeuralNetwork,
@@ -149,9 +295,9 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] Promise<MLBuffer> createBuffer(MLBufferDescriptor descriptor);
] Promise<MLTensor> createTensor(MLTensorDescriptor descriptor);
// TODO(crbug.com/328105506): enable partial MLBuffer reads/writes.
// TODO(crbug.com/328105506): enable partial MLTensor reads/writes.
// TODO(crbug.com/40278771): consider moving arguments into a dictonary
// per W3C recommendations:
// https://w3ctag.github.io/design-principles/#prefer-dictionaries
@@ -159,8 +305,8 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] void writeBuffer(
MLBuffer dstBuffer,
] void writeTensor(
MLTensor dstTensor,
[AllowShared] ArrayBufferView srcData,
optional MLSize64 srcElementOffset = 0,
optional MLSize64 srcElementSize);
@@ -169,8 +315,8 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] void writeBuffer(
MLBuffer dstBuffer,
] void writeTensor(
MLTensor dstTensor,
ArrayBuffer srcData,
optional MLSize64 srcByteOffset = 0,
optional MLSize64 srcByteSize);
@@ -179,24 +325,24 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] Promise<ArrayBuffer> readBuffer(
MLBuffer srcBuffer);
] Promise<ArrayBuffer> readTensor(
MLTensor sourceTensor);
[
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] Promise<void> readBuffer(
MLBuffer srcBuffer,
[AllowShared] ArrayBufferView dstData);
] Promise<undefined> readTensor(
MLTensor sourceTensor,
[AllowShared] ArrayBufferView destinationData);
[
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState,
RaisesException
] Promise<void> readBuffer(
MLBuffer srcBuffer,
[AllowShared] ArrayBuffer dstData);
] Promise<undefined> readTensor(
MLTensor sourceTensor,
[AllowShared] ArrayBuffer destinationData);
// TODO(crbug.com/1273291): enable partial buffer dispatches.
[
@@ -205,7 +351,7 @@ typedef record<DOMString, MLBuffer> MLNamedBuffers;
RaisesException,
Measure
] void dispatch(
MLGraph graph, MLNamedBuffers inputs, MLNamedBuffers outputs);
MLGraph graph, MLNamedTensors inputs, MLNamedTensors outputs);
[
RuntimeEnabled=MachineLearningNeuralNetwork,
CallWith=ScriptState
@@ -8,4 +8,5 @@
RuntimeEnabled=MachineLearningNeuralNetwork,
Exposed=(Window, DedicatedWorker)
] interface MLGraph {
void destroy();
};
@@ -63,6 +63,11 @@ dictionary MLConvTranspose2dOptions : MLOperatorOptions {
MLOperand bias;
};
dictionary MLCumulativeSumOptions : MLOperatorOptions {
boolean exclusive = false;
boolean reversed = false;
};
dictionary MLGatherOptions : MLOperatorOptions {
[EnforceRange] unsigned long axis = 0;
};
@@ -230,6 +235,8 @@ dictionary MLTriangularOptions : MLOperatorOptions {
[RaisesException] MLOperand conv2d(MLOperand input, MLOperand filter, optional MLConv2dOptions options = {});
[RaisesException] MLOperand convTranspose2d(MLOperand input, MLOperand filter, optional MLConvTranspose2dOptions options = {});
[RaisesException] MLOperand cumulativeSum(MLOperand input, [EnforceRange] unsigned long axis, optional MLCumulativeSumOptions options = {});
// Element-wise binary operations
[RaisesException] MLOperand add(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
[RaisesException] MLOperand sub(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
@@ -252,6 +259,7 @@ dictionary MLTriangularOptions : MLOperatorOptions {
[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 sign(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 = {});
@@ -262,12 +270,16 @@ dictionary MLTriangularOptions : MLOperatorOptions {
[RaisesException] MLOperand cast(MLOperand input, MLOperandDataType outputDataType, optional MLOperatorOptions options = {});
[RaisesException] MLOperand dequantizeLinear(MLOperand input, MLOperand scale, MLOperand zeroPoint, optional MLOperatorOptions options = {});
[RaisesException] MLOperand elu(MLOperand x, optional MLEluOptions options = {});
[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 gatherElements(MLOperand input, MLOperand indices, optional MLGatherOptions options = {});
[RaisesException] MLOperand gelu(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand gemm(MLOperand a, MLOperand b, optional MLGemmOptions options = {});
@@ -314,6 +326,8 @@ dictionary MLTriangularOptions : MLOperatorOptions {
[RaisesException] MLOperand prelu(MLOperand x, MLOperand slope, optional MLOperatorOptions options = {});
[RaisesException] MLOperand quantizeLinear(MLOperand input, MLOperand scale, MLOperand zeroPoint, optional MLOperatorOptions options = {});
[RaisesException] MLOperand reduceL1(MLOperand input, optional MLReduceOptions options = {});
[RaisesException] MLOperand reduceL2(MLOperand input, optional MLReduceOptions options = {});
[RaisesException] MLOperand reduceLogSum(MLOperand input, optional MLReduceOptions options = {});
@@ -334,6 +348,8 @@ dictionary MLTriangularOptions : MLOperatorOptions {
RaisesException
] MLOperand resample2d(MLOperand input, optional MLResample2dOptions options = {});
[RaisesException] MLOperand scatterND(MLOperand input, MLOperand indices, MLOperand updates, optional MLOperatorOptions options = {});
[RaisesException] MLOperand sigmoid(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand slice(MLOperand input, sequence<[EnforceRange] unsigned long> starts, sequence<[EnforceRange] unsigned long> sizes, optional MLOperatorOptions options = {});
@@ -351,6 +367,9 @@ dictionary MLTriangularOptions : MLOperatorOptions {
[RaisesException] MLOperand tanh(MLOperand input, optional MLOperatorOptions options = {});
[RaisesException] MLOperand tile(
MLOperand input, sequence<[EnforceRange] unsigned long> repetitions, optional MLOperatorOptions options = {});
[RaisesException] MLOperand transpose(
MLOperand input, optional MLTransposeOptions options = {});
@@ -2,14 +2,15 @@
// 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-mlbuffer
// https://www.w3.org/TR/webnn/#api-mltensor
[
RuntimeEnabled=MachineLearningNeuralNetwork,
Exposed=(Window, DedicatedWorker)
] interface MLBuffer {
] interface MLTensor {
readonly attribute MLOperandDataType dataType;
readonly attribute FrozenArray<unsigned long> shape;
readonly attribute MLTensorUsageFlags usage;
void destroy();
};
@@ -2,10 +2,10 @@
// 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-mlbuffer
// https://www.w3.org/TR/webnn/#api-mltensor
typedef [EnforceRange] unsigned long long MLSize64;
dictionary MLBufferDescriptor : MLOperandDescriptor {
// TODO(crbug.com/343638938): Add buffer usage flags.
dictionary MLTensorDescriptor : MLOperandDescriptor {
MLTensorUsageFlags usage;
};
@@ -0,0 +1,18 @@
// 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://www.w3.org/TR/webnn/#api-mltensor
typedef unsigned long MLFlagsConstant;
typedef [EnforceRange] unsigned long MLTensorUsageFlags;
[
RuntimeEnabled=MachineLearningNeuralNetwork,
Exposed=(Window, DedicatedWorker),
SecureContext
] namespace MLTensorUsage {
const MLFlagsConstant WEBGPU_INTEROP = 1;
const MLFlagsConstant READ = 2;
const MLFlagsConstant WRITE = 4;
};
@@ -11,7 +11,7 @@ dictionary LanguageDetectionResult {
[
RuntimeEnabled=LanguageDetectionAPI,
Exposed=(Window,Worker)
Exposed=Window
]
interface LanguageDetector {
[
@@ -33,6 +33,7 @@ interface Translation {
);
[
RuntimeEnabled=LanguageDetectionAPI,
Exposed=Window,
Measure,
CallWith=ScriptState,
RaisesException
@@ -40,6 +41,7 @@ interface Translation {
Promise<TranslationAvailability> canDetect();
[
RuntimeEnabled=LanguageDetectionAPI,
Exposed=Window,
Measure,
CallWith=ScriptState,
RaisesException
@@ -9,7 +9,7 @@
Exposed=(Window,Worker)
] interface PaymentInstruments {
[CallWith=ScriptState, RaisesException, ImplementedAs=deleteInstrument, Measure] Promise<boolean> delete(DOMString instrumentKey);
[CallWith=ScriptState, RaisesException, Measure] Promise<any> get(DOMString instrumentKey);
[CallWith=ScriptState, RaisesException, Measure] Promise<PaymentInstrument> get(DOMString instrumentKey);
[CallWith=ScriptState, RaisesException, Measure] Promise<sequence<DOMString>> keys();
[CallWith=ScriptState, RaisesException, Measure] Promise<boolean> has(DOMString instrumentKey);
[CallWith=ScriptState, RaisesException, Measure] Promise<undefined> set(DOMString instrumentKey, PaymentInstrument details);
@@ -18,5 +18,6 @@ enum PaymentDelegation {
] interface PaymentManager {
[SameObject, DeprecateAs=PaymentInstruments, RuntimeEnabled=PaymentInstruments] readonly attribute PaymentInstruments instruments;
attribute DOMString userHint;
[CallWith=ScriptState, RaisesException] Promise<undefined> enableDelegations(sequence<PaymentDelegation> delegations);
// The implementation resolves with boolean, even though the spec says undefined.
[CallWith=ScriptState, PromiseIDLTypeMismatch, RaisesException] Promise<undefined> enableDelegations(sequence<PaymentDelegation> delegations);
};
@@ -10,7 +10,7 @@ enum PaymentShippingType {
"pickup"
};
dictionary PaymentOptions {
[ConvertibleToObject] dictionary PaymentOptions {
boolean requestPayerName = false;
boolean requestPayerEmail = false;
boolean requestPayerPhone = false;
@@ -10,11 +10,20 @@ enum RTCPriorityType {
"high"
};
// https://github.com/w3c/webrtc-extensions/pull/221
dictionary RTCResolutionRestriction {
unsigned long maxWidth;
unsigned long maxHeight;
};
// https://w3c.github.io/webrtc-pc/#rtcrtpencodingparameters*
dictionary RTCRtpEncodingParameters : RTCRtpCodingParameters {
boolean active = true;
unsigned long maxBitrate;
double scaleResolutionDownBy;
// https://github.com/w3c/webrtc-extensions/pull/221
[RuntimeEnabled=RTCRtpScaleResolutionDownTo]
RTCResolutionRestriction scaleResolutionDownTo;
// https://w3c.github.io/webrtc-priority/#encoding-parameters
RTCPriorityType priority = "low";
RTCPriorityType networkPriority = "low";
@@ -23,8 +23,8 @@ interface RTCRtpTransceiver {
readonly attribute RTCRtpTransceiverDirection? currentDirection;
[Measure, RaisesException] void stop();
[RaisesException] void setCodecPreferences(sequence<RTCRtpCodecCapability> codecs);
[RuntimeEnabled=RTCRtpHeaderExtensionControl] sequence<RTCRtpHeaderExtensionCapability> getHeaderExtensionsToNegotiate();
[RaisesException, RuntimeEnabled=RTCRtpHeaderExtensionControl] void setHeaderExtensionsToNegotiate(
sequence<RTCRtpHeaderExtensionCapability> getHeaderExtensionsToNegotiate();
[RaisesException] void setHeaderExtensionsToNegotiate(
sequence<RTCRtpHeaderExtensionCapability> extensions);
[RuntimeEnabled=RTCRtpHeaderExtensionControl] sequence<RTCRtpHeaderExtensionCapability> getNegotiatedHeaderExtensions();
sequence<RTCRtpHeaderExtensionCapability> getNegotiatedHeaderExtensions();
};
@@ -42,6 +42,7 @@ enum PermissionName {
"keyboard-lock",
"pointer-lock",
"fullscreen",
"web-app-installation",
};
// The PermissionDescriptor dictionary is a base to describe permissions. Some
@@ -0,0 +1,13 @@
// 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://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/WebInstall/explainer.md
[
RuntimeEnabled=WebAppInstallation,
ImplementedAs=NavigatorWebInstall
] partial interface Navigator {
[CallWith=ScriptState, RaisesException] Promise<WebInstallResult> install(USVString manifest_id);
[CallWith=ScriptState, RaisesException] Promise<WebInstallResult> install(USVString manifest_id, USVString install_url);
};
@@ -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.
// https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/WebInstall/explainer.md
dictionary WebInstallResult {
USVString manifestId;
};
@@ -40,26 +40,20 @@ dictionary AudioSinkOptions {
ActiveScriptWrappable
] interface AudioContext : BaseAudioContext {
[HighEntropy, CallWith=ExecutionContext, RaisesException, Measure] constructor(optional AudioContextOptions contextOptions = {});
[MeasureAs=AudioContextSuspend, RaisesException, CallWith=ScriptState, ImplementedAs=suspendContext] Promise<undefined> suspend();
[MeasureAs=AudioContextClose, RaisesException, CallWith=ScriptState, ImplementedAs=closeContext] Promise<undefined> close();
[MeasureAs=AudioContextResume, RaisesException, CallWith=ScriptState, ImplementedAs=resumeContext] Promise<undefined> resume();
// Output timestamp
[MeasureAs=AudioContextGetOutputTimestamp, CallWith=ScriptState] AudioTimestamp getOutputTimestamp();
// Number of seconds of processing latency incurred by the AudioContext
// passing the audio from the AudioDestinationNode to the audio subsystem
[HighEntropy=Direct, MeasureAs=AudioContextBaseLatency] readonly attribute double baseLatency;
[HighEntropy=Direct, MeasureAs=AudioContextOutputLatency] readonly attribute double outputLatency;
[RuntimeEnabled=AudioContextPlayoutStats, SameObject] readonly attribute AudioPlayoutStats playoutStats;
[MeasureAs=AudioContextSinkId, SecureContext] readonly attribute (DOMString or AudioSinkInfo) sinkId;
[SecureContext] attribute EventHandler onsinkchange;
[RuntimeEnabled=AudioContextOnError, MeasureAs=AudioContextOnError] attribute EventHandler onerror;
[MeasureAs=AudioContextGetOutputTimestamp, CallWith=ScriptState] AudioTimestamp getOutputTimestamp();
[MeasureAs=AudioContextResume, RaisesException, CallWith=ScriptState, ImplementedAs=resumeContext] Promise<undefined> resume();
[MeasureAs=AudioContextSuspend, RaisesException, CallWith=ScriptState, ImplementedAs=suspendContext] Promise<undefined> suspend();
[MeasureAs=AudioContextClose, RaisesException, CallWith=ScriptState, ImplementedAs=closeContext] Promise<undefined> close();
[MeasureAs=AudioContextSetSinkId, RaisesException, CallWith=ScriptState, SecureContext] Promise<undefined> setSinkId((DOMString or AudioSinkOptions) sinkId);
[RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
[RaisesException, MeasureAs=AudioContextCreateMediaStreamSource] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
[RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaStreamAudioDestinationNode createMediaStreamDestination();
[MeasureAs=AudioContextSinkId, SecureContext] readonly attribute (DOMString or AudioSinkInfo) sinkId;
[MeasureAs=AudioContextSetSinkId, RaisesException, CallWith=ScriptState, SecureContext] Promise<undefined> setSinkId((DOMString or AudioSinkOptions) sinkId);
[RuntimeEnabled=AudioContextOnError, MeasureAs=AudioContextOnError] attribute EventHandler onerror;
[SecureContext] attribute EventHandler onsinkchange;
// https://wicg.github.io/web_audio_playout
[RuntimeEnabled=AudioContextPlayoutStats, SameObject] readonly attribute AudioPlayoutStats playoutStats;
};
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// See: https://webaudio.github.io/web-audio-api/#dictdef-audioworkletnodeoptions
dictionary AudioWorkletNodeOptions : AudioNodeOptions {
[ConvertibleToObject] dictionary AudioWorkletNodeOptions : AudioNodeOptions {
unsigned long numberOfInputs = 1;
unsigned long numberOfOutputs = 1;
sequence<unsigned long> outputChannelCount;
@@ -2,67 +2,46 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// See https://webaudio.github.io/web-audio-api/#BaseAudioContext
// https://webaudio.github.io/web-audio-api/#enumdef-audiocontextstate
enum AudioContextState {
"suspended",
"running",
"closed"
};
// https://webaudio.github.io/web-audio-api/#BaseAudioContext
callback DecodeErrorCallback = void (DOMException error);
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
[
Exposed=Window,
ActiveScriptWrappable
] interface BaseAudioContext : EventTarget {
// All rendered audio ultimately connects to destination, which represents the audio hardware.
readonly attribute AudioDestinationNode destination;
// All scheduled times are relative to this time in seconds.
readonly attribute double currentTime;
// All AudioNodes in the context run at this sample-rate (sample-frames per second).
[HighEntropy=Direct, Measure] readonly attribute float sampleRate;
// All panning is relative to this listener.
readonly attribute double currentTime;
readonly attribute AudioListener listener;
// Current state of the AudioContext
readonly attribute AudioContextState state;
[SecureContext] readonly attribute AudioWorklet audioWorklet;
attribute EventHandler onstatechange;
[RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate);
// Asynchronous audio file data decoding.
// TODO(crbug.com/841185): `successCallback` and `errorCallback` are not
// nullable in the spec.
[RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptState] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional DecodeSuccessCallback? successCallback, optional DecodeErrorCallback? errorCallback);
// Sources
[RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourceNode createBufferSource();
[RaisesException, MeasureAs=AudioContextCreateConstantSource] ConstantSourceNode createConstantSource();
// Processing nodes
[RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain();
[RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(optional double maxDelayTime);
[RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode createBiquadFilter();
[RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode createIIRFilter(sequence<double> feedForward, sequence<double> feedBack);
[RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode createWaveShaper();
[RaisesException, MeasureAs=AudioContextCreatePannerAutomated] PannerNode createPanner();
[RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode createConvolver();
[HighEntropy, RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCompressorNode createDynamicsCompressor();
[RaisesException, MeasureAs=AudioContextCreateAnalyser] AnalyserNode createAnalyser();
[RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode createBiquadFilter();
[RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate);
[RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourceNode createBufferSource();
[RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs);
[RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs);
[RaisesException, MeasureAs=AudioContextCreateConstantSource] ConstantSourceNode createConstantSource();
[RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode createConvolver();
[RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(optional double maxDelayTime);
[HighEntropy, RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCompressorNode createDynamicsCompressor();
[RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain();
[RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode createIIRFilter(sequence<double> feedForward, sequence<double> feedBack);
[HighEntropy, RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode createOscillator();
[RaisesException, MeasureAs=AudioContextCreatePannerAutomated] PannerNode createPanner();
[RaisesException, MeasureAs=AudioContextCreatePeriodicWave] PeriodicWave createPeriodicWave(sequence<float> real, sequence<float> imag, optional PeriodicWaveConstraints constraints = {});
[RaisesException, MeasureAs=AudioContextCreateScriptProcessor] ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels);
[RaisesException, MeasureAs=AudioContextCreateStereoPanner] StereoPannerNode createStereoPanner();
[HighEntropy, RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode createOscillator();
[RaisesException, MeasureAs=AudioContextCreatePeriodicWave] PeriodicWave createPeriodicWave(sequence<float> real, sequence<float> imag, optional PeriodicWaveConstraints constraints = {});
[RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode createWaveShaper();
// Channel splitting and merging
[RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs);
[RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs);
[SecureContext] readonly attribute AudioWorklet audioWorklet;
attribute EventHandler onstatechange;
[RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptState] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional DecodeSuccessCallback? successCallback, optional DecodeErrorCallback? errorCallback);
};
@@ -393,118 +393,53 @@ interface mixin WebGL2RenderingContextBase {
// called with only two arguments, it goes to the WebGL1 signatures; if it's
// called with three or four arguments, it goes to the WebGL2 specific
// signatures.
[NoAllocDirectCall] void uniform1fv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan, BufferSourceTypeNoSizeLimit] Float32Array v,
[NoAllocDirectCall] void uniform1fv(WebGLUniformLocation? location, Float32List v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v,
[NoAllocDirectCall] void uniform2fv(WebGLUniformLocation? location, Float32List v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform2fv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan, BufferSourceTypeNoSizeLimit] Float32Array v,
[NoAllocDirectCall] void uniform3fv(WebGLUniformLocation? location, Float32List v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v,
[NoAllocDirectCall] void uniform4fv(WebGLUniformLocation? location, Float32List v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform3fv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan, BufferSourceTypeNoSizeLimit] Float32Array v,
[NoAllocDirectCall] void uniform1iv(WebGLUniformLocation? location, Int32List v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v,
[NoAllocDirectCall] void uniform2iv(WebGLUniformLocation? location, Int32List v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform4fv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan, BufferSourceTypeNoSizeLimit] Float32Array v,
[NoAllocDirectCall] void uniform3iv(WebGLUniformLocation? location, Int32List v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v,
[NoAllocDirectCall] void uniform4iv(WebGLUniformLocation? location, Int32List v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform1iv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan, BufferSourceTypeNoSizeLimit] Int32Array v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform1iv(WebGLUniformLocation? location, sequence<GLint> v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform2iv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Int32Array v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform2iv(WebGLUniformLocation? location, sequence<GLint> v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform3iv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Int32Array v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform3iv(WebGLUniformLocation? location, sequence<GLint> v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform4iv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Int32Array v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform4iv(WebGLUniformLocation? location, sequence<GLint> v,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform1uiv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Uint32Array v,
[NoAllocDirectCall] void uniform1uiv(WebGLUniformLocation? location, Uint32List v,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform1uiv(WebGLUniformLocation? location, sequence<GLuint> v,
[NoAllocDirectCall] void uniform2uiv(WebGLUniformLocation? location, Uint32List v,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform2uiv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Uint32Array v,
[NoAllocDirectCall] void uniform3uiv(WebGLUniformLocation? location, Uint32List v,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform2uiv(WebGLUniformLocation? location, sequence<GLuint> v,
[NoAllocDirectCall] void uniform4uiv(WebGLUniformLocation? location, Uint32List v,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform3uiv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Uint32Array v,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform3uiv(WebGLUniformLocation? location, sequence<GLuint> v,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform4uiv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Uint32Array v,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniform4uiv(WebGLUniformLocation? location, sequence<GLuint> v,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array array,
[NoAllocDirectCall] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array,
[NoAllocDirectCall] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array array,
[NoAllocDirectCall] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array array,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array,
GLuint srcOffset, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array value,
[NoAllocDirectCall] void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value,
[NoAllocDirectCall] void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array value,
[NoAllocDirectCall] void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value,
[NoAllocDirectCall] void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array value,
[NoAllocDirectCall] void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
[NoAllocDirectCall] void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value,
[NoAllocDirectCall] void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
[NoAllocDirectCall] void vertexAttribI4iv(GLuint index, [AllowShared, PassAsSpan] Int32Array v);
[NoAllocDirectCall] void vertexAttribI4iv(GLuint index, sequence<GLint> v);
[NoAllocDirectCall] void vertexAttribI4iv(GLuint index, Int32List v);
void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
[NoAllocDirectCall] void vertexAttribI4uiv(GLuint index, [AllowShared, PassAsSpan] Uint32Array v);
[NoAllocDirectCall] void vertexAttribI4uiv(GLuint index, sequence<GLuint> v);
[NoAllocDirectCall] void vertexAttribI4uiv(GLuint index, Uint32List v);
void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
/* Writing to the drawing buffer */
@@ -515,15 +450,10 @@ interface mixin WebGL2RenderingContextBase {
/* Multiple Render Targets */
[NoAllocDirectCall] void drawBuffers(sequence<GLenum> buffers);
[NoAllocDirectCall] void clearBufferiv(GLenum buffer, GLint drawbuffer,
[AllowShared, PassAsSpan] Int32Array value, optional GLuint srcOffset = 0);
[NoAllocDirectCall] void clearBufferiv(GLenum buffer, GLint drawbuffer, sequence<GLint> value, optional GLuint srcOffset = 0);
[NoAllocDirectCall] void clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List value, optional GLuint srcOffset = 0);
[NoAllocDirectCall] void clearBufferuiv(GLenum buffer, GLint drawbuffer,
[AllowShared, PassAsSpan] Uint32Array value, optional GLuint srcOffset = 0);
[NoAllocDirectCall] void clearBufferuiv(GLenum buffer, GLint drawbuffer, sequence<GLuint> value, optional GLuint srcOffset = 0);
[NoAllocDirectCall] void clearBufferfv(GLenum buffer, GLint drawbuffer,
[AllowShared, PassAsSpan] Float32Array value, optional GLuint srcOffset = 0);
[NoAllocDirectCall] void clearBufferfv(GLenum buffer, GLint drawbuffer, sequence<GLfloat> value, optional GLuint srcOffset = 0);
Uint32List value, optional GLuint srcOffset = 0);
[NoAllocDirectCall] void clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List value, optional GLuint srcOffset = 0);
[NoAllocDirectCall] void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
/* Query Objects */
@@ -39,6 +39,9 @@ typedef unsigned short GLushort;
typedef unsigned long GLuint;
typedef unrestricted float GLfloat;
typedef unrestricted float GLclampf;
typedef [PassAsSpan] ([AllowShared, BufferSourceTypeNoSizeLimit] Float32Array or sequence<GLfloat>) Float32List;
typedef [PassAsSpan] ([AllowShared, BufferSourceTypeNoSizeLimit] Int32Array or sequence<GLint>) Int32List;
typedef [PassAsSpan] ([AllowShared, BufferSourceTypeNoSizeLimit] Uint32Array or sequence<GLuint>) Uint32List;
interface mixin WebGLRenderingContextBase {
@@ -485,10 +488,10 @@ interface mixin WebGLRenderingContextBase {
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferData(GLenum target, [AllowShared, BufferSourceTypeNoSizeLimit] ArrayBufferView data, GLenum usage);
void bufferData(GLenum target, [AllowShared, BufferSourceTypeNoSizeLimit] ArrayBuffer? data, GLenum usage);
void bufferSubData(GLenum target, GLintptr offset,
[AllowShared, PassAsSpan] BufferSource data);
GLenum checkFramebufferStatus(GLenum target);
void bufferSubData(GLenum target, GLintptr offset,
[AllowShared, PassAsSpan, BufferSourceTypeNoSizeLimit] BufferSource data);
[NoAllocDirectCall] void clear(GLbitfield mask);
[NoAllocDirectCall] void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
[NoAllocDirectCall] void clearDepth(GLclampf depth);
@@ -668,63 +671,37 @@ interface mixin WebGLRenderingContextBase {
GLenum format, GLenum type, VideoFrame frame);
[NoAllocDirectCall] void uniform1f(WebGLUniformLocation? location, GLfloat x);
[NoAllocDirectCall] void uniform1fv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan, BufferSourceTypeNoSizeLimit] Float32Array v);
[NoAllocDirectCall] void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v);
[NoAllocDirectCall] void uniform1fv(WebGLUniformLocation? location, Float32List v);
[NoAllocDirectCall] void uniform1i(WebGLUniformLocation? location, GLint x);
[NoAllocDirectCall] void uniform1iv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan, BufferSourceTypeNoSizeLimit] Int32Array v);
[NoAllocDirectCall] void uniform1iv(WebGLUniformLocation? location, sequence<GLint> v);
[NoAllocDirectCall] void uniform1iv(WebGLUniformLocation? location, Int32List v);
[NoAllocDirectCall] void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
[NoAllocDirectCall] void uniform2fv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Float32Array v);
[NoAllocDirectCall] void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v);
[NoAllocDirectCall] void uniform2fv(WebGLUniformLocation? location, Float32List v);
[NoAllocDirectCall] void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
[NoAllocDirectCall] void uniform2iv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Int32Array v);
[NoAllocDirectCall] void uniform2iv(WebGLUniformLocation? location, sequence<GLint> v);
[NoAllocDirectCall] void uniform2iv(WebGLUniformLocation? location, Int32List v);
[NoAllocDirectCall] void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
[NoAllocDirectCall] void uniform3fv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Float32Array v);
[NoAllocDirectCall] void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v);
[NoAllocDirectCall] void uniform3fv(WebGLUniformLocation? location, Float32List v);
[NoAllocDirectCall] void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
[NoAllocDirectCall] void uniform3iv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Int32Array v);
[NoAllocDirectCall] void uniform3iv(WebGLUniformLocation? location, sequence<GLint> v);
[NoAllocDirectCall] void uniform3iv(WebGLUniformLocation? location, Int32List v);
[NoAllocDirectCall] void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
[NoAllocDirectCall] void uniform4fv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Float32Array v);
[NoAllocDirectCall] void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v);
[NoAllocDirectCall] void uniform4fv(WebGLUniformLocation? location, Float32List v);
[NoAllocDirectCall] void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
[NoAllocDirectCall] void uniform4iv(WebGLUniformLocation? location,
[AllowShared, PassAsSpan] Int32Array v);
[NoAllocDirectCall] void uniform4iv(WebGLUniformLocation? location, sequence<GLint> v);
[NoAllocDirectCall] void uniform4iv(WebGLUniformLocation? location, Int32List v);
[NoAllocDirectCall] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array array);
[NoAllocDirectCall] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array);
[NoAllocDirectCall] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array array);
[NoAllocDirectCall] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array);
[NoAllocDirectCall] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
[AllowShared, PassAsSpan] Float32Array array);
[NoAllocDirectCall] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array);
[NoAllocDirectCall] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array);
[NoAllocDirectCall] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array);
[NoAllocDirectCall] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array);
void useProgram(WebGLProgram? program);
void validateProgram(WebGLProgram program);
[NoAllocDirectCall] void vertexAttrib1f(GLuint indx, GLfloat x);
[NoAllocDirectCall] void vertexAttrib1fv(GLuint indx, [AllowShared, PassAsSpan] Float32Array values);
[NoAllocDirectCall] void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values);
[NoAllocDirectCall] void vertexAttrib1fv(GLuint indx, Float32List values);
[NoAllocDirectCall] void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
[NoAllocDirectCall] void vertexAttrib2fv(GLuint indx, [AllowShared, PassAsSpan] Float32Array values);
[NoAllocDirectCall] void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values);
[NoAllocDirectCall] void vertexAttrib2fv(GLuint indx, Float32List values);
[NoAllocDirectCall] void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
[NoAllocDirectCall] void vertexAttrib3fv(GLuint indx, [AllowShared, PassAsSpan] Float32Array values);
[NoAllocDirectCall] void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values);
[NoAllocDirectCall] void vertexAttrib3fv(GLuint indx, Float32List values);
[NoAllocDirectCall] void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
[NoAllocDirectCall] void vertexAttrib4fv(GLuint indx, [AllowShared, PassAsSpan] Float32Array values);
[NoAllocDirectCall] void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values);
[NoAllocDirectCall] void vertexAttrib4fv(GLuint indx, Float32List values);
[NoAllocDirectCall] void vertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized,
GLsizei stride, GLintptr offset);
@@ -10,11 +10,11 @@
] interface GPUAdapter {
[SameObject] readonly attribute GPUSupportedFeatures features;
[SameObject] readonly attribute GPUSupportedLimits limits;
[SameObject, RuntimeEnabled=WebGPUAdapterInfoAttribute] readonly attribute GPUAdapterInfo info;
[SameObject] readonly attribute GPUAdapterInfo info;
readonly attribute boolean isFallbackAdapter;
[RuntimeEnabled=WebGPUExperimentalFeatures] readonly attribute boolean isCompatibilityMode;
[CallWith=ScriptState] Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
// TODO(crbug.com/335383516): Remove this once synchronous info attribute is implemented.
[CallWith=ScriptState, Measure] Promise<GPUAdapterInfo> requestAdapterInfo();
[RuntimeEnabled=DeprecatedRequestAdapterInfo, DeprecateAs=V8GPUAdapter_RequestAdapterInfo_Method, CallWith=ScriptState, Measure] Promise<GPUAdapterInfo> requestAdapterInfo();
};

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