diff --git a/DEPS b/DEPS index 0aa8c45..326903c 100644 --- a/DEPS +++ b/DEPS
@@ -297,15 +297,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '20402f8a42927a61657dc1723bb3949cfcff0184', + 'skia_revision': 'fbd9c4d0584285fa5bbb033f291b65c7b73ef1ae', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'b777d8384fa02d477e914e42c17ba4b10d399d3c', + 'v8_revision': '7d56b1895931100d4f378cf62fa0201fd07940b7', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'c0818a182b5e91eb2f524f1cf5319f5398530a92', + 'angle_revision': 'e6fcb2a9a9a46928fbcfbfb43b0e50554327c625', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -324,7 +324,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:9.20220803.3.1', + 'fuchsia_version': 'version:9.20220804.0.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling google-toolbox-for-mac # and whatever else without interference from each other. @@ -348,7 +348,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. - 'freetype_revision': 'dcb5fc5bcd1d73b6510ce20579ccbd8e96b639c5', + 'freetype_revision': '90e1e39f50f9431e41fc3fb21b8d8f75fd5b4b9c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -368,7 +368,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '97daa816fc4ad088cf4be1917c3339255eaa1e28', + 'catapult_revision': 'dcdf418945390a0e5a1f5ad8fde09b38c03d9516', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -376,7 +376,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': 'fea1410f6ab4c4fa2451941e16ffd0d4f8746f00', + 'devtools_frontend_revision': '453aa9a9b11b4dcd612a807993de8d59efb41d86', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -412,7 +412,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'e40bd8e9641296b45f89c36bc058191b26052e87', + 'dawn_revision': '6091d838a757968ed50bce7bd269b96200b24da1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -1465,7 +1465,7 @@ Var('chromium_git') + '/webm/libwebp.git' + '@' + '7366f7f394af26de814296152c50e673ed0a832f', 'src/third_party/libyuv': - Var('chromium_git') + '/libyuv/libyuv.git' + '@' + '98ec7c28d5f4664d0cf5b7631e82a876ccb11c26', + Var('chromium_git') + '/libyuv/libyuv.git' + '@' + '9892d70c965678381d2a70a1c9002d1cf136ee78', 'src/third_party/lighttpd': { 'url': Var('chromium_git') + '/chromium/deps/lighttpd.git' + '@' + Var('lighttpd_revision'), @@ -1573,7 +1573,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '470bc189f52bdbd4900e67dacb8e7bad1bac5fe1', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '28de3d8549eb54301b4becd765d405874c857db3', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1607,7 +1607,7 @@ }, 'src/third_party/re2/src': - Var('chromium_git') + '/external/github.com/google/re2.git' + '@' + 'ba2e7c2f25047a6848f2baa9bc4cb700ea9dda84', + Var('chromium_git') + '/external/github.com/google/re2.git' + '@' + '9a35e22166dd0ebe67f0ab31773cc1680502bf99', 'src/third_party/r8': { 'packages': [ @@ -1805,7 +1805,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@d5209604cb24074b46171b8e0cc367c5021f0e0f', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@4eeb63331fa4156d67fa99b7dd6d2b0c775dad42', 'condition': 'checkout_src_internal', }, @@ -1857,7 +1857,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'EapC761Sypj2L6fZ12iqUeJRwPQHcE4O7ALXYs__1goC', + 'version': 'x9iF0P771nlZSKaUi-tCbf9YA7zjZw8qg_zUvvOpuysC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/android_webview/browser/aw_content_browser_client_receiver_bindings.cc b/android_webview/browser/aw_content_browser_client_receiver_bindings.cc index 6802e6a..081fa34 100644 --- a/android_webview/browser/aw_content_browser_client_receiver_bindings.cc +++ b/android_webview/browser/aw_content_browser_client_receiver_bindings.cc
@@ -108,15 +108,17 @@ content::RenderFrameHost& render_frame_host, blink::AssociatedInterfaceRegistry& associated_registry) { // TODO(lingqi): Swap the parameters so that lambda functions are not needed. - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> - receiver) { - autofill::ContentAutofillDriverFactory::BindAutofillDriver( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface<autofill::mojom::AutofillDriver>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> + receiver) { + autofill::ContentAutofillDriverFactory::BindAutofillDriver( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface< + content_capture::mojom::ContentCaptureReceiver>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver< content_capture::mojom::ContentCaptureReceiver> receiver) { @@ -124,30 +126,33 @@ std::move(receiver), render_frame_host); }, &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface<mojom::FrameHost>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver<mojom::FrameHost> receiver) { AwRenderViewHostExt::BindFrameHost(std::move(receiver), render_frame_host); }, &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - page_load_metrics::mojom::PageLoadMetrics> receiver) { - page_load_metrics::MetricsWebContentsObserver::BindPageLoadMetrics( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> - receiver) { - AwPrintManager::BindPrintManagerHost(std::move(receiver), - render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface<page_load_metrics::mojom::PageLoadMetrics>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + page_load_metrics::mojom::PageLoadMetrics> receiver) { + page_load_metrics::MetricsWebContentsObserver::BindPageLoadMetrics( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface<printing::mojom::PrintManagerHost>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> + receiver) { + AwPrintManager::BindPrintManagerHost(std::move(receiver), + render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface< + security_interstitials::mojom::InterstitialCommands>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver< security_interstitials::mojom::InterstitialCommands> receiver) { @@ -163,7 +168,7 @@ content::RenderProcessHost* render_process_host) { content::ResourceContext* resource_context = render_process_host->GetBrowserContext()->GetResourceContext(); - registry->AddInterface( + registry->AddInterface<safe_browsing::mojom::SafeBrowsing>( base::BindRepeating( &MaybeCreateSafeBrowsing, render_process_host->GetID(), resource_context, @@ -178,8 +183,9 @@ mojo::MakeSelfOwnedReceiver(std::make_unique<SpellCheckHostImpl>(), std::move(receiver)); }; - registry->AddInterface(base::BindRepeating(create_spellcheck_host), - content::GetUIThreadTaskRunner({})); + registry->AddInterface<spellcheck::mojom::SpellCheckHost>( + base::BindRepeating(create_spellcheck_host), + content::GetUIThreadTaskRunner({})); #endif }
diff --git a/android_webview/nonembedded/java/proguard.flags b/android_webview/nonembedded/java/proguard.flags index 1f97557..c37f087b 100644 --- a/android_webview/nonembedded/java/proguard.flags +++ b/android_webview/nonembedded/java/proguard.flags
@@ -34,6 +34,15 @@ public *; } +# This rule prevents class merging on R$* resource classes (for example, R$anim, +# R$styleable, R$bool). This causes issues for WebView when unused resource +# stripping, since in WebView we are forced to detect which resources are unused +# by scanning the dex file for R$<res_type>.<res_name>. Having the R$* classes +# being merged together means that R$anim.foo may now be found in R$bool.foo, +# and this mistakenly will mark the foo resouce to be removed. More details in +# crbug.com/1348329. +-keep,allowaccessmodification,allowobfuscation,allowshrinking class **.R$* + # Functor classes with native methods implemented in Android. -keep class com.android.webview.chromium.DrawFunctor -keep class com.android.webview.chromium.DrawGLFunctor
diff --git a/android_webview/renderer/aw_render_frame_ext.cc b/android_webview/renderer/aw_render_frame_ext.cc index a391c7a1..5fef015 100644 --- a/android_webview/renderer/aw_render_frame_ext.cc +++ b/android_webview/renderer/aw_render_frame_ext.cc
@@ -164,7 +164,7 @@ // If we are the main frame register an additional mojo interface. if (render_frame->IsMainFrame()) { - registry_.AddInterface(base::BindRepeating( + registry_.AddInterface<mojom::LocalMainFrame>(base::BindRepeating( &AwRenderFrameExt::BindLocalMainFrame, base::Unretained(this))); }
diff --git a/android_webview/renderer/aw_render_thread_observer.cc b/android_webview/renderer/aw_render_thread_observer.cc index 7135a4f..cb95941 100644 --- a/android_webview/renderer/aw_render_thread_observer.cc +++ b/android_webview/renderer/aw_render_thread_observer.cc
@@ -21,7 +21,7 @@ // base::Unretained can be used here because the associated_interfaces // is owned by the RenderThread and will live for the duration of the // RenderThread. - associated_interfaces->AddInterface( + associated_interfaces->AddInterface<mojom::Renderer>( base::BindRepeating(&AwRenderThreadObserver::OnRendererAssociatedRequest, base::Unretained(this))); }
diff --git a/ash/app_list/views/app_list_nudge_controller.cc b/ash/app_list/views/app_list_nudge_controller.cc index c97067d..2eec8f40 100644 --- a/ash/app_list/views/app_list_nudge_controller.cc +++ b/ash/app_list/views/app_list_nudge_controller.cc
@@ -82,11 +82,9 @@ // static int AppListNudgeController::GetShownCount(PrefService* prefs, NudgeType type) { - const base::Value* dictionary = prefs->GetDictionary(GetPrefPath(type)); - if (!dictionary) - return 0; + const base::Value::Dict& dictionary = prefs->GetValueDict(GetPrefPath(type)); - return dictionary->FindIntPath(kReorderNudgeShownCount).value_or(0); + return dictionary.FindIntByDottedPath(kReorderNudgeShownCount).value_or(0); } // static @@ -160,12 +158,9 @@ if (!prefs) return false; - const base::Value* result = prefs->Get(prefs::kLauncherFilesPrivacyNotice) - ->FindKey(kPrivacyNoticeAcceptedKey); - if (!result || !result->is_bool()) - return false; - - return result->GetBool(); + return prefs->GetValueDict(prefs::kLauncherFilesPrivacyNotice) + .FindBool(kPrivacyNoticeAcceptedKey) + .value_or(false); } bool AppListNudgeController::WasPrivacyNoticeShown() const { @@ -173,12 +168,9 @@ if (!prefs) return false; - const base::Value* result = prefs->Get(prefs::kLauncherFilesPrivacyNotice) - ->FindKey(kPrivacyNoticeShownKey); - if (!result || !result->is_bool()) - return false; - - return result->GetBool(); + return prefs->GetValueDict(prefs::kLauncherFilesPrivacyNotice) + .FindBool(kPrivacyNoticeShownKey) + .value_or(false); } void AppListNudgeController::SetPrivacyNoticeShown(bool shown) {
diff --git a/ash/components/arc/arc_features.cc b/ash/components/arc/arc_features.cc index 67fde24..80b530c 100644 --- a/ash/components/arc/arc_features.cc +++ b/ash/components/arc/arc_features.cc
@@ -90,6 +90,10 @@ // Controls the size of the guest zram. const base::FeatureParam<int> kGuestZramSize{&kGuestZram, "size", 0}; +// Controls swappiness for the ARCVM guest. +const base::FeatureParam<int> kGuestZramSwappiness{&kGuestZram, "swappiness", + 0}; + // Enables/disables mlock() of guest memory for ARCVM. // Often used in combination with kGuestZram. const base::Feature kLockGuestMemory{"ArcLockGuestMemory",
diff --git a/ash/components/arc/arc_features.h b/ash/components/arc/arc_features.h index 58613c8..21e1f57f5 100644 --- a/ash/components/arc/arc_features.h +++ b/ash/components/arc/arc_features.h
@@ -30,6 +30,7 @@ extern const base::Feature kGmsCoreLowMemoryKillerProtection; extern const base::Feature kGuestZram; extern const base::FeatureParam<int> kGuestZramSize; +extern const base::FeatureParam<int> kGuestZramSwappiness; extern const base::Feature kLockGuestMemory; extern const base::Feature kLogdConfig; extern const base::FeatureParam<int> kLogdConfigSize;
diff --git a/ash/components/arc/session/arc_vm_client_adapter.cc b/ash/components/arc/session/arc_vm_client_adapter.cc index a01ac7e..a0e98fc 100644 --- a/ash/components/arc/session/arc_vm_client_adapter.cc +++ b/ash/components/arc/session/arc_vm_client_adapter.cc
@@ -504,6 +504,10 @@ VLOG(1) << "Use BalanceAvailableBalloonPolicy"; } + if (base::FeatureList::IsEnabled(kGuestZram)) { + request.set_guest_swappiness(kGuestZramSwappiness.Get()); + } + request.set_enable_consumer_auto_update_toggle(base::FeatureList::IsEnabled( ash::features::kConsumerAutoUpdateToggleAllowed));
diff --git a/ash/components/arc/session/arc_vm_client_adapter_unittest.cc b/ash/components/arc/session/arc_vm_client_adapter_unittest.cc index 3ced126..c1b7625ce 100644 --- a/ash/components/arc/session/arc_vm_client_adapter_unittest.cc +++ b/ash/components/arc/session/arc_vm_client_adapter_unittest.cc
@@ -2457,6 +2457,33 @@ base::Contains(request.params(), "androidboot.arcvm.logd.size=1M")); } +// Test that the value of swappiness is default value when kGuestZram is +// disabled. +TEST_F(ArcVmClientAdapterTest, ArcGuestZramDisabledSwappiness) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(kGuestZram); + StartParams start_params(GetPopulatedStartParams()); + StartMiniArcWithParams(true, std::move(start_params)); + EXPECT_GE(GetTestConciergeClient()->start_arc_vm_call_count(), 1); + EXPECT_FALSE(is_system_shutdown().has_value()); + const auto& request = GetTestConciergeClient()->start_arc_vm_request(); + EXPECT_EQ(0, request.guest_swappiness()); +} + +// Test that StartArcVmRequest has correct swappiness value. +TEST_F(ArcVmClientAdapterTest, ArcGuestZramSwappinessValid) { + base::test::ScopedFeatureList feature_list; + base::FieldTrialParams params; + params["swappiness"] = "90"; + feature_list.InitAndEnableFeatureWithParameters(kGuestZram, params); + StartParams start_params(GetPopulatedStartParams()); + StartMiniArcWithParams(true, std::move(start_params)); + EXPECT_GE(GetTestConciergeClient()->start_arc_vm_call_count(), 1); + EXPECT_FALSE(is_system_shutdown().has_value()); + auto request = GetTestConciergeClient()->start_arc_vm_request(); + EXPECT_EQ(90, request.guest_swappiness()); +} + // Test that StartArcVmRequest has no matching command line flag // when kVmMemoryPSIReports is enabled. TEST_F(ArcVmClientAdapterTest, ArcVmMemoryPSIReportsDisabled) {
diff --git a/ash/components/login/auth/auth_performer.cc b/ash/components/login/auth/auth_performer.cc index 2eb8ce83c..49ffad83 100644 --- a/ash/components/login/auth/auth_performer.cc +++ b/ash/components/login/auth/auth_performer.cc
@@ -14,6 +14,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/check.h" +#include "base/notreached.h" #include "base/time/time.h" #include "chromeos/ash/components/dbus/userdataauth/userdataauth_client.h" #include "chromeos/dbus/cryptohome/UserDataAuth.pb.h" @@ -85,6 +86,9 @@ std::unique_ptr<UserContext> context, AuthOperationCallback callback) { DCHECK(context->GetChallengeResponseKeys().empty()); + if (context->GetAuthSessionId().empty()) + NOTREACHED() << "Auth session should exist"; + if (context->GetKey()->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN) { DCHECK(!context->IsUsingPin()); SystemSaltGetter::Get()->GetSystemSalt(base::BindOnce( @@ -142,6 +146,8 @@ std::unique_ptr<UserContext> context, AuthOperationCallback callback) { DCHECK(!context->GetChallengeResponseKeys().empty()); + if (context->GetAuthSessionId().empty()) + NOTREACHED() << "Auth session should exist"; LOGIN_LOG(EVENT) << "Authenticating using challenge-response"; user_data_auth::AuthenticateAuthSessionRequest request; @@ -164,7 +170,9 @@ AuthOperationCallback callback) { DCHECK(!password.empty()) << "Caller should check for empty password"; DCHECK(!key_label.empty()) << "Caller should provide correct label"; - DCHECK(!context->GetAuthSessionId().empty()) << "Auth session should exist"; + if (context->GetAuthSessionId().empty()) + NOTREACHED() << "Auth session should exist"; + const AuthFactorsData& auth_factors = context->GetAuthFactorsData(); if (!auth_factors.HasPasswordKey(key_label)) { LOGIN_LOG(ERROR) << "User does not have password factor labeled " @@ -200,7 +208,9 @@ AuthOperationCallback callback) { DCHECK(!pin.empty()) << "Caller should check for empty PIN"; DCHECK(!pin_salt.empty()) << "Client code should provide correct salt"; - DCHECK(!context->GetAuthSessionId().empty()) << "Auth session should exist"; + if (context->GetAuthSessionId().empty()) + NOTREACHED() << "Auth session should exist"; + const AuthFactorsData& auth_factors = context->GetAuthFactorsData(); const cryptohome::KeyDefinition* key_def = auth_factors.FindPinKey(); if (!key_def) { @@ -221,6 +231,9 @@ void AuthPerformer::AuthenticateAsKiosk(std::unique_ptr<UserContext> context, AuthOperationCallback callback) { + if (context->GetAuthSessionId().empty()) + NOTREACHED() << "Auth session should exist"; + LOGIN_LOG(EVENT) << "Authenticating as Kiosk"; user_data_auth::AuthenticateAuthSessionRequest request; request.set_auth_session_id(context->GetAuthSessionId()); @@ -248,7 +261,8 @@ void AuthPerformer::GetAuthSessionStatus(std::unique_ptr<UserContext> context, AuthSessionStatusCallback callback) { - DCHECK(!context->GetAuthSessionId().empty()); + if (context->GetAuthSessionId().empty()) + NOTREACHED() << "Auth session should exist"; LOGIN_LOG(EVENT) << "Requesting authsession status"; user_data_auth::GetAuthSessionStatusRequest request;
diff --git a/ash/components/login/auth/auth_session_authenticator.cc b/ash/components/login/auth/auth_session_authenticator.cc index 00bfed3..a33ab32 100644 --- a/ash/components/login/auth/auth_session_authenticator.cc +++ b/ash/components/login/auth/auth_session_authenticator.cc
@@ -123,6 +123,8 @@ const std::string& auth_session_id, std::unique_ptr<UserContext> original_context, StartAuthSessionCallback callback) { + if (auth_session_id.empty()) + NOTREACHED() << "Auth session should exist"; LOGIN_LOG(EVENT) << "Deleting stale ephemeral user"; user_data_auth::RemoveRequest remove_request; remove_request.set_auth_session_id(auth_session_id);
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index a41dbfed..ba3c8e6 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -1126,7 +1126,7 @@ // If enabled, EULA and ARC Terms of Service screens are skipped and merged // into Consolidated Consent Screen. const base::Feature kOobeConsolidatedConsent{"OobeConsolidatedConsent", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Enables or disables the ChromeOS OOBE HID Detection Revamp, which updates // the OOBE HID detection screen UI and related infrastructure. See @@ -1675,7 +1675,7 @@ // Enables or disables whether to store UMA logs per-user and whether metrics // consent is per-user. const base::Feature kPerUserMetrics{"PerUserMetricsConsent", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Allows Files App to find and execute tasks using App Service for Arc and // Guest OS apps.
diff --git a/ash/login/ui/lock_contents_view.cc b/ash/login/ui/lock_contents_view.cc index 4dcaafc4..0b39d2e48 100644 --- a/ash/login/ui/lock_contents_view.cc +++ b/ash/login/ui/lock_contents_view.cc
@@ -38,6 +38,7 @@ #include "ash/public/cpp/child_accounts/parent_access_controller.h" #include "ash/public/cpp/login_accelerators.h" #include "ash/public/cpp/login_types.h" +#include "ash/public/cpp/reauth_reason.h" #include "ash/public/cpp/smartlock_state.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/session/session_controller_impl.h" @@ -2266,15 +2267,15 @@ // Show gaia signin if this is login and the user has failed too many times. // Do not show on secondary login screen – even though it has type kLogin – as // there is no OOBE there. - if (screen_type_ == LockScreen::ScreenType::kLogin && - unlock_attempt_ >= kLoginAttemptsBeforeGaiaDialog && - Shell::Get()->session_controller()->GetSessionState() != - session_manager::SessionState::LOGIN_SECONDARY) { - // TODO(crbug.com/1335222): Once implemented, we should show the recovery - // flow here instead of just gaia signin. - Shell::Get()->login_screen_controller()->ShowGaiaSignin( - big_view->auth_user()->current_user().basic_user_info.account_id); - return; + if (!ash::features::IsCryptohomeRecoveryFlowUIEnabled()) { + if (screen_type_ == LockScreen::ScreenType::kLogin && + unlock_attempt_ >= kLoginAttemptsBeforeGaiaDialog && + Shell::Get()->session_controller()->GetSessionState() != + session_manager::SessionState::LOGIN_SECONDARY) { + Shell::Get()->login_screen_controller()->ShowGaiaSignin( + big_view->auth_user()->current_user().basic_user_info.account_id); + return; + } } std::u16string error_text = l10n_util::GetStringUTF16( @@ -2443,10 +2444,15 @@ return; } - // TODO(crbug.com/1335222): Initiate recovery flow instead of blanked gaia - // sign in. - Shell::Get()->login_screen_controller()->ShowGaiaSignin( - big_view->auth_user()->current_user().basic_user_info.account_id); + const AccountId account_id = + big_view->auth_user()->current_user().basic_user_info.account_id; + // TODO(b/240283185): check whether recovery key is configured. + if (ash::features::IsCryptohomeRecoveryFlowEnabled()) { + user_manager::KnownUser(Shell::Get()->local_state()) + .UpdateReauthReason(account_id, + static_cast<int>(ReauthReason::FORGOT_PASSWORD)); + } + Shell::Get()->login_screen_controller()->ShowGaiaSignin(account_id); HideAuthErrorMessage(); }
diff --git a/ash/login/ui/lock_contents_view_unittest.cc b/ash/login/ui/lock_contents_view_unittest.cc index cae1ea0..438b781 100644 --- a/ash/login/ui/lock_contents_view_unittest.cc +++ b/ash/login/ui/lock_contents_view_unittest.cc
@@ -34,6 +34,7 @@ #include "ash/login/ui/views_utils.h" #include "ash/public/cpp/login_screen_test_api.h" #include "ash/public/cpp/login_types.h" +#include "ash/public/cpp/reauth_reason.h" #include "ash/public/mojom/tray_action.mojom.h" #include "ash/root_window_controller.h" #include "ash/session/session_controller_impl.h" @@ -56,6 +57,7 @@ #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power_manager/suspend.pb.h" #include "components/prefs/pref_service.h" +#include "components/user_manager/known_user.h" #include "services/media_session/public/mojom/media_session.mojom.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -1229,7 +1231,9 @@ TEST_F(LockContentsViewUnitTest, AuthErrorLoginScreenForgotPasswordButton) { // Enable the "forgot password" button. base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(features::kCryptohomeRecoveryFlowUI); + feature_list.InitWithFeatures( + {features::kCryptohomeRecoveryFlowUI, features::kCryptohomeRecoveryFlow}, + {}); auto* contents = new LockContentsView( mojom::TrayActionState::kNotAvailable, LockScreen::ScreenType::kLogin, @@ -1282,6 +1286,13 @@ // The error bubble should be hidden because of the button press. EXPECT_FALSE(test_api.auth_error_bubble()->GetVisible()); + + absl::optional<int> reauth_reason = + user_manager::KnownUser(Shell::Get()->local_state()) + .FindReauthReason(users()[0].basic_user_info.account_id); + EXPECT_TRUE(reauth_reason.has_value()); + EXPECT_EQ(reauth_reason.value(), + static_cast<int>(ReauthReason::FORGOT_PASSWORD)); } // Gaia is never shown on lock, no mater how many times auth fails.
diff --git a/ash/public/cpp/BUILD.gn b/ash/public/cpp/BUILD.gn index dda95a6..1b79ff0e 100644 --- a/ash/public/cpp/BUILD.gn +++ b/ash/public/cpp/BUILD.gn
@@ -249,6 +249,7 @@ "projector/projector_new_screencast_precondition.h", "projector/projector_session.cc", "projector/projector_session.h", + "reauth_reason.h", "resize_shadow_type.h", "rounded_corner_utils.cc", "rounded_corner_utils.h",
diff --git a/ash/public/cpp/reauth_reason.h b/ash/public/cpp/reauth_reason.h new file mode 100644 index 0000000..da85f02 --- /dev/null +++ b/ash/public/cpp/reauth_reason.h
@@ -0,0 +1,76 @@ +// Copyright 2022 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. + +#ifndef ASH_PUBLIC_CPP_REAUTH_REASON_H_ +#define ASH_PUBLIC_CPP_REAUTH_REASON_H_ + +namespace ash { + +// Track all the ways a user may be sent through the re-auth flow. +// This enum is used to define the buckets for an enumerated UMA histogram. +// Hence, existing enumerated constants should never be reordered, and all new +// constants should only be appended at the end of the enumeration. +enum ReauthReason { + // Default value: no reauth reasons were detected so far, or the reason was + // already reported. + NONE = 0, + + // Legacy profile holders. + OTHER = 1, + + // Password changed, revoked credentials, account deleted. + INVALID_TOKEN_HANDLE = 2, + + // Incorrect password entered 3 times at the user pod. + INCORRECT_PASSWORD_ENTERED = 3, + + // Incorrect password entered by a SAML user once. + // OS would show a tooltip offering user to complete the online sign-in. + INCORRECT_SAML_PASSWORD_ENTERED = 4, + + // Device policy is set not to show user pods, which requires re-auth on every + // login. + SAML_REAUTH_POLICY = 5, + + // Cryptohome is missing, most likely due to deletion during garbage + // collection. + MISSING_CRYPTOHOME = 6, + + // During last login OS failed to connect to the sync with the existing RT. + // This could be due to account deleted, password changed, account revoked, + // etc. + SYNC_FAILED = 7, + + // User cancelled the password change prompt when prompted by Chrome OS. + PASSWORD_UPDATE_SKIPPED = 8, + + // SAML password sync token validation failed. + SAML_PASSWORD_SYNC_TOKEN_VALIDATION_FAILED = 9, + + // Corrupted cryptohome + UNRECOVERABLE_CRYPTOHOME = 10, + + // Gaia policy is set, which requires re-auth on every login if the offline + // login time limit has been reached. + GAIA_REAUTH_POLICY = 11, + + // Gaia lock screen re-auth policy is set, which requires re-auth on lock + // screen if the offline lock screen time limit has been reached. + GAIA_LOCK_SCREEN_REAUTH_POLICY = 12, + + // Saml lock screen re-auth policy is set, which requires re-auth on lock + // screen if the offline lock screen time limit has been reached. + SAML_LOCK_SCREEN_REAUTH_POLICY = 13, + + // "Forgot Password" button clicked on the sign-in screen when password is + // entered wrongly. + FORGOT_PASSWORD = 14, + + // Must be the last value in this list. + NUM_REAUTH_FLOW_REASONS, +}; + +} // namespace ash + +#endif // ASH_PUBLIC_CPP_REAUTH_REASON_H_
diff --git a/ash/system/time/calendar_view.cc b/ash/system/time/calendar_view.cc index ed9b811..f1cbc55 100644 --- a/ash/system/time/calendar_view.cc +++ b/ash/system/time/calendar_view.cc
@@ -370,6 +370,10 @@ }, base::Unretained(this))) { SetFocusBehavior(FocusBehavior::ALWAYS); + + // Focusable nodes must have an accessible name and valid role. + // TODO(crbug.com/1348930): Review the accessible name and role. + GetViewAccessibility().OverrideRole(ax::mojom::Role::kPane); GetViewAccessibility().OverrideName(GetClassName()); // Since there's no separator in the `CalendarView`, first sets @@ -458,7 +462,10 @@ content_view_->SetBorder(views::CreateEmptyBorder( gfx::Insets::TLBR(kContentVerticalPadding, kWeekRowHorizontalPadding, kContentVerticalPadding, kWeekRowHorizontalPadding))); - // Focusable nodes must have an accessible name. + + // Focusable nodes must have an accessible name and valid role. + // TODO(crbug.com/1348930): Review the accessible name and role. + content_view_->GetViewAccessibility().OverrideRole(ax::mojom::Role::kPane); content_view_->GetViewAccessibility().OverrideName(GetClassName()); content_view_->SetFocusBehavior(FocusBehavior::ALWAYS);
diff --git a/ash/webui/common/resources/BUILD.gn b/ash/webui/common/resources/BUILD.gn index e09caa6e..38fa419 100644 --- a/ash/webui/common/resources/BUILD.gn +++ b/ash/webui/common/resources/BUILD.gn
@@ -132,6 +132,7 @@ ":css_wrapper_files", ":html_wrapper_files", ":preprocess", + "//ui/webui/resources:library", ] }
diff --git a/ash/webui/os_feedback_ui/os_feedback_ui.cc b/ash/webui/os_feedback_ui/os_feedback_ui.cc index d962d00..c80f3cb 100644 --- a/ash/webui/os_feedback_ui/os_feedback_ui.cc +++ b/ash/webui/os_feedback_ui/os_feedback_ui.cc
@@ -57,6 +57,7 @@ IDS_FEEDBACK_TOOL_HELP_CONTENT_OFFLINE_MESSAGE}, {"helpContentOfflineAltText", IDS_FEEDBACK_TOOL_HELP_CONTENT_OFFLINE_ALT_TEXT}, + {"helpContentLabelTooltip", IDS_FEEDBACK_TOOL_HELP_CONTENT_LABEL_TOOLTIP}, {"noMatchedResults", IDS_FEEDBACK_TOOL_NO_MATCHED_RESULTS}, {"attachFilesLabel", IDS_FEEDBACK_TOOL_ATTACH_FILES_LABEL}, {"attachScreenshotLabel", IDS_FEEDBACK_TOOL_SCREENSHOT_LABEL},
diff --git a/ash/webui/os_feedback_ui/os_feedback_untrusted_ui.cc b/ash/webui/os_feedback_ui/os_feedback_untrusted_ui.cc index a34af9a5..4b02ae8 100644 --- a/ash/webui/os_feedback_ui/os_feedback_untrusted_ui.cc +++ b/ash/webui/os_feedback_ui/os_feedback_untrusted_ui.cc
@@ -32,6 +32,7 @@ IDS_FEEDBACK_TOOL_HELP_CONTENT_OFFLINE_MESSAGE}, {"helpContentOfflineAltText", IDS_FEEDBACK_TOOL_HELP_CONTENT_OFFLINE_ALT_TEXT}, + {"helpContentLabelTooltip", IDS_FEEDBACK_TOOL_HELP_CONTENT_LABEL_TOOLTIP}, }; source->AddLocalizedStrings(kLocalizedStrings);
diff --git a/ash/webui/os_feedback_ui/resources/help_content.html b/ash/webui/os_feedback_ui/resources/help_content.html index c079f73..2f633385 100644 --- a/ash/webui/os_feedback_ui/resources/help_content.html +++ b/ash/webui/os_feedback_ui/resources/help_content.html
@@ -47,9 +47,7 @@ } #helpContentIcon { - --iron-icon-fill-color: var(--cros-icon-color-secondary); - --iron-icon-height: 20px; - --iron-icon-width: 20px; + --cr-tooltip-icon-fill-color: var(--cros-icon-color-secondary); margin-inline-start: 6px; } </style> @@ -59,9 +57,11 @@ <div id="helpContentContainer"> <div id="helpContentLabelContainer"> <h2 class="help-content-label">[[getLabel_(searchResult, isOnline_)]]</h2> - <iron-icon icon="help-content:info" id="helpContentIcon" - hidden$="[[!hasSuggestedHelpContent_(searchResult, isOnline_)]]"> - </iron-icon> + <cr-tooltip-icon icon-class="help-content:info" id="helpContentIcon" + hidden$="[[!hasSuggestedHelpContent_(searchResult, isOnline_)]]" + tooltip-text="[[i18n('helpContentLabelTooltip')]]" + icon-aria-label="[[i18n('helpContentLabelTooltip')]]"> + </cr-tooltip-icon> </div> <template is="dom-if" if="[[!isOnline_]]"> <div class="help-content-offline-details">
diff --git a/ash/webui/os_feedback_ui/resources/help_content.js b/ash/webui/os_feedback_ui/resources/help_content.js index f648aaa4..338353e 100644 --- a/ash/webui/os_feedback_ui/resources/help_content.js +++ b/ash/webui/os_feedback_ui/resources/help_content.js
@@ -9,6 +9,7 @@ import '//resources/cr_elements/cr_icons_css.m.js'; import '//resources/cr_elements/hidden_style_css.m.js'; import '//resources/cr_elements/icons.m.js'; +import '//resources/cr_elements/policy/cr_tooltip_icon.m.js'; import '//resources/cr_elements/shared_vars_css.m.js'; import {mojoString16ToString} from '//resources/ash/common/mojo_utils.js';
diff --git a/ash/webui/telemetry_extension_ui/mojom/BUILD.gn b/ash/webui/telemetry_extension_ui/mojom/BUILD.gn index f1fe6dc..42f6632 100644 --- a/ash/webui/telemetry_extension_ui/mojom/BUILD.gn +++ b/ash/webui/telemetry_extension_ui/mojom/BUILD.gn
@@ -8,8 +8,5 @@ assert(is_chromeos_ash) mojom("mojom") { - sources = [ - "diagnostics_service.mojom", - "system_events_service.mojom", - ] + sources = [ "system_events_service.mojom" ] }
diff --git a/ash/webui/telemetry_extension_ui/services/BUILD.gn b/ash/webui/telemetry_extension_ui/services/BUILD.gn index 52f6031..af6ce21c 100644 --- a/ash/webui/telemetry_extension_ui/services/BUILD.gn +++ b/ash/webui/telemetry_extension_ui/services/BUILD.gn
@@ -10,10 +10,6 @@ sources = [ "bluetooth_observer.cc", "bluetooth_observer.h", - "diagnostics_service.cc", - "diagnostics_service.h", - "diagnostics_service_converters.cc", - "diagnostics_service_converters.h", "lid_observer.cc", "lid_observer.h", "power_observer.cc", @@ -33,27 +29,9 @@ ] } -source_set("telemetry_services_test") { - testonly = true - sources = [ - "fake_diagnostics_service.cc", - "fake_diagnostics_service.h", - ] - - deps = [ - ":telemetry_services", - "//ash/webui/telemetry_extension_ui/mojom", - "//base", - "//chrome/test:test_support", - ] -} - source_set("unit_tests") { testonly = true - sources = [ - "diagnostics_service_converters_unittest.cc", - "system_events_service_unittest.cc", - ] + sources = [ "system_events_service_unittest.cc" ] deps = [ ":telemetry_services", "//ash/webui/telemetry_extension_ui/mojom",
diff --git a/ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.cc b/ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.cc deleted file mode 100644 index 8afcee7..0000000 --- a/ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.cc +++ /dev/null
@@ -1,244 +0,0 @@ -// Copyright 2020 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. - -#include "ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.h" - -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" -#include "base/notreached.h" -#include "base/strings/string_piece.h" -#include "chrome/browser/ash/wilco_dtc_supportd/mojo_utils.h" -#include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_diagnostics.mojom.h" -#include "third_party/abseil-cpp/absl/types/optional.h" - -namespace ash { -namespace converters { - -namespace unchecked { - -namespace { - -std::string GetStringFromMojoHandle(mojo::ScopedHandle handle) { - base::ReadOnlySharedMemoryMapping shared_memory; - return std::string(MojoUtils::GetStringPieceFromMojoHandle(std::move(handle), - &shared_memory)); -} - -} // namespace - -health::mojom::RoutineUpdatePtr UncheckedConvertPtr( - cros_healthd::mojom::RoutineUpdatePtr input) { - return health::mojom::RoutineUpdate::New( - input->progress_percent, - GetStringFromMojoHandle(std::move(input->output)), - ConvertDiagnosticsPtr(std::move(input->routine_update_union))); -} - -health::mojom::RoutineUpdateUnionPtr UncheckedConvertPtr( - cros_healthd::mojom::RoutineUpdateUnionPtr input) { - switch (input->which()) { - case cros_healthd::mojom::RoutineUpdateUnion::Tag::kInteractiveUpdate: - return health::mojom::RoutineUpdateUnion::NewInteractiveUpdate( - ConvertDiagnosticsPtr(std::move(input->get_interactive_update()))); - case cros_healthd::mojom::RoutineUpdateUnion::Tag::kNoninteractiveUpdate: - return health::mojom::RoutineUpdateUnion::NewNoninteractiveUpdate( - ConvertDiagnosticsPtr(std::move(input->get_noninteractive_update()))); - } -} - -health::mojom::InteractiveRoutineUpdatePtr UncheckedConvertPtr( - cros_healthd::mojom::InteractiveRoutineUpdatePtr input) { - return health::mojom::InteractiveRoutineUpdate::New( - Convert(input->user_message)); -} - -health::mojom::NonInteractiveRoutineUpdatePtr UncheckedConvertPtr( - cros_healthd::mojom::NonInteractiveRoutineUpdatePtr input) { - return health::mojom::NonInteractiveRoutineUpdate::New( - Convert(input->status), std::move(input->status_message)); -} - -health::mojom::RunRoutineResponsePtr UncheckedConvertPtr( - cros_healthd::mojom::RunRoutineResponsePtr input) { - return health::mojom::RunRoutineResponse::New(input->id, - Convert(input->status)); -} - -} // namespace unchecked - -absl::optional<health::mojom::DiagnosticRoutineEnum> Convert( - cros_healthd::mojom::DiagnosticRoutineEnum input) { - switch (input) { - case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryCapacity: - return health::mojom::DiagnosticRoutineEnum::kBatteryCapacity; - case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryHealth: - return health::mojom::DiagnosticRoutineEnum::kBatteryHealth; - case cros_healthd::mojom::DiagnosticRoutineEnum::kSmartctlCheck: - return health::mojom::DiagnosticRoutineEnum::kSmartctlCheck; - case cros_healthd::mojom::DiagnosticRoutineEnum::kAcPower: - return health::mojom::DiagnosticRoutineEnum::kAcPower; - case cros_healthd::mojom::DiagnosticRoutineEnum::kCpuCache: - return health::mojom::DiagnosticRoutineEnum::kCpuCache; - case cros_healthd::mojom::DiagnosticRoutineEnum::kCpuStress: - return health::mojom::DiagnosticRoutineEnum::kCpuStress; - case cros_healthd::mojom::DiagnosticRoutineEnum::kFloatingPointAccuracy: - return health::mojom::DiagnosticRoutineEnum::kFloatingPointAccuracy; - case cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel: - return health::mojom::DiagnosticRoutineEnum::kNvmeWearLevel; - case cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeSelfTest: - return health::mojom::DiagnosticRoutineEnum::kNvmeSelfTest; - case cros_healthd::mojom::DiagnosticRoutineEnum::kDiskRead: - return health::mojom::DiagnosticRoutineEnum::kDiskRead; - case cros_healthd::mojom::DiagnosticRoutineEnum::kPrimeSearch: - return health::mojom::DiagnosticRoutineEnum::kPrimeSearch; - case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryDischarge: - return health::mojom::DiagnosticRoutineEnum::kBatteryDischarge; - case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryCharge: - return health::mojom::DiagnosticRoutineEnum::kBatteryCharge; - case cros_healthd::mojom::DiagnosticRoutineEnum::kMemory: - return health::mojom::DiagnosticRoutineEnum::kMemory; - case cros_healthd::mojom::DiagnosticRoutineEnum::kLanConnectivity: - return health::mojom::DiagnosticRoutineEnum::kLanConnectivity; - default: - return absl::nullopt; - } -} - -std::vector<health::mojom::DiagnosticRoutineEnum> Convert( - const std::vector<cros_healthd::mojom::DiagnosticRoutineEnum>& input) { - std::vector<health::mojom::DiagnosticRoutineEnum> output; - for (const auto element : input) { - absl::optional<health::mojom::DiagnosticRoutineEnum> converted = - Convert(element); - if (converted.has_value()) { - output.push_back(converted.value()); - } - } - return output; -} - -health::mojom::DiagnosticRoutineUserMessageEnum Convert( - cros_healthd::mojom::DiagnosticRoutineUserMessageEnum input) { - switch (input) { - case cros_healthd::mojom::DiagnosticRoutineUserMessageEnum::kUnknown: - return health::mojom::DiagnosticRoutineUserMessageEnum::kUnknown; - case cros_healthd::mojom::DiagnosticRoutineUserMessageEnum::kUnplugACPower: - return health::mojom::DiagnosticRoutineUserMessageEnum::kUnplugACPower; - case cros_healthd::mojom::DiagnosticRoutineUserMessageEnum::kPlugInACPower: - return health::mojom::DiagnosticRoutineUserMessageEnum::kPlugInACPower; - } - NOTREACHED(); - return static_cast<health::mojom::DiagnosticRoutineUserMessageEnum>( - static_cast<int>( - health::mojom::DiagnosticRoutineUserMessageEnum::kMaxValue) + - 1); -} - -health::mojom::DiagnosticRoutineStatusEnum Convert( - cros_healthd::mojom::DiagnosticRoutineStatusEnum input) { - switch (input) { - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kUnknown: - return health::mojom::DiagnosticRoutineStatusEnum::kUnknown; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kReady: - return health::mojom::DiagnosticRoutineStatusEnum::kReady; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kRunning: - return health::mojom::DiagnosticRoutineStatusEnum::kRunning; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kWaiting: - return health::mojom::DiagnosticRoutineStatusEnum::kWaiting; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kPassed: - return health::mojom::DiagnosticRoutineStatusEnum::kPassed; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kFailed: - return health::mojom::DiagnosticRoutineStatusEnum::kFailed; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kError: - return health::mojom::DiagnosticRoutineStatusEnum::kError; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kCancelled: - return health::mojom::DiagnosticRoutineStatusEnum::kCancelled; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kFailedToStart: - return health::mojom::DiagnosticRoutineStatusEnum::kFailedToStart; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kRemoved: - return health::mojom::DiagnosticRoutineStatusEnum::kRemoved; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kCancelling: - return health::mojom::DiagnosticRoutineStatusEnum::kCancelling; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kUnsupported: - return health::mojom::DiagnosticRoutineStatusEnum::kUnsupported; - case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kNotRun: - return health::mojom::DiagnosticRoutineStatusEnum::kNotRun; - } - NOTREACHED(); - return static_cast<health::mojom::DiagnosticRoutineStatusEnum>( - static_cast<int>(health::mojom::DiagnosticRoutineStatusEnum::kMaxValue) + - 1); -} - -cros_healthd::mojom::DiagnosticRoutineCommandEnum Convert( - health::mojom::DiagnosticRoutineCommandEnum input) { - switch (input) { - case health::mojom::DiagnosticRoutineCommandEnum::kUnknown: - return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kUnknown; - case health::mojom::DiagnosticRoutineCommandEnum::kContinue: - return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kContinue; - case health::mojom::DiagnosticRoutineCommandEnum::kCancel: - return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kCancel; - case health::mojom::DiagnosticRoutineCommandEnum::kGetStatus: - return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kGetStatus; - case health::mojom::DiagnosticRoutineCommandEnum::kRemove: - return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kRemove; - } - NOTREACHED(); - return static_cast<cros_healthd::mojom::DiagnosticRoutineCommandEnum>( - static_cast<int>( - cros_healthd::mojom::DiagnosticRoutineCommandEnum::kMaxValue) + - 1); -} - -cros_healthd::mojom::AcPowerStatusEnum Convert( - health::mojom::AcPowerStatusEnum input) { - switch (input) { - case health::mojom::AcPowerStatusEnum::kUnknown: - return cros_healthd::mojom::AcPowerStatusEnum::kUnknown; - case health::mojom::AcPowerStatusEnum::kConnected: - return cros_healthd::mojom::AcPowerStatusEnum::kConnected; - case health::mojom::AcPowerStatusEnum::kDisconnected: - return cros_healthd::mojom::AcPowerStatusEnum::kDisconnected; - } - NOTREACHED(); - return static_cast<cros_healthd::mojom::AcPowerStatusEnum>( - static_cast<int>(cros_healthd::mojom::AcPowerStatusEnum::kMaxValue) + 1); -} - -cros_healthd::mojom::NvmeSelfTestTypeEnum Convert( - health::mojom::NvmeSelfTestTypeEnum input) { - switch (input) { - case health::mojom::NvmeSelfTestTypeEnum::kUnknown: - return cros_healthd::mojom::NvmeSelfTestTypeEnum::kUnknown; - case health::mojom::NvmeSelfTestTypeEnum::kShortSelfTest: - return cros_healthd::mojom::NvmeSelfTestTypeEnum::kShortSelfTest; - case health::mojom::NvmeSelfTestTypeEnum::kLongSelfTest: - return cros_healthd::mojom::NvmeSelfTestTypeEnum::kLongSelfTest; - } - NOTREACHED(); - return static_cast<cros_healthd::mojom::NvmeSelfTestTypeEnum>( - static_cast<int>(cros_healthd::mojom::NvmeSelfTestTypeEnum::kMaxValue) + - 1); -} - -cros_healthd::mojom::DiskReadRoutineTypeEnum Convert( - health::mojom::DiskReadRoutineTypeEnum input) { - switch (input) { - case health::mojom::DiskReadRoutineTypeEnum::kLinearRead: - return cros_healthd::mojom::DiskReadRoutineTypeEnum::kLinearRead; - case health::mojom::DiskReadRoutineTypeEnum::kRandomRead: - return cros_healthd::mojom::DiskReadRoutineTypeEnum::kRandomRead; - case health::mojom::DiskReadRoutineTypeEnum::kUnknown: - // Fall-through to not-supported case. - break; - } - NOTREACHED(); - return static_cast<cros_healthd::mojom::DiskReadRoutineTypeEnum>( - static_cast<int>( - cros_healthd::mojom::DiskReadRoutineTypeEnum::kMaxValue) + - 1); -} - -} // namespace converters -} // namespace ash
diff --git a/ash/webui/telemetry_extension_ui/services/fake_diagnostics_service.h b/ash/webui/telemetry_extension_ui/services/fake_diagnostics_service.h deleted file mode 100644 index 9a3927c..0000000 --- a/ash/webui/telemetry_extension_ui/services/fake_diagnostics_service.h +++ /dev/null
@@ -1,141 +0,0 @@ -// Copyright 2022 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. - -#ifndef ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_FAKE_DIAGNOSTICS_SERVICE_H_ -#define ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_FAKE_DIAGNOSTICS_SERVICE_H_ - -#include <memory> -#include <vector> - -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" -#include "ash/webui/telemetry_extension_ui/services/diagnostics_service.h" -#include "base/values.h" -#include "mojo/public/cpp/bindings/pending_receiver.h" -#include "mojo/public/cpp/bindings/receiver.h" -#include "third_party/abseil-cpp/absl/types/optional.h" - -namespace ash { - -class FakeDiagnosticsService : public health::mojom::DiagnosticsService { - public: - class Factory : public ash::DiagnosticsService::Factory { - public: - Factory(); - ~Factory() override; - - void SetCreateInstanceResponse( - std::unique_ptr<FakeDiagnosticsService> fake_service); - - protected: - // DiagnosticsService::Factory: - std::unique_ptr<health::mojom::DiagnosticsService> CreateInstance( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver) - override; - - private: - std::unique_ptr<FakeDiagnosticsService> fake_service_; - }; - - FakeDiagnosticsService(); - FakeDiagnosticsService(const FakeDiagnosticsService&) = delete; - FakeDiagnosticsService& operator=(const FakeDiagnosticsService&) = delete; - ~FakeDiagnosticsService() override; - - // health::mojom::DiagnosticsService overrides. - void GetAvailableRoutines(GetAvailableRoutinesCallback callback) override; - void GetRoutineUpdate(int32_t id, - health::mojom::DiagnosticRoutineCommandEnum command, - bool include_output, - GetRoutineUpdateCallback callback) override; - void RunBatteryCapacityRoutine( - RunBatteryCapacityRoutineCallback callback) override; - void RunBatteryHealthRoutine( - RunBatteryHealthRoutineCallback callback) override; - void RunSmartctlCheckRoutine( - RunSmartctlCheckRoutineCallback callback) override; - void RunAcPowerRoutine(health::mojom::AcPowerStatusEnum expected_status, - const absl::optional<std::string>& expected_power_type, - RunAcPowerRoutineCallback callback) override; - void RunCpuCacheRoutine(uint32_t length_seconds, - RunCpuCacheRoutineCallback callback) override; - void RunCpuStressRoutine(uint32_t length_seconds, - RunCpuStressRoutineCallback callback) override; - void RunFloatingPointAccuracyRoutine( - uint32_t length_seconds, - RunFloatingPointAccuracyRoutineCallback callback) override; - void RunNvmeWearLevelRoutine( - uint32_t wear_level_threshold, - RunNvmeWearLevelRoutineCallback callback) override; - void RunNvmeSelfTestRoutine( - health::mojom::NvmeSelfTestTypeEnum nvme_self_test_type, - RunNvmeSelfTestRoutineCallback callback) override; - void RunDiskReadRoutine(health::mojom::DiskReadRoutineTypeEnum type, - uint32_t length_seconds, - uint32_t file_size_mb, - RunDiskReadRoutineCallback callback) override; - void RunPrimeSearchRoutine(uint32_t length_seconds, - RunPrimeSearchRoutineCallback callback) override; - void RunBatteryDischargeRoutine( - uint32_t length_seconds, - uint32_t maximum_discharge_percent_allowed, - RunBatteryDischargeRoutineCallback callback) override; - void RunBatteryChargeRoutine( - uint32_t length_seconds, - uint32_t minimum_charge_percent_required, - RunBatteryChargeRoutineCallback callback) override; - void RunMemoryRoutine(RunMemoryRoutineCallback callback) override; - void RunLanConnectivityRoutine( - RunLanConnectivityRoutineCallback callback) override; - - // Sets the return value for |Run*Routine|. - void SetRunRoutineResponse( - health::mojom::RunRoutineResponsePtr expected_response); - - // Sets the return value for |GetAvailableRoutines|. - void SetAvailableRoutines( - std::vector<health::mojom::DiagnosticRoutineEnum> available_routines); - - // Sets the return value for |GetRoutineUpdate|. - void SetRoutineUpdateResponse(health::mojom::RoutineUpdatePtr routine_update); - - // Set expectation about the parameter that is passed to a call of - // |Run*Routine| or |GetAvailableRoutines|. - void SetExpectedLastPassedParameters( - base::Value::Dict expected_passed_parameter); - - // Set expectation about the type of routine that is called. - void SetExpectedLastCalledRoutine( - health::mojom::DiagnosticRoutineEnum expected_called_routine); - - private: - void BindPendingReceiver( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver); - - mojo::Receiver<health::mojom::DiagnosticsService> receiver_; - - // Response for a call to |Run*Routine|. - health::mojom::RunRoutineResponsePtr run_routine_response_; - - // Response for a call to |GetAvailableRoutines|. - std::vector<health::mojom::DiagnosticRoutineEnum> - available_routines_response_; - - // Response for a call to |GetRoutineUpdate|. - health::mojom::RoutineUpdatePtr routine_update_response_; - - // Expectation of the passed parameters to a |Run*Routine| call. - base::Value::Dict expected_passed_parameters_; - // Actually passed parameter. - base::Value::Dict actual_passed_parameters_; - - // Expectation of the called routine. - health::mojom::DiagnosticRoutineEnum expected_called_routine_{ - health::mojom::DiagnosticRoutineEnum::kUnknown}; - // Actually called routine. - health::mojom::DiagnosticRoutineEnum actual_called_routine_{ - health::mojom::DiagnosticRoutineEnum::kUnknown}; -}; -} // namespace ash - -#endif // ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_FAKE_DIAGNOSTICS_SERVICE_H_
diff --git a/base/test/trace_event_analyzer.cc b/base/test/trace_event_analyzer.cc index fd06cf347..98064a3c 100644 --- a/base/test/trace_event_analyzer.cc +++ b/base/test/trace_event_analyzer.cc
@@ -67,8 +67,6 @@ phase == TRACE_EVENT_PHASE_ASYNC_STEP_INTO || phase == TRACE_EVENT_PHASE_ASYNC_STEP_PAST || phase == TRACE_EVENT_PHASE_MEMORY_DUMP || - phase == TRACE_EVENT_PHASE_ENTER_CONTEXT || - phase == TRACE_EVENT_PHASE_LEAVE_CONTEXT || phase == TRACE_EVENT_PHASE_CREATE_OBJECT || phase == TRACE_EVENT_PHASE_DELETE_OBJECT || phase == TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ||
diff --git a/base/trace_event/common/trace_event_common.h b/base/trace_event/common/trace_event_common.h index fb1ce8a..082cf0ad 100644 --- a/base/trace_event/common/trace_event_common.h +++ b/base/trace_event/common/trace_event_common.h
@@ -1024,18 +1024,6 @@ TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, id, \ TRACE_EVENT_FLAG_NONE) -// Records entering and leaving trace event contexts. |category_group| and -// |name| specify the context category and type. |context| is a -// snapshotted context object id. -#define TRACE_EVENT_ENTER_CONTEXT(category_group, name, context) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_ENTER_CONTEXT, category_group, name, context, \ - TRACE_EVENT_FLAG_NONE) -#define TRACE_EVENT_LEAVE_CONTEXT(category_group, name, context) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_LEAVE_CONTEXT, category_group, name, context, \ - TRACE_EVENT_FLAG_NONE) - // Macro to efficiently determine if a given category group is enabled. #define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \ do { \ @@ -1099,8 +1087,6 @@ #define TRACE_EVENT_PHASE_MEMORY_DUMP ('v') #define TRACE_EVENT_PHASE_MARK ('R') #define TRACE_EVENT_PHASE_CLOCK_SYNC ('c') -#define TRACE_EVENT_PHASE_ENTER_CONTEXT ('(') -#define TRACE_EVENT_PHASE_LEAVE_CONTEXT (')') // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned int>(0))
diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc index 059aa14..20230804 100644 --- a/base/trace_event/trace_event_unittest.cc +++ b/base/trace_event/trace_event_unittest.cc
@@ -478,13 +478,6 @@ TRACE_EVENT1(kControlCharacters, kControlCharacters, kControlCharacters, kControlCharacters); - uint64_t context_id = 0x20151021; - - TRACE_EVENT_ENTER_CONTEXT("test_all", "TRACE_EVENT_ENTER_CONTEXT call", - TRACE_ID_WITH_SCOPE("scope", context_id)); - TRACE_EVENT_LEAVE_CONTEXT("test_all", "TRACE_EVENT_LEAVE_CONTEXT call", - TRACE_ID_WITH_SCOPE("scope", context_id)); - TRACE_EVENT_ASYNC_BEGIN0("test_all", "async default process scope", 0x1000); TRACE_EVENT_ASYNC_BEGIN0("test_all", "async local id", TRACE_ID_LOCAL(0x2000)); @@ -760,27 +753,6 @@ EXPECT_FIND_(kControlCharacters); EXPECT_SUB_FIND_(kControlCharacters); - { -#if BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY) - auto* id_hash = "0xbbd2598e28c3b487"; -#else - auto* id_hash = "0x20151021"; -#endif - EXPECT_FIND_("TRACE_EVENT_ENTER_CONTEXT call"); - { - EXPECT_EQ(*item->FindStringKey("ph"), "("); - EXPECT_EQ(*item->FindStringKey("scope"), "scope"); - EXPECT_EQ(*item->FindStringKey("id"), id_hash); - } - - EXPECT_FIND_("TRACE_EVENT_LEAVE_CONTEXT call"); - { - EXPECT_EQ(*item->FindStringKey("ph"), ")"); - - EXPECT_EQ(*item->FindStringKey("scope"), "scope"); - EXPECT_EQ(*item->FindStringKey("id"), id_hash); - } - } EXPECT_FIND_("async default process scope"); {
diff --git a/build/android/gyp/proguard.py b/build/android/gyp/proguard.py index d0bce86..070afc3 100755 --- a/build/android/gyp/proguard.py +++ b/build/android/gyp/proguard.py
@@ -289,7 +289,6 @@ # R8 OOMs with the default xmx=1G. cmd = build_utils.JavaCmd(options.warnings_as_errors, xmx='2G') + [ '-Dcom.android.tools.r8.experimental.enablewhyareyounotinlining=1', - '-Dcom.android.tools.r8.disableHorizontalClassMerging=1', ] if options.dump_inputs: cmd += ['-Dcom.android.tools.r8.dumpinputtofile=r8inputs.zip']
diff --git a/build/config/fuchsia/test/README.md b/build/config/fuchsia/test/README.md index fef3de32..3faeac9f09 100644 --- a/build/config/fuchsia/test/README.md +++ b/build/config/fuchsia/test/README.md
@@ -21,6 +21,10 @@ #### fonts.shard.test-cml For tests that access system fonts. +#### test_fonts.shard.test-cml +For tests that use the fonts in `//third_party/test_fonts` by way of +`//skia:test_fonts_cfv2`. + #### jit_capabilities.test-cmx Required by tests that execute JavaScript. Should only be required in a small number of tests.
diff --git a/build/config/fuchsia/test/test_fonts.shard.test-cml b/build/config/fuchsia/test/test_fonts.shard.test-cml new file mode 100644 index 0000000..a4fbc055 --- /dev/null +++ b/build/config/fuchsia/test/test_fonts.shard.test-cml
@@ -0,0 +1,29 @@ +{ + children: [ + { + name: "test_fonts", + url: "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cm", + }, + ], + offer: [ + { + protocol: "fuchsia.logger.LogSink", + from: "parent", + to: "#test_fonts", + }, + { + directory: "pkg", + subdir: "test_fonts", + from: "framework", + to: "#test_fonts", + as: "config-data", + rights: [ "r*" ], + } + ], + use: [ + { + protocol: "fuchsia.fonts.Provider", + from: "#test_fonts", + }, + ], +}
diff --git a/build/fuchsia/cipd/BUILD.gn b/build/fuchsia/cipd/BUILD.gn index 777a2f7..a2e5a64 100644 --- a/build/fuchsia/cipd/BUILD.gn +++ b/build/fuchsia/cipd/BUILD.gn
@@ -298,13 +298,13 @@ "${root_gen_dir}/ipc/ipc_tests/ipc_tests.far", "${root_gen_dir}/media/media_unittests/media_unittests.far", "${root_gen_dir}/mojo/mojo_unittests/mojo_unittests.far", + "${root_gen_dir}/skia/skia_unittests/skia_unittests.far", "${root_gen_dir}/third_party/blink/common/blink_common_unittests/blink_common_unittests.far", ] cfv1_far_sources = [ "${root_gen_dir}/fuchsia_web/runners/cast_runner_integration_tests_cfv1/cast_runner_integration_tests_cfv1.far", "${root_gen_dir}/fuchsia_web/runners/web_runner_integration_tests/web_runner_integration_tests.far", "${root_gen_dir}/fuchsia_web/webengine/web_engine_integration_tests/web_engine_integration_tests.far", - "${root_gen_dir}/skia/skia_unittests/skia_unittests.far", ] }, { @@ -314,10 +314,9 @@ "${root_gen_dir}/ipc/ipc_tests/ipc_tests.far", "${root_gen_dir}/media/media_unittests/media_unittests.far", "${root_gen_dir}/mojo/mojo_unittests/mojo_unittests.far", + "${root_gen_dir}/skia/skia_unittests/skia_unittests.far", "${root_gen_dir}/third_party/blink/common/blink_common_unittests/blink_common_unittests.far", ] - cfv1_far_sources = - [ "${root_gen_dir}/skia/skia_unittests/skia_unittests.far" ] }, { manifest_path = "${target_gen_dir}/web_engine_tests_manifest.json"
diff --git a/chrome/android/expectations/monochrome_public_bundle.proguard_flags.expected b/chrome/android/expectations/monochrome_public_bundle.proguard_flags.expected index 253e5f18..cd0845a 100644 --- a/chrome/android/expectations/monochrome_public_bundle.proguard_flags.expected +++ b/chrome/android/expectations/monochrome_public_bundle.proguard_flags.expected
@@ -416,6 +416,15 @@ public *; } +# This rule prevents class merging on R$* resource classes (for example, R$anim, +# R$styleable, R$bool). This causes issues for WebView when unused resource +# stripping, since in WebView we are forced to detect which resources are unused +# by scanning the dex file for R$<res_type>.<res_name>. Having the R$* classes +# being merged together means that R$anim.foo may now be found in R$bool.foo, +# and this mistakenly will mark the foo resouce to be removed. More details in +# crbug.com/1348329. +-keep,allowaccessmodification,allowobfuscation,allowshrinking class **.R$* + # Functor classes with native methods implemented in Android. -keep class com.android.webview.chromium.DrawFunctor -keep class com.android.webview.chromium.DrawGLFunctor
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 01e4f79..2bb3b1f 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -13444,6 +13444,15 @@ <message name="IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_STARTING_SCREEN_TITLE" desc="The title shown on the side panel after an Automated Password Change flow has been started. This message is shown until the first response from a script is received that resets the initial state."> Opening <ph name="URL">$1<ex>example.com</ex></ph>... </message> + <message name="IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_SUCCESSFULLY_CHANGED_PASSWORD_TITLE" desc="The title shown on the side panel after an Automated Password Change flow has been succeeded." translateable="false" > + Successfully changed the compromised password + </message> + <message name="IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_SUCCESSFULLY_CHANGED_PASSWORD_DESCRIPTION" desc="The description shown on the side panel after an Automated Password Change flow has been succeeded." translateable="false" > + Check your passwords any time in <ph name="GOOGLE_PASSWORD_MANAGER">$1<ex>Google Password Manager</ex></ph>. + </message> + <message name="IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_SUCCESSFULLY_CHANGED_PASSWORD_CLOSE_SIDE_PANEL" desc="The label of the button shown in the side panel after a sucessfull run. Once a user clicks on it, the side panel will close." translateable="false"> + Done + </message> </if> </messages> </release>
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 0f6faa78..e111a09 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -776,6 +776,12 @@ <message name="IDS_SETTINGS_PASSWORDS_IMPORT_SUCCESS_TIP" desc="Message is shown on the dialog for importing passwords, after a successful import. It is an advice for the user, that they should consider deleting the file, which they used for importing passwords from."> Consider deleting <ph name="FILENAME"><ex>file_name.csv</ex>$1</ph>, so others who use this device can't see your passwords. </message> + <message name="IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_UNKNOWN" desc="Message is shown on the dialog for importing passwords if no passwords were imported and we don't know the cause of error. Probably error in the backend or in our systems."> + Something went wrong and your passwords weren't imported + </message> + <message name="IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_BAD_FORMAT" desc="Message is shown on the dialog for importing passwords if no passwords were imported because file is not formated correctly"> + Can't import passwords. Check <ph name="FILENAME"><ex>file_name.csv</ex>$1</ph> and make sure it's formatted correctly. + </message> <message name="IDS_SETTINGS_PASSWORDS_EXPORT_MENU_ITEM" desc="A menu item in the More Actions menu above the password list in Chrome's settings. Selecting this action will open a dialog, through which the user can export their passwords outside of Chrome."> Export passwords... </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_BAD_FORMAT.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_BAD_FORMAT.png.sha1 new file mode 100644 index 0000000..c4a06b22 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_BAD_FORMAT.png.sha1
@@ -0,0 +1 @@ +04a37fd5ae412cd79c1862a96d41652dee76c03f \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_UNKNOWN.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_UNKNOWN.png.sha1 new file mode 100644 index 0000000..7eb8ab0 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_UNKNOWN.png.sha1
@@ -0,0 +1 @@ +01d3dde518343b1c9730566ee5f8f52345da439c \ No newline at end of file
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 613947c0..2c4ccf0 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3544,6 +3544,9 @@ }, #endif // BUILDFLAG(ENABLE_WEBUI_TAB_STRIP) && BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH) + {"audio-hfp-mic-sr", flag_descriptions::kAudioHFPMicSRName, + flag_descriptions::kAudioHFPMicSRDescription, kOsCrOS, + PLATFORM_FEATURE_NAME_TYPE("CrOSLateBootAudioHFPMicSR")}, { "audio-settings-page", flag_descriptions::kAudioSettingsPageName,
diff --git a/chrome/browser/ash/dbus/fusebox_service_provider.cc b/chrome/browser/ash/dbus/fusebox_service_provider.cc index 36ccf7e..6f13078 100644 --- a/chrome/browser/ash/dbus/fusebox_service_provider.cc +++ b/chrome/browser/ash/dbus/fusebox_service_provider.cc
@@ -113,15 +113,19 @@ void ReplyToStat(dbus::MethodCall* method_call, dbus::ExportedObject::ResponseSender sender, base::File::Error error_code, - const base::File::Info& info) { + const base::File::Info& info, + bool read_only) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); std::unique_ptr<dbus::Response> response = dbus::Response::FromMethodCall(method_call); dbus::MessageWriter writer(response.get()); + int32_t mode_bits = info.is_directory ? S_IFDIR : S_IFREG; + mode_bits |= read_only ? 0550 : 0770; // "r-xr-x---" versus "rwxrwx---". + writer.AppendInt32(static_cast<int32_t>(error_code)); - writer.AppendInt32(info.is_directory ? S_IFDIR : S_IFREG); + writer.AppendInt32(mode_bits); writer.AppendInt64(info.size); writer.AppendDouble(info.last_accessed.ToDoubleT()); writer.AppendDouble(info.last_modified.ToDoubleT()); @@ -249,7 +253,7 @@ if (!reader.PopString(&fs_url_as_string)) { ReplyToStat(method_call, std::move(sender), base::File::Error::FILE_ERROR_INVALID_OPERATION, - base::File::Info()); + base::File::Info(), false); return; }
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest.cc b/chrome/browser/ash/file_manager/file_manager_browsertest.cc index 0e853f7..1481e89 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest.cc
@@ -335,6 +335,12 @@ ::testing::Return(policy::DlpRulesManager::Level::kBlock)); return true; } + if (name == "setIsRestrictedByAnyRuleBlocked") { + EXPECT_CALL(*mock_rules_manager_, IsRestrictedByAnyRule) + .WillRepeatedly( + ::testing::Return(policy::DlpRulesManager::Level::kBlock)); + return true; + } return false; } @@ -674,6 +680,8 @@ TestCase("checkCutDisabledForReadOnlyDocument").FilesSwa(), TestCase("checkCutDisabledForReadOnlyFile"), TestCase("checkCutDisabledForReadOnlyFile").FilesSwa(), + TestCase("checkDlpRestrictionDetailsDisabledForNonDlpFiles"), + TestCase("checkDlpRestrictionDetailsDisabledForNonDlpFiles").FilesSwa(), TestCase("checkCutDisabledForReadOnlyFolder"), TestCase("checkCutDisabledForReadOnlyFolder").FilesSwa(), TestCase("checkPasteIntoFolderEnabledForReadWriteFolder"), @@ -1274,8 +1282,10 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( DLP, /* dlp.js */ DlpFilesAppBrowserTest, - ::testing::Values(TestCase("transferShowDlpToast").EnableDlp(), - TestCase("dlpShowManagedIcon").EnableDlp())); + ::testing::Values( + TestCase("transferShowDlpToast").EnableDlp(), + TestCase("dlpShowManagedIcon").EnableDlp(), + TestCase("dlpContextMenuRestrictionDetails").EnableDlp())); WRAPPED_INSTANTIATE_TEST_SUITE_P( RestorePrefs, /* restore_prefs.js */ @@ -1667,6 +1677,8 @@ TestCase("filesTooltipLabelChange").FilesSwa(), TestCase("filesTooltipMouseOver"), TestCase("filesTooltipMouseOver").FilesSwa(), + TestCase("filesTooltipMouseOverStaysOpen"), + TestCase("filesTooltipMouseOverStaysOpen").FilesSwa(), TestCase("filesTooltipClickHides"), TestCase("filesTooltipClickHides").FilesSwa(), TestCase("filesTooltipHidesOnWindowResize"),
diff --git a/chrome/browser/ash/file_manager/file_manager_jstest.cc b/chrome/browser/ash/file_manager/file_manager_jstest.cc index 33dee06..7fa9c75 100644 --- a/chrome/browser/ash/file_manager/file_manager_jstest.cc +++ b/chrome/browser/ash/file_manager/file_manager_jstest.cc
@@ -314,3 +314,11 @@ IN_PROC_BROWSER_TEST_F(FileManagerJsTest, EmptyFolderControllerTest) { RunTestURL("foreground/js/empty_folder_controller_unittest.js"); } + +IN_PROC_BROWSER_TEST_F(FileManagerJsTest, BaseStore) { + RunTestURL("lib/base_store_unittest.js"); +} + +IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ReducerAllEntries) { + RunTestURL("state/reducers/all_entries_unittest.js"); +}
diff --git a/chrome/browser/ash/file_manager/file_manager_string_util.cc b/chrome/browser/ash/file_manager/file_manager_string_util.cc index 081dc61..7120a3c 100644 --- a/chrome/browser/ash/file_manager/file_manager_string_util.cc +++ b/chrome/browser/ash/file_manager/file_manager_string_util.cc
@@ -927,6 +927,8 @@ SET_STRING("DLP_TOAST_BUTTON_LABEL", IDS_FILE_BROWSER_DLP_TOAST_BUTTON_LABEL); SET_STRING("DLP_RESTRICTION_DETAILS", IDS_FILE_BROWSER_DLP_RESTRICTION_DETAILS); + SET_STRING("DLP_MANAGED_ICON_TOOLTIP", + IDS_FILE_BROWSER_DLP_MANAGED_ICON_TOOLTIP); } #undef SET_STRING
diff --git a/chrome/browser/ash/file_manager/fusebox_mounter.cc b/chrome/browser/ash/file_manager/fusebox_mounter.cc index b84d354..ea93a6b1 100644 --- a/chrome/browser/ash/file_manager/fusebox_mounter.cc +++ b/chrome/browser/ash/file_manager/fusebox_mounter.cc
@@ -15,6 +15,7 @@ #include "base/logging.h" #include "base/memory/weak_ptr.h" #include "base/strings/string_util.h" +#include "chrome/browser/ash/fusebox/fusebox_server.h" #include "chromeos/ash/components/dbus/cros_disks/cros_disks_client.h" #include "chromeos/ash/components/dbus/fusebox/fusebox_reverse_client.h" @@ -56,14 +57,13 @@ return; } - constexpr auto strip_trailing_slash_from = [](std::string string) { - if (string.size() && base::EndsWith(string, "/")) - string.resize(string.size() - 1); - return string; - }; + fusebox::Server* fusebox_server = fusebox::Server::GetInstance(); + if (fusebox_server) { + fusebox_server->RegisterFSURLPrefix(subdir, url, read_only); + } - std::string name = base::JoinString( - {subdir, strip_trailing_slash_from(url), read_only ? "ro" : ""}, " "); + std::string name = + base::JoinString({subdir, subdir, read_only ? "ro" : ""}, " "); client->AttachStorage(name, std::move(callback)); } @@ -78,6 +78,11 @@ return; } + fusebox::Server* fusebox_server = fusebox::Server::GetInstance(); + if (fusebox_server) { + fusebox_server->UnregisterFSURLPrefix(subdir); + } + client->DetachStorage(subdir, std::move(callback)); }
diff --git a/chrome/browser/ash/fusebox/fusebox_moniker.cc b/chrome/browser/ash/fusebox/fusebox_moniker.cc index 9f946b7..e7576f5b 100644 --- a/chrome/browser/ash/fusebox/fusebox_moniker.cc +++ b/chrome/browser/ash/fusebox/fusebox_moniker.cc
@@ -12,12 +12,17 @@ // static MonikerMap::ExtractTokenResult MonikerMap::ExtractToken( const std::string& fs_url_as_string) { - if (!base::StartsWith(fs_url_as_string, fusebox::kMonikerFileSystemURL)) { + size_t n = 0; + if (base::StartsWith(fs_url_as_string, fusebox::kMonikerSubdir)) { + n = strlen(fusebox::kMonikerSubdir); + } else if (base::StartsWith(fs_url_as_string, + fusebox::kMonikerFileSystemURL)) { + n = strlen(fusebox::kMonikerFileSystemURL); + } else { ExtractTokenResult result; result.result_type = ExtractTokenResult::ResultType::NOT_A_MONIKER_FS_URL; return result; } - const size_t n = strlen(fusebox::kMonikerFileSystemURL); if (fs_url_as_string.size() <= n) { ExtractTokenResult result; result.result_type =
diff --git a/chrome/browser/ash/fusebox/fusebox_server.cc b/chrome/browser/ash/fusebox/fusebox_server.cc index fb42c0ac..2839b69 100644 --- a/chrome/browser/ash/fusebox/fusebox_server.cc +++ b/chrome/browser/ash/fusebox/fusebox_server.cc
@@ -5,9 +5,12 @@ #include "chrome/browser/ash/fusebox/fusebox_server.h" #include <sys/stat.h> +#include <utility> #include "base/callback.h" #include "base/logging.h" +#include "base/strings/strcat.h" +#include "base/strings/string_util.h" #include "base/task/bind_post_task.h" #include "chrome/browser/ash/file_manager/fileapi_util.h" #include "chrome/browser/profiles/profile_manager.h" @@ -29,20 +32,37 @@ Server* g_server_instance = nullptr; +std::pair<std::string, bool> ResolvePrefixMap( + fusebox::Server::PrefixMap& prefix_map, + const std::string& s) { + size_t i = s.find('/'); + if (i == std::string::npos) { + return std::make_pair(s, false); + } + auto iter = prefix_map.find(s.substr(0, i)); + if (iter == prefix_map.end()) { + return std::make_pair(s, false); + } + return std::make_pair(base::StrCat({iter->second.fs_url_prefix, s.substr(i)}), + iter->second.read_only); +} + // ParseResult is the type returned by ParseFileSystemURL. It is a result type // (see https://en.wikipedia.org/wiki/Result_type), being either an error or a // value. In this case, the error type is a base::File::Error (a numeric code) -// and the value type is a pair of storage::FileSystemContext and -// storage::FileSystemURL. +// and the value type is the storage::FileSystemContext and the +// storage::FileSystemURL (and some other incidental fields). struct ParseResult { explicit ParseResult(base::File::Error error_code_arg); ParseResult(scoped_refptr<storage::FileSystemContext> fs_context_arg, - storage::FileSystemURL fs_url_arg); + storage::FileSystemURL fs_url_arg, + bool read_only_arg); ~ParseResult(); base::File::Error error_code; scoped_refptr<storage::FileSystemContext> fs_context; storage::FileSystemURL fs_url; + bool read_only = false; // is_moniker_root is used for the special case where // fusebox::kMonikerFileSystemURL (also known as "dummy://moniker", with no @@ -59,10 +79,12 @@ ParseResult::ParseResult( scoped_refptr<storage::FileSystemContext> fs_context_arg, - storage::FileSystemURL fs_url_arg) + storage::FileSystemURL fs_url_arg, + bool read_only_arg) : error_code(base::File::Error::FILE_OK), fs_context(std::move(fs_context_arg)), - fs_url(std::move(fs_url_arg)) {} + fs_url(std::move(fs_url_arg)), + read_only(read_only_arg) {} ParseResult::~ParseResult() = default; @@ -70,6 +92,7 @@ // string). This function parses that first argument as well as finding the // FileSystemContext we will need to serve those methods. ParseResult ParseFileSystemURL(fusebox::MonikerMap& moniker_map, + fusebox::Server::PrefixMap& prefix_map, std::string fs_url_as_string) { scoped_refptr<storage::FileSystemContext> fs_context = file_manager::util::GetFileManagerFileSystemContext( @@ -83,6 +106,7 @@ } storage::FileSystemURL fs_url; + bool read_only = false; // Intercept any moniker names and replace them by their linked target. using ResultType = fusebox::MonikerMap::ExtractTokenResult::ResultType; @@ -96,13 +120,16 @@ return ParseResult(base::File::Error::FILE_ERROR_NOT_FOUND); } break; - case ResultType::NOT_A_MONIKER_FS_URL: - fs_url = fs_context->CrackURLInFirstPartyContext(GURL(fs_url_as_string)); + case ResultType::NOT_A_MONIKER_FS_URL: { + auto resolved = ResolvePrefixMap(prefix_map, fs_url_as_string); + read_only = resolved.second; + fs_url = fs_context->CrackURLInFirstPartyContext(GURL(resolved.first)); if (!fs_url.is_valid()) { LOG(ERROR) << "Invalid FileSystemURL"; return ParseResult(base::File::Error::FILE_ERROR_INVALID_URL); } break; + } case ResultType::MONIKER_FS_URL_BUT_ONLY_ROOT: { ParseResult result = ParseResult(base::File::Error::FILE_ERROR_NOT_FOUND); result.is_moniker_root = true; @@ -117,7 +144,7 @@ << storage::GetFileSystemTypeString(fs_url.type()); return ParseResult(base::File::Error::FILE_ERROR_INVALID_URL); } - return ParseResult(std::move(fs_context), std::move(fs_url)); + return ParseResult(std::move(fs_context), std::move(fs_url), read_only); } // Some functions (marked with a §) below, take an fs_context argument that @@ -212,15 +239,20 @@ void RunStatCallback( Server::StatCallback callback, scoped_refptr<storage::FileSystemContext> fs_context, // See § above. + bool read_only, base::File::Error error_code, const base::File::Info& info) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - std::move(callback).Run(error_code, info); + std::move(callback).Run(error_code, info, read_only); } } // namespace +Server::PrefixMapEntry::PrefixMapEntry(std::string fs_url_prefix_arg, + bool read_only_arg) + : fs_url_prefix(fs_url_prefix_arg), read_only(read_only_arg) {} + // static Server* Server::GetInstance() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -252,10 +284,33 @@ moniker_map_.DestroyMoniker(moniker); } +void Server::RegisterFSURLPrefix(const std::string& subdir, + const std::string& fs_url_prefix, + bool read_only) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + if (subdir.find('/') != std::string::npos) { + LOG(ERROR) << "Invalid subdir: " << subdir; + return; + } + std::string trimmed = + std::string(base::TrimString(fs_url_prefix, "/", base::TRIM_TRAILING)); + prefix_map_.insert({subdir, PrefixMapEntry(trimmed, read_only)}); +} + +void Server::UnregisterFSURLPrefix(const std::string& subdir) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + auto iter = prefix_map_.find(subdir); + if (iter != prefix_map_.end()) { + prefix_map_.erase(iter); + } +} + void Server::Close(std::string fs_url_as_string, CloseCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - auto common = ParseFileSystemURL(moniker_map_, fs_url_as_string); + auto common = ParseFileSystemURL(moniker_map_, prefix_map_, fs_url_as_string); if (common.error_code != base::File::Error::FILE_OK) { std::move(callback).Run(common.error_code); return; @@ -269,7 +324,7 @@ void Server::Open(std::string fs_url_as_string, OpenCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - auto common = ParseFileSystemURL(moniker_map_, fs_url_as_string); + auto common = ParseFileSystemURL(moniker_map_, prefix_map_, fs_url_as_string); if (common.error_code != base::File::Error::FILE_OK) { std::move(callback).Run(common.error_code); return; @@ -286,7 +341,7 @@ ReadCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - auto common = ParseFileSystemURL(moniker_map_, fs_url_as_string); + auto common = ParseFileSystemURL(moniker_map_, prefix_map_, fs_url_as_string); if (common.error_code != base::File::Error::FILE_OK) { std::move(callback).Run(common.error_code, nullptr, 0); return; @@ -303,7 +358,7 @@ ReadDirCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - auto common = ParseFileSystemURL(moniker_map_, fs_url_as_string); + auto common = ParseFileSystemURL(moniker_map_, prefix_map_, fs_url_as_string); if (common.is_moniker_root || (common.error_code != base::File::Error::FILE_OK)) { constexpr bool has_more = false; @@ -330,9 +385,9 @@ void Server::Stat(std::string fs_url_as_string, StatCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - auto common = ParseFileSystemURL(moniker_map_, fs_url_as_string); + auto common = ParseFileSystemURL(moniker_map_, prefix_map_, fs_url_as_string); if (common.error_code != base::File::Error::FILE_OK) { - std::move(callback).Run(common.error_code, base::File::Info()); + std::move(callback).Run(common.error_code, base::File::Info(), false); return; } @@ -341,9 +396,10 @@ storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED; - auto outer_callback = base::BindPostTask( - base::SequencedTaskRunnerHandle::Get(), - base::BindOnce(&RunStatCallback, std::move(callback), common.fs_context)); + auto outer_callback = + base::BindPostTask(base::SequencedTaskRunnerHandle::Get(), + base::BindOnce(&RunStatCallback, std::move(callback), + common.fs_context, common.read_only)); content::GetIOThreadTaskRunner({})->PostTask( FROM_HERE,
diff --git a/chrome/browser/ash/fusebox/fusebox_server.h b/chrome/browser/ash/fusebox/fusebox_server.h index 6e1cfc4..7ac50ba 100644 --- a/chrome/browser/ash/fusebox/fusebox_server.h +++ b/chrome/browser/ash/fusebox/fusebox_server.h
@@ -28,6 +28,11 @@ fusebox::Moniker CreateMoniker(storage::FileSystemURL target); void DestroyMoniker(fusebox::Moniker moniker); + void RegisterFSURLPrefix(const std::string& subdir, + const std::string& fs_url_prefix, + bool read_only); + void UnregisterFSURLPrefix(const std::string& subdir); + // These methods map 1:1 to the D-Bus methods implemented by // fusebox_service_provider.cc. // @@ -73,11 +78,29 @@ // Stat returns the file or directory's metadata. using StatCallback = base::OnceCallback<void(base::File::Error error_code, - const base::File::Info& info)>; + const base::File::Info& info, + bool read_only)>; void Stat(std::string fs_url_as_string, StatCallback callback); + struct PrefixMapEntry { + PrefixMapEntry(std::string fs_url_prefix_arg, bool read_only_arg); + + std::string fs_url_prefix; + bool read_only; + }; + + // Maps from a subdir to a storage::FileSystemURL prefix in string form (and + // other metadata). For example, the subdir could be the "foo" in the + // "/media/fuse/fusebox/foo/bar/baz.txt" filename, which gets mapped to + // "fs_url_prefix/bar/baz.txt" before that whole string is parsed as a + // storage::FileSystemURL. + // + // Neither subdir nor fs_url_prefix should have a trailing slash. + using PrefixMap = std::map<std::string, PrefixMapEntry>; + private: fusebox::MonikerMap moniker_map_; + PrefixMap prefix_map_; }; } // namespace fusebox
diff --git a/chrome/browser/ash/input_method/assistive_suggester.cc b/chrome/browser/ash/input_method/assistive_suggester.cc index af6cdd3..9bcc639 100644 --- a/chrome/browser/ash/input_method/assistive_suggester.cc +++ b/chrome/browser/ash/input_method/assistive_suggester.cc
@@ -193,8 +193,7 @@ bool AssistiveSuggester::IsAssistiveFeatureEnabled() { return IsAssistPersonalInfoEnabled() || IsEmojiSuggestAdditionEnabled() || IsMultiWordSuggestEnabled() || IsEnhancedEmojiSuggestEnabled() || - base::FeatureList::IsEnabled( - features::kDiacriticsOnPhysicalKeyboardLongpress); + IsDiacriticsOnPhysicalKeyboardLongpressEnabled(); } void AssistiveSuggester::FetchEnabledSuggestionsFromBrowserContextThen( @@ -229,6 +228,14 @@ base::FeatureList::IsEnabled(features::kAssistMultiWordExpanded); } +bool AssistiveSuggester::IsDiacriticsOnPhysicalKeyboardLongpressEnabled() { + return base::FeatureList::IsEnabled( + features::kDiacriticsOnPhysicalKeyboardLongpress) && + IsUsEnglishEngine(active_engine_id_) && + IsDiacriticsOnLongpressPrefEnabled(profile_->GetPrefs(), + active_engine_id_); +} + DisabledReason AssistiveSuggester::GetDisabledReasonForPersonalInfo( const AssistiveSuggesterSwitch::EnabledSuggestions& enabled_suggestions) { if (!base::FeatureList::IsEnabled(features::kAssistPersonalInfo)) { @@ -370,7 +377,15 @@ SuggestionStatus status = current_suggester_->HandleKeyEvent(event); switch (status) { case SuggestionStatus::kAccept: - RecordAssistiveSuccess(current_suggester_->GetProposeActionType()); + // Handle a race condition where the current suggester_ is set to + // nullptr by a simultaneous event (such as a key event causing a + // onBlur() event). + // TODO(b/240534923): Figure out how to record metrics when + // current_suggester_ is set to nullptr prematurely by a different + // event. + if (current_suggester_) { + RecordAssistiveSuccess(current_suggester_->GetProposeActionType()); + } current_suggester_ = nullptr; return true; case SuggestionStatus::kDismiss: @@ -383,13 +398,10 @@ } } - // Diacritics is only enabled for US English Engine. - if (IsUsEnglishEngine(active_engine_id_)) { + if (IsDiacriticsOnPhysicalKeyboardLongpressEnabled()) { // Longpress diacritics behaviour overrides the longpress to repeat key // behaviour for alphabetical keys. - if (base::FeatureList::IsEnabled( - features::kDiacriticsOnPhysicalKeyboardLongpress) && - event.is_repeat() && + if (event.is_repeat() && kDefaultLongpressEnabledKeys.contains(event.GetCharacter())) { return true; // Do not propagate this event. } @@ -402,8 +414,7 @@ const ui::KeyEvent& event) { if (const char c = event.GetCharacter(); kDefaultLongpressEnabledKeys.contains(c) && - base::FeatureList::IsEnabled( - features::kDiacriticsOnPhysicalKeyboardLongpress)) { + IsDiacriticsOnPhysicalKeyboardLongpressEnabled()) { // Process longpress keydown event. if (current_longpress_char_ == absl::nullopt && event.type() == ui::EventType::ET_KEY_PRESSED) {
diff --git a/chrome/browser/ash/input_method/assistive_suggester.h b/chrome/browser/ash/input_method/assistive_suggester.h index d9cdd39b..2717047d 100644 --- a/chrome/browser/ash/input_method/assistive_suggester.h +++ b/chrome/browser/ash/input_method/assistive_suggester.h
@@ -122,6 +122,8 @@ bool IsExpandedMultiWordSuggestEnabled(); + bool IsDiacriticsOnPhysicalKeyboardLongpressEnabled(); + // Checks the text before cursor, emits metric if any assistive prefix is // matched. void RecordAssistiveMatchMetrics(
diff --git a/chrome/browser/ash/input_method/assistive_suggester_prefs.cc b/chrome/browser/ash/input_method/assistive_suggester_prefs.cc index 5c3a082..85f5ec9 100644 --- a/chrome/browser/ash/input_method/assistive_suggester_prefs.cc +++ b/chrome/browser/ash/input_method/assistive_suggester_prefs.cc
@@ -23,5 +23,17 @@ return predictive_writing_setting.value_or(true); } +bool IsDiacriticsOnLongpressPrefEnabled(PrefService* pref_service, + const std::string& engine_id) { + const base::Value* input_method_settings = pref_service->GetDictionary( + ::prefs::kLanguageInputMethodSpecificSettings); + absl::optional<bool> diacritics_on_longpress_setting = + input_method_settings->FindBoolPath( + engine_id + ".physicalKeyboardEnableDiacriticsOnLongpress"); + // If no preference has been set yet by the user then we can assume the + // default preference as enabled. + return diacritics_on_longpress_setting.value_or(false); +} + } // namespace input_method } // namespace ash
diff --git a/chrome/browser/ash/input_method/assistive_suggester_prefs.h b/chrome/browser/ash/input_method/assistive_suggester_prefs.h index 7629836..9daa8e9 100644 --- a/chrome/browser/ash/input_method/assistive_suggester_prefs.h +++ b/chrome/browser/ash/input_method/assistive_suggester_prefs.h
@@ -15,6 +15,9 @@ bool IsPredictiveWritingPrefEnabled(PrefService* pref_service, const std::string& engine_id); +bool IsDiacriticsOnLongpressPrefEnabled(PrefService* pref_service, + const std::string& engine_id); + } // namespace input_method } // namespace ash
diff --git a/chrome/browser/ash/input_method/assistive_suggester_unittest.cc b/chrome/browser/ash/input_method/assistive_suggester_unittest.cc index 7197d241..6279963 100644 --- a/chrome/browser/ash/input_method/assistive_suggester_unittest.cc +++ b/chrome/browser/ash/input_method/assistive_suggester_unittest.cc
@@ -77,11 +77,17 @@ ui::EF_IS_REPEAT); } -void SetInputMethodOptions(Profile& profile, bool predictive_writing_enabled) { +void SetInputMethodOptions(Profile& profile, + bool predictive_writing_enabled, + bool diacritics_on_longpress_enabled) { base::Value input_method_setting(base::Value::Type::DICTIONARY); input_method_setting.SetPath(std::string(kUsEnglishEngineId) + ".physicalKeyboardEnablePredictiveWriting", base::Value(predictive_writing_enabled)); + input_method_setting.SetPath( + std::string(kUsEnglishEngineId) + + ".physicalKeyboardEnableDiacriticsOnLongpress", + base::Value(diacritics_on_longpress_enabled)); profile.GetPrefs()->Set(::prefs::kLanguageInputMethodSpecificSettings, input_method_setting); } @@ -243,7 +249,9 @@ /*enabled_features=*/{features::kAssistMultiWord}, /*disabled_features=*/{features::kAssistPersonalInfo}); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); EXPECT_TRUE(assistive_suggester_->IsAssistiveFeatureEnabled()); @@ -256,7 +264,9 @@ /*enabled_features=*/{features::kAssistMultiWord}, /*disabled_features=*/{features::kAssistPersonalInfo}); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); EXPECT_FALSE(assistive_suggester_->IsAssistiveFeatureEnabled()); @@ -270,21 +280,47 @@ /*disabled_features=*/{features::kAssistPersonalInfo, features::kAssistMultiWord}); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/false); assistive_suggester_->OnActivate(kUsEnglishEngineId); EXPECT_FALSE(assistive_suggester_->IsAssistiveFeatureEnabled()); } TEST_F(AssistiveSuggesterTest, - AssistiveDiacriticsLongpressFlagEnabled_AssistiveFeatureEnabled) { + AssistiveDiacriticsLongpressFlagAndPrefEnabled_AssistiveFeatureEnabled) { base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeature( features::kDiacriticsOnPhysicalKeyboardLongpress); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/true); + assistive_suggester_->OnActivate(kUsEnglishEngineId); EXPECT_TRUE(assistive_suggester_->IsAssistiveFeatureEnabled()); } +TEST_F(AssistiveSuggesterTest, + AssistiveDiacriticsLongpressFlagDisabled_AssistiveFeatureDisabled) { + // Feature flag not enabled by default. + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/true); + assistive_suggester_->OnActivate(kUsEnglishEngineId); + + EXPECT_FALSE(assistive_suggester_->IsAssistiveFeatureEnabled()); +} + +TEST_F(AssistiveSuggesterTest, + AssistiveDiacriticsLongpressPrefDisabled_AssistiveFeatureDisabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature( + features::kDiacriticsOnPhysicalKeyboardLongpress); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); + + EXPECT_FALSE(assistive_suggester_->IsAssistiveFeatureEnabled()); +} + TEST_F(AssistiveSuggesterTest, RecordPredictiveWritingPrefOnActivate) { base::test::ScopedFeatureList feature_list; feature_list.InitWithFeatures( @@ -294,7 +330,8 @@ suggestion_handler_.get(), profile_.get(), std::make_unique<FakeSuggesterSwitch>(EnabledSuggestions{})); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true, + /*diacritics_on_longpress_enabled=*/false); assistive_suggester_->OnActivate(kUsEnglishEngineId); histogram_tester_.ExpectUniqueSample( @@ -310,7 +347,9 @@ suggestion_handler_.get(), profile_.get(), std::make_unique<FakeSuggesterSwitch>(EnabledSuggestions{})); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); assistive_suggester_->OnFocus(5); @@ -331,7 +370,9 @@ std::make_unique<FakeSuggesterSwitch>( EnabledSuggestions{.multi_word_suggestions = true})); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); assistive_suggester_->OnFocus(5); @@ -353,7 +394,9 @@ std::make_unique<FakeSuggesterSwitch>( EnabledSuggestions{.multi_word_suggestions = true})); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); assistive_suggester_->OnFocus(5); @@ -375,7 +418,9 @@ std::make_unique<FakeSuggesterSwitch>( EnabledSuggestions{.multi_word_suggestions = true})); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kSpainSpanishEngineId); assistive_suggester_->OnFocus(5); @@ -396,7 +441,9 @@ std::make_unique<FakeSuggesterSwitch>( EnabledSuggestions{.multi_word_suggestions = true})); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); assistive_suggester_->OnFocus(5); @@ -413,6 +460,8 @@ feature_list.InitWithFeatures( /*enabled_features=*/{features::kDiacriticsOnPhysicalKeyboardLongpress}, /*disabled_features=*/{}); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/true); assistive_suggester_->OnActivate(kUsEnglishEngineId); assistive_suggester_->OnFocus(5); @@ -424,11 +473,30 @@ } TEST_F(AssistiveSuggesterTest, + NoDiacriticsSuggestionOnKeyDownLongpressForUSEnglishOnPrefDisabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitWithFeatures( + /*enabled_features=*/{features::kDiacriticsOnPhysicalKeyboardLongpress}, + /*disabled_features=*/{}); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); + assistive_suggester_->OnFocus(5); + + EXPECT_FALSE(assistive_suggester_->OnKeyEvent(PressKey(ui::DomCode::US_A))); + task_environment_.FastForwardBy(base::Seconds(1)); + + EXPECT_FALSE(suggestion_handler_->GetShowingSuggestion()); +} + +TEST_F(AssistiveSuggesterTest, NoDiacriticsSuggestionOnKeyDownLongpressForNonUSEnglish) { base::test::ScopedFeatureList feature_list; feature_list.InitWithFeatures( /*enabled_features=*/{features::kDiacriticsOnPhysicalKeyboardLongpress}, /*disabled_features=*/{}); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/true); assistive_suggester_->OnActivate(kSpainSpanishEngineId); assistive_suggester_->OnFocus(5); @@ -444,6 +512,8 @@ feature_list.InitWithFeatures( /*enabled_features=*/{features::kDiacriticsOnPhysicalKeyboardLongpress}, /*disabled_features=*/{}); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/true); assistive_suggester_->OnActivate(kUsEnglishEngineId); assistive_suggester_->OnFocus(5); @@ -486,11 +556,13 @@ } TEST_F(AssistiveSuggesterTest, - ProcesssAndDoNotPropagateAlphaRepeatKeyIfDiacriticsOnLongpressEnabled) { + DoNotPropagateAlphaRepeatKeyIfDiacriticsOnLongpressEnabled) { base::test::ScopedFeatureList feature_list; feature_list.InitWithFeatures( /*enabled_features=*/{features::kDiacriticsOnPhysicalKeyboardLongpress}, /*disabled_features=*/{}); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/true); assistive_suggester_->OnActivate(kUsEnglishEngineId); assistive_suggester_->OnFocus(5); @@ -505,6 +577,22 @@ } TEST_F(AssistiveSuggesterTest, + PropagateAlphaRepeatKeyIfDiacriticsOnLongpressDisabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitWithFeatures( + /*enabled_features=*/{features::kDiacriticsOnPhysicalKeyboardLongpress}, + /*disabled_features=*/{}); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/false, + /*diacritics_on_longpress_enabled=*/false); + assistive_suggester_->OnActivate(kUsEnglishEngineId); + assistive_suggester_->OnFocus(5); + + // Returning false tells IME to propagate this event. + EXPECT_FALSE(assistive_suggester_->OnKeyEvent( + CreateRepeatKeyEvent(ui::DomCode::US_A))); +} + +TEST_F(AssistiveSuggesterTest, IgnoreAndPropagateNonAlphaRepeatKeyIfDiacriticsOnLongpressEnabled) { base::test::ScopedFeatureList feature_list; feature_list.InitWithFeatures( @@ -808,7 +896,8 @@ /*enabled_features=*/{features::kAssistMultiWord}, /*disabled_features=*/{}); - SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true); + SetInputMethodOptions(*profile_, /*predictive_writing_enabled=*/true, + /*diacritics_on_longpress_enabled=*/false); } content::BrowserTaskEnvironment task_environment_;
diff --git a/chrome/browser/ash/input_method/longpress_diacritics_suggester.cc b/chrome/browser/ash/input_method/longpress_diacritics_suggester.cc index a45c4ec9..83c05c71 100644 --- a/chrome/browser/ash/input_method/longpress_diacritics_suggester.cc +++ b/chrome/browser/ash/input_method/longpress_diacritics_suggester.cc
@@ -95,10 +95,18 @@ SuggestionStatus LongpressDiacriticsSuggester::HandleKeyEvent( const ui::KeyEvent& event) { ui::DomCode code = event.code(); + // The diacritic suggester is not set up. if (focused_context_id_ == absl::nullopt || displayed_window_base_character_ == absl::nullopt || - !GetCurrentShownDiacritics().size()) + !GetCurrentShownDiacritics().size()) { return SuggestionStatus::kNotHandled; + } + // The diacritic suggester is displaying, but its just the repeat key of the + // base character (probably because user is still holding down the key). + if (*displayed_window_base_character_ == event.GetCharacter() && + event.is_repeat()) { + return SuggestionStatus::kNotHandled; + } size_t new_index = 0; @@ -149,6 +157,11 @@ } } } + + // Dismiss on any unexpected key events. + DismissSuggestion(); + // NotHandled is passed so that the IME will let the key event pass + // through. return SuggestionStatus::kNotHandled; } }
diff --git a/chrome/browser/ash/input_method/longpress_diacritics_suggester_unittest.cc b/chrome/browser/ash/input_method/longpress_diacritics_suggester_unittest.cc index 88c93d02..cea0d65e 100644 --- a/chrome/browser/ash/input_method/longpress_diacritics_suggester_unittest.cc +++ b/chrome/browser/ash/input_method/longpress_diacritics_suggester_unittest.cc
@@ -20,6 +20,8 @@ struct DiacriticsTestCase { char longpress_char; + ui::DomCode code; + bool is_shifted; std::u16string surrounding_text; std::u16string invalid_surrounding_text; std::vector<std::u16string> candidates; @@ -37,6 +39,15 @@ ui::DomKey::NONE, ui::EventTimeForNow()); } +ui::KeyEvent CreateRepeatKeyEventFromCode(const ui::DomCode& code, + bool shifted) { + int flags = ui::EF_IS_REPEAT; + if (shifted) + flags |= ui::EF_SHIFT_DOWN; + return ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, code, flags, + ui::DomKey::NONE, ui::EventTimeForNow()); +} + // Required since FakeSuggestionHandler joins the candidates. std::u16string Join(std::vector<std::u16string> candidates) { return base::JoinString(candidates, u";"); @@ -554,7 +565,7 @@ EXPECT_FALSE(suggestion_handler.GetAcceptedSuggestion()); } -TEST_P(LongpressDiacriticsSuggesterTest, DismissOnEscKeyPress) { +TEST_P(LongpressDiacriticsSuggesterTest, DismissSuggestionOnEscKeyPress) { FakeSuggestionHandler suggestion_handler; LongpressDiacriticsSuggester suggester = LongpressDiacriticsSuggester(&suggestion_handler); @@ -562,10 +573,42 @@ suggester.TrySuggestOnLongpress(GetParam().longpress_char); suggester.HandleKeyEvent(CreateKeyEventFromCode(ui::DomCode::ARROW_RIGHT)); - suggester.HandleKeyEvent(CreateKeyEventFromCode(ui::DomCode::ESCAPE)); + EXPECT_EQ( + suggester.HandleKeyEvent(CreateKeyEventFromCode(ui::DomCode::ESCAPE)), + SuggestionStatus::kDismiss); EXPECT_EQ(suggestion_handler.GetContextId(), kContextId); EXPECT_FALSE(suggestion_handler.GetShowingSuggestion()); +} + +TEST_P(LongpressDiacriticsSuggesterTest, DismissSuggestionOnSecondKeyPress) { + FakeSuggestionHandler suggestion_handler; + LongpressDiacriticsSuggester suggester = + LongpressDiacriticsSuggester(&suggestion_handler); + suggester.OnFocus(kContextId); + + suggester.TrySuggestOnLongpress(GetParam().longpress_char); + + EXPECT_EQ(suggester.HandleKeyEvent(CreateKeyEventFromCode(GetParam().code)), + SuggestionStatus::kNotHandled); + EXPECT_EQ(suggestion_handler.GetContextId(), kContextId); + EXPECT_FALSE(suggestion_handler.GetShowingSuggestion()); + EXPECT_FALSE(suggestion_handler.GetAcceptedSuggestion()); +} + +TEST_P(LongpressDiacriticsSuggesterTest, NoDismissSuggestionOnRepeatKeyPress) { + FakeSuggestionHandler suggestion_handler; + LongpressDiacriticsSuggester suggester = + LongpressDiacriticsSuggester(&suggestion_handler); + suggester.OnFocus(kContextId); + + suggester.TrySuggestOnLongpress(GetParam().longpress_char); + + EXPECT_EQ(suggester.HandleKeyEvent(CreateRepeatKeyEventFromCode( + GetParam().code, GetParam().is_shifted)), + SuggestionStatus::kNotHandled); + EXPECT_EQ(suggestion_handler.GetContextId(), kContextId); + EXPECT_TRUE(suggestion_handler.GetShowingSuggestion()); EXPECT_FALSE(suggestion_handler.GetAcceptedSuggestion()); } @@ -573,12 +616,32 @@ /* no prefix */, LongpressDiacriticsSuggesterTest, testing::ValuesIn<DiacriticsTestCase>( - {{'a', u"ca", u"caf", {u"à", u"á", u"â", u"ã", u"ã", u"ä", u"å", u"ā"}}, - {'A', u"cA", u"cAf", {u"À", u"Á", u"Â", u"Ã", u"Ä", u"Å", u"Æ", u"Ā"}}, - {'c', u"c", u"ca", {u"ç"}}, - {'C', u"C", u"Ca", {u"Ç"}}, - {'e', u"soufle", u"soufles", {u"è", u"é", u"ê", u"ë", u"ē"}}, - {'E', u"SOUFLE", u"SOUFLES", {u"È", u"É", u"Ê", u"Ë", u"Ē"}}}), + {{'a', + ui::DomCode::US_A, + false, + u"ca", + u"caf", + {u"à", u"á", u"â", u"ã", u"ã", u"ä", u"å", u"ā"}}, + {'A', + ui::DomCode::US_A, + true, + u"cA", + u"cAf", + {u"À", u"Á", u"Â", u"Ã", u"Ä", u"Å", u"Æ", u"Ā"}}, + {'c', ui::DomCode::US_C, false, u"c", u"ca", {u"ç"}}, + {'C', ui::DomCode::US_C, true, u"C", u"Ca", {u"Ç"}}, + {'e', + ui::DomCode::US_E, + false, + u"soufle", + u"soufles", + {u"è", u"é", u"ê", u"ë", u"ē"}}, + {'E', + ui::DomCode::US_E, + true, + u"SOUFLE", + u"SOUFLES", + {u"È", u"É", u"Ê", u"Ë", u"Ē"}}}), [](const testing::TestParamInfo< LongpressDiacriticsSuggesterTest::ParamType>& info) { return std::string(1, info.param.longpress_char);
diff --git a/chrome/browser/ash/login/consolidated_consent_field_trial.cc b/chrome/browser/ash/login/consolidated_consent_field_trial.cc index 23cd14c9..2e75e91 100644 --- a/chrome/browser/ash/login/consolidated_consent_field_trial.cc +++ b/chrome/browser/ash/login/consolidated_consent_field_trial.cc
@@ -54,13 +54,12 @@ case version_info::Channel::CANARY: case version_info::Channel::DEV: case version_info::Channel::BETA: - enabled_percent = 50; - disabled_percent = 50; + enabled_percent = 100; + disabled_percent = 0; break; case version_info::Channel::STABLE: - // Disabled on stable until green signals seen in experiment. - enabled_percent = 0; - disabled_percent = 100; + enabled_percent = 100; + disabled_percent = 0; break; } DCHECK_EQ(kTotalProbability, enabled_percent + disabled_percent); @@ -87,9 +86,10 @@ } // namespace -// Experiment is enabled on all channels except STABLE. +// Field trial override should not be used since feature is now enabled by +// default. bool ShouldEnableTrial(version_info::Channel channel) { - return channel != version_info::Channel::STABLE; + return false; } void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
diff --git a/chrome/browser/ash/login/consolidated_consent_field_trial.h b/chrome/browser/ash/login/consolidated_consent_field_trial.h index 202e057..4589833 100644 --- a/chrome/browser/ash/login/consolidated_consent_field_trial.h +++ b/chrome/browser/ash/login/consolidated_consent_field_trial.h
@@ -10,6 +10,7 @@ #include "components/prefs/pref_service.h" #include "components/version_info/version_info.h" +// TODO(crbug/1349811): Delete this file once feature is fully launched. namespace ash::consolidated_consent_field_trial { // String local state preference with the name of the assigned trial group.
diff --git a/chrome/browser/ash/login/password_change_browsertest.cc b/chrome/browser/ash/login/password_change_browsertest.cc index 1975d688..755d4c9 100644 --- a/chrome/browser/ash/login/password_change_browsertest.cc +++ b/chrome/browser/ash/login/password_change_browsertest.cc
@@ -282,9 +282,10 @@ login_mixin_.WaitForActiveSession(); } -IN_PROC_BROWSER_TEST_F(PasswordChangeStubAuthTest, SkipDataRecovery) { +IN_PROC_BROWSER_TEST_P(PasswordChangeTest, SkipDataRecovery) { + AddFakeUser("old user password"); OpenGaiaDialog(test_account_id_); - SetUpStubAuthenticatorAndAttemptLogin("old user password"); + SetGaiaScreenCredentials(test_account_id_, "new password"); WaitForPasswordChangeScreen(); test::OobeJS().CreateVisibilityWaiter(true, kPasswordStep)->Wait(); @@ -299,10 +300,8 @@ // Click "Proceed anyway". test::OobeJS().ClickOnPath(kProceedAnyway); - // User session should start, and whole OOBE screen is expected to be hidden, + // User session should start, and whole OOBE screen is expected to be hidden. OobeWindowVisibilityWaiter(false).Wait(); - EXPECT_EQ(StubAuthenticator::DataRecoveryStatus::kResynced, - data_recovery_status_); login_mixin_.WaitForActiveSession(); }
diff --git a/chrome/browser/ash/login/reauth_stats.cc b/chrome/browser/ash/login/reauth_stats.cc index 458ff2fa..57942592 100644 --- a/chrome/browser/ash/login/reauth_stats.cc +++ b/chrome/browser/ash/login/reauth_stats.cc
@@ -15,8 +15,6 @@ if (reason == ReauthReason::NONE) return; user_manager::KnownUser known_user(g_browser_process->local_state()); - // We record only the first value, skipping everything else, except "none" - // value, which is used to reset the current state. if (known_user.FindReauthReason(account_id).value_or(ReauthReason::NONE) == reason) { return;
diff --git a/chrome/browser/ash/login/reauth_stats.h b/chrome/browser/ash/login/reauth_stats.h index 73eda60..1533833 100644 --- a/chrome/browser/ash/login/reauth_stats.h +++ b/chrome/browser/ash/login/reauth_stats.h
@@ -5,70 +5,12 @@ #ifndef CHROME_BROWSER_ASH_LOGIN_REAUTH_STATS_H_ #define CHROME_BROWSER_ASH_LOGIN_REAUTH_STATS_H_ +#include "ash/public/cpp/reauth_reason.h" + class AccountId; namespace ash { -// Track all the ways a user may be sent through the re-auth flow. -// This enum is used to define the buckets for an enumerated UMA histogram. -// Hence, existing enumerated constants should never be reordered, and all new -// constants should only be appended at the end of the enumeration. -enum ReauthReason { - // Default value: no reauth reasons were detected so far, or the reason was - // already reported. - NONE = 0, - - // Legacy profile holders. - OTHER = 1, - - // Password changed, revoked credentials, account deleted. - INVALID_TOKEN_HANDLE = 2, - - // Incorrect password entered 3 times at the user pod. - INCORRECT_PASSWORD_ENTERED = 3, - - // Incorrect password entered by a SAML user once. - // OS would show a tooltip offering user to complete the online sign-in. - INCORRECT_SAML_PASSWORD_ENTERED = 4, - - // Device policy is set not to show user pods, which requires re-auth on every - // login. - SAML_REAUTH_POLICY = 5, - - // Cryptohome is missing, most likely due to deletion during garbage - // collection. - MISSING_CRYPTOHOME = 6, - - // During last login OS failed to connect to the sync with the existing RT. - // This could be due to account deleted, password changed, account revoked, - // etc. - SYNC_FAILED = 7, - - // User cancelled the password change prompt when prompted by Chrome OS. - PASSWORD_UPDATE_SKIPPED = 8, - - // SAML password sync token validation failed. - SAML_PASSWORD_SYNC_TOKEN_VALIDATION_FAILED = 9, - - // Corrupted cryptohome - UNRECOVERABLE_CRYPTOHOME = 10, - - // Gaia policy is set, which requires re-auth on every login if the offline - // login time limit has been reached. - GAIA_REAUTH_POLICY = 11, - - // Gaia lock screen re-auth policy is set, which requires re-auth on lock - // screen if the offline lock screen time limit has been reached. - GAIA_LOCK_SCREEN_REAUTH_POLICY = 12, - - // Saml lock screen re-auth policy is set, which requires re-auth on lock - // screen if the offline lock screen time limit has been reached. - SAML_LOCK_SCREEN_REAUTH_POLICY = 13, - - // Must be the last value in this list. - NUM_REAUTH_FLOW_REASONS, -}; - void RecordReauthReason(const AccountId& account_id, ReauthReason reason); void SendReauthReason(const AccountId& account_id, bool password_changed);
diff --git a/chrome/browser/ash/login/reporting/login_logout_reporter_browsertest.cc b/chrome/browser/ash/login/reporting/login_logout_reporter_browsertest.cc index 353f449..d26a9c2c 100644 --- a/chrome/browser/ash/login/reporting/login_logout_reporter_browsertest.cc +++ b/chrome/browser/ash/login/reporting/login_logout_reporter_browsertest.cc
@@ -24,6 +24,7 @@ #include "chrome/browser/ash/login/test/fake_gaia_mixin.h" #include "chrome/browser/ash/login/test/kiosk_apps_mixin.h" #include "chrome/browser/ash/login/test/login_manager_mixin.h" +#include "chrome/browser/ash/login/test/oobe_screens_utils.h" #include "chrome/browser/ash/login/test/session_manager_state_waiter.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" #include "chrome/browser/ash/policy/core/device_local_account.h" @@ -233,6 +234,9 @@ ASSERT_TRUE(LoginScreenTestApi::IsGuestButtonShown()); ASSERT_TRUE(LoginScreenTestApi::ClickGuestButton()); + test::WaitForGuestTosScreen(); + test::TapGuestTosAccept(); + restart_job_waiter.Run(); EXPECT_TRUE(FakeSessionManagerClient::Get()->restart_job_argv().has_value()); }
diff --git a/chrome/browser/ash/login/session/user_session_manager.cc b/chrome/browser/ash/login/session/user_session_manager.cc index d7693b0..2d21801 100644 --- a/chrome/browser/ash/login/session/user_session_manager.cc +++ b/chrome/browser/ash/login/session/user_session_manager.cc
@@ -1787,14 +1787,83 @@ } } -bool UserSessionManager::InitializeUserSession(Profile* profile) { - TRACE_EVENT0(kEventCategoryChromeOS, kEventInitUserDesktop); - +bool UserSessionManager::MaybeStartNewUserOnboarding(Profile* profile) { + user_manager::UserManager* user_manager = user_manager::UserManager::Get(); + if (!user_manager->IsCurrentUserNew()) { + return false; + } ChildAccountService* child_service = ChildAccountServiceFactory::GetForProfile(profile); child_service->AddChildStatusReceivedCallback( base::BindOnce(&UserSessionManager::ChildAccountStatusReceivedCallback, weak_factory_.GetWeakPtr(), profile)); + + PrefService* prefs = profile->GetPrefs(); + prefs->SetTime(prefs::kOobeOnboardingTime, base::Time::Now()); + prefs->SetBoolean(arc::prefs::kArcPlayStoreLaunchMetricCanBeRecorded, true); + // Don't specify start URLs if the administrator has configured the + // start URLs via policy. + if (!SessionStartupPref::TypeIsManaged(prefs)) { + if (child_service->IsChildAccountStatusKnown()) + MaybeLaunchHelpApp(profile); + else + waiting_for_child_account_status_ = true; + } + + // Mark the device as registered., i.e. the second part of OOBE as + // completed. + if (!StartupUtils::IsDeviceRegistered()) + StartupUtils::MarkDeviceRegistered(base::OnceClosure()); + + LoginDisplayHost::default_host()->GetSigninUI()->StartUserOnboarding(); + + OnboardingUserActivityCounter::MaybeMarkForStart(profile); + + return true; +} + +bool MaybeResumeUserOnboardingFlow(Profile* profile) { + const AccountId account_id = + ProfileHelper::Get()->GetUserByProfile(profile)->GetAccountId(); + user_manager::KnownUser known_user(g_browser_process->local_state()); + std::string pending_screen = + known_user.GetPendingOnboardingScreen(account_id); + user_manager::UserManager* user_manager = user_manager::UserManager::Get(); + if (!user_manager->IsCurrentUserNew() && !pending_screen.empty()) { + LoginDisplayHost::default_host()->GetSigninUI()->ResumeUserOnboarding( + OobeScreenId(pending_screen)); + return true; + } + return false; +} + +bool MaybeStartManagementTransition(Profile* profile) { + user_manager::UserManager* user_manager = user_manager::UserManager::Get(); + if (!user_manager->IsCurrentUserNew() && + arc::GetManagementTransition(profile) != + arc::ArcManagementTransition::NO_TRANSITION) { + LoginDisplayHost::default_host() + ->GetSigninUI() + ->StartManagementTransition(); + return true; + } + return false; +} + +bool MaybeShowManagedTermsOfService(Profile* profile) { + user_manager::UserManager* user_manager = user_manager::UserManager::Get(); + if (features::IsManagedTermsOfServiceEnabled() && + !user_manager->IsCurrentUserNew() && + profile->GetPrefs()->IsManagedPreference(::prefs::kTermsOfServiceURL)) { + LoginDisplayHost::default_host()->GetSigninUI()->ShowTosForExistingUser(); + return true; + } + return false; +} + +bool UserSessionManager::InitializeUserSession(Profile* profile) { + TRACE_EVENT0(kEventCategoryChromeOS, kEventInitUserDesktop); + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&UserSessionManager::StopChildStatusObserving, @@ -1815,74 +1884,42 @@ if (start_session_type_ == StartSessionType::kPrimary) { user_manager::KnownUser known_user(g_browser_process->local_state()); - const user_manager::User* user = - ProfileHelper::Get()->GetUserByProfile(profile); + const AccountId account_id = + ProfileHelper::Get()->GetUserByProfile(profile)->GetAccountId(); std::string pending_screen = - known_user.GetPendingOnboardingScreen(user->GetAccountId()); + known_user.GetPendingOnboardingScreen(account_id); if (!pending_screen.empty() && !WizardController::IsResumablePostLoginScreen( OobeScreenId(pending_screen))) { pending_screen.clear(); - known_user.RemovePendingOnboardingScreen(user->GetAccountId()); + known_user.RemovePendingOnboardingScreen(account_id); } absl::optional<base::Version> onboarding_completed_version = - known_user.GetOnboardingCompletedVersion(user->GetAccountId()); + known_user.GetOnboardingCompletedVersion(account_id); if (!user_manager->IsCurrentUserNew() && pending_screen.empty() && !onboarding_completed_version.has_value()) { known_user.SetOnboardingCompletedVersion( - user->GetAccountId(), base::Version(kOnboardingBackfillVersion)); + account_id, base::Version(kOnboardingBackfillVersion)); LoginDisplayHost::default_host() ->GetSigninUI() ->ClearOnboardingAuthSession(); } - // TODO(https://crbug.com/1313844): better structure different user flows - if (user_manager->IsCurrentUserNew()) { - prefs->SetTime(prefs::kOobeOnboardingTime, base::Time::Now()); - prefs->SetBoolean(arc::prefs::kArcPlayStoreLaunchMetricCanBeRecorded, - true); - // Don't specify start URLs if the administrator has configured the - // start URLs via policy. - if (!SessionStartupPref::TypeIsManaged(prefs)) { - if (child_service->IsChildAccountStatusKnown()) - MaybeLaunchHelpApp(profile); - else - waiting_for_child_account_status_ = true; - } - - // Mark the device as registered., i.e. the second part of OOBE as - // completed. - if (!StartupUtils::IsDeviceRegistered()) - StartupUtils::MarkDeviceRegistered(base::OnceClosure()); - - LoginDisplayHost::default_host()->GetSigninUI()->StartUserOnboarding(); - - OnboardingUserActivityCounter::MaybeMarkForStart(profile); - + if (MaybeStartNewUserOnboarding(profile)) { return false; } if (MaybeShowNewTermsAfterUpdateToFlex(profile)) { return false; } - if (!user_manager->IsCurrentUserNew() && !pending_screen.empty()) { - LoginDisplayHost::default_host()->GetSigninUI()->ResumeUserOnboarding( - OobeScreenId(pending_screen)); + if (MaybeResumeUserOnboardingFlow(profile)) { return false; } - if (!user_manager->IsCurrentUserNew() && - arc::GetManagementTransition(profile) != - arc::ArcManagementTransition::NO_TRANSITION) { - LoginDisplayHost::default_host() - ->GetSigninUI() - ->StartManagementTransition(); + if (MaybeStartManagementTransition(profile)) { return false; } - if (features::IsManagedTermsOfServiceEnabled() && - !user_manager->IsCurrentUserNew() && - profile->GetPrefs()->IsManagedPreference(::prefs::kTermsOfServiceURL)) { - LoginDisplayHost::default_host()->GetSigninUI()->ShowTosForExistingUser(); + if (MaybeShowManagedTermsOfService(profile)) { return false; } }
diff --git a/chrome/browser/ash/login/session/user_session_manager.h b/chrome/browser/ash/login/session/user_session_manager.h index 1e703ff6..8d1deed 100644 --- a/chrome/browser/ash/login/session/user_session_manager.h +++ b/chrome/browser/ash/login/session/user_session_manager.h
@@ -455,6 +455,9 @@ // Launches the Help App depending on flags / prefs / user. void MaybeLaunchHelpApp(Profile* profile) const; + // Start user onboarding if the user is new. + bool MaybeStartNewUserOnboarding(Profile* profile); + // Perform session initialization and either move to additional login flows // such as TOS (public sessions), priority pref sync UI (new users) or // launch browser.
diff --git a/chrome/browser/ash/login/test/oobe_screens_utils.cc b/chrome/browser/ash/login/test/oobe_screens_utils.cc index 9ed3275..ccc17f9 100644 --- a/chrome/browser/ash/login/test/oobe_screens_utils.cc +++ b/chrome/browser/ash/login/test/oobe_screens_utils.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.h" +#include "chrome/browser/ui/webui/chromeos/login/guest_tos_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/pin_setup_screen_handler.h" @@ -202,6 +203,14 @@ OobeJS().TapOnPath({"consolidated-consent", "acceptButton"}); } +void WaitForGuestTosScreen() { + WaitFor(GuestTosScreenView::kScreenId); +} + +void TapGuestTosAccept() { + OobeJS().TapOnPath({"guest-tos", "acceptButton"}); +} + void ClickSignInFatalScreenActionButton() { OobeJS().ClickOnPath({"signin-fatal-error", "actionButton"}); }
diff --git a/chrome/browser/ash/login/test/oobe_screens_utils.h b/chrome/browser/ash/login/test/oobe_screens_utils.h index 3c1f0df..88c59d78 100644 --- a/chrome/browser/ash/login/test/oobe_screens_utils.h +++ b/chrome/browser/ash/login/test/oobe_screens_utils.h
@@ -36,6 +36,8 @@ void ExitScreenSyncConsent(); void WaitForConsolidatedConsentScreen(); void TapConsolidatedConsentAccept(); +void WaitForGuestTosScreen(); +void TapGuestTosAccept(); void ClickSignInFatalScreenActionButton();
diff --git a/chrome/browser/ash/login/ui/captive_portal_dialog_delegate_browsertest.cc b/chrome/browser/ash/login/ui/captive_portal_dialog_delegate_browsertest.cc index ef48604..6cb11767 100644 --- a/chrome/browser/ash/login/ui/captive_portal_dialog_delegate_browsertest.cc +++ b/chrome/browser/ash/login/ui/captive_portal_dialog_delegate_browsertest.cc
@@ -28,7 +28,9 @@ DCHECK(owned_by_widget()); SetModalType(ui::MODAL_TYPE_CHILD); SetFocusBehavior(FocusBehavior::ALWAYS); - // Dialogs that take focus must have a name to pass accessibility checks. + // Dialogs that take focus must have a name and role to pass accessibility + // checks. + GetViewAccessibility().OverrideRole(ax::mojom::Role::kDialog); GetViewAccessibility().OverrideName("Test dialog"); } ChildModalDialogDelegate(const ChildModalDialogDelegate&) = delete;
diff --git a/chrome/browser/ash/login/wizard_controller.cc b/chrome/browser/ash/login/wizard_controller.cc index 18fed0d..ce5c87be 100644 --- a/chrome/browser/ash/login/wizard_controller.cc +++ b/chrome/browser/ash/login/wizard_controller.cc
@@ -1543,7 +1543,12 @@ case EnrollmentScreen::Result::BACK: case EnrollmentScreen::Result::SKIPPED_FOR_TESTS: PerformOOBECompletedActions(); - ShowPackagedLicenseScreen(); + if (prescribed_enrollment_config_.is_forced()) { + LOG(WARNING) << "User trying to skip enrollment screen"; + ShowPackagedLicenseScreen(); + } else { + ShowLoginScreen(); + } break; case EnrollmentScreen::Result::TPM_ERROR: DCHECK(switches::IsTpmDynamic());
diff --git a/chrome/browser/ash/login/wizard_controller_browsertest.cc b/chrome/browser/ash/login/wizard_controller_browsertest.cc index d469d73..bc3648a 100644 --- a/chrome/browser/ash/login/wizard_controller_browsertest.cc +++ b/chrome/browser/ash/login/wizard_controller_browsertest.cc
@@ -2548,6 +2548,7 @@ if (chromeos::features::IsOobeConsolidatedConsentEnabled()) { // If OobeConsolidatedConsent is enabled, the flow will be updated to: // Network -> Update -> Consolidated Consent -> Auto Enrollment. + EXPECT_CALL(*mock_update_screen_, ShowImpl()).Times(1); mock_demo_preferences_screen_->ExitScreen( DemoPreferencesScreen::Result::COMPLETED_CONSOLIDATED_CONSENT); @@ -2820,12 +2821,12 @@ EXPECT_TRUE(DemoSetupController::IsOobeDemoSetupFlowInProgress()); EXPECT_CALL(*mock_consolidated_consent_screen_, HideImpl()).Times(1); - EXPECT_CALL(*mock_network_screen_, ShowImpl()).Times(1); + EXPECT_CALL(*mock_demo_preferences_screen_, ShowImpl()).Times(1); mock_consolidated_consent_screen_->ExitScreen( ConsolidatedConsentScreen::Result::BACK_DEMO); - CheckCurrentScreen(NetworkScreenView::kScreenId); + CheckCurrentScreen(DemoPreferencesScreenView::kScreenId); EXPECT_TRUE(DemoSetupController::IsOobeDemoSetupFlowInProgress()); }
diff --git a/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter_browsertest.cc b/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter_browsertest.cc index 6c311a9b..bcfdba8 100644 --- a/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter_browsertest.cc +++ b/chrome/browser/ash/policy/reporting/user_added_removed/user_added_removed_reporter_browsertest.cc
@@ -19,6 +19,8 @@ #include "chrome/browser/ash/login/test/fake_gaia_mixin.h" #include "chrome/browser/ash/login/test/kiosk_apps_mixin.h" #include "chrome/browser/ash/login/test/login_manager_mixin.h" +#include "chrome/browser/ash/login/test/oobe_screen_waiter.h" +#include "chrome/browser/ash/login/test/oobe_screens_utils.h" #include "chrome/browser/ash/login/test/session_manager_state_waiter.h" #include "chrome/browser/ash/login/test/user_policy_mixin.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" @@ -252,6 +254,9 @@ ASSERT_TRUE(LoginScreenTestApi::IsGuestButtonShown()); ASSERT_TRUE(LoginScreenTestApi::ClickGuestButton()); + test::WaitForGuestTosScreen(); + test::TapGuestTosAccept(); + restart_job_waiter.Run(); EXPECT_TRUE(FakeSessionManagerClient::Get()->restart_job_argv().has_value()); }
diff --git a/chrome/browser/ash/telemetry_extension/BUILD.gn b/chrome/browser/ash/telemetry_extension/BUILD.gn index cedee3d..d6ea88d 100644 --- a/chrome/browser/ash/telemetry_extension/BUILD.gn +++ b/chrome/browser/ash/telemetry_extension/BUILD.gn
@@ -8,6 +8,10 @@ source_set("telemetry_extension") { sources = [ + "diagnostics_service_ash.cc", + "diagnostics_service_ash.h", + "diagnostics_service_converters.cc", + "diagnostics_service_converters.h", "probe_service_ash.cc", "probe_service_ash.h", "probe_service_converters.cc", @@ -16,6 +20,7 @@ deps = [ "//base", + "//chrome/browser/ash/wilco_dtc_supportd:mojo_utils", "//chromeos/ash/components/dbus/debug_daemon", "//chromeos/ash/services/cros_healthd/public/cpp", "//chromeos/ash/services/cros_healthd/public/mojom", @@ -27,6 +32,7 @@ source_set("unit_tests") { testonly = true sources = [ + "diagnostics_service_converters_unittest.cc", "probe_service_ash_unittest.cc", "probe_service_converters_unittest.cc", ] @@ -34,6 +40,7 @@ ":telemetry_extension", "//base", "//base/test:test_support", + "//chrome/browser/ash/wilco_dtc_supportd:mojo_utils", "//chromeos/ash/components/dbus/debug_daemon", "//chromeos/ash/services/cros_healthd/public/cpp", "//chromeos/ash/services/cros_healthd/public/mojom",
diff --git a/ash/webui/telemetry_extension_ui/services/diagnostics_service.cc b/chrome/browser/ash/telemetry_extension/diagnostics_service_ash.cc similarity index 69% rename from ash/webui/telemetry_extension_ui/services/diagnostics_service.cc rename to chrome/browser/ash/telemetry_extension/diagnostics_service_ash.cc index ea1126b..e421a31 100644 --- a/ash/webui/telemetry_extension_ui/services/diagnostics_service.cc +++ b/chrome/browser/ash/telemetry_extension/diagnostics_service_ash.cc
@@ -2,70 +2,70 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/webui/telemetry_extension_ui/services/diagnostics_service.h" +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h" #include <memory> #include <utility> #include <vector> -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" -#include "ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.h" #include "base/bind.h" #include "base/memory/ptr_util.h" +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_converters.h" #include "chromeos/ash/services/cros_healthd/public/cpp/service_connection.h" #include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_diagnostics.mojom.h" #include "chromeos/ash/services/cros_healthd/public/mojom/nullable_primitives.mojom.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" namespace ash { // static -DiagnosticsService::Factory* DiagnosticsService::Factory::test_factory_ = +DiagnosticsServiceAsh::Factory* DiagnosticsServiceAsh::Factory::test_factory_ = nullptr; // static -std::unique_ptr<health::mojom::DiagnosticsService> -DiagnosticsService::Factory::Create( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver) { +std::unique_ptr<crosapi::mojom::DiagnosticsService> +DiagnosticsServiceAsh::Factory::Create( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver) { if (test_factory_) { return test_factory_->CreateInstance(std::move(receiver)); } - return base::WrapUnique<DiagnosticsService>( - new DiagnosticsService(std::move(receiver))); + return base::WrapUnique<DiagnosticsServiceAsh>( + new DiagnosticsServiceAsh(std::move(receiver))); } // static -void DiagnosticsService::Factory::SetForTesting(Factory* test_factory) { +void DiagnosticsServiceAsh::Factory::SetForTesting(Factory* test_factory) { test_factory_ = test_factory; } -DiagnosticsService::Factory::~Factory() = default; +DiagnosticsServiceAsh::Factory::~Factory() = default; -DiagnosticsService::DiagnosticsService( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver) +DiagnosticsServiceAsh::DiagnosticsServiceAsh( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver) : receiver_(this, std::move(receiver)) {} -DiagnosticsService::~DiagnosticsService() = default; +DiagnosticsServiceAsh::~DiagnosticsServiceAsh() = default; cros_healthd::mojom::CrosHealthdDiagnosticsService* -DiagnosticsService::GetService() { +DiagnosticsServiceAsh::GetService() { if (!service_ || !service_.is_connected()) { cros_healthd::ServiceConnection::GetInstance()->GetDiagnosticsService( service_.BindNewPipeAndPassReceiver()); service_.set_disconnect_handler(base::BindOnce( - &DiagnosticsService::OnDisconnect, base::Unretained(this))); + &DiagnosticsServiceAsh::OnDisconnect, base::Unretained(this))); } return service_.get(); } -void DiagnosticsService::OnDisconnect() { +void DiagnosticsServiceAsh::OnDisconnect() { service_.reset(); } -void DiagnosticsService::GetAvailableRoutines( +void DiagnosticsServiceAsh::GetAvailableRoutines( GetAvailableRoutinesCallback callback) { GetService()->GetAvailableRoutines(base::BindOnce( - [](health::mojom::DiagnosticsService::GetAvailableRoutinesCallback + [](crosapi::mojom::DiagnosticsService::GetAvailableRoutinesCallback callback, const std::vector<cros_healthd::mojom::DiagnosticRoutineEnum>& routines) { @@ -74,15 +74,15 @@ std::move(callback))); } -void DiagnosticsService::GetRoutineUpdate( +void DiagnosticsServiceAsh::GetRoutineUpdate( int32_t id, - health::mojom::DiagnosticRoutineCommandEnum command, + crosapi::mojom::DiagnosticsRoutineCommandEnum command, bool include_output, GetRoutineUpdateCallback callback) { GetService()->GetRoutineUpdate( id, converters::Convert(command), include_output, base::BindOnce( - [](health::mojom::DiagnosticsService::GetRoutineUpdateCallback + [](crosapi::mojom::DiagnosticsService::GetRoutineUpdateCallback callback, cros_healthd::mojom::RoutineUpdatePtr ptr) { std::move(callback).Run( @@ -91,10 +91,10 @@ std::move(callback))); } -void DiagnosticsService::RunBatteryCapacityRoutine( +void DiagnosticsServiceAsh::RunBatteryCapacityRoutine( RunBatteryCapacityRoutineCallback callback) { GetService()->RunBatteryCapacityRoutine(base::BindOnce( - [](health::mojom::DiagnosticsService::RunBatteryCapacityRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunBatteryCapacityRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -103,10 +103,10 @@ std::move(callback))); } -void DiagnosticsService::RunBatteryHealthRoutine( +void DiagnosticsServiceAsh::RunBatteryHealthRoutine( RunBatteryHealthRoutineCallback callback) { GetService()->RunBatteryHealthRoutine(base::BindOnce( - [](health::mojom::DiagnosticsService::RunBatteryHealthRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunBatteryHealthRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -115,10 +115,10 @@ std::move(callback))); } -void DiagnosticsService::RunSmartctlCheckRoutine( +void DiagnosticsServiceAsh::RunSmartctlCheckRoutine( RunSmartctlCheckRoutineCallback callback) { GetService()->RunSmartctlCheckRoutine(base::BindOnce( - [](health::mojom::DiagnosticsService::RunSmartctlCheckRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunSmartctlCheckRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -127,14 +127,14 @@ std::move(callback))); } -void DiagnosticsService::RunAcPowerRoutine( - health::mojom::AcPowerStatusEnum expected_status, +void DiagnosticsServiceAsh::RunAcPowerRoutine( + crosapi::mojom::DiagnosticsAcPowerStatusEnum expected_status, const absl::optional<std::string>& expected_power_type, RunAcPowerRoutineCallback callback) { GetService()->RunAcPowerRoutine( converters::Convert(expected_status), expected_power_type, base::BindOnce( - [](health::mojom::DiagnosticsService::RunAcPowerRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunAcPowerRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -143,13 +143,13 @@ std::move(callback))); } -void DiagnosticsService::RunCpuCacheRoutine( +void DiagnosticsServiceAsh::RunCpuCacheRoutine( uint32_t length_seconds, RunCpuCacheRoutineCallback callback) { GetService()->RunCpuCacheRoutine( cros_healthd::mojom::NullableUint32::New(length_seconds), base::BindOnce( - [](health::mojom::DiagnosticsService::RunCpuCacheRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunCpuCacheRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -158,13 +158,13 @@ std::move(callback))); } -void DiagnosticsService::RunCpuStressRoutine( +void DiagnosticsServiceAsh::RunCpuStressRoutine( uint32_t length_seconds, RunCpuStressRoutineCallback callback) { GetService()->RunCpuStressRoutine( cros_healthd::mojom::NullableUint32::New(length_seconds), base::BindOnce( - [](health::mojom::DiagnosticsService::RunCpuStressRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunCpuStressRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -173,13 +173,13 @@ std::move(callback))); } -void DiagnosticsService::RunFloatingPointAccuracyRoutine( +void DiagnosticsServiceAsh::RunFloatingPointAccuracyRoutine( uint32_t length_seconds, RunFloatingPointAccuracyRoutineCallback callback) { GetService()->RunFloatingPointAccuracyRoutine( cros_healthd::mojom::NullableUint32::New(length_seconds), base::BindOnce( - [](health::mojom::DiagnosticsService:: + [](crosapi::mojom::DiagnosticsService:: RunFloatingPointAccuracyRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -188,13 +188,13 @@ std::move(callback))); } -void DiagnosticsService::RunNvmeWearLevelRoutine( +void DiagnosticsServiceAsh::RunNvmeWearLevelRoutine( uint32_t wear_level_threshold, RunNvmeWearLevelRoutineCallback callback) { GetService()->RunNvmeWearLevelRoutine( wear_level_threshold, base::BindOnce( - [](health::mojom::DiagnosticsService::RunNvmeWearLevelRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunNvmeWearLevelRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -203,13 +203,13 @@ std::move(callback))); } -void DiagnosticsService::RunNvmeSelfTestRoutine( - health::mojom::NvmeSelfTestTypeEnum nvme_self_test_type, +void DiagnosticsServiceAsh::RunNvmeSelfTestRoutine( + crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum nvme_self_test_type, RunNvmeSelfTestRoutineCallback callback) { GetService()->RunNvmeSelfTestRoutine( converters::Convert(nvme_self_test_type), base::BindOnce( - [](health::mojom::DiagnosticsService::RunNvmeSelfTestRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunNvmeSelfTestRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -218,15 +218,15 @@ std::move(callback))); } -void DiagnosticsService::RunDiskReadRoutine( - health::mojom::DiskReadRoutineTypeEnum type, +void DiagnosticsServiceAsh::RunDiskReadRoutine( + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum type, uint32_t length_seconds, uint32_t file_size_mb, RunDiskReadRoutineCallback callback) { GetService()->RunDiskReadRoutine( converters::Convert(type), length_seconds, file_size_mb, base::BindOnce( - [](health::mojom::DiagnosticsService::RunDiskReadRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunDiskReadRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -235,13 +235,13 @@ std::move(callback))); } -void DiagnosticsService::RunPrimeSearchRoutine( +void DiagnosticsServiceAsh::RunPrimeSearchRoutine( uint32_t length_seconds, RunPrimeSearchRoutineCallback callback) { GetService()->RunPrimeSearchRoutine( cros_healthd::mojom::NullableUint32::New(length_seconds), base::BindOnce( - [](health::mojom::DiagnosticsService::RunPrimeSearchRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunPrimeSearchRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -250,14 +250,14 @@ std::move(callback))); } -void DiagnosticsService::RunBatteryDischargeRoutine( +void DiagnosticsServiceAsh::RunBatteryDischargeRoutine( uint32_t length_seconds, uint32_t maximum_discharge_percent_allowed, RunBatteryDischargeRoutineCallback callback) { GetService()->RunBatteryDischargeRoutine( length_seconds, maximum_discharge_percent_allowed, base::BindOnce( - [](health::mojom::DiagnosticsService:: + [](crosapi::mojom::DiagnosticsService:: RunBatteryDischargeRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -266,14 +266,14 @@ std::move(callback))); } -void DiagnosticsService::RunBatteryChargeRoutine( +void DiagnosticsServiceAsh::RunBatteryChargeRoutine( uint32_t length_seconds, uint32_t minimum_charge_percent_required, RunBatteryChargeRoutineCallback callback) { GetService()->RunBatteryChargeRoutine( length_seconds, minimum_charge_percent_required, base::BindOnce( - [](health::mojom::DiagnosticsService::RunBatteryChargeRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunBatteryChargeRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( @@ -282,9 +282,10 @@ std::move(callback))); } -void DiagnosticsService::RunMemoryRoutine(RunMemoryRoutineCallback callback) { +void DiagnosticsServiceAsh::RunMemoryRoutine( + RunMemoryRoutineCallback callback) { GetService()->RunMemoryRoutine(base::BindOnce( - [](health::mojom::DiagnosticsService::RunMemoryRoutineCallback callback, + [](crosapi::mojom::DiagnosticsService::RunMemoryRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run( converters::ConvertDiagnosticsPtr(std::move(ptr))); @@ -292,10 +293,10 @@ std::move(callback))); } -void DiagnosticsService::RunLanConnectivityRoutine( +void DiagnosticsServiceAsh::RunLanConnectivityRoutine( RunLanConnectivityRoutineCallback callback) { GetService()->RunLanConnectivityRoutine(base::BindOnce( - [](health::mojom::DiagnosticsService::RunLanConnectivityRoutineCallback + [](crosapi::mojom::DiagnosticsService::RunLanConnectivityRoutineCallback callback, cros_healthd::mojom::RunRoutineResponsePtr ptr) { std::move(callback).Run(
diff --git a/ash/webui/telemetry_extension_ui/services/diagnostics_service.h b/chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h similarity index 63% rename from ash/webui/telemetry_extension_ui/services/diagnostics_service.h rename to chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h index 659fae0..0450e79 100644 --- a/ash/webui/telemetry_extension_ui/services/diagnostics_service.h +++ b/chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_DIAGNOSTICS_SERVICE_H_ -#define ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_DIAGNOSTICS_SERVICE_H_ +#ifndef CHROME_BROWSER_ASH_TELEMETRY_EXTENSION_DIAGNOSTICS_SERVICE_ASH_H_ +#define CHROME_BROWSER_ASH_TELEMETRY_EXTENSION_DIAGNOSTICS_SERVICE_ASH_H_ #include <memory> -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" #include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd.mojom.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" @@ -20,32 +20,32 @@ namespace mojom = ::chromeos::cros_healthd::mojom; } // namespace cros_healthd -class DiagnosticsService : public health::mojom::DiagnosticsService { +class DiagnosticsServiceAsh : public crosapi::mojom::DiagnosticsService { public: class Factory { public: - static std::unique_ptr<health::mojom::DiagnosticsService> Create( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver); + static std::unique_ptr<crosapi::mojom::DiagnosticsService> Create( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver); static void SetForTesting(Factory* test_factory); virtual ~Factory(); protected: - virtual std::unique_ptr<health::mojom::DiagnosticsService> CreateInstance( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver) = 0; + virtual std::unique_ptr<crosapi::mojom::DiagnosticsService> CreateInstance( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver) = 0; private: static Factory* test_factory_; }; - DiagnosticsService(const DiagnosticsService&) = delete; - DiagnosticsService& operator=(const DiagnosticsService&) = delete; - ~DiagnosticsService() override; + DiagnosticsServiceAsh(const DiagnosticsServiceAsh&) = delete; + DiagnosticsServiceAsh& operator=(const DiagnosticsServiceAsh&) = delete; + ~DiagnosticsServiceAsh() override; private: - explicit DiagnosticsService( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver); + explicit DiagnosticsServiceAsh( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver); // Ensures that |service_| created and connected to the // CrosHealthdDiagnosticsService. cros_healthd::mojom::CrosHealthdDiagnosticsService* GetService(); @@ -54,7 +54,7 @@ void GetAvailableRoutines(GetAvailableRoutinesCallback callback) override; void GetRoutineUpdate(int32_t id, - health::mojom::DiagnosticRoutineCommandEnum command, + crosapi::mojom::DiagnosticsRoutineCommandEnum command, bool include_output, GetRoutineUpdateCallback callback) override; void RunBatteryCapacityRoutine( @@ -63,9 +63,10 @@ RunBatteryHealthRoutineCallback callback) override; void RunSmartctlCheckRoutine( RunSmartctlCheckRoutineCallback callback) override; - void RunAcPowerRoutine(health::mojom::AcPowerStatusEnum expected_status, - const absl::optional<std::string>& expected_power_type, - RunAcPowerRoutineCallback callback) override; + void RunAcPowerRoutine( + crosapi::mojom::DiagnosticsAcPowerStatusEnum expected_status, + const absl::optional<std::string>& expected_power_type, + RunAcPowerRoutineCallback callback) override; void RunCpuCacheRoutine(uint32_t length_seconds, RunCpuCacheRoutineCallback callback) override; void RunCpuStressRoutine(uint32_t length_seconds, @@ -77,12 +78,13 @@ uint32_t wear_level_threshold, RunNvmeWearLevelRoutineCallback callback) override; void RunNvmeSelfTestRoutine( - health::mojom::NvmeSelfTestTypeEnum nvme_self_test_type, + crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum nvme_self_test_type, RunNvmeSelfTestRoutineCallback callback) override; - void RunDiskReadRoutine(health::mojom::DiskReadRoutineTypeEnum type, - uint32_t length_seconds, - uint32_t file_size_mb, - RunDiskReadRoutineCallback callback) override; + void RunDiskReadRoutine( + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum type, + uint32_t length_seconds, + uint32_t file_size_mb, + RunDiskReadRoutineCallback callback) override; void RunPrimeSearchRoutine(uint32_t length_seconds, RunPrimeSearchRoutineCallback callback) override; void RunBatteryDischargeRoutine( @@ -104,14 +106,9 @@ // interface pipe before destroying pending response callbacks owned by // |service_|. It is an error to drop response callbacks which still // correspond to an open interface pipe. - mojo::Receiver<health::mojom::DiagnosticsService> receiver_; + mojo::Receiver<crosapi::mojom::DiagnosticsService> receiver_; }; } // namespace ash -// TODO(https://crbug.com/1164001): remove when ChromeOS code migration is done. -namespace chromeos { -using ::ash::DiagnosticsService; -} // namespace chromeos - -#endif // ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_DIAGNOSTICS_SERVICE_H_ +#endif // CHROME_BROWSER_ASH_TELEMETRY_EXTENSION_DIAGNOSTICS_SERVICE_ASH_H_
diff --git a/chrome/browser/ash/telemetry_extension/diagnostics_service_converters.cc b/chrome/browser/ash/telemetry_extension/diagnostics_service_converters.cc new file mode 100644 index 0000000..b7085a8 --- /dev/null +++ b/chrome/browser/ash/telemetry_extension/diagnostics_service_converters.cc
@@ -0,0 +1,247 @@ +// Copyright 2020 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. + +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_converters.h" + +#include "base/notreached.h" +#include "base/strings/string_piece.h" +#include "chrome/browser/ash/wilco_dtc_supportd/mojo_utils.h" +#include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_diagnostics.mojom.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace ash { +namespace converters { + +namespace unchecked { + +namespace { + +std::string GetStringFromMojoHandle(mojo::ScopedHandle handle) { + base::ReadOnlySharedMemoryMapping shared_memory; + return std::string(MojoUtils::GetStringPieceFromMojoHandle(std::move(handle), + &shared_memory)); +} + +} // namespace + +crosapi::mojom::DiagnosticsRoutineUpdatePtr UncheckedConvertPtr( + cros_healthd::mojom::RoutineUpdatePtr input) { + return crosapi::mojom::DiagnosticsRoutineUpdate::New( + input->progress_percent, + GetStringFromMojoHandle(std::move(input->output)), + ConvertDiagnosticsPtr(std::move(input->routine_update_union))); +} + +crosapi::mojom::DiagnosticsRoutineUpdateUnionPtr UncheckedConvertPtr( + cros_healthd::mojom::RoutineUpdateUnionPtr input) { + switch (input->which()) { + case cros_healthd::mojom::RoutineUpdateUnion::Tag::kInteractiveUpdate: + return crosapi::mojom::DiagnosticsRoutineUpdateUnion:: + NewInteractiveUpdate(ConvertDiagnosticsPtr( + std::move(input->get_interactive_update()))); + case cros_healthd::mojom::RoutineUpdateUnion::Tag::kNoninteractiveUpdate: + return crosapi::mojom::DiagnosticsRoutineUpdateUnion:: + NewNoninteractiveUpdate(ConvertDiagnosticsPtr( + std::move(input->get_noninteractive_update()))); + } +} + +crosapi::mojom::DiagnosticsInteractiveRoutineUpdatePtr UncheckedConvertPtr( + cros_healthd::mojom::InteractiveRoutineUpdatePtr input) { + return crosapi::mojom::DiagnosticsInteractiveRoutineUpdate::New( + Convert(input->user_message)); +} + +crosapi::mojom::DiagnosticsNonInteractiveRoutineUpdatePtr UncheckedConvertPtr( + cros_healthd::mojom::NonInteractiveRoutineUpdatePtr input) { + return crosapi::mojom::DiagnosticsNonInteractiveRoutineUpdate::New( + Convert(input->status), std::move(input->status_message)); +} + +crosapi::mojom::DiagnosticsRunRoutineResponsePtr UncheckedConvertPtr( + cros_healthd::mojom::RunRoutineResponsePtr input) { + return crosapi::mojom::DiagnosticsRunRoutineResponse::New( + input->id, Convert(input->status)); +} + +} // namespace unchecked + +absl::optional<crosapi::mojom::DiagnosticsRoutineEnum> Convert( + cros_healthd::mojom::DiagnosticRoutineEnum input) { + switch (input) { + case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryCapacity: + return crosapi::mojom::DiagnosticsRoutineEnum::kBatteryCapacity; + case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryHealth: + return crosapi::mojom::DiagnosticsRoutineEnum::kBatteryHealth; + case cros_healthd::mojom::DiagnosticRoutineEnum::kSmartctlCheck: + return crosapi::mojom::DiagnosticsRoutineEnum::kSmartctlCheck; + case cros_healthd::mojom::DiagnosticRoutineEnum::kAcPower: + return crosapi::mojom::DiagnosticsRoutineEnum::kAcPower; + case cros_healthd::mojom::DiagnosticRoutineEnum::kCpuCache: + return crosapi::mojom::DiagnosticsRoutineEnum::kCpuCache; + case cros_healthd::mojom::DiagnosticRoutineEnum::kCpuStress: + return crosapi::mojom::DiagnosticsRoutineEnum::kCpuStress; + case cros_healthd::mojom::DiagnosticRoutineEnum::kFloatingPointAccuracy: + return crosapi::mojom::DiagnosticsRoutineEnum::kFloatingPointAccuracy; + case cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel: + return crosapi::mojom::DiagnosticsRoutineEnum::kNvmeWearLevel; + case cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeSelfTest: + return crosapi::mojom::DiagnosticsRoutineEnum::kNvmeSelfTest; + case cros_healthd::mojom::DiagnosticRoutineEnum::kDiskRead: + return crosapi::mojom::DiagnosticsRoutineEnum::kDiskRead; + case cros_healthd::mojom::DiagnosticRoutineEnum::kPrimeSearch: + return crosapi::mojom::DiagnosticsRoutineEnum::kPrimeSearch; + case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryDischarge: + return crosapi::mojom::DiagnosticsRoutineEnum::kBatteryDischarge; + case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryCharge: + return crosapi::mojom::DiagnosticsRoutineEnum::kBatteryCharge; + case cros_healthd::mojom::DiagnosticRoutineEnum::kMemory: + return crosapi::mojom::DiagnosticsRoutineEnum::kMemory; + case cros_healthd::mojom::DiagnosticRoutineEnum::kLanConnectivity: + return crosapi::mojom::DiagnosticsRoutineEnum::kLanConnectivity; + default: + return absl::nullopt; + } +} + +std::vector<crosapi::mojom::DiagnosticsRoutineEnum> Convert( + const std::vector<cros_healthd::mojom::DiagnosticRoutineEnum>& input) { + std::vector<crosapi::mojom::DiagnosticsRoutineEnum> output; + for (const auto element : input) { + absl::optional<crosapi::mojom::DiagnosticsRoutineEnum> converted = + Convert(element); + if (converted.has_value()) { + output.push_back(converted.value()); + } + } + return output; +} + +crosapi::mojom::DiagnosticsRoutineUserMessageEnum Convert( + cros_healthd::mojom::DiagnosticRoutineUserMessageEnum input) { + switch (input) { + case cros_healthd::mojom::DiagnosticRoutineUserMessageEnum::kUnknown: + return crosapi::mojom::DiagnosticsRoutineUserMessageEnum::kUnknown; + case cros_healthd::mojom::DiagnosticRoutineUserMessageEnum::kUnplugACPower: + return crosapi::mojom::DiagnosticsRoutineUserMessageEnum::kUnplugACPower; + case cros_healthd::mojom::DiagnosticRoutineUserMessageEnum::kPlugInACPower: + return crosapi::mojom::DiagnosticsRoutineUserMessageEnum::kPlugInACPower; + } + NOTREACHED(); + return static_cast<crosapi::mojom::DiagnosticsRoutineUserMessageEnum>( + static_cast<int>( + crosapi::mojom::DiagnosticsRoutineUserMessageEnum::kMaxValue) + + 1); +} + +crosapi::mojom::DiagnosticsRoutineStatusEnum Convert( + cros_healthd::mojom::DiagnosticRoutineStatusEnum input) { + switch (input) { + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kUnknown: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kUnknown; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kReady: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kRunning: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kRunning; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kWaiting: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kWaiting; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kPassed: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kPassed; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kFailed: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kFailed; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kError: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kError; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kCancelled: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kCancelled; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kFailedToStart: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kFailedToStart; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kRemoved: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kRemoved; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kCancelling: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kCancelling; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kUnsupported: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kUnsupported; + case cros_healthd::mojom::DiagnosticRoutineStatusEnum::kNotRun: + return crosapi::mojom::DiagnosticsRoutineStatusEnum::kNotRun; + } + NOTREACHED(); + return static_cast<crosapi::mojom::DiagnosticsRoutineStatusEnum>( + static_cast<int>( + crosapi::mojom::DiagnosticsRoutineStatusEnum::kMaxValue) + + 1); +} + +cros_healthd::mojom::DiagnosticRoutineCommandEnum Convert( + crosapi::mojom::DiagnosticsRoutineCommandEnum input) { + switch (input) { + case crosapi::mojom::DiagnosticsRoutineCommandEnum::kUnknown: + return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kUnknown; + case crosapi::mojom::DiagnosticsRoutineCommandEnum::kContinue: + return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kContinue; + case crosapi::mojom::DiagnosticsRoutineCommandEnum::kCancel: + return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kCancel; + case crosapi::mojom::DiagnosticsRoutineCommandEnum::kGetStatus: + return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kGetStatus; + case crosapi::mojom::DiagnosticsRoutineCommandEnum::kRemove: + return cros_healthd::mojom::DiagnosticRoutineCommandEnum::kRemove; + } + NOTREACHED(); + return static_cast<cros_healthd::mojom::DiagnosticRoutineCommandEnum>( + static_cast<int>( + cros_healthd::mojom::DiagnosticRoutineCommandEnum::kMaxValue) + + 1); +} + +cros_healthd::mojom::AcPowerStatusEnum Convert( + crosapi::mojom::DiagnosticsAcPowerStatusEnum input) { + switch (input) { + case crosapi::mojom::DiagnosticsAcPowerStatusEnum::kUnknown: + return cros_healthd::mojom::AcPowerStatusEnum::kUnknown; + case crosapi::mojom::DiagnosticsAcPowerStatusEnum::kConnected: + return cros_healthd::mojom::AcPowerStatusEnum::kConnected; + case crosapi::mojom::DiagnosticsAcPowerStatusEnum::kDisconnected: + return cros_healthd::mojom::AcPowerStatusEnum::kDisconnected; + } + NOTREACHED(); + return static_cast<cros_healthd::mojom::AcPowerStatusEnum>( + static_cast<int>(cros_healthd::mojom::AcPowerStatusEnum::kMaxValue) + 1); +} + +cros_healthd::mojom::NvmeSelfTestTypeEnum Convert( + crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum input) { + switch (input) { + case crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum::kUnknown: + return cros_healthd::mojom::NvmeSelfTestTypeEnum::kUnknown; + case crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum::kShortSelfTest: + return cros_healthd::mojom::NvmeSelfTestTypeEnum::kShortSelfTest; + case crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum::kLongSelfTest: + return cros_healthd::mojom::NvmeSelfTestTypeEnum::kLongSelfTest; + } + NOTREACHED(); + return static_cast<cros_healthd::mojom::NvmeSelfTestTypeEnum>( + static_cast<int>(cros_healthd::mojom::NvmeSelfTestTypeEnum::kMaxValue) + + 1); +} + +cros_healthd::mojom::DiskReadRoutineTypeEnum Convert( + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum input) { + switch (input) { + case crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum::kLinearRead: + return cros_healthd::mojom::DiskReadRoutineTypeEnum::kLinearRead; + case crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum::kRandomRead: + return cros_healthd::mojom::DiskReadRoutineTypeEnum::kRandomRead; + case crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum::kUnknown: + // Fall-through to not-supported case. + break; + } + NOTREACHED(); + return static_cast<cros_healthd::mojom::DiskReadRoutineTypeEnum>( + static_cast<int>( + cros_healthd::mojom::DiskReadRoutineTypeEnum::kMaxValue) + + 1); +} + +} // namespace converters +} // namespace ash
diff --git a/ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.h b/chrome/browser/ash/telemetry_extension/diagnostics_service_converters.h similarity index 61% rename from ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.h rename to chrome/browser/ash/telemetry_extension/diagnostics_service_converters.h index 84bf0f2..7a975e2 100644 --- a/ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.h +++ b/chrome/browser/ash/telemetry_extension/diagnostics_service_converters.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_DIAGNOSTICS_SERVICE_CONVERTERS_H_ -#define ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_DIAGNOSTICS_SERVICE_CONVERTERS_H_ +#ifndef CHROME_BROWSER_ASH_TELEMETRY_EXTENSION_DIAGNOSTICS_SERVICE_CONVERTERS_H_ +#define CHROME_BROWSER_ASH_TELEMETRY_EXTENSION_DIAGNOSTICS_SERVICE_CONVERTERS_H_ #include <string> #include <utility> #include <vector> -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom-forward.h" #include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_diagnostics.mojom.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom-forward.h" #include "mojo/public/cpp/system/handle.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -28,46 +28,46 @@ namespace unchecked { -health::mojom::RoutineUpdatePtr UncheckedConvertPtr( +crosapi::mojom::DiagnosticsRoutineUpdatePtr UncheckedConvertPtr( cros_healthd::mojom::RoutineUpdatePtr input); -health::mojom::RoutineUpdateUnionPtr UncheckedConvertPtr( +crosapi::mojom::DiagnosticsRoutineUpdateUnionPtr UncheckedConvertPtr( cros_healthd::mojom::RoutineUpdateUnionPtr input); -health::mojom::InteractiveRoutineUpdatePtr UncheckedConvertPtr( +crosapi::mojom::DiagnosticsInteractiveRoutineUpdatePtr UncheckedConvertPtr( cros_healthd::mojom::InteractiveRoutineUpdatePtr input); -health::mojom::NonInteractiveRoutineUpdatePtr UncheckedConvertPtr( +crosapi::mojom::DiagnosticsNonInteractiveRoutineUpdatePtr UncheckedConvertPtr( cros_healthd::mojom::NonInteractiveRoutineUpdatePtr input); -health::mojom::RunRoutineResponsePtr UncheckedConvertPtr( +crosapi::mojom::DiagnosticsRunRoutineResponsePtr UncheckedConvertPtr( cros_healthd::mojom::RunRoutineResponsePtr input); } // namespace unchecked -absl::optional<health::mojom::DiagnosticRoutineEnum> Convert( +absl::optional<crosapi::mojom::DiagnosticsRoutineEnum> Convert( cros_healthd::mojom::DiagnosticRoutineEnum input); -std::vector<health::mojom::DiagnosticRoutineEnum> Convert( +std::vector<crosapi::mojom::DiagnosticsRoutineEnum> Convert( const std::vector<cros_healthd::mojom::DiagnosticRoutineEnum>& input); -health::mojom::DiagnosticRoutineUserMessageEnum Convert( +crosapi::mojom::DiagnosticsRoutineUserMessageEnum Convert( cros_healthd::mojom::DiagnosticRoutineUserMessageEnum input); -health::mojom::DiagnosticRoutineStatusEnum Convert( +crosapi::mojom::DiagnosticsRoutineStatusEnum Convert( cros_healthd::mojom::DiagnosticRoutineStatusEnum input); cros_healthd::mojom::DiagnosticRoutineCommandEnum Convert( - health::mojom::DiagnosticRoutineCommandEnum input); + crosapi::mojom::DiagnosticsRoutineCommandEnum input); cros_healthd::mojom::AcPowerStatusEnum Convert( - health::mojom::AcPowerStatusEnum input); + crosapi::mojom::DiagnosticsAcPowerStatusEnum input); cros_healthd::mojom::NvmeSelfTestTypeEnum Convert( - health::mojom::NvmeSelfTestTypeEnum input); + crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum input); cros_healthd::mojom::DiskReadRoutineTypeEnum Convert( - health::mojom::DiskReadRoutineTypeEnum input); + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum input); template <class InputT> auto ConvertDiagnosticsPtr(InputT input) { @@ -78,4 +78,4 @@ } // namespace converters } // namespace ash -#endif // ASH_WEBUI_TELEMETRY_EXTENSION_UI_SERVICES_DIAGNOSTICS_SERVICE_CONVERTERS_H_ +#endif // CHROME_BROWSER_ASH_TELEMETRY_EXTENSION_DIAGNOSTICS_SERVICE_CONVERTERS_H_
diff --git a/ash/webui/telemetry_extension_ui/services/diagnostics_service_converters_unittest.cc b/chrome/browser/ash/telemetry_extension/diagnostics_service_converters_unittest.cc similarity index 61% rename from ash/webui/telemetry_extension_ui/services/diagnostics_service_converters_unittest.cc rename to chrome/browser/ash/telemetry_extension/diagnostics_service_converters_unittest.cc index 6d8c9973..f8d2f6e 100644 --- a/ash/webui/telemetry_extension_ui/services/diagnostics_service_converters_unittest.cc +++ b/chrome/browser/ash/telemetry_extension/diagnostics_service_converters_unittest.cc
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/webui/telemetry_extension_ui/services/diagnostics_service_converters.h" +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_converters.h" -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" #include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_diagnostics.mojom.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash { @@ -22,94 +22,94 @@ TEST(DiagnosticsServiceConvertersTest, ConvertDiagnosticRoutineStatusEnum) { namespace cros_healthd = ::chromeos::cros_healthd::mojom; - namespace health = ::ash::health::mojom; + namespace crosapi = ::crosapi::mojom; EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kReady), - health::DiagnosticRoutineStatusEnum::kReady); + crosapi::DiagnosticsRoutineStatusEnum::kReady); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kRunning), - health::DiagnosticRoutineStatusEnum::kRunning); + crosapi::DiagnosticsRoutineStatusEnum::kRunning); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kWaiting), - health::DiagnosticRoutineStatusEnum::kWaiting); + crosapi::DiagnosticsRoutineStatusEnum::kWaiting); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kPassed), - health::DiagnosticRoutineStatusEnum::kPassed); + crosapi::DiagnosticsRoutineStatusEnum::kPassed); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kFailed), - health::DiagnosticRoutineStatusEnum::kFailed); + crosapi::DiagnosticsRoutineStatusEnum::kFailed); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kError), - health::DiagnosticRoutineStatusEnum::kError); + crosapi::DiagnosticsRoutineStatusEnum::kError); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kCancelled), - health::DiagnosticRoutineStatusEnum::kCancelled); + crosapi::DiagnosticsRoutineStatusEnum::kCancelled); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kFailedToStart), - health::DiagnosticRoutineStatusEnum::kFailedToStart); + crosapi::DiagnosticsRoutineStatusEnum::kFailedToStart); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kRemoved), - health::DiagnosticRoutineStatusEnum::kRemoved); + crosapi::DiagnosticsRoutineStatusEnum::kRemoved); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kCancelling), - health::DiagnosticRoutineStatusEnum::kCancelling); + crosapi::DiagnosticsRoutineStatusEnum::kCancelling); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kUnsupported), - health::DiagnosticRoutineStatusEnum::kUnsupported); + crosapi::DiagnosticsRoutineStatusEnum::kUnsupported); EXPECT_EQ(Convert(cros_healthd::DiagnosticRoutineStatusEnum::kNotRun), - health::DiagnosticRoutineStatusEnum::kNotRun); + crosapi::DiagnosticsRoutineStatusEnum::kNotRun); } TEST(DiagnosticsServiceConvertersTest, ConvertDiagnosticRoutineUserMessageEnum) { namespace cros_healthd = ::chromeos::cros_healthd::mojom; - namespace health = ::ash::health::mojom; + namespace crosapi = ::crosapi::mojom; EXPECT_EQ( Convert(cros_healthd::DiagnosticRoutineUserMessageEnum::kUnplugACPower), - health::DiagnosticRoutineUserMessageEnum::kUnplugACPower); + crosapi::DiagnosticsRoutineUserMessageEnum::kUnplugACPower); EXPECT_EQ( Convert(cros_healthd::DiagnosticRoutineUserMessageEnum::kPlugInACPower), - health::DiagnosticRoutineUserMessageEnum::kPlugInACPower); + crosapi::DiagnosticsRoutineUserMessageEnum::kPlugInACPower); } TEST(DiagnosticsServiceConvertersTest, ConvertDiagnosticRoutineCommandEnum) { namespace cros_healthd = ::chromeos::cros_healthd::mojom; - namespace health = ::ash::health::mojom; + namespace crosapi = ::crosapi::mojom; - EXPECT_EQ(Convert(health::DiagnosticRoutineCommandEnum::kUnknown), + EXPECT_EQ(Convert(crosapi::DiagnosticsRoutineCommandEnum::kUnknown), cros_healthd::DiagnosticRoutineCommandEnum::kUnknown); - EXPECT_EQ(Convert(health::DiagnosticRoutineCommandEnum::kContinue), + EXPECT_EQ(Convert(crosapi::DiagnosticsRoutineCommandEnum::kContinue), cros_healthd::DiagnosticRoutineCommandEnum::kContinue); - EXPECT_EQ(Convert(health::DiagnosticRoutineCommandEnum::kCancel), + EXPECT_EQ(Convert(crosapi::DiagnosticsRoutineCommandEnum::kCancel), cros_healthd::DiagnosticRoutineCommandEnum::kCancel); - EXPECT_EQ(Convert(health::DiagnosticRoutineCommandEnum::kGetStatus), + EXPECT_EQ(Convert(crosapi::DiagnosticsRoutineCommandEnum::kGetStatus), cros_healthd::DiagnosticRoutineCommandEnum::kGetStatus); - EXPECT_EQ(Convert(health::DiagnosticRoutineCommandEnum::kRemove), + EXPECT_EQ(Convert(crosapi::DiagnosticsRoutineCommandEnum::kRemove), cros_healthd::DiagnosticRoutineCommandEnum::kRemove); } TEST(DiagnosticsServiceConvertersTest, ConvertAcPowerStatusEnum) { namespace cros_healthd = ::chromeos::cros_healthd::mojom; - namespace health = ::ash::health::mojom; + namespace crosapi = ::crosapi::mojom; - EXPECT_EQ(Convert(health::AcPowerStatusEnum::kUnknown), + EXPECT_EQ(Convert(crosapi::DiagnosticsAcPowerStatusEnum::kUnknown), cros_healthd::AcPowerStatusEnum::kUnknown); - EXPECT_EQ(Convert(health::AcPowerStatusEnum::kConnected), + EXPECT_EQ(Convert(crosapi::DiagnosticsAcPowerStatusEnum::kConnected), cros_healthd::AcPowerStatusEnum::kConnected); - EXPECT_EQ(Convert(health::AcPowerStatusEnum::kDisconnected), + EXPECT_EQ(Convert(crosapi::DiagnosticsAcPowerStatusEnum::kDisconnected), cros_healthd::AcPowerStatusEnum::kDisconnected); } TEST(DiagnosticsServiceConvertersTest, ConvertNvmeSelfTestTypeEnum) { namespace cros_healthd = ::chromeos::cros_healthd::mojom; - namespace health = ::ash::health::mojom; + namespace crosapi = ::crosapi::mojom; - EXPECT_EQ(Convert(health::NvmeSelfTestTypeEnum::kUnknown), + EXPECT_EQ(Convert(crosapi::DiagnosticsNvmeSelfTestTypeEnum::kUnknown), cros_healthd::NvmeSelfTestTypeEnum::kUnknown); - EXPECT_EQ(Convert(health::NvmeSelfTestTypeEnum::kShortSelfTest), + EXPECT_EQ(Convert(crosapi::DiagnosticsNvmeSelfTestTypeEnum::kShortSelfTest), cros_healthd::NvmeSelfTestTypeEnum::kShortSelfTest); - EXPECT_EQ(Convert(health::NvmeSelfTestTypeEnum::kLongSelfTest), + EXPECT_EQ(Convert(crosapi::DiagnosticsNvmeSelfTestTypeEnum::kLongSelfTest), cros_healthd::NvmeSelfTestTypeEnum::kLongSelfTest); } TEST(DiagnosticsServiceConvertersTest, ConvertDiskReadRoutineTypeEnum) { namespace cros_healthd = ::chromeos::cros_healthd::mojom; - namespace health = ::ash::health::mojom; + namespace crosapi = ::crosapi::mojom; - EXPECT_EQ(Convert(health::DiskReadRoutineTypeEnum::kLinearRead), + EXPECT_EQ(Convert(crosapi::DiagnosticsDiskReadRoutineTypeEnum::kLinearRead), cros_healthd::DiskReadRoutineTypeEnum::kLinearRead); - EXPECT_EQ(Convert(health::DiskReadRoutineTypeEnum::kRandomRead), + EXPECT_EQ(Convert(crosapi::DiagnosticsDiskReadRoutineTypeEnum::kRandomRead), cros_healthd::DiskReadRoutineTypeEnum::kRandomRead); }
diff --git a/chrome/browser/autofill_assistant/password_change/apc_client_impl.cc b/chrome/browser/autofill_assistant/password_change/apc_client_impl.cc index 7bb52c29..4de13d86 100644 --- a/chrome/browser/autofill_assistant/password_change/apc_client_impl.cc +++ b/chrome/browser/autofill_assistant/password_change/apc_client_impl.cc
@@ -22,7 +22,6 @@ #include "chrome/common/channel_info.h" #include "components/autofill_assistant/browser/public/autofill_assistant_factory.h" #include "components/autofill_assistant/browser/public/headless_script_controller.h" -#include "components/autofill_assistant/browser/public/password_change/empty_website_login_manager_impl.h" #include "components/autofill_assistant/browser/public/password_change/website_login_manager_impl.h" #include "components/autofill_assistant/browser/public/public_script_parameters.h" #include "components/password_manager/core/browser/password_manager_client.h" @@ -60,6 +59,7 @@ std::move(callback).Run(false); return; } + // Ensure that only one run is ongoing. if (is_running_) { std::move(callback).Run(false); @@ -171,6 +171,13 @@ } scrim_manager_ = CreateApcScrimManager(); + + website_login_manager_ = CreateWebsiteLoginManager(); + + apc_external_action_delegate_ = CreateApcExternalActionDelegate(); + apc_external_action_delegate_->SetupDisplay(); + apc_external_action_delegate_->ShowStartingScreen(url_); + external_script_controller_ = CreateHeadlessScriptController(); scrim_manager_->Show(); external_script_controller_->StartScript( @@ -180,8 +187,13 @@ void ApcClientImpl::OnRunComplete( autofill_assistant::HeadlessScriptController::ScriptResult result) { - // TODO(crbug.com/1324089): Handle failed result. - Stop(result.success); + if (result.success) { + apc_external_action_delegate_->ShowCompletionScreen(base::BindRepeating( + &ApcClientImpl::Stop, base::Unretained(this), result.success)); + } else { + // TODO(crbug.com/1324089): Handle failed result. + Stop(result.success); + } } void ApcClientImpl::OnHidden() { @@ -206,16 +218,8 @@ std::unique_ptr<autofill_assistant::HeadlessScriptController> ApcClientImpl::CreateHeadlessScriptController() { DCHECK(scrim_manager_); - - website_login_manager_ = - std::make_unique<autofill_assistant::WebsiteLoginManagerImpl>( - GetPasswordManagerClient(), &GetWebContents()); - - apc_external_action_delegate_ = std::make_unique<ApcExternalActionDelegate>( - side_panel_coordinator_.get(), scrim_manager_.get(), - website_login_manager_.get()); - apc_external_action_delegate_->SetupDisplay(); - apc_external_action_delegate_->ShowStartingScreen(url_); + DCHECK(apc_external_action_delegate_); + DCHECK(website_login_manager_); std::unique_ptr<autofill_assistant::AutofillAssistant> autofill_assistant = autofill_assistant::AutofillAssistantFactory::CreateForBrowserContext( @@ -235,6 +239,22 @@ return ApcScrimManager::Create(&GetWebContents()); } +std::unique_ptr<ApcExternalActionDelegate> +ApcClientImpl::CreateApcExternalActionDelegate() { + DCHECK(scrim_manager_); + DCHECK(website_login_manager_); + + return std::make_unique<ApcExternalActionDelegate>( + side_panel_coordinator_.get(), scrim_manager_.get(), + website_login_manager_.get()); +} + +std::unique_ptr<autofill_assistant::WebsiteLoginManager> +ApcClientImpl::CreateWebsiteLoginManager() { + return std::make_unique<autofill_assistant::WebsiteLoginManagerImpl>( + GetPasswordManagerClient(), &GetWebContents()); +} + password_manager::PasswordManagerClient* ApcClientImpl::GetPasswordManagerClient() { return ChromePasswordManagerClient::FromWebContents(&GetWebContents());
diff --git a/chrome/browser/autofill_assistant/password_change/apc_client_impl.h b/chrome/browser/autofill_assistant/password_change/apc_client_impl.h index cc473b3..850594e 100644 --- a/chrome/browser/autofill_assistant/password_change/apc_client_impl.h +++ b/chrome/browser/autofill_assistant/password_change/apc_client_impl.h
@@ -79,6 +79,16 @@ // during script runs. virtual std::unique_ptr<ApcScrimManager> CreateApcScrimManager(); + // Creates the external action delegate responsible for receiving and handling + // action protos. + virtual std::unique_ptr<ApcExternalActionDelegate> + CreateApcExternalActionDelegate(); + + // Creates the website login manager to handle interactions with the password + // manager. + virtual std::unique_ptr<autofill_assistant::WebsiteLoginManager> + CreateWebsiteLoginManager(); + // Get the `PasswordManagerClient` so that we can initialize // `website_login_manager_`. virtual password_manager::PasswordManagerClient* GetPasswordManagerClient();
diff --git a/chrome/browser/autofill_assistant/password_change/apc_client_impl_unittest.cc b/chrome/browser/autofill_assistant/password_change/apc_client_impl_unittest.cc index f508d8cd..7c0c3c49 100644 --- a/chrome/browser/autofill_assistant/password_change/apc_client_impl_unittest.cc +++ b/chrome/browser/autofill_assistant/password_change/apc_client_impl_unittest.cc
@@ -7,11 +7,13 @@ #include <memory> #include <string> +#include "base/callback.h" #include "base/callback_helpers.h" #include "base/memory/raw_ptr.h" #include "base/test/gmock_move_support.h" #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" +#include "chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.h" #include "chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.h" #include "chrome/browser/autofill_assistant/password_change/mock_apc_onboarding_coordinator.h" #include "chrome/browser/ui/autofill_assistant/password_change/mock_apc_scrim_manager.h" @@ -20,6 +22,7 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "components/autofill_assistant/browser/public/mock_headless_script_controller.h" #include "components/autofill_assistant/browser/public/mock_runtime_manager.h" +#include "components/autofill_assistant/browser/public/password_change/mock_website_login_manager.h" #include "components/password_manager/core/browser/password_manager_client.h" #include "components/password_manager/core/browser/password_manager_client_helper.h" #include "components/password_manager/core/browser/stub_password_manager_client.h" @@ -48,6 +51,22 @@ constexpr int kDescriptionId1 = 3; constexpr int kDescriptionId2 = 17; +class MockApcExternalActionDelegate : public ApcExternalActionDelegate { + public: + MockApcExternalActionDelegate( + AssistantDisplayDelegate* display_delegate, + ApcScrimManager* apc_scrim_manager, + autofill_assistant::WebsiteLoginManager* website_login_manager) + : ApcExternalActionDelegate(display_delegate, + apc_scrim_manager, + website_login_manager) {} + ~MockApcExternalActionDelegate() override = default; + + MOCK_METHOD(void, ShowStartingScreen, (const GURL&), (override)); + MOCK_METHOD(void, ShowCompletionScreen, (base::RepeatingClosure), (override)); + MOCK_METHOD(void, SetupDisplay, (), (override)); +}; + } // namespace using ::testing::_; @@ -85,6 +104,16 @@ return std::move(scrim_manager_); } + std::unique_ptr<ApcExternalActionDelegate> CreateApcExternalActionDelegate() + override { + return std::move(apc_external_action_delegate_); + } + + std::unique_ptr<autofill_assistant::WebsiteLoginManager> + CreateWebsiteLoginManager() override { + return std::move(website_login_manager_); + } + password_manager::PasswordManagerClient* GetPasswordManagerClient() override { return password_manager_client_.get(); } @@ -122,6 +151,19 @@ scrim_manager_ = std::move(scrim_manager); } + // Allows setting a ApcExternalActionDelegate. + void InjectApcExternalActionDelegateForTesting( + std::unique_ptr<ApcExternalActionDelegate> apc_external_action_delegate) { + apc_external_action_delegate_ = std::move(apc_external_action_delegate); + } + + // Allows setting a WebsiteLoginManager. + void InjectWebsiteLoginManagerForTesting( + std::unique_ptr<autofill_assistant::WebsiteLoginManager> + website_login_manager) { + website_login_manager_ = std::move(website_login_manager); + } + // Allows setting an PasswordManagerClient. void InjectPasswordManagerClientForTesting( std::unique_ptr<password_manager::PasswordManagerClient> @@ -136,6 +178,9 @@ external_script_controller_; raw_ptr<autofill_assistant::RuntimeManager> runtime_manager_; std::unique_ptr<ApcScrimManager> scrim_manager_; + std::unique_ptr<ApcExternalActionDelegate> apc_external_action_delegate_; + std::unique_ptr<autofill_assistant::WebsiteLoginManager> + website_login_manager_; std::unique_ptr<password_manager::PasswordManagerClient> password_manager_client_; }; @@ -195,14 +240,33 @@ // Prepare the PasswordManagerClient. auto password_manager_client = std::make_unique<password_manager::StubPasswordManagerClient>(); + password_manager_client_ref_ = password_manager_client.get(); test_apc_client_->InjectPasswordManagerClientForTesting( std::move(password_manager_client)); + + // Prepare the WebsiteLoginManager. + auto website_login_manager = + std::make_unique<autofill_assistant::MockWebsiteLoginManager>(); + website_login_manager_ref_ = website_login_manager.get(); + test_apc_client_->InjectWebsiteLoginManagerForTesting( + std::move(website_login_manager)); + + // Prepare the ApcExternalActionDelegate. + auto apc_external_action_delegate = + std::make_unique<MockApcExternalActionDelegate>( + side_panel_ref_, scrim_manager_ref_, website_login_manager_ref_); + apc_external_action_delegate_ref_ = apc_external_action_delegate.get(); + test_apc_client_->InjectApcExternalActionDelegateForTesting( + std::move(apc_external_action_delegate)); } TestApcClientImpl* apc_client() { return test_apc_client_; } MockApcOnboardingCoordinator* coordinator() { return coordinator_ref_; } MockAssistantSidePanelCoordinator* side_panel() { return side_panel_ref_; } MockApcScrimManager* scrim_manager() { return scrim_manager_ref_; } + MockApcExternalActionDelegate* apc_external_action_delegate() { + return apc_external_action_delegate_ref_; + } AssistantSidePanelCoordinator::Observer* side_panel_observer() { return side_panel_observer_; } @@ -224,6 +288,12 @@ raw_ptr<autofill_assistant::MockHeadlessScriptController> external_script_controller_ref_ = nullptr; raw_ptr<MockApcScrimManager> scrim_manager_ref_ = nullptr; + raw_ptr<MockApcExternalActionDelegate> apc_external_action_delegate_ref_ = + nullptr; + raw_ptr<password_manager::StubPasswordManagerClient> + password_manager_client_ref_ = nullptr; + raw_ptr<autofill_assistant::WebsiteLoginManager> website_login_manager_ref_ = + nullptr; // The last registered side panel observer - may be null or dangling. raw_ptr<AssistantSidePanelCoordinator::Observer> side_panel_observer_ = @@ -254,6 +324,7 @@ .WillOnce(MoveArg<0>(&coordinator_callback)); EXPECT_CALL(*runtime_manager(), SetUIState(autofill_assistant::UIState::kShown)); + EXPECT_CALL(*apc_external_action_delegate(), ShowStartingScreen(GURL(kUrl1))); EXPECT_CALL(*scrim_manager(), Show()); client->Start(GURL(kUrl1), kUsername1, /*skip_login=*/false, @@ -281,10 +352,20 @@ autofill_assistant::HeadlessScriptController::ScriptResult script_result = { /* success= */ true}; + EXPECT_CALL(*runtime_manager(), SetUIState(autofill_assistant::UIState::kNotShown)); EXPECT_CALL(result_callback1, Run(true)); + + // Prepare to extract the callback from the completion screen call. + base::RepeatingClosure show_completion_screen_callback; + EXPECT_CALL(*apc_external_action_delegate(), ShowCompletionScreen(_)) + .Times(1) + .WillOnce(MoveArg<0>(&show_completion_screen_callback)); + std::move(external_script_controller_callback).Run(script_result); + std::move(show_completion_screen_callback).Run(); + EXPECT_FALSE(client->IsRunning()); }
diff --git a/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.cc b/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.cc index e8c3c51..70abc4a 100644 --- a/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.cc +++ b/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.cc
@@ -234,22 +234,13 @@ } void ApcExternalActionDelegate::ShowStartingScreen(const GURL& url) { - SetTopIcon( - autofill_assistant::password_change::TopIcon::TOP_ICON_UNSPECIFIED); - SetProgressBarStep( - autofill_assistant::password_change::ProgressStep::PROGRESS_STEP_START); + password_change_run_display_->ShowStartingScreen(url); +} - const std::u16string formatted_url = url_formatter::FormatUrl( - url, - url_formatter::kFormatUrlOmitHTTP | url_formatter::kFormatUrlOmitHTTPS | - url_formatter::kFormatUrlOmitTrivialSubdomains | - url_formatter::kFormatUrlTrimAfterHost, - base::UnescapeRule::SPACES, /*new_parsed=*/nullptr, - /*prefix_end=*/nullptr, /*offset_for_adjustment=*/nullptr); - SetTitle(l10n_util::GetStringFUTF16( - IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_STARTING_SCREEN_TITLE, - formatted_url)); - SetDescription(std::u16string()); +void ApcExternalActionDelegate::ShowCompletionScreen( + base::RepeatingClosure onShowCompletionScreenDoneButtonClicked) { + password_change_run_display_->ShowCompletionScreen( + std::move(onShowCompletionScreenDoneButtonClicked)); } void ApcExternalActionDelegate::Show(
diff --git a/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.h b/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.h index f71277bd..39403992 100644 --- a/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.h +++ b/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate.h
@@ -17,6 +17,7 @@ class PasswordChangeRunDisplay; class AssistantDisplayDelegate; class ApcScrimManager; +class GURL; namespace autofill_assistant { struct RectF; @@ -45,7 +46,7 @@ // Sets up the display to render a password change run UI, // needs to be called BEFORE starting a script. - void SetupDisplay(); + virtual void SetupDisplay(); // ExternalActionDelegate: void OnActionRequested( @@ -79,6 +80,8 @@ const std::u16string& generated_password) override; void OnGeneratedPasswordSelected(bool selected) override; void ShowStartingScreen(const GURL& url) override; + void ShowCompletionScreen( + base::RepeatingClosure onShowCompletionScreenDoneButtonClicked) override; private: friend class ApcExternalActionDelegateTest;
diff --git a/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate_unittest.cc b/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate_unittest.cc index eb138a18..e14c8f57 100644 --- a/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate_unittest.cc +++ b/chrome/browser/autofill_assistant/password_change/apc_external_action_delegate_unittest.cc
@@ -237,14 +237,7 @@ TEST_F(ApcExternalActionDelegateTest, ShowStartingScreen) { const GURL url(kUrl); - EXPECT_CALL(*display(), SetTopIcon(TopIcon::TOP_ICON_UNSPECIFIED)); - EXPECT_CALL(*display(), - SetProgressBarStep(ProgressStep::PROGRESS_STEP_START)); - EXPECT_CALL(*display(), - SetTitle(l10n_util::GetStringFUTF16( - IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_STARTING_SCREEN_TITLE, - u"example.com"))); - EXPECT_CALL(*display(), SetDescription(std::u16string())); + EXPECT_CALL(*display(), ShowStartingScreen(url)); action_delegate()->ShowStartingScreen(url); }
diff --git a/chrome/browser/browser_features.cc b/chrome/browser/browser_features.cc index 95b5e4c..e3b943f3 100644 --- a/chrome/browser/browser_features.cc +++ b/chrome/browser/browser_features.cc
@@ -42,6 +42,11 @@ const base::Feature kDestroySystemProfiles{"DestroySystemProfiles", base::FEATURE_DISABLED_BY_DEFAULT}; +// Let DevTools front-end talk to the target of type "tab" rather than +// "frame" when inspecting a WebContents. +const base::Feature kDevToolsTabTarget{"DevToolsTabTarget", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Nukes profile directory before creating a new profile using // ProfileManager::CreateMultiProfileAsync(). const base::Feature kNukeProfileBeforeCreateMultiAsync{
diff --git a/chrome/browser/browser_features.h b/chrome/browser/browser_features.h index f860c19..8e2ef23 100644 --- a/chrome/browser/browser_features.h +++ b/chrome/browser/browser_features.h
@@ -25,6 +25,8 @@ extern const base::Feature kDestroyProfileOnBrowserClose; extern const base::Feature kDestroySystemProfiles; +extern const base::Feature kDevToolsTabTarget; + extern const base::Feature kNukeProfileBeforeCreateMultiAsync; extern const base::Feature kPromoBrowserCommands;
diff --git a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc index c32733d..55f30ef 100644 --- a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc +++ b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
@@ -203,12 +203,13 @@ // message after a time delay, in order to rate limit. The association // protects against the render process host ID being recycled in that time // gap between the preparation and the execution of that IPC. - associated_registry->AddInterface(base::BindRepeating( - &CacheStatsRecorder::Create, render_process_host->GetID())); + associated_registry->AddInterface<chrome::mojom::CacheStatsRecorder>( + base::BindRepeating(&CacheStatsRecorder::Create, + render_process_host->GetID())); scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = content::GetUIThreadTaskRunner({}); - registry->AddInterface( + registry->AddInterface<metrics::mojom::CallStackProfileCollector>( base::BindRepeating(&metrics::CallStackProfileCollector::Create)); if (NetBenchmarking::CheckBenchmarkingEnabled()) { @@ -216,7 +217,7 @@ Profile::FromBrowserContext(render_process_host->GetBrowserContext()); auto* loading_predictor = predictors::LoadingPredictorFactory::GetForProfile(profile); - registry->AddInterface( + registry->AddInterface<chrome::mojom::NetBenchmarking>( base::BindRepeating( &NetBenchmarking::Create, loading_predictor ? loading_predictor->GetWeakPtr() : nullptr, @@ -228,7 +229,7 @@ if (safe_browsing_service_) { content::ResourceContext* resource_context = render_process_host->GetBrowserContext()->GetResourceContext(); - registry->AddInterface( + registry->AddInterface<safe_browsing::mojom::SafeBrowsing>( base::BindRepeating( &MaybeCreateSafeBrowsingForRenderer, render_process_host->GetID(), resource_context, @@ -253,7 +254,7 @@ return base::Process(); }, render_process_host->GetID()); - registry->AddInterface( + registry->AddInterface<mojom::ModuleEventSink>( base::BindRepeating( &ModuleEventSinkImpl::Create, std::move(get_process), content::PROCESS_TYPE_RENDERER, @@ -261,7 +262,7 @@ ui_task_runner); #endif #if BUILDFLAG(IS_ANDROID) - registry->AddInterface( + registry->AddInterface<chrome::mojom::AvailableOfflineContentProvider>( base::BindRepeating(&android::AvailableOfflineContentProvider::Create, render_process_host->GetID()), content::GetUIThreadTaskRunner({})); @@ -271,11 +272,13 @@ #if defined(ARCH_CPU_X86_64) if (performance_manager::mechanism::userspace_swap:: UserspaceSwapInitializationImpl::UserspaceSwapSupportedAndEnabled()) { - registry->AddInterface( - base::BindRepeating(&performance_manager::mechanism::userspace_swap:: - UserspaceSwapInitializationImpl::Create, - render_process_host->GetID()), - performance_manager::PerformanceManager::GetTaskRunner()); + registry + ->AddInterface<::userspace_swap::mojom::UserspaceSwapInitialization>( + base::BindRepeating( + &performance_manager::mechanism::userspace_swap:: + UserspaceSwapInitializationImpl::Create, + render_process_host->GetID()), + performance_manager::PerformanceManager::GetTaskRunner()); } #endif // defined(ARCH_CPU_X86_64) #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -421,7 +424,8 @@ content::RenderFrameHost& render_frame_host, blink::AssociatedInterfaceRegistry& associated_registry) { // TODO(lingqi): Swap the parameters so that lambda functions are not needed. - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface< + autofill_assistant::mojom::AutofillAssistantDriver>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver< autofill_assistant::mojom::AutofillAssistantDriver> receiver) { @@ -429,23 +433,26 @@ std::move(receiver), render_frame_host); }, &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> - receiver) { - autofill::ContentAutofillDriverFactory::BindAutofillDriver( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - autofill::mojom::PasswordGenerationDriver> receiver) { - ChromePasswordManagerClient::BindPasswordGenerationDriver( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface<autofill::mojom::AutofillDriver>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> + receiver) { + autofill::ContentAutofillDriverFactory::BindAutofillDriver( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface<autofill::mojom::PasswordGenerationDriver>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + autofill::mojom::PasswordGenerationDriver> receiver) { + ChromePasswordManagerClient::BindPasswordGenerationDriver( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface< + autofill::mojom::PasswordManagerDriver>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver<autofill::mojom::PasswordManagerDriver> receiver) { @@ -453,31 +460,35 @@ BindPasswordManagerDriver(std::move(receiver), render_frame_host); }, &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<chrome::mojom::NetworkDiagnostics> - receiver) { - chrome_browser_net::NetErrorTabHelper::BindNetworkDiagnostics( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<chrome::mojom::NetworkEasterEgg> - receiver) { - chrome_browser_net::NetErrorTabHelper::BindNetworkEasterEgg( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<chrome::mojom::NetErrorPageSupport> - receiver) { - chrome_browser_net::NetErrorTabHelper::BindNetErrorPageSupport( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface<chrome::mojom::NetworkDiagnostics>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<chrome::mojom::NetworkDiagnostics> + receiver) { + chrome_browser_net::NetErrorTabHelper::BindNetworkDiagnostics( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface<chrome::mojom::NetworkEasterEgg>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<chrome::mojom::NetworkEasterEgg> + receiver) { + chrome_browser_net::NetErrorTabHelper::BindNetworkEasterEgg( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface<chrome::mojom::NetErrorPageSupport>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<chrome::mojom::NetErrorPageSupport> + receiver) { + chrome_browser_net::NetErrorTabHelper::BindNetErrorPageSupport( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface< + chrome::mojom::OpenSearchDescriptionDocumentHandler>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver< chrome::mojom::OpenSearchDescriptionDocumentHandler> receiver) { @@ -486,7 +497,8 @@ }, &render_frame_host)); #if BUILDFLAG(ENABLE_PLUGINS) - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface< + chrome::mojom::PluginAuthHost>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver<chrome::mojom::PluginAuthHost> receiver) { @@ -501,125 +513,137 @@ #else using PluginObserverImpl = PluginObserver; #endif - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<chrome::mojom::PluginHost> - receiver) { - PluginObserverImpl::BindPluginHost(std::move(receiver), - render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<chrome::mojom::PluginHost>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<chrome::mojom::PluginHost> + receiver) { + PluginObserverImpl::BindPluginHost(std::move(receiver), + render_frame_host); + }, + &render_frame_host)); #endif // BUILDFLAG(ENABLE_PLUGINS) || BUILDFLAG(IS_ANDROID) #if !BUILDFLAG(IS_ANDROID) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - chrome::mojom::SyncEncryptionKeysExtension> receiver) { - SyncEncryptionKeysTabHelper::BindSyncEncryptionKeysExtension( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<chrome::mojom::SyncEncryptionKeysExtension>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + chrome::mojom::SyncEncryptionKeysExtension> receiver) { + SyncEncryptionKeysTabHelper::BindSyncEncryptionKeysExtension( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); #endif // !BUILDFLAG(IS_ANDROID) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - content_capture::mojom::ContentCaptureReceiver> receiver) { - content_capture::OnscreenContentProvider::BindContentCaptureReceiver( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface< + content_capture::mojom::ContentCaptureReceiver>(base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + content_capture::mojom::ContentCaptureReceiver> receiver) { + content_capture::OnscreenContentProvider::BindContentCaptureReceiver( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); #if BUILDFLAG(ENABLE_EXTENSIONS) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost> - receiver) { - extensions::ExtensionWebContentsObserver::BindLocalFrameHost( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<extensions::mojom::LocalFrameHost>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost> + receiver) { + extensions::ExtensionWebContentsObserver::BindLocalFrameHost( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); #endif // BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_OFFLINE_PAGES) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - offline_pages::mojom::MhtmlPageNotifier> receiver) { - offline_pages::OfflinePageTabHelper::BindHtmlPageNotifier( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<offline_pages::mojom::MhtmlPageNotifier>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + offline_pages::mojom::MhtmlPageNotifier> receiver) { + offline_pages::OfflinePageTabHelper::BindHtmlPageNotifier( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); #endif // BUILDFLAG(ENABLE_OFFLINE_PAGES) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - page_load_metrics::mojom::PageLoadMetrics> receiver) { - page_load_metrics::MetricsWebContentsObserver::BindPageLoadMetrics( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<page_load_metrics::mojom::PageLoadMetrics>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + page_load_metrics::mojom::PageLoadMetrics> receiver) { + page_load_metrics::MetricsWebContentsObserver::BindPageLoadMetrics( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); #if BUILDFLAG(ENABLE_PDF) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) { - pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver), - render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<pdf::mojom::PdfService>(base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) { + pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver), + render_frame_host); + }, + &render_frame_host)); #endif // BUILDFLAG(ENABLE_PDF) #if !BUILDFLAG(IS_ANDROID) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - search::mojom::EmbeddedSearchConnector> receiver) { - SearchTabHelper::BindEmbeddedSearchConnecter(std::move(receiver), - render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<search::mojom::EmbeddedSearchConnector>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + search::mojom::EmbeddedSearchConnector> receiver) { + SearchTabHelper::BindEmbeddedSearchConnecter(std::move(receiver), + render_frame_host); + }, + &render_frame_host)); #endif // !BUILDFLAG(IS_ANDROID) #if BUILDFLAG(ENABLE_PRINTING) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> - receiver) { - if (headless::IsChromeNativeHeadless()) { - headless::HeadlessPrintManager::BindPrintManagerHost( - std::move(receiver), render_frame_host); - } else { + associated_registry.AddInterface<printing::mojom::PrintManagerHost>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> + receiver) { + if (headless::IsChromeNativeHeadless()) { + headless::HeadlessPrintManager::BindPrintManagerHost( + std::move(receiver), render_frame_host); + } else { #if BUILDFLAG(ENABLE_PRINT_PREVIEW) - printing::PrintViewManager::BindPrintManagerHost( - std::move(receiver), render_frame_host); + printing::PrintViewManager::BindPrintManagerHost( + std::move(receiver), render_frame_host); #else - printing::PrintViewManagerBasic::BindPrintManagerHost( - std::move(receiver), render_frame_host); + printing::PrintViewManagerBasic::BindPrintManagerHost( + std::move(receiver), render_frame_host); #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) - } - }, - &render_frame_host)); + } + }, + &render_frame_host)); #endif // BUILDFLAG(ENABLE_PRINTING) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - security_interstitials::mojom::InterstitialCommands> receiver) { - security_interstitials::SecurityInterstitialTabHelper:: - BindInterstitialCommands(std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - subresource_filter::mojom::SubresourceFilterHost> receiver) { - subresource_filter::ContentSubresourceFilterThrottleManager:: - BindReceiver(std::move(receiver), render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface< + security_interstitials::mojom::InterstitialCommands>(base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + security_interstitials::mojom::InterstitialCommands> receiver) { + security_interstitials::SecurityInterstitialTabHelper:: + BindInterstitialCommands(std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface< + subresource_filter::mojom::SubresourceFilterHost>(base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + subresource_filter::mojom::SubresourceFilterHost> receiver) { + subresource_filter::ContentSubresourceFilterThrottleManager:: + BindReceiver(std::move(receiver), render_frame_host); + }, + &render_frame_host)); #if BUILDFLAG(ENABLE_SUPERVISED_USERS) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - supervised_user::mojom::SupervisedUserCommands> receiver) { - SupervisedUserNavigationObserver::BindSupervisedUserCommands( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); + associated_registry + .AddInterface<supervised_user::mojom::SupervisedUserCommands>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + supervised_user::mojom::SupervisedUserCommands> receiver) { + SupervisedUserNavigationObserver::BindSupervisedUserCommands( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) }
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/BUILD.gn b/chrome/browser/chromeos/extensions/telemetry/api/BUILD.gn index 7f8e173..5ecfc7f 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/BUILD.gn +++ b/chrome/browser/chromeos/extensions/telemetry/api/BUILD.gn
@@ -78,6 +78,10 @@ "diagnostics_api_browsertest.cc", "fake_api_guard_delegate.cc", "fake_api_guard_delegate.h", + "fake_diagnostics_service.cc", + "fake_diagnostics_service.h", + "fake_diagnostics_service_factory.cc", + "fake_diagnostics_service_factory.h", "fake_probe_service.cc", "fake_probe_service.h", "fake_probe_service_factory.cc", @@ -90,7 +94,6 @@ ":api", ":fake_hardware_info_delegate", "//ash/webui/telemetry_extension_ui/services:telemetry_services", - "//ash/webui/telemetry_extension_ui/services:telemetry_services_test", "//base", "//chrome/browser/ash/telemetry_extension", "//chrome/browser/ash/wilco_dtc_supportd:mojo_utils", @@ -107,6 +110,7 @@ "//extensions/common", "//net", "//net:test_support", + "//testing/gtest", "//url", ] } @@ -125,6 +129,7 @@ "//chrome/common/chromeos/extensions/api", "//chrome/test:test_support", "//chromeos/crosapi/mojom", + "//testing/gtest", ] }
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api.cc b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api.cc index 8f6dea27..c89992d 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api.cc
@@ -8,12 +8,13 @@ #include <string> #include <utility> -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" #include "base/bind.h" #include "base/values.h" +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h" #include "chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.h" #include "chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.h" #include "chrome/common/chromeos/extensions/api/diagnostics.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" namespace chromeos { @@ -22,9 +23,10 @@ DiagnosticsApiFunctionBase::DiagnosticsApiFunctionBase() : remote_diagnostics_service_strategy_( RemoteDiagnosticsServiceStrategy::Create()) {} + DiagnosticsApiFunctionBase::~DiagnosticsApiFunctionBase() = default; -mojo::Remote<ash::health::mojom::DiagnosticsService>& +mojo::Remote<crosapi::mojom::DiagnosticsService>& DiagnosticsApiFunctionBase::GetRemoteService() { return remote_diagnostics_service_strategy_->GetRemoteService(); } @@ -44,7 +46,7 @@ } void OsDiagnosticsGetAvailableRoutinesFunction::OnResult( - const std::vector<ash::health::mojom::DiagnosticRoutineEnum>& routines) { + const std::vector<crosapi::mojom::DiagnosticsRoutineEnum>& routines) { api::os_diagnostics::GetAvailableRoutinesResponse result; for (const auto in : routines) { api::os_diagnostics::RoutineType out; @@ -83,7 +85,7 @@ } void OsDiagnosticsGetRoutineUpdateFunction::OnResult( - ash::health::mojom::RoutineUpdatePtr ptr) { + crosapi::mojom::DiagnosticsRoutineUpdatePtr ptr) { if (!ptr) { // |ptr| should never be null, otherwise Mojo validation will fail. // However it's safer to handle it in case of API changes. @@ -100,14 +102,15 @@ } switch (ptr->routine_update_union->which()) { - case ash::health::mojom::RoutineUpdateUnion::Tag::kNoninteractiveUpdate: { + case crosapi::mojom::DiagnosticsRoutineUpdateUnion::Tag:: + kNoninteractiveUpdate: { auto& routine_update = ptr->routine_update_union->get_noninteractive_update(); result.status = converters::ConvertRoutineStatus(routine_update->status); result.status_message = std::move(routine_update->status_message); break; } - case ash::health::mojom::RoutineUpdateUnion::Tag::kInteractiveUpdate: + case crosapi::mojom::DiagnosticsRoutineUpdateUnion::Tag::kInteractiveUpdate: // Routine is waiting for user action. Set the status to waiting. result.status = api::os_diagnostics::RoutineStatus:: ROUTINE_STATUS_WAITING_USER_ACTION; @@ -129,7 +132,7 @@ default; void DiagnosticsApiRunRoutineFunctionBase::OnResult( - ash::health::mojom::RunRoutineResponsePtr ptr) { + crosapi::mojom::DiagnosticsRunRoutineResponsePtr ptr) { if (!ptr) { // |ptr| should never be null, otherwise Mojo validation will fail. // However it's safer to handle it in case of API changes.
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api.h b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api.h index 58591cf..1cf6140 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api.h +++ b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api.h
@@ -7,9 +7,10 @@ #include <memory> -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h" #include "chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_api_guard_function.h" #include "chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" #include "extensions/browser/extension_function.h" #include "extensions/browser/extension_function_histogram_value.h" #include "mojo/public/cpp/bindings/remote.h" @@ -28,7 +29,7 @@ protected: ~DiagnosticsApiFunctionBase() override; - mojo::Remote<ash::health::mojom::DiagnosticsService>& GetRemoteService(); + mojo::Remote<crosapi::mojom::DiagnosticsService>& GetRemoteService(); private: std::unique_ptr<RemoteDiagnosticsServiceStrategy> @@ -54,7 +55,7 @@ void RunIfAllowed() override; void OnResult( - const std::vector<ash::health::mojom::DiagnosticRoutineEnum>& routines); + const std::vector<crosapi::mojom::DiagnosticsRoutineEnum>& routines); }; class OsDiagnosticsGetRoutineUpdateFunction @@ -75,7 +76,7 @@ // BaseTelemetryExtensionApiGuardFunction: void RunIfAllowed() override; - void OnResult(ash::health::mojom::RoutineUpdatePtr ptr); + void OnResult(crosapi::mojom::DiagnosticsRoutineUpdatePtr ptr); }; class DiagnosticsApiRunRoutineFunctionBase : public DiagnosticsApiFunctionBase { @@ -87,7 +88,7 @@ DiagnosticsApiRunRoutineFunctionBase& operator=( const DiagnosticsApiRunRoutineFunctionBase&) = delete; - void OnResult(ash::health::mojom::RunRoutineResponsePtr ptr); + void OnResult(crosapi::mojom::DiagnosticsRunRoutineResponsePtr ptr); protected: ~DiagnosticsApiRunRoutineFunctionBase() override;
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_browsertest.cc b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_browsertest.cc index d37cf1f..69485a0 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_browsertest.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_browsertest.cc
@@ -5,10 +5,11 @@ #include <memory> #include <utility> -#include "ash/webui/telemetry_extension_ui/services/diagnostics_service.h" -#include "ash/webui/telemetry_extension_ui/services/fake_diagnostics_service.h" #include "base/values.h" +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h" #include "chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_browser_test.h" +#include "chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.h" +#include "chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service_factory.h" #include "content/public/test/browser_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -18,7 +19,7 @@ : public BaseTelemetryExtensionBrowserTest { public: TelemetryExtensionDiagnosticsApiBrowserTest() { - ash::DiagnosticsService::Factory::SetForTesting( + ash::DiagnosticsServiceAsh::Factory::SetForTesting( &fake_diagnostics_service_factory_); } @@ -30,34 +31,34 @@ const TelemetryExtensionDiagnosticsApiBrowserTest&) = delete; protected: - void SetServiceForTesting(std::unique_ptr<ash::FakeDiagnosticsService> - fake_diagnostics_service_impl) { + void SetServiceForTesting( + std::unique_ptr<FakeDiagnosticsService> fake_diagnostics_service_impl) { fake_diagnostics_service_factory_.SetCreateInstanceResponse( std::move(fake_diagnostics_service_impl)); } - ash::FakeDiagnosticsService::Factory fake_diagnostics_service_factory_; + FakeDiagnosticsServiceFactory fake_diagnostics_service_factory_; }; IN_PROC_BROWSER_TEST_F(TelemetryExtensionDiagnosticsApiBrowserTest, GetAvailableRoutinesSuccess) { { - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetAvailableRoutines({ - ash::health::mojom::DiagnosticRoutineEnum::kAcPower, - ash::health::mojom::DiagnosticRoutineEnum::kBatteryCapacity, - ash::health::mojom::DiagnosticRoutineEnum::kBatteryCharge, - ash::health::mojom::DiagnosticRoutineEnum::kBatteryDischarge, - ash::health::mojom::DiagnosticRoutineEnum::kBatteryHealth, - ash::health::mojom::DiagnosticRoutineEnum::kCpuCache, - ash::health::mojom::DiagnosticRoutineEnum::kFloatingPointAccuracy, - ash::health::mojom::DiagnosticRoutineEnum::kPrimeSearch, - ash::health::mojom::DiagnosticRoutineEnum::kCpuStress, - ash::health::mojom::DiagnosticRoutineEnum::kDiskRead, - ash::health::mojom::DiagnosticRoutineEnum::kLanConnectivity, - ash::health::mojom::DiagnosticRoutineEnum::kMemory, - ash::health::mojom::DiagnosticRoutineEnum::kNvmeWearLevel, - ash::health::mojom::DiagnosticRoutineEnum::kSmartctlCheck, + crosapi::mojom::DiagnosticsRoutineEnum::kAcPower, + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryCapacity, + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryCharge, + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryDischarge, + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryHealth, + crosapi::mojom::DiagnosticsRoutineEnum::kCpuCache, + crosapi::mojom::DiagnosticsRoutineEnum::kFloatingPointAccuracy, + crosapi::mojom::DiagnosticsRoutineEnum::kPrimeSearch, + crosapi::mojom::DiagnosticsRoutineEnum::kCpuStress, + crosapi::mojom::DiagnosticsRoutineEnum::kDiskRead, + crosapi::mojom::DiagnosticsRoutineEnum::kLanConnectivity, + crosapi::mojom::DiagnosticsRoutineEnum::kMemory, + crosapi::mojom::DiagnosticsRoutineEnum::kNvmeWearLevel, + crosapi::mojom::DiagnosticsRoutineEnum::kSmartctlCheck, }); SetServiceForTesting(std::move(fake_service_impl)); @@ -98,21 +99,21 @@ // Configure FakeDiagnosticsService. { auto nonInteractiveRoutineUpdate = - ash::health::mojom::NonInteractiveRoutineUpdate::New(); + crosapi::mojom::DiagnosticsNonInteractiveRoutineUpdate::New(); nonInteractiveRoutineUpdate->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; nonInteractiveRoutineUpdate->status_message = "Routine ran by Google."; auto routineUpdateUnion = - ash::health::mojom::RoutineUpdateUnion::NewNoninteractiveUpdate( + crosapi::mojom::DiagnosticsRoutineUpdateUnion::NewNoninteractiveUpdate( std::move(nonInteractiveRoutineUpdate)); - auto response = ash::health::mojom::RoutineUpdate::New(); + auto response = crosapi::mojom::DiagnosticsRoutineUpdate::New(); response->progress_percent = 87; response->routine_update_union = std::move(routineUpdateUnion); // Set the return value for a call to GetAvailableRoutines. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRoutineUpdateResponse(std::move(response)); // Set the expected passed parameters. @@ -122,7 +123,7 @@ expected_result.Set( "command", static_cast<int32_t>( - ash::health::mojom::DiagnosticRoutineCommandEnum::kGetStatus)); + crosapi::mojom::DiagnosticsRoutineCommandEnum::kGetStatus)); expected_result.Set("include_output", true); fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); @@ -158,30 +159,29 @@ // Configure FakeDiagnosticsService. { auto interactiveRoutineUpdate = - ash::health::mojom::InteractiveRoutineUpdate::New(); + crosapi::mojom::DiagnosticsInteractiveRoutineUpdate::New(); interactiveRoutineUpdate->user_message = - ash::health::mojom::DiagnosticRoutineUserMessageEnum::kUnplugACPower; + crosapi::mojom::DiagnosticsRoutineUserMessageEnum::kUnplugACPower; auto routineUpdateUnion = - ash::health::mojom::RoutineUpdateUnion::NewInteractiveUpdate( + crosapi::mojom::DiagnosticsRoutineUpdateUnion::NewInteractiveUpdate( std::move(interactiveRoutineUpdate)); - auto response = ash::health::mojom::RoutineUpdate::New(); + auto response = crosapi::mojom::DiagnosticsRoutineUpdate::New(); response->progress_percent = 50; response->output = "routine is running..."; response->routine_update_union = std::move(routineUpdateUnion); // Set the return value for a call to GetAvailableRoutines. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRoutineUpdateResponse(std::move(response)); // Set the expected passed parameters. base::Value::Dict expected_result; expected_result.Set("id", 654321); expected_result.Set( - "command", - static_cast<int32_t>( - ash::health::mojom::DiagnosticRoutineCommandEnum::kRemove)); + "command", static_cast<int32_t>( + crosapi::mojom::DiagnosticsRoutineCommandEnum::kRemove)); expected_result.Set("include_output", true); fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); @@ -218,26 +218,28 @@ RunAcPowerRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunAcPowerRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; - expected_result.Set("expected_status", - static_cast<int32_t>( - ash::health::mojom::AcPowerStatusEnum::kConnected)); + expected_result.Set( + "expected_status", + static_cast<int32_t>( + crosapi::mojom::DiagnosticsAcPowerStatusEnum::kConnected)); expected_result.Set("expected_power_type", "ac_power"); // Set the expected runtime actions. fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kAcPower); + crosapi::mojom::DiagnosticsRoutineEnum::kAcPower); SetServiceForTesting(std::move(fake_service_impl)); } @@ -263,18 +265,19 @@ RunBatteryCapacityRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunBatteryCapacityRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); // Set the expected called routine. fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kBatteryCapacity); + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryCapacity); SetServiceForTesting(std::move(fake_service_impl)); } @@ -295,13 +298,14 @@ RunBatteryChargeRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunBatteryChargeRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; @@ -312,7 +316,7 @@ fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kBatteryCharge); + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryCharge); SetServiceForTesting(std::move(fake_service_impl)); } @@ -338,13 +342,14 @@ RunBatteryDischargeRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunBatteryDischargeRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; @@ -355,7 +360,7 @@ fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kBatteryDischarge); + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryDischarge); SetServiceForTesting(std::move(fake_service_impl)); } @@ -381,18 +386,19 @@ RunBatteryHealthRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunBatteryHealthRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); // Set the expected called routine. fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kBatteryHealth); + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryHealth); SetServiceForTesting(std::move(fake_service_impl)); } @@ -413,13 +419,14 @@ RunCpuCacheRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunCpuCacheRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; @@ -429,7 +436,7 @@ fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kCpuCache); + crosapi::mojom::DiagnosticsRoutineEnum::kCpuCache); SetServiceForTesting(std::move(fake_service_impl)); } @@ -454,13 +461,14 @@ RunCpuFloatingPointAccuracyRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunCpuFloatingPointAccuracyRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; @@ -470,7 +478,7 @@ fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kFloatingPointAccuracy); + crosapi::mojom::DiagnosticsRoutineEnum::kFloatingPointAccuracy); SetServiceForTesting(std::move(fake_service_impl)); } @@ -495,13 +503,14 @@ RunCpuPrimeSearchRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunCpuPrimeSearchRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; @@ -511,7 +520,7 @@ fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kPrimeSearch); + crosapi::mojom::DiagnosticsRoutineEnum::kPrimeSearch); SetServiceForTesting(std::move(fake_service_impl)); } @@ -536,13 +545,14 @@ RunCpuStressRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunCpuStressRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; @@ -552,7 +562,7 @@ fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kCpuStress); + crosapi::mojom::DiagnosticsRoutineEnum::kCpuStress); SetServiceForTesting(std::move(fake_service_impl)); } @@ -577,19 +587,21 @@ RunDiskReadRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunDiskReadRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; expected_result.Set( - "type", static_cast<int32_t>( - ash::health::mojom::DiskReadRoutineTypeEnum::kLinearRead)); + "type", + static_cast<int32_t>( + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum::kLinearRead)); expected_result.Set("length_seconds", 20); expected_result.Set("file_size_mb", 1000); @@ -597,7 +609,7 @@ fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kDiskRead); + crosapi::mojom::DiagnosticsRoutineEnum::kDiskRead); SetServiceForTesting(std::move(fake_service_impl)); } @@ -624,18 +636,19 @@ RunLanConnectivityRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunLanConnectivityRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); // Set the expected called routine. fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kLanConnectivity); + crosapi::mojom::DiagnosticsRoutineEnum::kLanConnectivity); SetServiceForTesting(std::move(fake_service_impl)); } @@ -656,18 +669,19 @@ RunMemoryRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunMemoryRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); // Set the expected called routine. fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kMemory); + crosapi::mojom::DiagnosticsRoutineEnum::kMemory); SetServiceForTesting(std::move(fake_service_impl)); } @@ -688,13 +702,14 @@ RunNvmeWearLevelRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunNvmeWearLevelRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); base::Value::Dict expected_result; @@ -704,7 +719,7 @@ fake_service_impl->SetExpectedLastPassedParameters( std::move(expected_result)); fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kNvmeWearLevel); + crosapi::mojom::DiagnosticsRoutineEnum::kNvmeWearLevel); SetServiceForTesting(std::move(fake_service_impl)); } @@ -729,18 +744,19 @@ RunSmartctlCheckRoutineSuccess) { // Configure FakeDiagnosticsService. { - auto expected_response = ash::health::mojom::RunRoutineResponse::New(); + auto expected_response = + crosapi::mojom::DiagnosticsRunRoutineResponse::New(); expected_response->id = 0; expected_response->status = - ash::health::mojom::DiagnosticRoutineStatusEnum::kReady; + crosapi::mojom::DiagnosticsRoutineStatusEnum::kReady; // Set the return value for a call to RunSmartctlCheckRoutine. - auto fake_service_impl = std::make_unique<ash::FakeDiagnosticsService>(); + auto fake_service_impl = std::make_unique<FakeDiagnosticsService>(); fake_service_impl->SetRunRoutineResponse(std::move(expected_response)); // Set the expected called routine. fake_service_impl->SetExpectedLastCalledRoutine( - ash::health::mojom::DiagnosticRoutineEnum::kSmartctlCheck); + crosapi::mojom::DiagnosticsRoutineEnum::kSmartctlCheck); SetServiceForTesting(std::move(fake_service_impl)); }
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.cc b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.cc index 9a2654c..935f3d6 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.cc
@@ -4,22 +4,23 @@ #include "chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.h" -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" #include "base/notreached.h" #include "chrome/common/chromeos/extensions/api/diagnostics.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" namespace chromeos { namespace converters { namespace { -using MojoRoutineCommandType = ash::health::mojom::DiagnosticRoutineCommandEnum; -using MojoRoutineStatus = ::ash::health::mojom::DiagnosticRoutineStatusEnum; -using MojoRoutineType = ::ash::health::mojom::DiagnosticRoutineEnum; -using MojoAcPowerStatusType = ash::health::mojom::AcPowerStatusEnum; +using MojoRoutineCommandType = crosapi::mojom::DiagnosticsRoutineCommandEnum; +using MojoRoutineStatus = ::crosapi::mojom::DiagnosticsRoutineStatusEnum; +using MojoRoutineType = ::crosapi::mojom::DiagnosticsRoutineEnum; +using MojoAcPowerStatusType = crosapi::mojom::DiagnosticsAcPowerStatusEnum; using MojoRoutineUserMessageType = - ash::health::mojom::DiagnosticRoutineUserMessageEnum; -using MojoDiskReadRoutineType = ash::health::mojom::DiskReadRoutineTypeEnum; + crosapi::mojom::DiagnosticsRoutineUserMessageEnum; +using MojoDiskReadRoutineType = + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum; using RoutineCommandType = ::chromeos::api::os_diagnostics::RoutineCommandType; using RoutineStatus = ::chromeos::api::os_diagnostics::RoutineStatus;
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.h b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.h index 33bc3bab..a50ef23 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.h +++ b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.h
@@ -5,28 +5,28 @@ #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_DIAGNOSTICS_API_CONVERTERS_H_ #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_DIAGNOSTICS_API_CONVERTERS_H_ -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" #include "chrome/common/chromeos/extensions/api/diagnostics.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" namespace chromeos { namespace converters { -bool ConvertMojoRoutine(ash::health::mojom::DiagnosticRoutineEnum in, +bool ConvertMojoRoutine(crosapi::mojom::DiagnosticsRoutineEnum in, chromeos::api::os_diagnostics::RoutineType* out); chromeos::api::os_diagnostics::RoutineStatus ConvertRoutineStatus( - ash::health::mojom::DiagnosticRoutineStatusEnum status); + crosapi::mojom::DiagnosticsRoutineStatusEnum status); -ash::health::mojom::DiagnosticRoutineCommandEnum ConvertRoutineCommand( +crosapi::mojom::DiagnosticsRoutineCommandEnum ConvertRoutineCommand( chromeos::api::os_diagnostics::RoutineCommandType commandType); -ash::health::mojom::AcPowerStatusEnum ConvertAcPowerStatusRoutineType( +crosapi::mojom::DiagnosticsAcPowerStatusEnum ConvertAcPowerStatusRoutineType( chromeos::api::os_diagnostics::AcPowerStatus routineType); chromeos::api::os_diagnostics::UserMessageType ConvertRoutineUserMessage( - ash::health::mojom::DiagnosticRoutineUserMessageEnum userMessage); + crosapi::mojom::DiagnosticsRoutineUserMessageEnum userMessage); -ash::health::mojom::DiskReadRoutineTypeEnum ConvertDiskReadRoutineType( +crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum ConvertDiskReadRoutineType( chromeos::api::os_diagnostics::DiskReadRoutineType routineType); } // namespace converters
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters_unittest.cc b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters_unittest.cc index 6cf1a6a..537f29f5 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters_unittest.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters_unittest.cc
@@ -3,8 +3,8 @@ // found in the LICENSE file. #include "chrome/browser/chromeos/extensions/telemetry/api/diagnostics_api_converters.h" -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" #include "chrome/common/chromeos/extensions/api/diagnostics.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos { @@ -12,13 +12,14 @@ namespace { -using MojoRoutineCommandType = ash::health::mojom::DiagnosticRoutineCommandEnum; -using MojoRoutineStatus = ::ash::health::mojom::DiagnosticRoutineStatusEnum; -using MojoRoutineType = ::ash::health::mojom::DiagnosticRoutineEnum; +using MojoRoutineCommandType = crosapi::mojom::DiagnosticsRoutineCommandEnum; +using MojoRoutineStatus = ::crosapi::mojom::DiagnosticsRoutineStatusEnum; +using MojoRoutineType = ::crosapi::mojom::DiagnosticsRoutineEnum; using MojoRoutineUserMessageType = - ash::health::mojom::DiagnosticRoutineUserMessageEnum; -using MojoDiskReadRoutineType = ash::health::mojom::DiskReadRoutineTypeEnum; -using MojoAcPowerStatusType = ash::health::mojom::AcPowerStatusEnum; + crosapi::mojom::DiagnosticsRoutineUserMessageEnum; +using MojoDiskReadRoutineType = + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum; +using MojoAcPowerStatusType = crosapi::mojom::DiagnosticsAcPowerStatusEnum; using RoutineCommandType = ::chromeos::api::os_diagnostics::RoutineCommandType; using RoutineStatus = ::chromeos::api::os_diagnostics::RoutineStatus;
diff --git a/ash/webui/telemetry_extension_ui/services/fake_diagnostics_service.cc b/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.cc similarity index 78% rename from ash/webui/telemetry_extension_ui/services/fake_diagnostics_service.cc rename to chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.cc index 26783c5..5223c67a 100644 --- a/ash/webui/telemetry_extension_ui/services/fake_diagnostics_service.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.cc
@@ -2,37 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.h" + #include <memory> #include <utility> #include <vector> -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" -#include "ash/webui/telemetry_extension_ui/services/fake_diagnostics_service.h" #include "base/bind.h" #include "base/location.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/values.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" -namespace ash { - -FakeDiagnosticsService::Factory::Factory() = default; -FakeDiagnosticsService::Factory::~Factory() = default; - -void FakeDiagnosticsService::Factory::SetCreateInstanceResponse( - std::unique_ptr<FakeDiagnosticsService> fake_service) { - fake_service_ = std::move(fake_service); -} - -std::unique_ptr<health::mojom::DiagnosticsService> -FakeDiagnosticsService::Factory::CreateInstance( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver) { - DCHECK(fake_service_); - fake_service_->BindPendingReceiver(std::move(receiver)); - return std::move(fake_service_); -} +namespace chromeos { FakeDiagnosticsService::FakeDiagnosticsService() : receiver_(this) {} @@ -42,6 +27,11 @@ EXPECT_EQ(actual_called_routine_, expected_called_routine_); } +void FakeDiagnosticsService::BindPendingReceiver( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver) { + receiver_.Bind(std::move(receiver)); +} + void FakeDiagnosticsService::GetAvailableRoutines( GetAvailableRoutinesCallback callback) { base::SequencedTaskRunnerHandle::Get()->PostTask( @@ -51,7 +41,7 @@ void FakeDiagnosticsService::GetRoutineUpdate( int32_t id, - health::mojom::DiagnosticRoutineCommandEnum command, + crosapi::mojom::DiagnosticsRoutineCommandEnum command, bool include_output, GetRoutineUpdateCallback callback) { actual_passed_parameters_.clear(); @@ -68,7 +58,7 @@ RunBatteryCapacityRoutineCallback callback) { actual_passed_parameters_.clear(); actual_called_routine_ = - health::mojom::DiagnosticRoutineEnum::kBatteryCapacity; + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryCapacity; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), run_routine_response_->Clone())); @@ -77,7 +67,8 @@ void FakeDiagnosticsService::RunBatteryHealthRoutine( RunBatteryHealthRoutineCallback callback) { actual_passed_parameters_.clear(); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kBatteryHealth; + actual_called_routine_ = + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryHealth; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), run_routine_response_->Clone())); @@ -86,14 +77,15 @@ void FakeDiagnosticsService::RunSmartctlCheckRoutine( RunSmartctlCheckRoutineCallback callback) { actual_passed_parameters_.clear(); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kSmartctlCheck; + actual_called_routine_ = + crosapi::mojom::DiagnosticsRoutineEnum::kSmartctlCheck; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), run_routine_response_->Clone())); } void FakeDiagnosticsService::RunAcPowerRoutine( - health::mojom::AcPowerStatusEnum expected_status, + crosapi::mojom::DiagnosticsAcPowerStatusEnum expected_status, const absl::optional<std::string>& expected_power_type, RunAcPowerRoutineCallback callback) { actual_passed_parameters_.clear(); @@ -104,7 +96,7 @@ expected_power_type.value()); } - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kAcPower; + actual_called_routine_ = crosapi::mojom::DiagnosticsRoutineEnum::kAcPower; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -118,7 +110,7 @@ actual_passed_parameters_.Set("length_seconds", static_cast<int32_t>(length_seconds)); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kCpuCache; + actual_called_routine_ = crosapi::mojom::DiagnosticsRoutineEnum::kCpuCache; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -132,7 +124,7 @@ actual_passed_parameters_.Set("length_seconds", static_cast<int32_t>(length_seconds)); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kCpuStress; + actual_called_routine_ = crosapi::mojom::DiagnosticsRoutineEnum::kCpuStress; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -147,7 +139,7 @@ static_cast<int32_t>(length_seconds)); actual_called_routine_ = - health::mojom::DiagnosticRoutineEnum::kFloatingPointAccuracy; + crosapi::mojom::DiagnosticsRoutineEnum::kFloatingPointAccuracy; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -161,7 +153,8 @@ actual_passed_parameters_.Set("wear_level_threshold", static_cast<int32_t>(wear_level_threshold)); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kNvmeWearLevel; + actual_called_routine_ = + crosapi::mojom::DiagnosticsRoutineEnum::kNvmeWearLevel; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -169,13 +162,14 @@ } void FakeDiagnosticsService::RunNvmeSelfTestRoutine( - health::mojom::NvmeSelfTestTypeEnum nvme_self_test_type, + crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum nvme_self_test_type, RunNvmeSelfTestRoutineCallback callback) { actual_passed_parameters_.clear(); actual_passed_parameters_.Set("nvme_self_test_type", static_cast<int32_t>(nvme_self_test_type)); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kNvmeSelfTest; + actual_called_routine_ = + crosapi::mojom::DiagnosticsRoutineEnum::kNvmeSelfTest; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -183,7 +177,7 @@ } void FakeDiagnosticsService::RunDiskReadRoutine( - health::mojom::DiskReadRoutineTypeEnum type, + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum type, uint32_t length_seconds, uint32_t file_size_mb, RunDiskReadRoutineCallback callback) { @@ -194,7 +188,7 @@ actual_passed_parameters_.Set("file_size_mb", static_cast<int32_t>(file_size_mb)); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kDiskRead; + actual_called_routine_ = crosapi::mojom::DiagnosticsRoutineEnum::kDiskRead; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -208,7 +202,7 @@ actual_passed_parameters_.Set("length_seconds", static_cast<int32_t>(length_seconds)); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kPrimeSearch; + actual_called_routine_ = crosapi::mojom::DiagnosticsRoutineEnum::kPrimeSearch; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -227,7 +221,7 @@ static_cast<int32_t>(maximum_discharge_percent_allowed)); actual_called_routine_ = - health::mojom::DiagnosticRoutineEnum::kBatteryDischarge; + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryDischarge; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -245,7 +239,8 @@ "minimum_charge_percent_required", static_cast<int32_t>(minimum_charge_percent_required)); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kBatteryCharge; + actual_called_routine_ = + crosapi::mojom::DiagnosticsRoutineEnum::kBatteryCharge; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -255,7 +250,7 @@ void FakeDiagnosticsService::RunMemoryRoutine( RunMemoryRoutineCallback callback) { actual_passed_parameters_.clear(); - actual_called_routine_ = health::mojom::DiagnosticRoutineEnum::kMemory; + actual_called_routine_ = crosapi::mojom::DiagnosticsRoutineEnum::kMemory; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), run_routine_response_->Clone())); @@ -265,24 +260,24 @@ RunLanConnectivityRoutineCallback callback) { actual_passed_parameters_.clear(); actual_called_routine_ = - health::mojom::DiagnosticRoutineEnum::kLanConnectivity; + crosapi::mojom::DiagnosticsRoutineEnum::kLanConnectivity; base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), run_routine_response_->Clone())); } void FakeDiagnosticsService::SetRunRoutineResponse( - health::mojom::RunRoutineResponsePtr response) { + crosapi::mojom::DiagnosticsRunRoutineResponsePtr response) { run_routine_response_ = std::move(response); } void FakeDiagnosticsService::SetAvailableRoutines( - std::vector<health::mojom::DiagnosticRoutineEnum> available_routines) { + std::vector<crosapi::mojom::DiagnosticsRoutineEnum> available_routines) { available_routines_response_ = available_routines; } void FakeDiagnosticsService::SetRoutineUpdateResponse( - health::mojom::RoutineUpdatePtr routine_update) { + crosapi::mojom::DiagnosticsRoutineUpdatePtr routine_update) { routine_update_response_ = std::move(routine_update); } @@ -292,13 +287,8 @@ } void FakeDiagnosticsService::SetExpectedLastCalledRoutine( - health::mojom::DiagnosticRoutineEnum expected_called_routine) { + crosapi::mojom::DiagnosticsRoutineEnum expected_called_routine) { expected_called_routine_ = expected_called_routine; } -void FakeDiagnosticsService::BindPendingReceiver( - mojo::PendingReceiver<health::mojom::DiagnosticsService> receiver) { - receiver_.Bind(std::move(receiver)); -} - -} // namespace ash +} // namespace chromeos
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.h b/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.h new file mode 100644 index 0000000..3b36a9a --- /dev/null +++ b/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.h
@@ -0,0 +1,125 @@ +// Copyright 2022 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. + +#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_FAKE_DIAGNOSTICS_SERVICE_H_ +#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_FAKE_DIAGNOSTICS_SERVICE_H_ + +#include <memory> +#include <vector> + +#include "base/values.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace chromeos { + +class FakeDiagnosticsService : public crosapi::mojom::DiagnosticsService { + public: + FakeDiagnosticsService(); + FakeDiagnosticsService(const FakeDiagnosticsService&) = delete; + FakeDiagnosticsService& operator=(const FakeDiagnosticsService&) = delete; + ~FakeDiagnosticsService() override; + + void BindPendingReceiver( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver); + + // crosapi::health::mojom::DiagnosticsService overrides. + void GetAvailableRoutines(GetAvailableRoutinesCallback callback) override; + void GetRoutineUpdate(int32_t id, + crosapi::mojom::DiagnosticsRoutineCommandEnum command, + bool include_output, + GetRoutineUpdateCallback callback) override; + void RunBatteryCapacityRoutine( + RunBatteryCapacityRoutineCallback callback) override; + void RunBatteryHealthRoutine( + RunBatteryHealthRoutineCallback callback) override; + void RunSmartctlCheckRoutine( + RunSmartctlCheckRoutineCallback callback) override; + void RunAcPowerRoutine( + crosapi::mojom::DiagnosticsAcPowerStatusEnum expected_status, + const absl::optional<std::string>& expected_power_type, + RunAcPowerRoutineCallback callback) override; + void RunCpuCacheRoutine(uint32_t length_seconds, + RunCpuCacheRoutineCallback callback) override; + void RunCpuStressRoutine(uint32_t length_seconds, + RunCpuStressRoutineCallback callback) override; + void RunFloatingPointAccuracyRoutine( + uint32_t length_seconds, + RunFloatingPointAccuracyRoutineCallback callback) override; + void RunNvmeWearLevelRoutine( + uint32_t wear_level_threshold, + RunNvmeWearLevelRoutineCallback callback) override; + void RunNvmeSelfTestRoutine( + crosapi::mojom::DiagnosticsNvmeSelfTestTypeEnum nvme_self_test_type, + RunNvmeSelfTestRoutineCallback callback) override; + void RunDiskReadRoutine( + crosapi::mojom::DiagnosticsDiskReadRoutineTypeEnum type, + uint32_t length_seconds, + uint32_t file_size_mb, + RunDiskReadRoutineCallback callback) override; + void RunPrimeSearchRoutine(uint32_t length_seconds, + RunPrimeSearchRoutineCallback callback) override; + void RunBatteryDischargeRoutine( + uint32_t length_seconds, + uint32_t maximum_discharge_percent_allowed, + RunBatteryDischargeRoutineCallback callback) override; + void RunBatteryChargeRoutine( + uint32_t length_seconds, + uint32_t minimum_charge_percent_required, + RunBatteryChargeRoutineCallback callback) override; + void RunMemoryRoutine(RunMemoryRoutineCallback callback) override; + void RunLanConnectivityRoutine( + RunLanConnectivityRoutineCallback callback) override; + + // Sets the return value for |Run*Routine|. + void SetRunRoutineResponse( + crosapi::mojom::DiagnosticsRunRoutineResponsePtr expected_response); + + // Sets the return value for |GetAvailableRoutines|. + void SetAvailableRoutines( + std::vector<crosapi::mojom::DiagnosticsRoutineEnum> available_routines); + + // Sets the return value for |GetRoutineUpdate|. + void SetRoutineUpdateResponse( + crosapi::mojom::DiagnosticsRoutineUpdatePtr routine_update); + + // Set expectation about the parameter that is passed to a call of + // |Run*Routine| or |GetAvailableRoutines|. + void SetExpectedLastPassedParameters( + base::Value::Dict expected_passed_parameter); + + // Set expectation about the type of routine that is called. + void SetExpectedLastCalledRoutine( + crosapi::mojom::DiagnosticsRoutineEnum expected_called_routine); + + private: + mojo::Receiver<crosapi::mojom::DiagnosticsService> receiver_; + + // Response for a call to |Run*Routine|. + crosapi::mojom::DiagnosticsRunRoutineResponsePtr run_routine_response_; + + // Response for a call to |GetAvailableRoutines|. + std::vector<crosapi::mojom::DiagnosticsRoutineEnum> + available_routines_response_; + + // Response for a call to |GetRoutineUpdate|. + crosapi::mojom::DiagnosticsRoutineUpdatePtr routine_update_response_; + + // Expectation of the passed parameters to a |Run*Routine| call. + base::Value::Dict expected_passed_parameters_; + // Actually passed parameter. + base::Value::Dict actual_passed_parameters_; + + // Expectation of the called routine. + crosapi::mojom::DiagnosticsRoutineEnum expected_called_routine_{ + crosapi::mojom::DiagnosticsRoutineEnum::kUnknown}; + // Actually called routine. + crosapi::mojom::DiagnosticsRoutineEnum actual_called_routine_{ + crosapi::mojom::DiagnosticsRoutineEnum::kUnknown}; +}; +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_FAKE_DIAGNOSTICS_SERVICE_H_
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service_factory.cc b/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service_factory.cc new file mode 100644 index 0000000..7e3ae4cf --- /dev/null +++ b/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service_factory.cc
@@ -0,0 +1,32 @@ +// Copyright 2022 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. + +#include "chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service_factory.h" + +#include <memory> +#include <utility> + +#include "base/check.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" + +namespace chromeos { + +FakeDiagnosticsServiceFactory::FakeDiagnosticsServiceFactory() = default; +FakeDiagnosticsServiceFactory::~FakeDiagnosticsServiceFactory() = default; + +void FakeDiagnosticsServiceFactory::SetCreateInstanceResponse( + std::unique_ptr<FakeDiagnosticsService> fake_service) { + fake_service_ = std::move(fake_service); +} + +std::unique_ptr<crosapi::mojom::DiagnosticsService> +FakeDiagnosticsServiceFactory::CreateInstance( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver) { + DCHECK(fake_service_); + fake_service_->BindPendingReceiver(std::move(receiver)); + return std::move(fake_service_); +} + +} // namespace chromeos
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service_factory.h b/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service_factory.h new file mode 100644 index 0000000..39d00074 --- /dev/null +++ b/chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service_factory.h
@@ -0,0 +1,37 @@ +// Copyright 2022 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. + +#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_FAKE_DIAGNOSTICS_SERVICE_FACTORY_H_ +#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_FAKE_DIAGNOSTICS_SERVICE_FACTORY_H_ + +#include <memory> + +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h" +#include "chrome/browser/chromeos/extensions/telemetry/api/fake_diagnostics_service.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" + +namespace chromeos { +class FakeDiagnosticsServiceFactory + : public ash::DiagnosticsServiceAsh::Factory { + public: + FakeDiagnosticsServiceFactory(); + ~FakeDiagnosticsServiceFactory() override; + + void SetCreateInstanceResponse( + std::unique_ptr<FakeDiagnosticsService> fake_service); + + protected: + // DiagnosticsServiceAsh::Factory: + std::unique_ptr<crosapi::mojom::DiagnosticsService> CreateInstance( + mojo::PendingReceiver<crosapi::mojom::DiagnosticsService> receiver) + override; + + private: + std::unique_ptr<FakeDiagnosticsService> fake_service_; +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_FAKE_DIAGNOSTICS_SERVICE_FACTORY_H_
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.cc b/chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.cc index cde2e054..899a70b4 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.cc
@@ -6,8 +6,8 @@ #include <memory> -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" -#include "ash/webui/telemetry_extension_ui/services/diagnostics_service.h" +#include "chrome/browser/ash/telemetry_extension/diagnostics_service_ash.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" #include "mojo/public/cpp/bindings/remote.h" namespace chromeos { @@ -18,22 +18,21 @@ : public RemoteDiagnosticsServiceStrategy { public: RemoteDiagnosticsServiceStrategyAsh() - : diagnostics_service_(ash::DiagnosticsService::Factory::Create( + : diagnostics_service_(ash::DiagnosticsServiceAsh::Factory::Create( remote_diagnostics_service_.BindNewPipeAndPassReceiver())) {} ~RemoteDiagnosticsServiceStrategyAsh() override = default; // RemoteDiagnosticsServiceStrategy override: - mojo::Remote<ash::health::mojom::DiagnosticsService>& GetRemoteService() + mojo::Remote<crosapi::mojom::DiagnosticsService>& GetRemoteService() override { return remote_diagnostics_service_; } private: - mojo::Remote<ash::health::mojom::DiagnosticsService> - remote_diagnostics_service_; + mojo::Remote<crosapi::mojom::DiagnosticsService> remote_diagnostics_service_; - std::unique_ptr<ash::health::mojom::DiagnosticsService> diagnostics_service_; + std::unique_ptr<crosapi::mojom::DiagnosticsService> diagnostics_service_; }; } // namespace
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.h b/chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.h index 46888b0..910efe40 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.h +++ b/chrome/browser/chromeos/extensions/telemetry/api/remote_diagnostics_service_strategy.h
@@ -7,7 +7,7 @@ #include <memory> -#include "ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom.h" +#include "chromeos/crosapi/mojom/diagnostics_service.mojom.h" #include "mojo/public/cpp/bindings/remote.h" namespace chromeos { @@ -25,7 +25,7 @@ const RemoteDiagnosticsServiceStrategy&) = delete; virtual ~RemoteDiagnosticsServiceStrategy(); - virtual mojo::Remote<ash::health::mojom::DiagnosticsService>& + virtual mojo::Remote<crosapi::mojom::DiagnosticsService>& GetRemoteService() = 0; protected:
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.cc b/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.cc index 55e24db..7465aab 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.cc
@@ -6,14 +6,23 @@ #include <memory> -#include "chrome/browser/ash/telemetry_extension/probe_service_ash.h" +#include "build/chromeos_buildflags.h" #include "chromeos/crosapi/mojom/probe_service.mojom.h" #include "mojo/public/cpp/bindings/remote.h" +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ash/telemetry_extension/probe_service_ash.h" +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/lacros/lacros_service.h" +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) + namespace chromeos { namespace { +#if BUILDFLAG(IS_CHROMEOS_ASH) class RemoteProbeServiceStrategyAsh : public RemoteProbeServiceStrategy { public: RemoteProbeServiceStrategyAsh() @@ -32,13 +41,33 @@ std::unique_ptr<crosapi::mojom::ProbeService> probe_service_; }; +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +#if BUILDFLAG(IS_CHROMEOS_LACROS) +class RemoteProbeServiceStrategyLacros : public RemoteProbeServiceStrategy { + public: + RemoteProbeServiceStrategyLacros() = default; + + ~RemoteProbeServiceStrategyLacros() override = default; + + // RemoteProbeServiceStrategy override: + mojo::Remote<ash::mojom::ProbeService>& GetRemoteService() override { + return LacrosService::Get()->GetRemote<crosapi::mojom::ProbeService>(); + } +}; +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) } // namespace // static std::unique_ptr<RemoteProbeServiceStrategy> RemoteProbeServiceStrategy::Create() { +#if BUILDFLAG(IS_CHROMEOS_ASH) return std::make_unique<RemoteProbeServiceStrategyAsh>(); +#endif // BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS_LACROS) + return std::make_unique<RemoteProbeServiceStrategyLacros>(); +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) } RemoteProbeServiceStrategy::RemoteProbeServiceStrategy() = default;
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index 4f49cd8..2f17e37 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -33,6 +33,7 @@ #include "components/content_settings/core/browser/website_settings_info.h" #include "components/content_settings/core/browser/website_settings_registry.h" #include "components/content_settings/core/common/content_settings_pattern.h" +#include "components/content_settings/core/common/content_settings_types.h" #include "components/content_settings/core/common/content_settings_utils.h" #include "components/content_settings/core/common/pref_names.h" #include "components/content_settings/core/test/content_settings_test_utils.h" @@ -1812,7 +1813,8 @@ HostContentSettingsMap* host_content_settings_map = HostContentSettingsMapFactory::GetForProfile(&profile); - // Testing case: WebsiteSettingsInfo::REQUESTING_DOMAIN_ONLY_SCOPE. + // Testing case: + // WebsiteSettingsInfo::REQUESTING_ORIGIN_WITH_TOP_ORIGIN_EXCEPTIONS_SCOPE. host_content_settings_map->SetContentSettingDefaultScope( primary_url, secondary_url, ContentSettingsType::COOKIES, CONTENT_SETTING_ALLOW); @@ -1826,35 +1828,11 @@ ContentSettingsPattern::FromURL(primary_url)); EXPECT_EQ(settings[0].secondary_pattern, ContentSettingsPattern::Wildcard()); - // Testing case: WebsiteSettingsInfo::TOP_LEVEL_ORIGIN_ONLY_SCOPE. - host_content_settings_map->SetContentSettingDefaultScope( - primary_url, secondary_url, ContentSettingsType::JAVASCRIPT, - CONTENT_SETTING_ALLOW); - - host_content_settings_map->GetSettingsForOneType( - ContentSettingsType::JAVASCRIPT, &settings); - - EXPECT_EQ(settings[0].primary_pattern, - ContentSettingsPattern::FromURLNoWildcard(primary_url)); - EXPECT_EQ(settings[0].secondary_pattern, ContentSettingsPattern::Wildcard()); - - // Testing case: WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE. - host_content_settings_map->SetContentSettingDefaultScope( - primary_url, secondary_url, ContentSettingsType::NOTIFICATIONS, - CONTENT_SETTING_ALLOW); - - host_content_settings_map->GetSettingsForOneType( - ContentSettingsType::NOTIFICATIONS, &settings); - - EXPECT_EQ(settings[0].primary_pattern, - ContentSettingsPattern::FromURLNoWildcard(primary_url)); - EXPECT_EQ(settings[0].secondary_pattern, ContentSettingsPattern::Wildcard()); - - // Testing case: - // WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE. + // Testing cases: + // WebsiteSettingsInfo::REQUESTING_AND_TOP_ORIGIN_SCOPE, host_content_settings_map->SetContentSettingDefaultScope( primary_url, secondary_url, ContentSettingsType::STORAGE_ACCESS, - CONTENT_SETTING_ASK); + CONTENT_SETTING_ALLOW); host_content_settings_map->GetSettingsForOneType( ContentSettingsType::STORAGE_ACCESS, &settings); @@ -1863,6 +1841,27 @@ ContentSettingsPattern::FromURLNoWildcard(primary_url)); EXPECT_EQ(settings[0].secondary_pattern, ContentSettingsPattern::FromURLNoWildcard(secondary_url)); + + // Testing cases: + // WebsiteSettingsInfo::TOP_ORIGIN_WITH_RESOURCE_EXCEPTIONS_SCOPE, + // WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, + // WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, + // WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE. + for (const auto& kContentSetting : + {ContentSettingsType::JAVASCRIPT, ContentSettingsType::NOTIFICATIONS, + ContentSettingsType::GEOLOCATION, + ContentSettingsType::FEDERATED_IDENTITY_API}) { + host_content_settings_map->SetContentSettingDefaultScope( + primary_url, secondary_url, kContentSetting, CONTENT_SETTING_ALLOW); + + host_content_settings_map->GetSettingsForOneType(kContentSetting, + &settings); + + EXPECT_EQ(settings[0].primary_pattern, + ContentSettingsPattern::FromURLNoWildcard(primary_url)); + EXPECT_EQ(settings[0].secondary_pattern, + ContentSettingsPattern::Wildcard()); + } } // Tests if changing a settings in incognito mode does not affects the regular
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc index 11d631d9..642445c 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.cc +++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -360,6 +360,9 @@ if (key == "enabledExperiments") return SanitizeEnabledExperiments(value); + if (key == "targetType" && value == "tab") + return value; + return std::string(); }
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc index 93f76136..5d6907c 100644 --- a/chrome/browser/devtools/devtools_window.cc +++ b/chrome/browser/devtools/devtools_window.cc
@@ -19,6 +19,7 @@ #include "base/strings/escape.h" #include "base/time/time.h" #include "base/values.h" +#include "chrome/browser/browser_features.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/certificate_viewer.h" #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" @@ -745,6 +746,17 @@ return profile->GetOriginalProfile(); } +namespace { + +scoped_refptr<DevToolsAgentHost> GetOrCreateDevToolsHostForWebContents( + WebContents* wc) { + return base::FeatureList::IsEnabled(::features::kDevToolsTabTarget) + ? DevToolsAgentHost::GetOrCreateForTab(wc) + : DevToolsAgentHost::GetOrCreateFor(wc); +} + +} // namespace + // static void DevToolsWindow::ToggleDevToolsWindow( content::WebContents* inspected_web_contents, @@ -754,7 +766,7 @@ const std::string& settings, DevToolsOpenedByAction opened_by) { scoped_refptr<DevToolsAgentHost> agent( - DevToolsAgentHost::GetOrCreateFor(inspected_web_contents)); + GetOrCreateDevToolsHostForWebContents(inspected_web_contents)); DevToolsWindow* window = FindDevToolsWindow(agent.get()); bool do_open = force_open; if (!window) { @@ -809,7 +821,7 @@ WebContents* web_contents = WebContents::FromRenderFrameHost(inspected_frame_host); scoped_refptr<DevToolsAgentHost> agent( - DevToolsAgentHost::GetOrCreateFor(web_contents)); + GetOrCreateDevToolsHostForWebContents(web_contents)); agent->InspectElement(inspected_frame_host, x, y); bool should_measure_time = !FindDevToolsWindow(agent.get()); base::TimeTicks start_time = base::TimeTicks::Now(); @@ -856,6 +868,8 @@ return std::make_unique<Throttle>(handle, window); } +// TODO(caseq): this method should be removed once we switch to +// using tab target, so we don't currently use tab target here. void DevToolsWindow::UpdateInspectedWebContents( content::WebContents* new_web_contents, base::OnceCallback<void()> callback) { @@ -1177,6 +1191,9 @@ url += "&can_dock=true"; if (!panel.empty()) url += "&panel=" + panel; + if (base::FeatureList::IsEnabled(::features::kDevToolsTabTarget)) { + url += "&targetType=tab"; + } break; case kFrontendWorker: url = kWorkerFrontendURL + remote_base;
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc index 40f3219b..4e123a4 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -274,10 +274,6 @@ updated_credential.note = password_manager::PasswordNote( base::UTF8ToUTF16(*params.note), base::Time::Now()); } - // Collect the credentials that will be edited before executing the edit - // process. - auto forms_to_edit = saved_passwords_presenter_.GetCorrespondingPasswordForms( - *original_credential); switch (saved_passwords_presenter_.EditSavedCredentials(*original_credential, updated_credential)) { case password_manager::SavedPasswordsPresenter::EditResult::kSuccess:
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h b/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h index eca62db..b7f9d78b 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h
@@ -43,8 +43,8 @@ // differences: // - IdGenerator owns a copy of the key data, so that clients don't need to // worry about dangling pointers. -// - Repeated calls to GenerateId with the same |key| are no-ops, and return the -// same ids. +// - Repeated calls to GenerateId with the same |key| return the same ids and +// replace the |key|. template <typename KeyT, typename IdT = int32_t, typename KeyCompare = std::less<>> @@ -57,6 +57,7 @@ // a == b. IdT GenerateId(const KeyT& key) { auto result = key_cache_.emplace(key, next_id_); + IdT id_for_key = result.first->second; if (result.second) { // In case we haven't seen |key| before, add a pointer to the inserted key // and the corresponding id to the |id_cache_|. This insertion should @@ -65,9 +66,15 @@ &result.first->first); DCHECK_EQ(&result.first->first, iter->second); ++next_id_; + } else { + // Refresh the |key| in the caches, as the |result.first->first| may + // compare the same due to |KeyCompare|. + key_cache_.erase(result.first); + auto new_result = key_cache_.emplace(key, id_for_key); + id_cache_[id_for_key] = &new_result.first->first; } - return result.first->second; + return id_for_key; } // This method tries to return the key corresponding to |id|. In case |id| was
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_utils_unittest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_utils_unittest.cc index d3f5d40e..312d47a 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_utils_unittest.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_utils_unittest.cc
@@ -16,6 +16,12 @@ using password_manager::CredentialUIEntry; +struct StringFirstLetterCmp { + bool operator()(const std::string& lhs, const std::string& rhs) const { + return lhs.empty() ? !rhs.empty() : lhs[0] < rhs[0]; + } +}; + } // namespace TEST(CreateUrlCollectionFromFormTest, UrlsFromHtmlForm) { @@ -101,6 +107,20 @@ EXPECT_THAT(id_generator.TryGetKey(bar_id), Pointee(Eq("bar"))); EXPECT_THAT(id_generator.TryGetKey(baz_id), Pointee(Eq("baz"))); + + // Check that due to clashing |KeyCompare|, new |key|s invalidate existing + // |key|. + IdGenerator<std::string, int32_t, StringFirstLetterCmp> + clashing_id_generator_; + int crab_id = clashing_id_generator_.GenerateId("crab"); + + EXPECT_THAT(clashing_id_generator_.TryGetKey(crab_id), Pointee(Eq("crab"))); + + int chromium_id = clashing_id_generator_.GenerateId("chromium"); + + EXPECT_EQ(crab_id, chromium_id); + EXPECT_THAT(clashing_id_generator_.TryGetKey(chromium_id), + Pointee(Eq("chromium"))); } } // namespace extensions
diff --git a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc index a519230..e69be6d 100644 --- a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc +++ b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
@@ -744,12 +744,14 @@ service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* host) { - associated_registry->AddInterface( + associated_registry->AddInterface<mojom::EventRouter>( base::BindRepeating(&EventRouter::BindForRenderer, host->GetID())); - associated_registry->AddInterface(base::BindRepeating( - &ExtensionsGuestView::CreateForComponents, host->GetID())); - associated_registry->AddInterface(base::BindRepeating( - &ExtensionsGuestView::CreateForExtensions, host->GetID())); + associated_registry->AddInterface<guest_view::mojom::GuestViewHost>( + base::BindRepeating(&ExtensionsGuestView::CreateForComponents, + host->GetID())); + associated_registry->AddInterface<extensions::mojom::GuestView>( + base::BindRepeating(&ExtensionsGuestView::CreateForExtensions, + host->GetID())); } } // namespace extensions
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 9c2f34b..b12e65c5 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -371,6 +371,11 @@ "expiry_milestone": 110 }, { + "name": "audio-hfp-mic-sr", + "owners": [ "paulhsia", "cranelw", "chromeos-audio@google.com" ], + "expiry_milestone": 120 + }, + { "name": "audio-settings-page", "owners": [ "gordonseto", "michaelcheco", "cros-peripherals@google.com" ], "expiry_milestone": 113
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 9b27a7e..c8405e8 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -4508,6 +4508,11 @@ "Enable unified desktop mode which allows a window to span multiple " "displays."; +const char kAudioHFPMicSRName[] = + "Audio super-resolution Bluetooth HFP microphone"; +const char kAudioHFPMicSRDescription[] = + "Enable super-resolution Bluetooth HFP microphone recording."; + const char kAudioSettingsPageName[] = "Audio Settings Page"; const char kAudioSettingsPageDescription[] = "Enables the dedicated Audio Settings Page in system settings, which "
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 39c6055..91c5ed2 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2585,6 +2585,9 @@ extern const char kAshEnableUnifiedDesktopName[]; extern const char kAshEnableUnifiedDesktopDescription[]; +extern const char kAudioHFPMicSRName[]; +extern const char kAudioHFPMicSRDescription[]; + extern const char kAudioSettingsPageName[]; extern const char kAudioSettingsPageDescription[];
diff --git a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc index 210bb53..cecfbbfd 100644 --- a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc +++ b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
@@ -25,6 +25,7 @@ #include "components/media_router/common/pref_names.h" #include "components/media_router/common/route_request_result.h" #include "components/prefs/scoped_user_pref_update.h" +#include "content/public/browser/presentation_observer.h" #include "content/public/browser/presentation_request.h" #include "content/public/browser/presentation_screen_availability_listener.h" #include "content/public/browser/render_process_host.h" @@ -85,7 +86,7 @@ }; class MockWebContentsPresentationObserver - : public WebContentsPresentationManager::Observer { + : public content::PresentationObserver { public: explicit MockWebContentsPresentationObserver( content::WebContents* web_contents) { @@ -98,8 +99,7 @@ presentation_manager_->RemoveObserver(this); } - MOCK_METHOD1(OnMediaRoutesChanged, - void(const std::vector<MediaRoute>& routes)); + MOCK_METHOD1(OnPresentationsChanged, void(bool has_presentation)); MOCK_METHOD1(OnDefaultPresentationChanged, void(const content::PresentationRequest* presentation_request)); @@ -459,12 +459,11 @@ RouteRequestResult::FromSuccess(media_route, kPresentationId); StrictMock<MockWebContentsPresentationObserver> observer(GetWebContents()); - EXPECT_CALL(observer, - OnMediaRoutesChanged(std::vector<MediaRoute>({media_route}))); + EXPECT_CALL(observer, OnPresentationsChanged(true)); delegate_impl_->OnPresentationResponse(request, /** connection */ nullptr, *result); - EXPECT_CALL(observer, OnMediaRoutesChanged(std::vector<MediaRoute>())); + EXPECT_CALL(observer, OnPresentationsChanged(false)); delegate_impl_->Terminate(render_process_id, render_frame_id, kPresentationId); } @@ -492,9 +491,9 @@ MockCreatePresentationConnectionCallbacks mock_create_connection_callbacks; delegate_impl_->ReconnectPresentation( *presentation_request_, kPresentationId, - base::BindOnce(&MockCreatePresentationConnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( + &MockCreatePresentationConnectionCallbacks::OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), base::BindOnce( &MockCreatePresentationConnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); @@ -789,9 +788,9 @@ .Times(0); delegate_impl_->ReconnectPresentation( *presentation_request_, kPresentationId, - base::BindOnce(&MockCreatePresentationConnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( + &MockCreatePresentationConnectionCallbacks::OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), base::BindOnce( &MockCreatePresentationConnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); @@ -808,9 +807,9 @@ .Times(1); delegate_impl_->ReconnectPresentation( *presentation_request_, kPresentationId, - base::BindOnce(&MockCreatePresentationConnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( + &MockCreatePresentationConnectionCallbacks::OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), base::BindOnce( &MockCreatePresentationConnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); @@ -846,9 +845,9 @@ .Times(0); delegate_impl_->ReconnectPresentation( *presentation_request_, kPresentationId, - base::BindOnce(&MockCreatePresentationConnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( + &MockCreatePresentationConnectionCallbacks::OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), base::BindOnce( &MockCreatePresentationConnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks))); @@ -866,9 +865,9 @@ .Times(1); delegate_impl_->ReconnectPresentation( *presentation_request_, kPresentationId, - base::BindOnce(&MockCreatePresentationConnectionCallbacks:: - OnCreateConnectionSuccess, - base::Unretained(&mock_create_connection_callbacks)), + base::BindOnce( + &MockCreatePresentationConnectionCallbacks::OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), base::BindOnce( &MockCreatePresentationConnectionCallbacks::OnCreateConnectionError, base::Unretained(&mock_create_connection_callbacks)));
diff --git a/chrome/browser/password_check/android/password_check_manager.h b/chrome/browser/password_check/android/password_check_manager.h index 3ee3b69..be3952e8e 100644 --- a/chrome/browser/password_check/android/password_check_manager.h +++ b/chrome/browser/password_check/android/password_check_manager.h
@@ -12,6 +12,7 @@ #include "base/strings/string_piece_forward.h" #include "chrome/browser/password_check/android/password_check_ui_status.h" #include "chrome/browser/password_entry_edit/android/credential_edit_bridge.h" +#include "chrome/browser/password_manager/account_password_store_factory.h" #include "chrome/browser/password_manager/bulk_leak_check_service_factory.h" #include "chrome/browser/password_manager/password_scripts_fetcher_factory.h" #include "chrome/browser/password_manager/password_store_factory.h" @@ -223,12 +224,6 @@ // Object storing the progress of a running password check. std::unique_ptr<PasswordCheckProgress> progress_; - // Handle to the password store, powering both `saved_passwords_presenter_` - // and `insecure_credentials_manager_`. - scoped_refptr<password_manager::PasswordStoreInterface> password_store_ = - PasswordStoreFactory::GetForProfile(profile_, - ServiceAccessType::EXPLICIT_ACCESS); - // Used to check whether autofill assistant scripts are available for // the specified domain. raw_ptr<password_manager::PasswordScriptsFetcher> password_script_fetcher_ = @@ -238,11 +233,20 @@ // Used by `insecure_credentials_manager_` to obtain the list of saved // passwords. password_manager::SavedPasswordsPresenter saved_passwords_presenter_{ - password_store_}; + PasswordStoreFactory::GetForProfile(profile_, + ServiceAccessType::EXPLICIT_ACCESS), + AccountPasswordStoreFactory::GetForProfile( + profile_, + ServiceAccessType::EXPLICIT_ACCESS)}; // Used to obtain the list of insecure credentials. password_manager::InsecureCredentialsManager insecure_credentials_manager_{ - &saved_passwords_presenter_, password_store_}; + &saved_passwords_presenter_, + PasswordStoreFactory::GetForProfile(profile_, + ServiceAccessType::EXPLICIT_ACCESS), + AccountPasswordStoreFactory::GetForProfile( + profile_, + ServiceAccessType::EXPLICIT_ACCESS)}; // Adapter used to start, monitor and stop a bulk leak check. password_manager::BulkLeakCheckServiceAdapter
diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordStoreBridge.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordStoreBridge.java index a685d61..56ad010 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordStoreBridge.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordStoreBridge.java
@@ -4,6 +4,8 @@ package org.chromium.chrome.browser.password_manager; +import androidx.annotation.VisibleForTesting; + import org.chromium.base.ObserverList; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.NativeMethods; @@ -75,8 +77,9 @@ /** * Inserts new credential into the password store. */ + @VisibleForTesting public void insertPasswordCredential(PasswordStoreCredential credential) { - PasswordStoreBridgeJni.get().insertPasswordCredential( + PasswordStoreBridgeJni.get().insertPasswordCredentialForTesting( mNativePasswordStoreBridge, credential); } @@ -109,13 +112,6 @@ } /** - * Empties the password store. - */ - public void clearAllPasswords() { - PasswordStoreBridgeJni.get().clearAllPasswords(mNativePasswordStoreBridge); - } - - /** * Destroys its C++ counterpart. */ public void destroy() { @@ -152,14 +148,13 @@ @NativeMethods interface Natives { long init(PasswordStoreBridge passwordStoreBridge); - void insertPasswordCredential( + void insertPasswordCredentialForTesting( long nativePasswordStoreBridge, PasswordStoreCredential credential); boolean editPassword(long nativePasswordStoreBridge, PasswordStoreCredential credential, String newPassword); int getPasswordStoreCredentialsCount(long nativePasswordStoreBridge); void getAllCredentials( long nativePasswordStoreBridge, PasswordStoreCredential[] credentials); - void clearAllPasswords(long nativePasswordStoreBridge); void destroy(long nativePasswordStoreBridge); } }
diff --git a/chrome/browser/password_manager/android/password_store_bridge.cc b/chrome/browser/password_manager/android/password_store_bridge.cc index 465ca06..1e65fe5b 100644 --- a/chrome/browser/password_manager/android/password_store_bridge.cc +++ b/chrome/browser/password_manager/android/password_store_bridge.cc
@@ -53,10 +53,10 @@ PasswordStoreBridge::~PasswordStoreBridge() = default; -void PasswordStoreBridge::InsertPasswordCredential( +void PasswordStoreBridge::InsertPasswordCredentialForTesting( JNIEnv* env, const base::android::JavaParamRef<jobject>& credential) { - password_store_->AddLogin(ConvertJavaObjectToPasswordForm(env, credential)); + profile_store_->AddLogin(ConvertJavaObjectToPasswordForm(env, credential)); } bool PasswordStoreBridge::EditPassword( @@ -92,13 +92,6 @@ } } -void PasswordStoreBridge::ClearAllPasswords(JNIEnv* env) { - password_store_->RemoveLoginsCreatedBetween( - base::Time(), base::Time::Max(), - base::BindOnce(&PasswordStoreBridge::OnPasswordStoreCleared, - weak_factory_.GetWeakPtr())); -} - void PasswordStoreBridge::OnPasswordStoreCleared(bool success) { if (success) { saved_passwords_presenter_.Init();
diff --git a/chrome/browser/password_manager/android/password_store_bridge.h b/chrome/browser/password_manager/android/password_store_bridge.h index be8cef82..bc70895 100644 --- a/chrome/browser/password_manager/android/password_store_bridge.h +++ b/chrome/browser/password_manager/android/password_store_bridge.h
@@ -10,6 +10,7 @@ #include "base/android/jni_string.h" #include "base/android/scoped_java_ref.h" #include "base/scoped_observation.h" +#include "chrome/browser/password_manager/account_password_store_factory.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -27,7 +28,7 @@ PasswordStoreBridge& operator=(const PasswordStoreBridge&) = delete; // Called by Java to store a new credential into the password store. - void InsertPasswordCredential( + void InsertPasswordCredentialForTesting( JNIEnv* env, const base::android::JavaParamRef<jobject>& credential); @@ -44,9 +45,6 @@ JNIEnv* env, const base::android::JavaParamRef<jobjectArray>& java_credentials) const; - // Called by Java to clear all stored passwords. - void ClearAllPasswords(JNIEnv* env); - // Called by Java to destroy `this`. void Destroy(JNIEnv* env); @@ -65,14 +63,15 @@ // The corresponding java object. base::android::ScopedJavaGlobalRef<jobject> java_bridge_; - // Handle to the password store, powering `saved_passwords_presenter_`. - scoped_refptr<password_manager::PasswordStoreInterface> password_store_ = + scoped_refptr<password_manager::PasswordStoreInterface> profile_store_ = PasswordStoreFactory::GetForProfile(ProfileManager::GetLastUsedProfile(), ServiceAccessType::EXPLICIT_ACCESS); // Used to fetch and edit passwords. password_manager::SavedPasswordsPresenter saved_passwords_presenter_{ - password_store_}; + profile_store_, AccountPasswordStoreFactory::GetForProfile( + ProfileManager::GetLastUsedProfile(), + ServiceAccessType::EXPLICIT_ACCESS)}; // A scoped observer for `saved_passwords_presenter_`. base::ScopedObservation<password_manager::SavedPasswordsPresenter,
diff --git a/chrome/browser/password_manager/android/password_ui_view_android.cc b/chrome/browser/password_manager/android/password_ui_view_android.cc index c0ac5aa1..ccb7d97 100644 --- a/chrome/browser/password_manager/android/password_ui_view_android.cc +++ b/chrome/browser/password_manager/android/password_ui_view_android.cc
@@ -128,7 +128,7 @@ form.username_value = ConvertJavaStringToUTF16(env, username); form.password_value = ConvertJavaStringToUTF16(env, password); - password_store_->AddLogin(form); + profile_store_->AddLogin(form); } void PasswordUIViewAndroid::UpdatePasswordLists(JNIEnv* env,
diff --git a/chrome/browser/password_manager/android/password_ui_view_android.h b/chrome/browser/password_manager/android/password_ui_view_android.h index c930bce..1c6e199 100644 --- a/chrome/browser/password_manager/android/password_ui_view_android.h +++ b/chrome/browser/password_manager/android/password_ui_view_android.h
@@ -15,6 +15,7 @@ #include "base/android/scoped_java_ref.h" #include "base/memory/raw_ptr.h" #include "chrome/browser/password_entry_edit/android/credential_edit_bridge.h" +#include "chrome/browser/password_manager/account_password_store_factory.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/identity_manager_factory.h" @@ -149,13 +150,15 @@ raw_ptr<SerializationResult> export_target_for_testing_ = nullptr; // Pointer to the password store, powering |saved_passwords_presenter_|. - scoped_refptr<password_manager::PasswordStoreInterface> password_store_ = + scoped_refptr<password_manager::PasswordStoreInterface> profile_store_ = PasswordStoreFactory::GetForProfile(ProfileManager::GetLastUsedProfile(), ServiceAccessType::EXPLICIT_ACCESS); // Manages the list of saved passwords, including updates. password_manager::SavedPasswordsPresenter saved_passwords_presenter_{ - password_store_}; + profile_store_, AccountPasswordStoreFactory::GetForProfile( + ProfileManager::GetLastUsedProfile(), + ServiceAccessType::EXPLICIT_ACCESS)}; // Cached passwords and blocked sites. std::vector<password_manager::CredentialUIEntry> passwords_;
diff --git a/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc b/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc index 98e79d0..16eb2b4 100644 --- a/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc +++ b/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc
@@ -130,7 +130,7 @@ service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* host) { - associated_registry->AddInterface( + associated_registry->AddInterface<chrome::mojom::PluginInfoHost>( base::BindRepeating(&BindPluginInfoHost, host->GetID())); }
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc index 49a2926..6290413 100644 --- a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc +++ b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
@@ -10,6 +10,7 @@ #include "base/memory/raw_ptr.h" #include "base/run_loop.h" #include "base/test/bind.h" +#include "base/test/test_future.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "build/build_config.h" @@ -33,6 +34,7 @@ #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/mock_device_management_service.h" #include "components/policy/core/common/cloud/mock_user_cloud_policy_store.h" +#include "components/policy/core/common/cloud/test/policy_builder.h" #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" #include "components/policy/core/common/schema_registry.h" #include "components/prefs/pref_service.h" @@ -649,6 +651,72 @@ EXPECT_EQ(dm_token_, expected_dm_token); } +// Tests that `FetchPolicyForSignedInUser()` can be called in the middle of a +// client registration. +TEST_F(UserPolicySigninServiceTest, + FetchPolicyForSignedInUserWhileUnregisteredClient) { + identity_test_env()->MakePrimaryAccountAvailable( + kTestUser, signin::ConsentLevel::kSignin); + + // UserCloudPolicyManager should be initialized. + EXPECT_EQ(mock_store_->signin_account_id(), test_account_id_); + ASSERT_TRUE(manager_->core()->service()); + ASSERT_FALSE(manager_->IsClientRegistered()); + // Client registration should not be in progress since the store is not + // yet initialized. + ASSERT_FALSE(IsRequestActive()); + + // `FetchPolicyForSignedInUser()` will notify the callback after the client + // registers and fetches policies. + UserPolicySigninService* signin_service = + UserPolicySigninServiceFactory::GetForProfile(profile_.get()); + network::TestURLLoaderFactory fetch_policy_url_loader_factory; + base::test::TestFuture<bool> future; + signin_service->FetchPolicyForSignedInUser( + test_account_id_, "dm_token", "client-id", + fetch_policy_url_loader_factory.GetSafeWeakWrapper(), + future.GetCallback()); + + // Complete the store initialization with the registration info. + auto data = std::make_unique<enterprise_management::PolicyData>(); + data->set_request_token("fake token"); + data->set_device_id("fake client id"); + mock_store_->set_policy_data_for_testing(std::move(data)); + mock_store_->NotifyStoreLoaded(); + // The client should be registered. + ASSERT_TRUE(manager_->IsClientRegistered()); + // Since there is a signed-in user expect a policy fetch to be started to + // refresh the policy for the user. + DeviceManagementService::JobConfiguration::JobType job_type = + DeviceManagementService::JobConfiguration::TYPE_INVALID; + DeviceManagementService::JobForTesting job; + EXPECT_CALL(job_creation_handler_, OnJobCreation) + .WillOnce(DoAll(device_management_service_.CaptureJobType(&job_type), + SaveArg<0>(&job))); + // A task to trigger policy fetch should have been posted to the task queue. + base::RunLoop().RunUntilIdle(); + Mock::VerifyAndClearExpectations(this); + EXPECT_EQ(DeviceManagementService::JobConfiguration::TYPE_POLICY_FETCH, + job_type); + + EXPECT_CALL(*mock_store_, Store(_)); + // Complete the policy fetch request. + em::DeviceManagementResponse policy_fetch_response; + UserPolicyBuilder policy_builder; + policy_builder.Build(); + policy_fetch_response.mutable_policy_response()->add_responses()->CopyFrom( + policy_builder.policy()); + device_management_service_.SendJobOKNow(&job, policy_fetch_response); + // The callback isn't called until `Store()` completes. + ASSERT_FALSE(future.IsReady()); + Mock::VerifyAndClearExpectations(this); + + mock_store_->NotifyStoreLoaded(); + // `FetchPolicyForSignedInUser()` callback should be executed. + ASSERT_TRUE(future.IsReady()); + EXPECT_TRUE(future.Get()); +} + #endif // !BUILDFLAG(IS_ANDROID) TEST_F(UserPolicySigninServiceSignedInTest, SignOutAfterInit) {
diff --git a/chrome/browser/preloading/prerender/prerender_omnibox_ui_browsertest.cc b/chrome/browser/preloading/prerender/prerender_omnibox_ui_browsertest.cc index f3f7a70..372eb85 100644 --- a/chrome/browser/preloading/prerender/prerender_omnibox_ui_browsertest.cc +++ b/chrome/browser/preloading/prerender/prerender_omnibox_ui_browsertest.cc
@@ -385,7 +385,7 @@ histogram_tester.ExpectUniqueSample( "Prerender.Experimental.PrerenderHostFinalStatus.Embedder_DirectURLInput", - /*PrerenderHost::FinalStatus::kTriggerDestroyed*/ 1, 0); + /*PrerenderHost::FinalStatus::kTriggerDestroyed*/ 16, 0); StartOmniboxNavigationAndWaitForActivation(kPrerenderingUrl);
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_service.h b/chrome/browser/privacy_sandbox/privacy_sandbox_service.h index c906fe5..d230015 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_service.h +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_service.h
@@ -5,20 +5,18 @@ #ifndef CHROME_BROWSER_PRIVACY_SANDBOX_PRIVACY_SANDBOX_SERVICE_H_ #define CHROME_BROWSER_PRIVACY_SANDBOX_PRIVACY_SANDBOX_SERVICE_H_ +#include <set> + #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "base/scoped_observation.h" #include "base/time/time.h" #include "components/content_settings/core/common/content_settings.h" #include "components/keyed_service/core/keyed_service.h" -#include "components/policy/core/common/policy_service.h" #include "components/prefs/pref_change_registrar.h" #include "components/privacy_sandbox/canonical_topic.h" #include "components/privacy_sandbox/privacy_sandbox_settings.h" #include "components/profile_metrics/browser_profile_type.h" -#include "components/signin/public/identity_manager/identity_manager.h" -#include "components/sync/driver/sync_service.h" -#include "components/sync/driver/sync_service_observer.h" class Browser; class PrefService; @@ -47,10 +45,7 @@ // preferences and content settings) by the PrivacySandboxSettings located in // components/privacy_sandbox/, which in turn makes them available to Privacy // Sandbox APIs. -class PrivacySandboxService : public KeyedService, - public policy::PolicyService::Observer, - public syncer::SyncServiceObserver, - public signin::IdentityManager::Observer { +class PrivacySandboxService : public KeyedService { public: // Possible types of Privacy Sandbox prompts that may be shown to the user. // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.privacy_sandbox
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel.js b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel.js index 0c32cf5..d179560 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel.js
@@ -30,7 +30,7 @@ export class Panel extends PanelInterface { /** @override */ setPendingCallback(callback) { - /** @type {?Function} @private */ + /** @type {?function() : !Promise} @private */ Panel.pendingCallback_ = callback; } @@ -342,7 +342,7 @@ } chromevoxMenu.addMenuItem( Msgs.getMsg('open_keyboard_shortcuts_menu'), - `Ctrl+Alt+${localizedSlash}`, '', '', function() { + `Ctrl+Alt+${localizedSlash}`, '', '', async function() { EventGenerator.sendKeyPress( KeyCode.OEM_2 /* forward slash */, {'ctrl': true, 'alt': true}); }); @@ -466,7 +466,7 @@ // Add all open tabs to the Tabs menu. const data = await BackgroundBridge.PanelBackground.getTabMenuData(); for (const menuInfo of data) { - tabsMenu.addMenuItem(menuInfo.title, '', '', '', () => { + tabsMenu.addMenuItem(menuInfo.title, '', '', '', async function() { BackgroundBridge.PanelBackground.focusTab( menuInfo.windowId, menuInfo.tabId); }); @@ -488,7 +488,8 @@ // Add a menu item that disables / closes ChromeVox. chromevoxMenu.addMenuItem( - Msgs.getMsg('disable_chromevox'), 'Ctrl+Alt+Z', '', '', function() { + Msgs.getMsg('disable_chromevox'), 'Ctrl+Alt+Z', '', '', + async function() { Panel.onClose(); }); @@ -1045,7 +1046,6 @@ // Make sure all menus are cleared to avoid bogus output when we re-open. Panel.clearMenus(); - BackgroundBridge.PanelBackground.clearSavedNode(); // Make sure we're not in full-screen mode. Panel.setMode(PanelMode.COLLAPSED); @@ -1055,8 +1055,10 @@ await BackgroundBridge.PanelBackground.waitForPanelCollapse(); if (pendingCallback) { - pendingCallback(); + await pendingCallback(); } + + BackgroundBridge.PanelBackground.clearSavedNode(); } /** Open the tutorial. */
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_interface.js b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_interface.js index cd943da..55bbcdac 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_interface.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_interface.js
@@ -17,7 +17,7 @@ * A callback function to be executed to perform the action from selecting * a menu item after the menu has been closed and focus has been restored * to the page or wherever it was previously. - * @param {?Function} callback + * @param {?function() : !Promise} callback */ setPendingCallback(callback) {} }
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu.js b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu.js index 5d592d2..92016b15 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu.js
@@ -73,7 +73,8 @@ * @param {string} menuItemShortcut The keystrokes to select this item. * @param {string} menuItemBraille * @param {string} gesture - * @param {Function} callback The function to call if this item is selected. + * @param {function() : !Promise} callback The function to call if this item + * is selected. * @param {string=} opt_id An optional id for the menu item element. * @return {!PanelMenuItem} The menu item just created. */ @@ -237,7 +238,7 @@ /** * Get the callback for the active menu item. - * @return {Function} The callback. + * @return {?function() : !Promise} The callback. */ getCallbackForCurrentItem() { if (this.activeIndex_ >= 0 && this.activeIndex_ < this.items_.length) { @@ -249,7 +250,7 @@ /** * Get the callback for a menu item given its DOM element. * @param {Element} element The DOM element. - * @return {Function} The callback. + * @return {?function() : !Promise} The callback. */ getCallbackForElement(element) { for (let i = 0; i < this.items_.length; i++) {
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu_item.js b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu_item.js index 21175905..926ada3 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu_item.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_menu_item.js
@@ -14,7 +14,8 @@ * @param {string} menuItemShortcut The keystrokes to select this item. * @param {string} menuItemBraille The braille keystrokes to select this item. * @param {string} gesture The gesture to select this item. - * @param {Function} callback The function to call if this item is selected. + * @param {function() : !Promise} callback The function to call if this item + * is selected. * @param {string=} opt_id An optional id for the menu item element. */ constructor( @@ -28,7 +29,7 @@ this.menuItemBraille = menuItemBraille; /** @type {string} */ this.gesture = gesture; - /** @type {Function} */ + /** @type {function() : !Promise} */ this.callback = callback; /** @type {Element} */
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_test.js index ca5f5d71..2395712 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/panel/panel_test.js
@@ -278,3 +278,17 @@ this.assertActiveMenuItem( 'panel_menu_touchgestures', 'Click on current item'); }); + +AX_TEST_F('ChromeVoxPanelTest', 'PerformDoDefaultAction', async function() { + const rootNode = await this.runWithLoadedTree(`<button>OK</button>`); + const button = rootNode.find({role: RoleType.BUTTON}); + CommandHandlerInterface.instance.onCommand('showActionsMenu'); + await this.waitForMenu('panel_menu_actions'); + this.fireMockEvent('ArrowDown')(); + this.assertActiveMenuItem('panel_menu_actions', 'Start Or End Selection'); + this.fireMockEvent('ArrowDown')(); + this.fireMockEvent('ArrowDown')(); + this.assertActiveMenuItem('panel_menu_actions', 'Perform default action'); + this.fireMockEvent('Enter')(); + await this.waitForEvent(button, chrome.automation.EventType.CLICKED); +});
diff --git a/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni b/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni index 948028f..c5e4016 100644 --- a/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni +++ b/chrome/browser/resources/chromeos/login/oobe_auto_imports.gni
@@ -64,7 +64,6 @@ "chrome/browser/resources/chromeos/login/keyboard_utils.html|keyboard", "chrome/browser/resources/chromeos/login/login_ui_tools.html|addSubmitListener", "chrome/browser/resources/gaia_auth_host/authenticator.html|Authenticator,AuthFlow,AuthMode,AuthParams,SUPPORTED_PARAMS", - "ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.html|CrFingerprintProgressArcElement", "ui/webui/resources/cr_components/chromeos/multidevice_setup/multidevice_setup_delegate.html|MultiDeviceSetupDelegate", "ui/webui/resources/cr_components/chromeos/network/mojo_interface_provider.html|MojoInterfaceProviderImpl", "ui/webui/resources/cr_components/chromeos/network/network_list_types.html|NetworkList",
diff --git a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn index 9aab714..280a315 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn
@@ -261,9 +261,10 @@ "../../components/buttons:oobe_text_button.m", "../../components/dialogs:oobe_adaptive_dialog.m", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_fingerprint:cr_fingerprint_progress_arc", "//ui/webui/resources/js:load_time_data.m", ] + externs_list = [ "//ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc_externs.js" ] + extra_deps = [ ":fingerprint_setup_module" ] }
diff --git a/chrome/browser/resources/privacy_sandbox/BUILD.gn b/chrome/browser/resources/privacy_sandbox/BUILD.gn index 7da179964..a849442 100644 --- a/chrome/browser/resources/privacy_sandbox/BUILD.gn +++ b/chrome/browser/resources/privacy_sandbox/BUILD.gn
@@ -2,78 +2,28 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//chrome/browser/resources/tools/build_webui.gni") import("//chrome/common/features.gni") -import("//tools/grit/grit_rule.gni") -import("//tools/grit/preprocess_if_expr.gni") -import("//tools/polymer/html_to_wrapper.gni") -import("//tools/typescript/ts_library.gni") -import("//ui/webui/resources/tools/generate_grd.gni") -import("privacy_sandbox.gni") assert(!is_android, "!is_android check failed") -preprocess_folder = "preprocessed" - -grit("resources") { - defines = chrome_grit_defines - - # These arguments are needed since the grd is generated at build time. - enable_input_discovery_for_gn_analyze = false - source = "$target_gen_dir/resources.grd" - deps = [ ":build_grd" ] - - outputs = [ - "grit/privacy_sandbox_resources.h", - "grit/privacy_sandbox_resources_map.cc", - "grit/privacy_sandbox_resources_map.h", - "privacy_sandbox_resources.pak", - ] - output_dir = "$root_gen_dir/chrome" -} - -preprocess_if_expr("preprocess") { - out_folder = "$target_gen_dir/$preprocess_folder" - in_files = ts_files -} - -preprocess_if_expr("preprocess_generated") { - deps = [ ":html_wrapper_files" ] - in_folder = target_gen_dir - out_folder = "$target_gen_dir/$preprocess_folder" - in_files = html_wrapper_files -} - -html_to_wrapper("html_wrapper_files") { - in_files = html_files -} - -ts_library("build_ts") { - root_dir = "$target_gen_dir/$preprocess_folder" - out_dir = "$target_gen_dir/tsc" - composite = true - tsconfig_base = "tsconfig_base.json" - in_files = ts_files + html_wrapper_files - definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ] - deps = [ - "//third_party/polymer/v3_0:library", - "//ui/webui/resources:library", - ] - extra_deps = [ - ":preprocess", - ":preprocess_generated", - ] -} - -generate_grd("build_grd") { +build_webui("build") { grd_prefix = "privacy_sandbox" - out_grd = "$target_gen_dir/resources.grd" - input_files = [ + + static_files = [ "privacy_sandbox_dialog.html", "images/privacy_sandbox_confirmation_banner.svg", "images/privacy_sandbox_confirmation_banner_dark.svg", ] - input_files_base_dir = rebase_path(".", "//") - deps = [ ":build_ts" ] - manifest_files = - filter_include(get_target_outputs(":build_ts"), [ "*.manifest" ]) + + web_component_files = [ "privacy_sandbox_dialog_app.ts" ] + + non_web_component_files = [ "privacy_sandbox_dialog_browser_proxy.ts" ] + + ts_composite = true + ts_definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ] + ts_deps = [ + "//third_party/polymer/v3_0:library", + "//ui/webui/resources:library", + ] }
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox.gni b/chrome/browser/resources/privacy_sandbox/privacy_sandbox.gni deleted file mode 100644 index 2ac978e..0000000 --- a/chrome/browser/resources/privacy_sandbox/privacy_sandbox.gni +++ /dev/null
@@ -1,19 +0,0 @@ -# Copyright 2022 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. - -web_component_files = [ "privacy_sandbox_dialog_app.ts" ] - -# Files that are passed as input to html_to_wrapper(). -html_files = [] -foreach(f, web_component_files) { - html_files += [ string_replace(f, ".ts", ".html") ] -} - -# Files that are generated by html_to_wrapper(). -html_wrapper_files = [] -foreach(f, html_files) { - html_wrapper_files += [ f + ".ts" ] -} - -ts_files = [ "privacy_sandbox_dialog_browser_proxy.ts" ] + web_component_files
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn index 3a26646c..33b223c 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn
@@ -119,7 +119,6 @@ "autofill_page/avatar_icon.ts", "autofill_page/credit_card_edit_dialog.ts", "autofill_page/credit_card_list_entry.ts", - "autofill_page/password_check_edit_dialog.ts", "autofill_page/password_check_edit_disclaimer_dialog.ts", "autofill_page/password_check_list_item.ts", "autofill_page/password_check.ts", @@ -298,6 +297,7 @@ "appearance_page/fonts_browser_proxy.ts", "autofill_page/autofill_manager_proxy.ts", "autofill_page/merge_passwords_store_copies_mixin.ts", + "autofill_page/user_util_mixin.ts", "autofill_page/password_check_mixin.ts", "autofill_page/password_manager_proxy.ts", "autofill_page/password_removal_mixin.ts",
diff --git a/chrome/browser/resources/settings/autofill_page/password_check.html b/chrome/browser/resources/settings/autofill_page/password_check.html index 1cd9cf3..7cd5db9d 100644 --- a/chrome/browser/resources/settings/autofill_page/password_check.html +++ b/chrome/browser/resources/settings/autofill_page/password_check.html
@@ -74,9 +74,9 @@ <!-- If the password check concluded, show only a status Icon. --> <div id="iconContainer" class$="[[iconHaloClass_]]"> <template is="dom-if" if="[[!isCheckInProgress_(status)]]"> - <iron-icon class$="[[getStatusIconClass_(status, isSignedOut_, + <iron-icon class$="[[getStatusIconClass_(status, signedIn, leakedPasswords, weakPasswords)]]" - icon="[[getStatusIcon_(status, isSignedOut_, + icon="[[getStatusIcon_(status, signedIn, leakedPasswords, weakPasswords)]]"> </iron-icon> </template> @@ -143,7 +143,7 @@ </template> </div> <div class="list-frame vertical-list"> - <div class="list-item secondary" hidden$="[[!isSignedOut_]]" + <div class="list-item secondary" hidden$="[[signedIn]]" id="signedOutUserLabel"> <div inner-h-t-m-l="[[getSignedOutUserLabel_(leakedPasswords)]]"></div> </div> @@ -184,7 +184,7 @@ </div> <div class="list-frame vertical-list"> <div class="cr-padded-text secondary" id="weakPasswordsDescription" - inner-h-t-m-l="[[getWeakPasswordsHelpText_(isSyncingPasswords_)]]"> + inner-h-t-m-l="[[getWeakPasswordsHelpText_(isSyncingPasswords)]]"> </div> </div> <div id="weakPasswordList" class="list-frame first"> @@ -242,9 +242,11 @@ </template> </cr-action-menu> <template is="dom-if" if="[[showPasswordEditDialog_]]" restamp> - <settings-password-check-edit-dialog - on-close="onPasswordEditDialogClosed_" item="[[activePassword_]]"> - </settings-password-check-edit-dialog> + <password-edit-dialog on-close="onPasswordEditDialogClosed_" + id="passwordEditDialog" existing-entry="[[activePassword_]]" + saved-passwords="[[savedPasswords]]" + is-account-store-user="[[isAccountStoreUser]]"> + </password-edit-dialog> </template> <template is="dom-if" if="[[showPasswordRemoveDialog_]]" restamp> <settings-password-remove-confirmation-dialog
diff --git a/chrome/browser/resources/settings/autofill_page/password_check.ts b/chrome/browser/resources/settings/autofill_page/password_check.ts index bf6ec76..b0bb261 100644 --- a/chrome/browser/resources/settings/autofill_page/password_check.ts +++ b/chrome/browser/resources/settings/autofill_page/password_check.ts
@@ -14,7 +14,6 @@ import '../i18n_setup.js'; import '../route.js'; import '../prefs/prefs.js'; -import './password_check_edit_dialog.js'; import './password_check_edit_disclaimer_dialog.js'; import './password_check_list_item.js'; import './password_remove_confirmation_dialog.js'; @@ -38,7 +37,6 @@ import {loadTimeData} from '../i18n_setup.js'; // </if> -import {StoredAccount, SyncBrowserProxyImpl, SyncPrefs, SyncStatus} from '../people_page/sync_browser_proxy.js'; import {PrefsMixin, PrefsMixinInterface} from '../prefs/prefs_mixin.js'; import {routes} from '../route.js'; import {Route, RouteObserverMixin, RouteObserverMixinInterface, Router} from '../router.js'; @@ -46,13 +44,13 @@ // <if expr="chromeos_ash or chromeos_lacros"> import {BlockingRequestManager} from './blocking_request_manager.js'; // </if> - +import {MergePasswordsStoreCopiesMixin, MergePasswordsStoreCopiesMixinInterface} from './merge_passwords_store_copies_mixin.js'; import {getTemplate} from './password_check.html.js'; import {PasswordCheckListItemElement} from './password_check_list_item.js'; import {PasswordCheckMixin, PasswordCheckMixinInterface} from './password_check_mixin.js'; import {PasswordCheckInteraction, SavedPasswordListChangedListener} from './password_manager_proxy.js'; import {PasswordRequestorMixin, PasswordRequestorMixinInterface} from './password_requestor_mixin.js'; - +import {UserUtilMixin, UserUtilMixinInterface} from './user_util_mixin.js'; const CheckState = chrome.passwordsPrivate.PasswordCheckState; @@ -78,12 +76,14 @@ } const SettingsPasswordCheckElementBase = - RouteObserverMixin(WebUIListenerMixin(I18nMixin(PrefsMixin( - PasswordRequestorMixin(PasswordCheckMixin((PolymerElement))))))) as { + UserUtilMixin(MergePasswordsStoreCopiesMixin(RouteObserverMixin( + WebUIListenerMixin(I18nMixin(PrefsMixin(PasswordRequestorMixin( + PasswordCheckMixin((PolymerElement))))))))) as { new (): PolymerElement & I18nMixinInterface & WebUIListenerMixinInterface & PrefsMixinInterface & PasswordCheckMixinInterface & PasswordRequestorMixinInterface & - RouteObserverMixinInterface, + RouteObserverMixinInterface & + MergePasswordsStoreCopiesMixinInterface & UserUtilMixinInterface, }; export class SettingsPasswordCheckElement extends @@ -98,8 +98,6 @@ static get properties() { return { - storedAccounts_: Array, - title_: { type: String, computed: 'computeTitle_(status, canUsePasswordCheckup_)', @@ -110,26 +108,15 @@ computed: 'computeMutedLeakedCredentialsTitle_(mutedPasswords)', }, - isSignedOut_: { - type: Boolean, - computed: 'computeIsSignedOut_(syncStatus_, storedAccounts_)', - }, - - isSyncingPasswords_: { - type: Boolean, - computed: 'computeIsSyncingPasswords_(syncPrefs_, syncStatus_)', - }, - canUsePasswordCheckup_: { type: Boolean, - computed: 'computeCanUsePasswordCheckup_(syncPrefs_,' + - 'isSyncingPasswords_)', + computed: 'computeCanUsePasswordCheckup_(syncPrefs, ' + + 'isSyncingPasswords)', }, isButtonHidden_: { type: Boolean, - computed: - 'computeIsButtonHidden_(status, isSignedOut_, isInitialStatus)', + computed: 'computeIsButtonHidden_(status, signedIn, isInitialStatus)', }, isMutePasswordButtonEnabled_: { @@ -142,8 +129,6 @@ computed: 'computeIsUnmutePasswordButtonEnabled_(activePassword_)', }, - syncPrefs_: Object, - syncStatus_: Object, showPasswordEditDialog_: Boolean, showPasswordRemoveDialog_: Boolean, showPasswordEditDisclaimer_: Boolean, @@ -156,7 +141,7 @@ showCompromisedCredentialsBody_: { type: Boolean, computed: 'computeShowCompromisedCredentialsBody_(' + - 'isSignedOut_, leakedPasswords, mutedPasswords)', + 'signedIn, leakedPasswords, mutedPasswords)', }, showMutedPasswordsSection_: { @@ -167,7 +152,7 @@ showNoCompromisedPasswordsLabel_: { type: Boolean, computed: 'computeShowNoCompromisedPasswordsLabel_(' + - 'isSignedOut_, prefs.*, status, leakedPasswords)', + 'signedIn, prefs.*, status, leakedPasswords)', }, showHideMenuTitle_: { @@ -178,7 +163,7 @@ iconHaloClass_: { type: String, computed: 'computeIconHaloClass_(' + - 'status, isSignedOut_, leakedPasswords, weakPasswords)', + 'status, signedIn, leakedPasswords, weakPasswords)', }, /** @@ -196,17 +181,12 @@ }; } - private storedAccounts_: StoredAccount[]; private title_: string; private mutedPasswordsTitle_: string; - private isSignedOut_: boolean; - private isSyncingPasswords_: boolean; private canUsePasswordCheckup_: boolean; private isButtonHidden_: boolean; private isMutePasswordButtonEnabled_: boolean; private isUnmutePasswordButtonEnabled_: boolean; - private syncPrefs_: SyncPrefs; - private syncStatus_: SyncStatus; private showPasswordEditDialog_: boolean; private showPasswordRemoveDialog_: boolean; private showPasswordEditDisclaimer_: boolean; @@ -275,30 +255,6 @@ this.setSavedPasswordsListener_ = setSavedPasswordsListener; this.passwordManager!.addSavedPasswordListChangedListener( setSavedPasswordsListener); - - // Set the manager. These can be overridden by tests. - const syncBrowserProxy = SyncBrowserProxyImpl.getInstance(); - - const syncStatusChanged = (syncStatus: SyncStatus) => this.syncStatus_ = - syncStatus; - const syncPrefsChanged = (syncPrefs: SyncPrefs) => this.syncPrefs_ = - syncPrefs; - - // Listen for changes. - this.addWebUIListener('sync-status-changed', syncStatusChanged); - this.addWebUIListener('sync-prefs-changed', syncPrefsChanged); - - // Request initial data. - syncBrowserProxy.getSyncStatus().then(syncStatusChanged); - syncBrowserProxy.sendSyncPrefsChanged(); - - // For non-ChromeOS, also check whether accounts are available. - // <if expr="not (chromeos_ash or chromeos_lacros)"> - const storedAccountsChanged = (accounts: StoredAccount[]) => - this.storedAccounts_ = accounts; - syncBrowserProxy.getStoredAccounts().then(storedAccountsChanged); - this.addWebUIListener('stored-accounts-updated', storedAccountsChanged); - // </if> } override disconnectedCallback() { @@ -405,8 +361,8 @@ */ private getWeakPasswordsHelpText_(): string { return this.i18nAdvanced( - this.isSyncingPasswords_ ? 'weakPasswordsDescriptionGeneration' : - 'weakPasswordsDescription'); + this.isSyncingPasswords ? 'weakPasswordsDescriptionGeneration' : + 'weakPasswordsDescription'); } private onMoreActionsClick_( @@ -435,6 +391,8 @@ password => { this.activePassword_!.password = password; this.showPasswordEditDialog_ = true; + this.passwordManager!.recordPasswordCheckInteraction( + PasswordCheckInteraction.EDIT_PASSWORD); }, _error => { // <if expr="not (chromeos_ash or chromeos_lacros)"> @@ -772,7 +730,7 @@ * exist. */ private getPasswordsCount_(): string { - return this.isSignedOut_ && this.leakedPasswords.length === 0 ? + return !this.signedIn && this.leakedPasswords.length === 0 ? this.weakPasswordsCount : this.insecurePasswordsCount; } @@ -799,41 +757,22 @@ } /** - * @return true iff the user is signed out. - */ - private computeIsSignedOut_(): boolean { - if (!this.syncStatus_ || !this.syncStatus_.signedIn) { - return !this.storedAccounts_ || this.storedAccounts_.length === 0; - } - return !!this.syncStatus_.hasError; - } - - /** - * @return true iff the user is syncing passwords. - */ - private computeIsSyncingPasswords_(): boolean { - return !!this.syncStatus_ && !!this.syncStatus_.signedIn && - !this.syncStatus_.hasError && !!this.syncPrefs_ && - this.syncPrefs_.passwordsSynced; - } - - /** * @return whether the user can use the online Password Checkup. */ private computeCanUsePasswordCheckup_(): boolean { - return this.isSyncingPasswords_ && - (!this.syncPrefs_ || !this.syncPrefs_.encryptAllData); + return this.isSyncingPasswords && + (!this.syncPrefs || !this.syncPrefs.encryptAllData); } private computeShowCompromisedCredentialsBody_(): boolean { // Always shows compromised credentials section if user is signed out. - return this.isSignedOut_ || this.hasLeakedCredentials_() || + return !this.signedIn || this.hasLeakedCredentials_() || this.computeShowMutedLeakedCredentials_(); } private computeShowNoCompromisedPasswordsLabel_(): boolean { // Check if user isn't signed in. - if (this.isSignedOut_) { + if (!this.signedIn) { return false; }
diff --git a/chrome/browser/resources/settings/autofill_page/password_check_edit_dialog.html b/chrome/browser/resources/settings/autofill_page/password_check_edit_dialog.html deleted file mode 100644 index fb935e1..0000000 --- a/chrome/browser/resources/settings/autofill_page/password_check_edit_dialog.html +++ /dev/null
@@ -1,51 +0,0 @@ - <style include="settings-shared passwords-shared"> - cr-input { - --cr-input-error-display: none; - } - - cr-input:not(:last-of-type) { - margin-bottom: var(--cr-form-field-bottom-spacing); - } - - cr-icon-button { - --cr-icon-button-icon-size: 16px; - margin-inline-start: 2px; - } - - #footnote { - margin-inline-start: 2px; - margin-top: 16px; - } - - </style> - <cr-dialog id="dialog" close-text="$i18n{close}"> - <div slot="title">$i18n{editPasswordTitle}</div> - <div slot="body"> - <cr-input value="[[item.urls.link]]" readonly - label="[[getSiteOrApp_(item.isAndroidCredential)]]"> - </cr-input> - <cr-input value="[[item.username]]" readonly - label="$i18n{editPasswordUsernameLabel}"> - </cr-input> - <cr-input id="passwordInput" value="[[item.password]]" - class="password-input" label="$i18n{editPasswordPasswordLabel}" - type="[[getPasswordInputType_(visible)]]" required auto-validate - invalid="{{inputInvalid_}}"> - <cr-icon-button id="showPasswordButton" - class$="[[showPasswordIcon_(visible)]]" - slot="suffix" on-click="onShowPasswordButtonClick_" - title="[[showPasswordTitle_(visible)]]"> - </cr-icon-button> - </cr-input> - <div id="footnote">[[getFootnote_(item.urls.formattedOrigin)]]</div> - </div> - <div slot="button-container"> - <cr-button id="cancel" class="cancel-button" on-click="onCancel_"> - $i18n{cancel} - </cr-button> - <cr-button id="save" class="action-button" on-click="onSave_" - disabled="[[inputInvalid_]]"> - $i18n{save} - </cr-button> - </div> - </cr-dialog>
diff --git a/chrome/browser/resources/settings/autofill_page/password_check_edit_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_check_edit_dialog.ts deleted file mode 100644 index 404670d..0000000 --- a/chrome/browser/resources/settings/autofill_page/password_check_edit_dialog.ts +++ /dev/null
@@ -1,174 +0,0 @@ -// Copyright 2020 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. - -/** - * @fileoverview 'password-check-edit-dialog' is the dialog that allows showing - * a saved password. - */ - -import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; -import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; -import 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; -import 'chrome://resources/cr_elements/cr_icons_css.m.js'; -import 'chrome://resources/cr_elements/shared_vars_css.m.js'; -import '../icons.html.js'; -import '../settings_shared.css.js'; -import '../settings_vars.css.js'; -import './passwords_shared.css.js'; - -import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; -import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; -import {CrInputElement} from 'chrome://resources/cr_elements/cr_input/cr_input.m.js'; -import {assert} from 'chrome://resources/js/assert_ts.js'; -import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js'; -import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; -import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - -import {getTemplate} from './password_check_edit_dialog.html.js'; -import {PasswordCheckInteraction, PasswordManagerImpl, PasswordManagerProxy} from './password_manager_proxy.js'; - -export interface SettingsPasswordCheckEditDialogElement { - $: { - dialog: CrDialogElement, - cancel: HTMLElement, - passwordInput: CrInputElement, - save: CrButtonElement, - }; -} - -const SettingsPasswordCheckEditDialogElementBase = I18nMixin(PolymerElement); - -export class SettingsPasswordCheckEditDialogElement extends - SettingsPasswordCheckEditDialogElementBase { - static get is() { - return 'settings-password-check-edit-dialog'; - } - - static get template() { - return getTemplate(); - } - - static get properties() { - return { - /** - * The password that the user is interacting with now. - */ - item: Object, - - /** - * Whether the password is visible or obfuscated. - */ - visible: { - type: Boolean, - value: false, - }, - - /** - * Whether the input is invalid. - */ - inputInvalid_: Boolean, - }; - } - - item: chrome.passwordsPrivate.PasswordUiEntry|null; - private visible: boolean; - private inputInvalid_: boolean; - private passwordManager_: PasswordManagerProxy = - PasswordManagerImpl.getInstance(); - - override connectedCallback() { - super.connectedCallback(); - - this.$.dialog.showModal(); - focusWithoutInk(this.$.cancel); - } - - /** Closes the dialog. */ - close() { - this.$.dialog.close(); - } - - /** - * Handler for tapping the 'cancel' button. Should just dismiss the dialog. - */ - private onCancel_() { - this.close(); - } - - /** - * Handler for tapping the 'save' button. Should just dismiss the dialog. - */ - private onSave_() { - this.passwordManager_.recordPasswordCheckInteraction( - PasswordCheckInteraction.EDIT_PASSWORD); - assert(this.item); - const params: chrome.passwordsPrivate.ChangeSavedPasswordParams = { - username: this.item.username, - password: this.$.passwordInput.value, - }; - this.passwordManager_.changeSavedPassword(this.item.id, params) - .finally(() => { - this.close(); - }); - } - - /** - * @return The title text for the show/hide icon. - */ - private showPasswordTitle_(): string { - return this.i18n(this.visible ? 'hidePassword' : 'showPassword'); - } - - /** - * @return The visibility icon class, depending on whether the password is - * already visible. - */ - private showPasswordIcon_(): string { - return this.visible ? 'icon-visibility-off' : 'icon-visibility'; - } - - /** - * @return The type of the password input field (text or password), - * depending on whether the password should be obfuscated. - */ - private getPasswordInputType_(): string { - return this.visible ? 'text' : 'password'; - } - - /** - * Handler for tapping the show/hide button. - */ - private onShowPasswordButtonClick_() { - this.visible = !this.visible; - } - - /** - * @return The text to be displayed as the dialog's footnote. - */ - private getFootnote_(): string { - return this.i18n('editPasswordFootnote', this.item!.urls.shown); - } - - /** - * @return The label for the origin, depending on the whether it's a site or - * an app. - */ - private getSiteOrApp_(): string { - return this.i18n( - this.item!.isAndroidCredential ? 'editPasswordAppLabel' : - 'editPasswordWebsiteLabel'); - } -} - -declare global { - interface HTMLElementTagNameMap { - 'settings-password-check-edit-dialog': - SettingsPasswordCheckEditDialogElement; - } -} - -customElements.define( - SettingsPasswordCheckEditDialogElement.is, - SettingsPasswordCheckEditDialogElement);
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.html b/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.html index 40a60a1..2d6a79b3 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.html +++ b/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.html
@@ -7,10 +7,17 @@ margin-inline-end: 10px; } - .success-icon { + #successIcon { fill: var(--cr-checked-color); } + #errorIcon { + height: 16px; + margin-bottom: auto; + margin-top: auto; + --iron-icon-fill-color: var(--settings-error-color); + } + #tipBox { align-items: center; background: var(--google-grey-50); @@ -34,16 +41,20 @@ <div class="flex"> <template is="dom-if" if="[[isState_(importDialogStateEnum_.SUCCESS, dialogState)]]"> - <iron-icon class="success-icon" icon="settings:check-circle"> + <iron-icon id="successIcon" icon="settings:check-circle"> </iron-icon> </template> + <template is="dom-if" + if="[[isState_(importDialogStateEnum_.ERROR, dialogState)]]"> + <iron-icon id="errorIcon" icon="cr:warning"></iron-icon> + </template> <div id="descriptionText">[[descriptionText_]]</div> </div> <template is="dom-if" if="[[isState_(importDialogStateEnum_.SUCCESS, dialogState)]]"> <div id="tipBox" class="flex"> <iron-icon icon="cr:info-outline"></iron-icon> - <div id="successTip" inner-h-t-m-l="[[getSuccessTip_(results_)]]"></div> + <div id="successTip">[[getSuccessTip_(results_)]]</div> </div> </template> </div> @@ -53,6 +64,14 @@ <cr-button id="cancel" class="cancel-button" on-click="onCancelClick_"> $i18n{cancel} </cr-button> + </template> + <template is="dom-if" + if="[[isState_(importDialogStateEnum_.ERROR, dialogState)]]"> + <cr-button id="close" class="cancel-button" on-click="onCloseClick_"> + $i18n{close} + </cr-button> + </template> + <template is="dom-if" if="[[showChooseFileButton_(dialogState)]]"> <cr-button id="chooseFile" class="action-button" on-click="onChooseFileClick_"> $i18n{importPasswordsChooseFile}
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts b/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts index c9263a7..8bca36eaf 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts
@@ -13,6 +13,7 @@ import '../settings_shared.css.js'; import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; +import {assert, assertNotReached} from 'chrome://resources/js/assert_ts.js'; import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js'; import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -31,6 +32,7 @@ export enum ImportDialogState { START, + ERROR, SUCCESS, } @@ -74,12 +76,40 @@ return this.dialogState === state; } + private showChooseFileButton_(): boolean { + return this.isState_(ImportDialogState.START) || + this.isState_(ImportDialogState.ERROR); + } + /** * Handler for clicking the 'chooseFile' button. It triggers import flow. */ private async onChooseFileClick_() { this.results_ = await this.passwordManager_.importPasswords( chrome.passwordsPrivate.PasswordStoreSet.DEVICE); + switch (this.results_.status) { + case chrome.passwordsPrivate.ImportResultsStatus.SUCCESS: + this.handleSuccess_(); + break; + case chrome.passwordsPrivate.ImportResultsStatus.IO_ERROR: + this.descriptionText_ = this.i18n('importPasswordsUnknownError'); + this.dialogState = ImportDialogState.ERROR; + break; + case chrome.passwordsPrivate.ImportResultsStatus.BAD_FORMAT: + this.descriptionText_ = + this.i18n('importPasswordsBadFormatError', this.results_.fileName); + this.dialogState = ImportDialogState.ERROR; + break; + case chrome.passwordsPrivate.ImportResultsStatus.DISMISSED: + // Dialog state should not change if a system file picker was dismissed. + return; + default: + assertNotReached(); + } + } + + private async handleSuccess_() { + assert(this.results_); this.descriptionText_ = await PluralStringProxyImpl.getInstance().getPluralString( 'importPasswordsSuccessSummaryDevice',
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_section.html b/chrome/browser/resources/settings/autofill_page/passwords_section.html index 1c99a356..7214159a 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_section.html +++ b/chrome/browser/resources/settings/autofill_page/passwords_section.html
@@ -204,33 +204,33 @@ <if expr="chromeos_ash or chromeos_lacros"> token-request-manager="[[tokenRequestManager]]" </if> - is-account-store-user="[[isAccountStoreUser_]]" + is-account-store-user="[[isAccountStoreUser]]" focus-config="[[focusConfig]]" saved-passwords="[[savedPasswords]]"> <div slot="body"> <div class="list-frame"> - <div hidden$="[[!eligibleForAccountStorage_]]" + <div hidden$="[[!eligibleForAccountStorage]]" id="accountStorageButtonsContainer"> <div class="cr-row first two-line list-item" id="accountStorageOptInButtonsContainer"> <settings-avatar-icon id="profileIcon"></settings-avatar-icon> <div class="flex cr-padded-text"> <div id="accountStorageOptInBody" - hidden$="[[isOptedInForAccountStorage_]]"> + hidden$="[[isOptedInForAccountStorage]]"> $i18nRaw{optInAccountStorageBody} </div> <div id="accountStorageOptOutBody" - hidden$="[[!isOptedInForAccountStorage_]]"> + hidden$="[[!isOptedInForAccountStorage]]"> $i18nRaw{optOutAccountStorageBody} </div> - <div id="accountEmail" class="secondary">[[profileEmail_]]</div> + <div id="accountEmail" class="secondary">[[profileEmail]]</div> </div> - <cr-button on-click="onOptIn_" id="optInToAccountStorageButton" - hidden$="[[isOptedInForAccountStorage_]]"> + <cr-button on-click="optInForAccountStorage" id="optInToAccountStorageButton" + hidden$="[[isOptedInForAccountStorage]]"> $i18n{optInAccountStorageLabel} </cr-button> - <cr-button on-click="onOptOut_" id="optOutOfAccountStorageButton" - hidden$="[[!isOptedInForAccountStorage_]]"> + <cr-button on-click="optOutFromAccountStorage" id="optOutOfAccountStorageButton" + hidden$="[[!isOptedInForAccountStorage]]"> $i18n{optOutAccountStorageLabel} </cr-button> </div> @@ -293,12 +293,12 @@ </cr-action-menu> <template is="dom-if" if="[[showAddPasswordDialog_]]" restamp> <password-edit-dialog on-close="onAddPasswordDialogClosed_" - id="addPasswordDialog" account-email="[[profileEmail_]]" + id="addPasswordDialog" account-email="[[profileEmail]]" saved-passwords="[[savedPasswords]]" <if expr="chromeos_ash or chromeos_lacros"> token-request-manager="[[tokenRequestManager]]" </if> - is-account-store-user="[[isAccountStoreUser_]]"> + is-account-store-user="[[isAccountStoreUser]]"> </password-edit-dialog> </template> <template is="dom-if" if="[[showPasswordsExportDialog_]]" restamp>
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_section.ts b/chrome/browser/resources/settings/autofill_page/passwords_section.ts index 933be72..db1dc5ba 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_section.ts +++ b/chrome/browser/resources/settings/autofill_page/passwords_section.ts
@@ -46,7 +46,7 @@ import {HatsBrowserProxyImpl, TrustSafetyInteraction} from '../hats_browser_proxy.js'; import {loadTimeData} from '../i18n_setup.js'; import {OpenWindowProxyImpl} from '../open_window_proxy.js'; -import {StoredAccount, SyncBrowserProxyImpl, SyncPrefs, SyncStatus, TrustedVaultBannerState} from '../people_page/sync_browser_proxy.js'; +import {SyncBrowserProxyImpl, TrustedVaultBannerState} from '../people_page/sync_browser_proxy.js'; import {PrefsMixin, PrefsMixinInterface} from '../prefs/prefs_mixin.js'; import {routes} from '../route.js'; import {Route, RouteObserverMixin, RouteObserverMixinInterface, Router} from '../router.js'; @@ -64,6 +64,7 @@ import {PasswordRequestorMixin, PasswordRequestorMixinInterface} from './password_requestor_mixin.js'; import {PasswordsListHandlerElement} from './passwords_list_handler.js'; import {getTemplate} from './passwords_section.html.js'; +import {UserUtilMixin, UserUtilMixinInterface} from './user_util_mixin.js'; /** * Checks if an HTML element is an editable. An editable is either a text @@ -109,14 +110,15 @@ } const PasswordsSectionElementBase = - MergePasswordsStoreCopiesMixin(PasswordRequestorMixin(PrefsMixin( - GlobalScrollTargetMixin(RouteObserverMixin(WebUIListenerMixin( - I18nMixin(PasswordCheckMixin(PolymerElement)))))))) as { + UserUtilMixin( + MergePasswordsStoreCopiesMixin(PasswordRequestorMixin(PrefsMixin( + GlobalScrollTargetMixin(RouteObserverMixin(WebUIListenerMixin( + I18nMixin(PasswordCheckMixin(PolymerElement))))))))) as { new (): PolymerElement & PasswordCheckMixinInterface & I18nMixinInterface & WebUIListenerMixinInterface & RouteObserverMixinInterface & GlobalScrollTargetMixinInterface & PrefsMixinInterface & PasswordRequestorMixinInterface & - MergePasswordsStoreCopiesMixinInterface, + MergePasswordsStoreCopiesMixinInterface & UserUtilMixinInterface, }; export class PasswordsSectionElement extends PasswordsSectionElementBase { @@ -163,21 +165,6 @@ value: 0, }, - storedAccounts_: Array, - - signedIn_: { - type: Boolean, - value: true, - computed: 'computeSignedIn_(syncStatus_, storedAccounts_)', - }, - - eligibleForAccountStorage_: { - type: Boolean, - value: false, - computed: 'computeEligibleForAccountStorage_(' + - 'syncStatus_, signedIn_, syncPrefs_)', - }, - hasNeverCheckedPasswords_: { type: Boolean, computed: 'computeHasNeverCheckedPasswords_(status)', @@ -208,18 +195,7 @@ type: Boolean, value: true, computed: 'computeShouldShowBanner_(hasLeakedCredentials_,' + - 'signedIn_, hasNeverCheckedPasswords_, hasSavedPasswords_)', - }, - - /** - * If true, the edit dialog and removal notification show - * information about which location(s) a password is stored. - */ - isAccountStoreUser_: { - type: Boolean, - value: false, - computed: 'computeIsAccountStoreUser_(' + - 'eligibleForAccountStorage_, isOptedInForAccountStorage_)', + 'signedIn, hasNeverCheckedPasswords_, hasSavedPasswords_)', }, /** @@ -230,7 +206,7 @@ type: Boolean, value: false, computed: 'computeShouldShowDevicePasswordsLink_(' + - 'isOptedInForAccountStorage_, numberOfDevicePasswords_)', + 'isOptedInForAccountStorage, numberOfDevicePasswords_)', }, /** The visibility state of the trusted vault banner. */ @@ -252,8 +228,8 @@ hidePasswordsLink_: { type: Boolean, - computed: 'computeHidePasswordsLink_(syncPrefs_, syncStatus_, ' + - 'eligibleForAccountStorage_)', + computed: 'computeHidePasswordsLink_(syncPrefs, syncStatus, ' + + 'eligibleForAccountStorage, isUnifiedPasswordManagerEnabled_)', }, isAutomaticPasswordChangeEnabled_: { @@ -293,21 +269,6 @@ value: () => [], }, - profileEmail_: { - type: String, - value: '', - computed: 'getFirstStoredAccountEmail_(storedAccounts_)', - }, - - /** - * The currently selected profile icon as CSS image set. - */ - profileIcon_: String, - - isOptedInForAccountStorage_: Boolean, - syncPrefs_: Object, - syncStatus_: Object, - // <if expr="chromeos_ash or chromeos_lacros"> showPasswordPromptDialog_: Boolean, // </if> @@ -333,16 +294,11 @@ private shownPasswordsCount_: number; private shownExceptionsCount_: number; - - private storedAccounts_: StoredAccount[]; - private signedIn_: boolean; - private eligibleForAccountStorage_: boolean; private hasNeverCheckedPasswords_: boolean; private hasSavedPasswords_: boolean; private numberOfDevicePasswords_: number; private hasPasswordExceptions_: boolean; private shouldShowBanner_: boolean; - private isAccountStoreUser_: boolean; private isAutomaticPasswordChangeEnabled_: boolean; private isPasswordViewPageEnabled_: boolean; private isUnifiedPasswordManagerEnabled_: boolean; @@ -352,11 +308,6 @@ private hasPasskeys_: boolean; private hidePasswordsLink_: boolean; private showImportPasswords_: boolean; - private profileEmail_: string; - private profileIcon_: string; - private isOptedInForAccountStorage_: boolean; - private syncPrefs_: SyncPrefs; - private syncStatus_: SyncStatus; // <if expr="chromeos_ash or chromeos_lacros"> private showPasswordPromptDialog_: boolean; @@ -374,8 +325,6 @@ private passkeysBrowserProxy_: PasskeysBrowserProxy = PasskeysBrowserProxyImpl.getInstance(); // </if> - private setIsOptedInForAccountStorageListener_: - ((isOptedIn: boolean) => void)|null = null; private setPasswordExceptionsListener_: PasswordExceptionListChangedListener| null = null; @@ -418,11 +367,6 @@ override connectedCallback() { super.connectedCallback(); - // Create listener functions. - this.setIsOptedInForAccountStorageListener_ = (optedIn: boolean) => { - this.isOptedInForAccountStorage_ = optedIn; - }; - this.setPasswordExceptionsListener_ = exceptionList => { this.passwordExceptions = exceptionList; }; @@ -441,36 +385,14 @@ // </if> // Request initial data. - this.passwordManager_.isOptedInForAccountStorage().then( - this.setIsOptedInForAccountStorageListener_); this.passwordManager_.getExceptionList(this.setPasswordExceptionsListener_); // Listen for changes. - this.passwordManager_.addAccountStorageOptInStateListener( - this.setIsOptedInForAccountStorageListener_); this.passwordManager_.addExceptionListChangedListener( this.setPasswordExceptionsListener_); const syncBrowserProxy = SyncBrowserProxyImpl.getInstance(); - const syncStatusChanged = (syncStatus: SyncStatus) => this.syncStatus_ = - syncStatus; - syncBrowserProxy.getSyncStatus().then(syncStatusChanged); - this.addWebUIListener('sync-status-changed', syncStatusChanged); - - const syncPrefsChanged = (syncPrefs: SyncPrefs) => this.syncPrefs_ = - syncPrefs; - this.addWebUIListener('sync-prefs-changed', syncPrefsChanged); - syncBrowserProxy.sendSyncPrefsChanged(); - - // For non-ChromeOS, non-Lacros, also check whether accounts are available. - // <if expr="not (chromeos_ash or chromeos_lacros)"> - const storedAccountsChanged = (accounts: StoredAccount[]) => - this.storedAccounts_ = accounts; - syncBrowserProxy.getStoredAccounts().then(storedAccountsChanged); - this.addWebUIListener('stored-accounts-updated', storedAccountsChanged); - // </if> - syncBrowserProxy.sendTrustedVaultBannerStateChanged(); this.addWebUIListener( 'trusted-vault-banner-state-changed', @@ -485,11 +407,6 @@ override disconnectedCallback() { super.disconnectedCallback(); - assert(this.setIsOptedInForAccountStorageListener_); - this.passwordManager_.removeAccountStorageOptInStateListener( - this.setIsOptedInForAccountStorageListener_); - this.setIsOptedInForAccountStorageListener_ = null; - assert(this.setPasswordExceptionsListener_); PasswordManagerImpl.getInstance().removeExceptionListChangedListener( this.setPasswordExceptionsListener_); @@ -514,21 +431,6 @@ !this.prefs.credentials_enable_service.value); } - private computeSignedIn_(): boolean { - return !!this.syncStatus_ && !!this.syncStatus_.signedIn ? - !this.syncStatus_.hasError : - (!!this.storedAccounts_ && this.storedAccounts_.length > 0); - } - - private computeEligibleForAccountStorage_(): boolean { - // The user must have signed in but should have sync disabled - // (|!this.syncStatus_.signedin|). They should not be using a custom - // passphrase to encrypt their sync data, since there's no way for account - // storage users to input their passphrase and decrypt the passwords. - return (!!this.syncStatus_ && !this.syncStatus_.signedIn) && - this.signedIn_ && (!this.syncPrefs_ || !this.syncPrefs_.encryptAllData); - } - private computeHasSavedPasswords_(): boolean { return this.savedPasswords.length > 0; } @@ -546,16 +448,12 @@ } private computeShouldShowBanner_(): boolean { - return this.signedIn_ && this.hasSavedPasswords_ && + return !!this.signedIn && this.hasSavedPasswords_ && this.hasNeverCheckedPasswords_ && !this.hasLeakedCredentials_; } - private computeIsAccountStoreUser_(): boolean { - return this.eligibleForAccountStorage_ && this.isOptedInForAccountStorage_; - } - private computeShouldShowDevicePasswordsLink_(): boolean { - return this.isOptedInForAccountStorage_ && + return this.isOptedInForAccountStorage && (this.numberOfDevicePasswords_ > 0); } @@ -566,9 +464,9 @@ * c) unified password manager for desktop is enabled. */ private computeHidePasswordsLink_(): boolean { - return this.eligibleForAccountStorage_ || - (!!this.syncStatus_ && !!this.syncStatus_.signedIn && - !!this.syncPrefs_ && !!this.syncPrefs_.encryptAllData) || + return !!this.eligibleForAccountStorage || + (!!this.syncStatus && !!this.syncStatus.signedIn && !!this.syncPrefs && + !!this.syncPrefs.encryptAllData) || this.isUnifiedPasswordManagerEnabled_; } @@ -759,30 +657,10 @@ focusWithoutInk(toFocus); } - private onOptIn_() { - this.passwordManager_.optInForAccountStorage(true); - } - - private onOptOut_() { - this.passwordManager_.optInForAccountStorage(false); - } - private showImportOrExportPasswords_(): boolean { return this.hasSavedPasswords_ || this.showImportPasswords_; } - /** - * Return the first available stored account. This is useful when trying to - * figure out the account logged into the content area which seems to always - * be first even if multiple accounts are available. - * @return The email address of the first stored account or an empty string. - */ - private getFirstStoredAccountEmail_(): string { - return !!this.storedAccounts_ && this.storedAccounts_.length > 0 ? - this.storedAccounts_[0].email : - ''; - } - private focusConfigChanged_(_newConfig: FocusConfig, oldConfig: FocusConfig) { // focusConfig is set only once on the parent, so this observer should // only fire once.
diff --git a/chrome/browser/resources/settings/autofill_page/user_util_mixin.ts b/chrome/browser/resources/settings/autofill_page/user_util_mixin.ts new file mode 100644 index 0000000..a7c18d06 --- /dev/null +++ b/chrome/browser/resources/settings/autofill_page/user_util_mixin.ts
@@ -0,0 +1,212 @@ +// Copyright 2022 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. + +import {assert} from 'chrome://resources/js/assert_ts.js'; +import {WebUIListenerMixin, WebUIListenerMixinInterface} from 'chrome://resources/js/web_ui_listener_mixin.js'; +import {dedupingMixin, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {StoredAccount, SyncBrowserProxyImpl, SyncPrefs, SyncStatus} from '../people_page/sync_browser_proxy.js'; + +import {PasswordManagerImpl, PasswordManagerProxy} from './password_manager_proxy.js'; + +type Constructor<T> = new (...args: any[]) => T; + +/** + * This mixin bundles functionality related to syncing, sign in status and + * account storage. It is used by <passwords-section> and <passwords-check>. + */ +export const UserUtilMixin = dedupingMixin( + <T extends Constructor<PolymerElement>>(superClass: T): + (T|WebUIListenerMixinInterface)&Constructor<UserUtilMixinInterface> => { + class UserUtilMixin extends WebUIListenerMixin + (superClass) { + static get properties() { + return { + /** + * The list of stored accounts. + */ + storedAccounts_: Array, + + /** + * Indicates whether user opted in using passwords stored on + * their account. + */ + isOptedInForAccountStorage: Boolean, + syncPrefs: Object, + syncStatus: Object, + + signedIn: { + type: Boolean, + computed: 'computeSignedIn_(syncStatus, storedAccounts_)', + }, + + isSyncingPasswords: { + type: Boolean, + computed: 'computeIsSyncingPasswords_(syncPrefs, syncStatus)', + }, + + /** + * Indicates whether user is eligible to using passwords stored + * on their account. + */ + eligibleForAccountStorage: { + type: Boolean, + computed: 'computeEligibleForAccountStorage_(' + + 'syncStatus, signedIn, syncPrefs)', + }, + + /** + * If true, the edit dialog and removal notification show + * information about which location(s) a password is stored. + */ + isAccountStoreUser: { + type: Boolean, + computed: 'computeIsAccountStoreUser_(' + + 'eligibleForAccountStorage, isOptedInForAccountStorage)', + }, + + profileEmail: { + type: String, + value: '', + computed: 'getFirstStoredAccountEmail_(storedAccounts_)', + }, + }; + } + + isAccountStoreUser: boolean; + isOptedInForAccountStorage: boolean; + syncPrefs: SyncPrefs; + syncStatus: SyncStatus; + profileEmail: string; + signedIn: boolean; + isSyncingPasswords: boolean; + eligibleForAccountStorage: boolean; + + private passwordManager_: PasswordManagerProxy = + PasswordManagerImpl.getInstance(); + private storedAccounts_: StoredAccount[]; + private setIsOptedInForAccountStorageListener_: + ((isOptedIn: boolean) => void)|null = null; + + override connectedCallback() { + super.connectedCallback(); + + // Create listener functions. + this.setIsOptedInForAccountStorageListener_ = (optedIn) => { + this.isOptedInForAccountStorage = optedIn; + }; + // Request initial data. + this.passwordManager_.isOptedInForAccountStorage().then( + this.setIsOptedInForAccountStorageListener_); + + // Listen for changes. + this.passwordManager_.addAccountStorageOptInStateListener( + this.setIsOptedInForAccountStorageListener_!); + + const syncBrowserProxy = SyncBrowserProxyImpl.getInstance(); + + const syncStatusChanged = (syncStatus: SyncStatus) => { + this.syncStatus = syncStatus; + }; + syncBrowserProxy.getSyncStatus().then(syncStatusChanged); + this.addWebUIListener('sync-status-changed', syncStatusChanged); + + const syncPrefsChanged = (syncPrefs: SyncPrefs) => { + this.syncPrefs = syncPrefs; + }; + this.addWebUIListener('sync-prefs-changed', syncPrefsChanged); + syncBrowserProxy.sendSyncPrefsChanged(); + + + // <if expr="not (chromeos_ash or chromeos_lacros)"> + // For non-ChromeOS, non-Lacros, also check whether accounts are + // available. + const storedAccountsChanged = (accounts: StoredAccount[]) => { + this.storedAccounts_ = accounts; + }; + syncBrowserProxy.getStoredAccounts().then(storedAccountsChanged); + this.addWebUIListener( + 'stored-accounts-updated', storedAccountsChanged); + // </if> + } + + override disconnectedCallback() { + super.disconnectedCallback(); + + assert(this.setIsOptedInForAccountStorageListener_); + this.passwordManager_.removeAccountStorageOptInStateListener( + this.setIsOptedInForAccountStorageListener_); + this.setIsOptedInForAccountStorageListener_ = null; + } + + optInForAccountStorage() { + this.passwordManager_.optInForAccountStorage(true); + } + + optOutFromAccountStorage() { + this.passwordManager_.optInForAccountStorage(false); + } + + private computeSignedIn_(): boolean { + return !!this.syncStatus && !!this.syncStatus.signedIn ? + !this.syncStatus.hasError : + (!!this.storedAccounts_ && this.storedAccounts_.length > 0); + } + + /** + * @return true iff the user is syncing passwords. + */ + private computeIsSyncingPasswords_(): boolean { + return !!this.syncStatus && !!this.syncStatus.signedIn && + !this.syncStatus.hasError && !!this.syncPrefs && + this.syncPrefs.passwordsSynced; + } + + private computeEligibleForAccountStorage_(): boolean { + // The user must have signed in but should have sync disabled + // (|!this.syncStatus_.signedin|). They should not be using a + // custom passphrase to encrypt their sync data, since there's no + // way for account storage users to input their passphrase and + // decrypt the passwords. + return (!!this.syncStatus && !this.syncStatus.signedIn) && + this.signedIn && + (!this.syncPrefs || !this.syncPrefs.encryptAllData); + } + + private computeIsAccountStoreUser_(): boolean { + return this.eligibleForAccountStorage && + this.isOptedInForAccountStorage; + } + + /** + * Return the first available stored account. This is useful when + * trying to figure out the account logged into the content area + * which seems to always be first even if multiple accounts are + * available. + * @return The email address of the first stored account or an empty + * string. + */ + private getFirstStoredAccountEmail_(): string { + return !!this.storedAccounts_ && this.storedAccounts_.length > 0 ? + this.storedAccounts_[0].email : + ''; + } + } + + return UserUtilMixin; + }); + + +export interface UserUtilMixinInterface { + isAccountStoreUser: boolean; + isOptedInForAccountStorage: boolean; + syncPrefs: SyncPrefs; + syncStatus: SyncStatus; + profileEmail: string; + signedIn: boolean; + isSyncingPasswords: boolean; + eligibleForAccountStorage: boolean; + optInForAccountStorage(): void; + optOutFromAccountStorage(): void; +}
diff --git a/chrome/browser/resources/settings/chromeos/BUILD.gn b/chrome/browser/resources/settings/chromeos/BUILD.gn index 1fa32fa6..0c903a9 100644 --- a/chrome/browser/resources/settings/chromeos/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/BUILD.gn
@@ -111,6 +111,7 @@ extra_deps = [ ":preprocess_gen_ts_files", ":preprocess_src_ts_files", + "//ash/webui/common/resources:generate_definitions", ] definitions = [ "//tools/typescript/definitions/chrome_send.d.ts",
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn index 7dec4b6..2392dca 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_people_page/BUILD.gn
@@ -175,11 +175,11 @@ ":fingerprint_browser_proxy", "..:metrics_recorder", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/cr_elements/cr_fingerprint:cr_fingerprint_progress_arc", "//ui/webui/resources/cr_elements/cr_lottie:cr_lottie.m", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", ] + externs_list = [ "//ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc_externs.js" ] } js_library("setup_pin_dialog") {
diff --git a/chrome/browser/resources/settings/lazy_load.ts b/chrome/browser/resources/settings/lazy_load.ts index 230fb04..807e802 100644 --- a/chrome/browser/resources/settings/lazy_load.ts +++ b/chrome/browser/resources/settings/lazy_load.ts
@@ -91,7 +91,6 @@ export {SettingsPasskeysSubpageElement} from './autofill_page/passkeys_subpage.js'; // </if> export {SettingsPasswordCheckElement} from './autofill_page/password_check.js'; -export {SettingsPasswordCheckEditDialogElement} from './autofill_page/password_check_edit_dialog.js'; export {SettingsPasswordEditDisclaimerDialogElement} from './autofill_page/password_check_edit_disclaimer_dialog.js'; export {PasswordCheckListItemElement} from './autofill_page/password_check_list_item.js'; export {PasswordDialogMode, PasswordEditDialogElement} from './autofill_page/password_edit_dialog.js';
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 694c6d4b..c24a0b0 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -4887,6 +4887,8 @@ "views/side_search/unified_side_search_controller.cc", "views/side_search/unified_side_search_controller.h", "views/side_search/unified_side_search_helper.cc", + "views/site_data/page_specific_site_data_dialog.cc", + "views/site_data/page_specific_site_data_dialog.h", "views/ssl_client_certificate_selector.cc", "views/ssl_client_certificate_selector.h", "views/status_bubble_views.cc",
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java index 572d9ca..dfc736d2 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
@@ -62,6 +62,13 @@ private static final int MAX_DISPLAYABLE_LENGTH = 4000; private static final int MAX_DISPLAYABLE_LENGTH_LOW_END = 1000; + // Stylus handwriting: Setting this ime option instructs stylus writing service to restrict + // capturing writing events slightly outside the Url bar area. This is needed to prevent stylus + // handwriting in inputs in web content area that are very close to url bar area, from being + // committed to Url bar's Edit text. Ex: google.com search field. + private static final String IME_OPTION_RESTRICT_STYLUS_WRITING_AREA = + "restrictDirectWritingArea=true"; + private boolean mFirstDrawComplete; /** @@ -305,6 +312,12 @@ fixupTextDirection(); } + @Override + public void onFinishInflate() { + super.onFinishInflate(); + setPrivateImeOptions(IME_OPTION_RESTRICT_STYLUS_WRITING_AREA); + } + /** * Sets whether this {@link UrlBar} should be focusable. */
diff --git a/chrome/browser/ui/apps/chrome_app_window_client.cc b/chrome/browser/ui/apps/chrome_app_window_client.cc index 516d75b4..bb7e1d4 100644 --- a/chrome/browser/ui/apps/chrome_app_window_client.cc +++ b/chrome/browser/ui/apps/chrome_app_window_client.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" @@ -14,6 +15,7 @@ #include "components/version_info/version_info.h" #include "content/public/browser/devtools_agent_host.h" #include "extensions/browser/app_window/app_window.h" +#include "extensions/browser/app_window/native_app_window.h" #include "extensions/common/extension.h" #include "extensions/common/features/feature_channel.h" @@ -68,13 +70,14 @@ #endif } -extensions::NativeAppWindow* ChromeAppWindowClient::CreateNativeAppWindow( +std::unique_ptr<extensions::NativeAppWindow> +ChromeAppWindowClient::CreateNativeAppWindow( extensions::AppWindow* window, extensions::AppWindow::CreateParams* params) { #if BUILDFLAG(IS_ANDROID) return nullptr; #else - return CreateNativeAppWindowImpl(window, *params); + return base::WrapUnique(CreateNativeAppWindowImpl(window, *params)); #endif }
diff --git a/chrome/browser/ui/apps/chrome_app_window_client.h b/chrome/browser/ui/apps/chrome_app_window_client.h index 284869d0..858cab32 100644 --- a/chrome/browser/ui/apps/chrome_app_window_client.h +++ b/chrome/browser/ui/apps/chrome_app_window_client.h
@@ -37,7 +37,7 @@ content::BrowserContext* context, const extensions::Extension* extension, extensions::api::app_runtime::ActionType action) override; - extensions::NativeAppWindow* CreateNativeAppWindow( + std::unique_ptr<extensions::NativeAppWindow> CreateNativeAppWindow( extensions::AppWindow* window, extensions::AppWindow::CreateParams* params) override; void OpenDevToolsWindow(content::WebContents* web_contents,
diff --git a/chrome/browser/ui/aura/accessibility/automation_manager_aura_browsertest.cc b/chrome/browser/ui/aura/accessibility/automation_manager_aura_browsertest.cc index b870343..b68de11 100644 --- a/chrome/browser/ui/aura/accessibility/automation_manager_aura_browsertest.cc +++ b/chrome/browser/ui/aura/accessibility/automation_manager_aura_browsertest.cc
@@ -250,17 +250,20 @@ cache_ptr->set_focused_widget_for_testing(widget); views::View* view1 = new views::View(); + view1->GetViewAccessibility().OverrideRole(ax::mojom::Role::kDialog); view1->GetViewAccessibility().OverrideName("view1"); view1->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); widget->GetRootView()->AddChildView(view1); views::AXAuraObjWrapper* wrapper1 = cache_ptr->GetOrCreate(view1); views::View* view2 = new views::View(); view2->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); + view2->GetViewAccessibility().OverrideRole(ax::mojom::Role::kDialog); view2->GetViewAccessibility().OverrideName("view2"); widget->GetRootView()->AddChildView(view2); views::AXAuraObjWrapper* wrapper2 = cache_ptr->GetOrCreate(view2); views::View* view3 = new views::View(); view3->GetViewAccessibility().OverrideName("view3"); + view3->GetViewAccessibility().OverrideRole(ax::mojom::Role::kDialog); view3->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); widget->GetRootView()->AddChildView(view3); views::AXAuraObjWrapper* wrapper3 = cache_ptr->GetOrCreate(view3); @@ -525,11 +528,13 @@ cache_ptr->set_focused_widget_for_testing(widget); views::View* view1 = new views::View(); + view1->GetViewAccessibility().OverrideRole(ax::mojom::Role::kDialog); view1->GetViewAccessibility().OverrideName("view1"); view1->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); widget->GetRootView()->AddChildView(view1); views::View* view2 = new views::View(); view2->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); + view2->GetViewAccessibility().OverrideRole(ax::mojom::Role::kDialog); view2->GetViewAccessibility().OverrideName("view2"); widget->GetRootView()->AddChildView(view2); views::AXAuraObjWrapper* wrapper2 = cache_ptr->GetOrCreate(view2);
diff --git a/chrome/browser/ui/autofill_assistant/password_change/mock_password_change_run_controller.h b/chrome/browser/ui/autofill_assistant/password_change/mock_password_change_run_controller.h index 492523c..c9cc527 100644 --- a/chrome/browser/ui/autofill_assistant/password_change/mock_password_change_run_controller.h +++ b/chrome/browser/ui/autofill_assistant/password_change/mock_password_change_run_controller.h
@@ -7,6 +7,7 @@ #include "chrome/browser/ui/autofill_assistant/password_change/password_change_run_controller.h" +#include "base/callback.h" #include "base/memory/weak_ptr.h" #include "testing/gmock/include/gmock/gmock.h" #include "url/gurl.h" @@ -46,6 +47,10 @@ const std::u16string&), (override)); MOCK_METHOD(void, ShowStartingScreen, (const GURL&), (override)); + MOCK_METHOD(void, + ShowCompletionScreen, + (base::RepeatingClosure done_button_callback), + (override)); MOCK_METHOD(void, OnGeneratedPasswordSelected, (bool), (override)); base::WeakPtr<PasswordChangeRunController> GetWeakPtr() override { return weak_ptr_factory_.GetWeakPtr();
diff --git a/chrome/browser/ui/autofill_assistant/password_change/mock_password_change_run_display.h b/chrome/browser/ui/autofill_assistant/password_change/mock_password_change_run_display.h index fba9b1c9..2011d87 100644 --- a/chrome/browser/ui/autofill_assistant/password_change/mock_password_change_run_display.h +++ b/chrome/browser/ui/autofill_assistant/password_change/mock_password_change_run_display.h
@@ -10,6 +10,7 @@ #include <string> #include <vector> +#include "base/callback.h" #include "base/memory/weak_ptr.h" #include "components/autofill_assistant/browser/public/password_change/proto/actions.pb.h" #include "testing/gmock/include/gmock/gmock.h" @@ -44,6 +45,11 @@ const PromptChoice&), (override)); MOCK_METHOD(void, ClearPrompt, (), (override)); + MOCK_METHOD(void, ShowStartingScreen, (const GURL&), (override)); + MOCK_METHOD(void, + ShowCompletionScreen, + (base::RepeatingClosure done_button_callback), + (override)); MOCK_METHOD(void, OnControllerGone, (), (override)); base::WeakPtr<MockPasswordChangeRunDisplay> GetWeakPtr() {
diff --git a/chrome/browser/ui/autofill_assistant/password_change/password_change_run_controller.h b/chrome/browser/ui/autofill_assistant/password_change/password_change_run_controller.h index e044bde..5e7621a 100644 --- a/chrome/browser/ui/autofill_assistant/password_change/password_change_run_controller.h +++ b/chrome/browser/ui/autofill_assistant/password_change/password_change_run_controller.h
@@ -8,11 +8,12 @@ #include <memory> #include <string> +#include "base/callback_forward.h" #include "base/memory/weak_ptr.h" #include "components/autofill_assistant/browser/public/password_change/proto/actions.pb.h" -#include "url/gurl.h" class PasswordChangeRunDisplay; +class GURL; // Abstract interface for a controller of an `PasswordChangeRunDisplay`. class PasswordChangeRunController { @@ -65,6 +66,10 @@ // from the script controller. virtual void ShowStartingScreen(const GURL& url) = 0; + // Shows the ending screen, displayed after script completion. + virtual void ShowCompletionScreen( + base::RepeatingClosure done_button_callback) = 0; + // Returns a weak pointer to this controller. virtual base::WeakPtr<PasswordChangeRunController> GetWeakPtr() = 0;
diff --git a/chrome/browser/ui/autofill_assistant/password_change/password_change_run_display.h b/chrome/browser/ui/autofill_assistant/password_change/password_change_run_display.h index 6cc6163..e68b874 100644 --- a/chrome/browser/ui/autofill_assistant/password_change/password_change_run_display.h +++ b/chrome/browser/ui/autofill_assistant/password_change/password_change_run_display.h
@@ -9,10 +9,12 @@ #include <string> #include <vector> +#include "base/callback_forward.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/autofill_assistant/password_change/assistant_display_delegate.h" #include "components/autofill_assistant/browser/public/password_change/proto/actions.pb.h" +class GURL; class PasswordChangeRunController; // Abstract interface for the view component of a password change script run. @@ -64,6 +66,11 @@ // Clears the area that contains the prompt body. virtual void ClearPrompt() = 0; + // Methods used to render the UI state before and after a script run. + virtual void ShowStartingScreen(const GURL& url) = 0; + virtual void ShowCompletionScreen( + base::RepeatingClosure done_button_callback) = 0; + // Notifies the view that the controller was destroyed so that the view // can close itself. virtual void OnControllerGone() = 0;
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service.cc b/chrome/browser/ui/global_media_controls/media_notification_service.cc index 12aa16b..c1c8a5d 100644 --- a/chrome/browser/ui/global_media_controls/media_notification_service.cc +++ b/chrome/browser/ui/global_media_controls/media_notification_service.cc
@@ -99,9 +99,9 @@ } void MediaNotificationService::PresentationManagerObservation:: - OnMediaRoutesChanged(const std::vector<media_router::MediaRoute>& routes) { - // If there are no routes, then casting hasn't started. - if (routes.empty()) + OnPresentationsChanged(bool has_presentation) { + // If there is no presentation, then casting hasn't started. + if (!has_presentation) return; // This will dismiss the backing item and therefore delete |this|. Do not use
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service.h b/chrome/browser/ui/global_media_controls/media_notification_service.h index df74de33..38c9ba2d 100644 --- a/chrome/browser/ui/global_media_controls/media_notification_service.h +++ b/chrome/browser/ui/global_media_controls/media_notification_service.h
@@ -18,7 +18,7 @@ #include "components/global_media_controls/public/media_session_item_producer.h" #include "components/global_media_controls/public/media_session_item_producer_observer.h" #include "components/keyed_service/core/keyed_service.h" -#include "components/media_router/browser/presentation/web_contents_presentation_manager.h" +#include "content/public/browser/presentation_observer.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -119,8 +119,7 @@ FRIEND_TEST_ALL_PREFIXES(MediaNotificationServiceCastTest, ShowSupplementalNotifications); - class PresentationManagerObservation - : public media_router::WebContentsPresentationManager::Observer { + class PresentationManagerObservation : public content::PresentationObserver { public: PresentationManagerObservation(base::RepeatingClosure cast_started_callback, content::WebContents* web_contents); @@ -130,9 +129,8 @@ const PresentationManagerObservation&) = delete; ~PresentationManagerObservation() override; - // media_router::WebContentsPresentationManager::Observer: - void OnMediaRoutesChanged( - const std::vector<media_router::MediaRoute>& routes) override; + // content::PresentationObserver: + void OnPresentationsChanged(bool has_presentation) override; void SetPresentationManagerForTesting( base::WeakPtr<media_router::WebContentsPresentationManager>
diff --git a/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.cc b/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.cc index 8793064..e8f373e8 100644 --- a/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.cc +++ b/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.cc
@@ -209,9 +209,9 @@ presentation_manager_ = nullptr; } -void PresentationRequestNotificationProducer::OnMediaRoutesChanged( - const std::vector<media_router::MediaRoute>& routes) { - if (!routes.empty()) { +void PresentationRequestNotificationProducer::OnPresentationsChanged( + bool has_presentation) { + if (has_presentation) { item_manager_->HideDialog(); if (item_) { item_->Dismiss();
diff --git a/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.h b/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.h index af18401..9a6e54baa 100644 --- a/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.h +++ b/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.h
@@ -16,6 +16,7 @@ #include "components/global_media_controls/public/media_item_ui_observer.h" #include "components/global_media_controls/public/media_item_ui_observer_set.h" #include "components/media_router/browser/presentation/web_contents_presentation_manager.h" +#include "content/public/browser/presentation_observer.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace global_media_controls { @@ -49,7 +50,7 @@ // managing the notification for an active session. class PresentationRequestNotificationProducer final : public global_media_controls::MediaItemProducer, - public media_router::WebContentsPresentationManager::Observer, + public content::PresentationObserver, public global_media_controls::MediaItemManagerObserver, public global_media_controls::MediaItemUIObserver { public: @@ -104,9 +105,8 @@ presentation_manager); void AfterMediaDialogClosed(); - // WebContentsPresentationManager::Observer: - void OnMediaRoutesChanged( - const std::vector<media_router::MediaRoute>& routes) override; + // content::PresentationObserver: + void OnPresentationsChanged(bool has_presentation) override; void OnDefaultPresentationChanged( const content::PresentationRequest* presentation_request) final;
diff --git a/chrome/browser/ui/global_media_controls/presentation_request_notification_producer_unittest.cc b/chrome/browser/ui/global_media_controls/presentation_request_notification_producer_unittest.cc index 2e1ad09..2b1af9e 100644 --- a/chrome/browser/ui/global_media_controls/presentation_request_notification_producer_unittest.cc +++ b/chrome/browser/ui/global_media_controls/presentation_request_notification_producer_unittest.cc
@@ -30,18 +30,6 @@ using testing::AtLeast; using testing::NiceMock; -namespace { - -media_router::MediaRoute CreateMediaRoute( - media_router::MediaRoute::Id route_id) { - media_router::MediaRoute media_route(route_id, - media_router::MediaSource("source_id"), - "sink_id", "description", true); - media_route.set_controller_type(media_router::RouteControllerType::kGeneric); - return media_route; -} -} // namespace - class PresentationRequestNotificationProducerTest : public ChromeRenderViewHostTestHarness { public: @@ -102,9 +90,8 @@ std::move(context)); } - void SimulateMediaRouteChanged( - const std::vector<media_router::MediaRoute>& routes) { - notification_producer_->OnMediaRoutesChanged(routes); + void SimulatePresentationsChanged(bool has_presentation) { + notification_producer_->OnPresentationsChanged(has_presentation); } content::RenderFrameHost* CreateChildFrame() { @@ -130,7 +117,7 @@ TEST_F(PresentationRequestNotificationProducerTest, HideItemOnMediaRoutesChanged) { SimulateStartPresentationContextCreated(); - SimulateMediaRouteChanged({CreateMediaRoute("id")}); + SimulatePresentationsChanged(true); EXPECT_FALSE(notification_service_->media_item_manager()->HasOpenDialog()); task_environment()->RunUntilIdle(); }
diff --git a/chrome/browser/ui/global_media_controls/test_helper.cc b/chrome/browser/ui/global_media_controls/test_helper.cc index 8735269..d1256b2 100644 --- a/chrome/browser/ui/global_media_controls/test_helper.cc +++ b/chrome/browser/ui/global_media_controls/test_helper.cc
@@ -7,6 +7,7 @@ #include <memory> #include <string> +#include "content/public/browser/presentation_observer.h" #include "testing/gmock/include/gmock/gmock.h" MockWebContentsPresentationManager::MockWebContentsPresentationManager() = @@ -31,17 +32,17 @@ void MockWebContentsPresentationManager::NotifyMediaRoutesChanged( const std::vector<media_router::MediaRoute>& routes) { for (auto& observer : observers_) { - observer.OnMediaRoutesChanged(routes); + observer.OnPresentationsChanged(!routes.empty()); } } void MockWebContentsPresentationManager::AddObserver( - media_router::WebContentsPresentationManager::Observer* observer) { + content::PresentationObserver* observer) { observers_.AddObserver(observer); } void MockWebContentsPresentationManager::RemoveObserver( - media_router::WebContentsPresentationManager::Observer* observer) { + content::PresentationObserver* observer) { observers_.RemoveObserver(observer); }
diff --git a/chrome/browser/ui/global_media_controls/test_helper.h b/chrome/browser/ui/global_media_controls/test_helper.h index 1645798..d3b0125 100644 --- a/chrome/browser/ui/global_media_controls/test_helper.h +++ b/chrome/browser/ui/global_media_controls/test_helper.h
@@ -27,9 +27,8 @@ bool HasDefaultPresentationRequest() const override; const content::PresentationRequest& GetDefaultPresentationRequest() const override; - void AddObserver(WebContentsPresentationManager::Observer* observer) override; - void RemoveObserver( - WebContentsPresentationManager::Observer* observer) override; + void AddObserver(content::PresentationObserver* observer) override; + void RemoveObserver(content::PresentationObserver* observer) override; base::WeakPtr<WebContentsPresentationManager> GetWeakPtr() override; MOCK_METHOD(void, @@ -41,7 +40,7 @@ private: absl::optional<content::PresentationRequest> default_presentation_request_; - base::ObserverList<WebContentsPresentationManager::Observer> observers_; + base::ObserverList<content::PresentationObserver> observers_; base::WeakPtrFactory<MockWebContentsPresentationManager> weak_factory_{this}; };
diff --git a/chrome/browser/ui/media_router/media_route_starter.h b/chrome/browser/ui/media_router/media_route_starter.h index e62dca1..15f6087c 100644 --- a/chrome/browser/ui/media_router/media_route_starter.h +++ b/chrome/browser/ui/media_router/media_route_starter.h
@@ -19,6 +19,7 @@ #include "components/media_router/browser/presentation/start_presentation_context.h" #include "components/media_router/browser/presentation/web_contents_presentation_manager.h" #include "components/media_router/common/issue.h" +#include "content/public/browser/presentation_observer.h" #include "url/origin.h" namespace content { @@ -33,7 +34,7 @@ // Provides cast services (lists of sinks, routes, start & terminate route) to // UI controllers -class MediaRouteStarter : public WebContentsPresentationManager::Observer { +class MediaRouteStarter : public content::PresentationObserver { public: MediaRouteStarter( const CastModeSet& initial_modes, @@ -126,7 +127,7 @@ // as supported for the service when initialized. static bool IsCastModeAvailable(const CastModeSet& modes, MediaCastMode mode); - // WebContentsPresentationManager::Observer + // content::PresentationObserver: void OnDefaultPresentationChanged( const content::PresentationRequest* presentation_request) override;
diff --git a/chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt_helper.cc b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt_helper.cc index f9bd3b3..96609dfb 100644 --- a/chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt_helper.cc +++ b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt_helper.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/privacy_sandbox/privacy_sandbox_prompt.h" +#include "components/sync/driver/sync_service.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h"
diff --git a/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.cc b/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.cc index 17423e2..f5afd5ff 100644 --- a/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.cc +++ b/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.cc
@@ -7,6 +7,7 @@ #include <string> #include <vector> +#include "base/callback.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/autofill_assistant/password_change/vector_icons/vector_icons.h" #include "components/autofill_assistant/browser/public/password_change/proto/actions.pb.h" @@ -149,6 +150,14 @@ AnimatedIcon& operator=(const AnimatedIcon&) = delete; ~AnimatedIcon() override = default; + void SetAnimationEndedCallback(base::OnceClosure callback) { + animation_ended_callback_ = std::move(callback); + // If animation already finished, run callback right away. + if (animation_ended_) { + std::move(animation_ended_callback_).Run(); + } + } + void StartPulsingAnimation() { pulsing_animation_ = true; SetDuration(base::Milliseconds(kIconPulseAnimationDurationMilliseconds)); @@ -169,12 +178,24 @@ }; void AnimationEnded(const gfx::Animation* animation) override { - if (pulsing_animation_) { + // Add one more cycle after stop animation request to avoid abrupt changes. + if (pulsing_animation_ || last_animation_cycle_) { + if (!pulsing_animation_) + last_animation_cycle_ = false; Start(); + } else { + animation_ended_ = true; + if (animation_ended_callback_) { + std::move(animation_ended_callback_).Run(); + } } } autofill_assistant::password_change::ProgressStep progress_step_; bool pulsing_animation_; + bool last_animation_cycle_; + bool animation_ended_; + + base::OnceClosure animation_ended_callback_; }; PasswordChangeRunProgress::PasswordChangeRunProgress(int childrenIDsOffset) { @@ -264,6 +285,13 @@ return current_progress_step_; } +void PasswordChangeRunProgress::SetAnimationEndedCallback( + base::OnceClosure callback) { + progress_step_ui_elements_ + [autofill_assistant::password_change::ProgressStep::PROGRESS_STEP_END] + .icon->SetAnimationEndedCallback(std::move(callback)); +} + void PasswordChangeRunProgress::OnLastProgressBarAnimationCompleted() { progress_step_ui_elements_ [autofill_assistant::password_change::ProgressStep::PROGRESS_STEP_END]
diff --git a/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.h b/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.h index ece5077..5665d83 100644 --- a/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.h +++ b/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_PASSWORD_CHANGE_RUN_PROGRESS_H_ #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_PASSWORD_CHANGE_RUN_PROGRESS_H_ +#include "base/callback_forward.h" #include "components/autofill_assistant/browser/public/password_change/proto/actions.pb.h" #include "ui/views/view.h" @@ -47,6 +48,10 @@ // Returns the current progress bar step. autofill_assistant::password_change::ProgressStep GetCurrentProgressBarStep(); + // Adds a callback for when the progress bar is complete. + // The completion happens after the last step animation is done. + void SetAnimationEndedCallback(base::OnceClosure callback); + private: // Method ran once the last progress bar animation is completed, // Used to trigger the last item animation.
diff --git a/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_view.cc b/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_view.cc index 9fc933ac..48c72240c 100644 --- a/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_view.cc +++ b/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_view.cc
@@ -9,12 +9,16 @@ #include <vector> #include "base/bind.h" +#include "base/callback_forward.h" #include "base/memory/ptr_util.h" #include "chrome/browser/ui/autofill_assistant/password_change/apc_utils.h" #include "chrome/browser/ui/autofill_assistant/password_change/password_change_run_controller.h" #include "chrome/browser/ui/autofill_assistant/password_change/password_change_run_display.h" #include "chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_progress.h" +#include "chrome/grit/generated_resources.h" #include "components/autofill_assistant/browser/public/password_change/proto/actions.pb.h" +#include "components/url_formatter/url_formatter.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/views/controls/button/button.h" @@ -22,9 +26,11 @@ #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/controls/separator.h" +#include "ui/views/controls/styled_label.h" #include "ui/views/layout/flex_layout.h" #include "ui/views/layout/layout_provider.h" #include "ui/views/view.h" +#include "url/gurl.h" namespace { @@ -53,12 +59,13 @@ // Helper function that creates a button. std::unique_ptr<views::MdTextButton> CreateButton( - const PasswordChangeRunDisplay::PromptChoice& choice, + const std::u16string text, + bool highlighted, views::Button::PressedCallback callback) { return views::Builder<views::MdTextButton>() .SetCallback(std::move(callback)) - .SetText(choice.text) - .SetProminent(choice.highlighted) + .SetText(text) + .SetProminent(highlighted) .Build(); } @@ -173,6 +180,7 @@ .SetID(static_cast<int>(ChildrenViewsIds::kDescription)) .Build()); } + void PasswordChangeRunView::SetProgressBarStep( autofill_assistant::password_change::ProgressStep progress_step) { password_change_run_progress_->SetProgressBarStep(progress_step); @@ -187,7 +195,7 @@ for (size_t index = 0; index < choices.size(); ++index) { if (!choices[index].text.empty()) { button_container->AddChildView(CreateButton( - choices[index], + choices[index].text, choices[index].highlighted, base::BindRepeating( &PasswordChangeRunController::OnBasePromptChoiceSelected, controller_, index))); @@ -215,17 +223,82 @@ DCHECK(body_); views::View* button_container = body_->AddChildView(CreateButtonContainer()); button_container->AddChildView(CreateButton( - manual_password_choice, + manual_password_choice.text, false, base::BindRepeating( &PasswordChangeRunController::OnGeneratedPasswordSelected, controller_, false))); button_container->AddChildView(CreateButton( - generated_password_choice, + generated_password_choice.text, true, base::BindRepeating( &PasswordChangeRunController::OnGeneratedPasswordSelected, controller_, true))); } +void PasswordChangeRunView::ShowStartingScreen(const GURL& url) { + SetTopIcon( + autofill_assistant::password_change::TopIcon::TOP_ICON_UNSPECIFIED); + + const std::u16string formatted_url = url_formatter::FormatUrl( + url, + url_formatter::kFormatUrlOmitHTTP | url_formatter::kFormatUrlOmitHTTPS | + url_formatter::kFormatUrlOmitTrivialSubdomains | + url_formatter::kFormatUrlTrimAfterHost, + base::UnescapeRule::SPACES, /*new_parsed=*/nullptr, + /*prefix_end=*/nullptr, /*offset_for_adjustment=*/nullptr); + SetTitle(l10n_util::GetStringFUTF16( + IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_STARTING_SCREEN_TITLE, + formatted_url)); + SetDescription(std::u16string()); +} + +void PasswordChangeRunView::ShowCompletionScreen( + base::RepeatingClosure done_button_callback) { + show_completion_screen_done_button_callback_ = + std::move(done_button_callback); + + password_change_run_progress_->SetAnimationEndedCallback(base::BindOnce( + &PasswordChangeRunView::OnShowCompletionScreen, base::Unretained(this))); +} + +void PasswordChangeRunView::OnShowCompletionScreen() { + SetTopIcon( + autofill_assistant::password_change::TopIcon::TOP_ICON_CHANGED_PASSWORD); + password_change_run_progress_->SetVisible(false); + SetTitle(l10n_util::GetStringUTF16( + IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_SUCCESSFULLY_CHANGED_PASSWORD_TITLE)); + + const std::u16string password_manager_link = l10n_util::GetStringUTF16( + IDS_PASSWORD_BUBBLES_PASSWORD_MANAGER_LINK_TEXT_SYNCED_TO_ACCOUNT); + size_t offset = 0; + std::u16string description = l10n_util::GetStringFUTF16( + IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_SUCCESSFULLY_CHANGED_PASSWORD_DESCRIPTION, + password_manager_link, &offset); + + body_->RemoveAllChildViews(); + body_->AddChildView(std::make_unique<views::Separator>()); + views::StyledLabel* description_view = body_->AddChildView( + views::Builder<views::StyledLabel>() + .SetText(description) + .SetHorizontalAlignment(gfx::ALIGN_LEFT) + .SetDefaultTextStyle(views::style::STYLE_SECONDARY) + .SetTextContext(views::style::CONTEXT_LABEL) + .SetID(static_cast<int>(ChildrenViewsIds::kDescription)) + .Build()); + + // TODO(crbug.com/1329179): Navidate user to password manager + // components/password_manager/core/browser/manage_passwords_referrer.h + description_view->AddStyleRange( + gfx::Range(offset, offset + password_manager_link.length()), + views::StyledLabel::RangeStyleInfo::CreateForLink( + static_cast<base::RepeatingClosure>(base::DoNothing()))); + + views::View* button_container = body_->AddChildView(CreateButtonContainer()); + button_container->AddChildView(CreateButton( + l10n_util::GetStringUTF16( + IDS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_SUCCESSFULLY_CHANGED_PASSWORD_CLOSE_SIDE_PANEL), + true, show_completion_screen_done_button_callback_)); +} + void PasswordChangeRunView::ClearPrompt() { DCHECK(body_); body_->RemoveAllChildViews();
diff --git a/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_view.h b/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_view.h index 3b3fb94..63b3d5e 100644 --- a/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_view.h +++ b/chrome/browser/ui/views/autofill_assistant/password_change/password_change_run_view.h
@@ -69,6 +69,9 @@ const PromptChoice& manual_password_choice, const PromptChoice& generated_password_choice) override; void ClearPrompt() override; + void ShowStartingScreen(const GURL& url) override; + void ShowCompletionScreen( + base::RepeatingClosure done_button_callback) override; void OnControllerGone() override; // Returns a weak pointer to itself. @@ -82,6 +85,12 @@ // This method destroys an instance of this class. void Close(); + // Method that updates the UI to render the completion screen. This is called + // only AFTER `password_change_run_progress_` is completed, both in terms of + // steps and animation. Runs `show_completion_screen_done_button_callback_` + // when user clicks on Done. + void OnShowCompletionScreen(); + // The controller belonging to this view. base::WeakPtr<PasswordChangeRunController> controller_; @@ -96,6 +105,8 @@ // prompts and descriptions. raw_ptr<views::View> body_ = nullptr; + // Callback run when a user clicks Done after a successful run. + base::RepeatingClosure show_completion_screen_done_button_callback_; // Factory for weak pointers to this view. base::WeakPtrFactory<PasswordChangeRunView> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index b3e4551..70964ea 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/cookie_info_view.h" +#include "chrome/browser/ui/views/site_data/page_specific_site_data_dialog.h" #include "chrome/grit/generated_resources.h" #include "components/browsing_data/content/cookie_helper.h" #include "components/browsing_data/content/database_helper.h" @@ -26,6 +27,7 @@ #include "components/content_settings/browser/page_specific_content_settings.h" #include "components/content_settings/core/browser/cookie_settings.h" #include "components/infobars/content/content_infobar_manager.h" +#include "components/page_info/core/features.h" #include "components/strings/grit/components_strings.h" #include "components/vector_icons/vector_icons.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" @@ -134,12 +136,12 @@ tracker_.view()->GetWidget()->CloseNow(); } - static CollectedCookiesViews* GetDialog(content::WebContents* web_contents) { + static views::View* GetDialogView(content::WebContents* web_contents) { WebContentsUserData* handle = static_cast<WebContentsUserData*>( web_contents->GetUserData(UserDataKey())); if (!handle) return nullptr; - return handle->GetCollectedCookiesViews(); + return handle->GetDialogView(); } static void Create(content::WebContents* web_contents) { @@ -153,15 +155,24 @@ explicit WebContentsUserData(content::WebContents* web_contents) : content::WebContentsUserData< CollectedCookiesViews::WebContentsUserData>(*web_contents) { - // Owned by its Widget - CollectedCookiesViews* const dialog = - new CollectedCookiesViews(web_contents); - tracker_.SetView(dialog); + // TODO(crbug.com/1344787): Provide a public interface to show cookies + // dialog independent on the actual implementation, not tied to any views + // class. + if (base::FeatureList::IsEnabled(page_info::kPageSpecificSiteDataDialog)) { + views::Widget* widget = ShowPageSpecificSiteDataDialog(web_contents); + tracker_.SetView(widget->GetRootView()); + } else { + // CollectedCookiesViews is DialogDelegateView and it's owned by its + // widget. It created the widget in the constructor using + // `ShowWebModalDialogViews()`. It will be destroyed when its widget is + // destroyed. + CollectedCookiesViews* const dialog = + new CollectedCookiesViews(web_contents); + tracker_.SetView(dialog); + } } - CollectedCookiesViews* GetCollectedCookiesViews() { - return static_cast<CollectedCookiesViews*>(tracker_.view()); - } + views::View* GetDialogView() { return tracker_.view(); } views::ViewTracker tracker_; @@ -322,8 +333,8 @@ // static void CollectedCookiesViews::CreateAndShowForWebContents( content::WebContents* web_contents) { - CollectedCookiesViews* instance = - CollectedCookiesViews::WebContentsUserData::GetDialog(web_contents); + views::View* const instance = + CollectedCookiesViews::WebContentsUserData::GetDialogView(web_contents); if (!instance) { CollectedCookiesViews::WebContentsUserData::Create(web_contents); return; @@ -345,7 +356,9 @@ CollectedCookiesViews* CollectedCookiesViews::GetDialogForTesting( content::WebContents* web_contents) { - return CollectedCookiesViews::WebContentsUserData::GetDialog(web_contents); + CHECK(!base::FeatureList::IsEnabled(page_info::kPageSpecificSiteDataDialog)); + return static_cast<CollectedCookiesViews*>( + CollectedCookiesViews::WebContentsUserData::GetDialogView(web_contents)); } ///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/views/constrained_window_views_browsertest.cc b/chrome/browser/ui/views/constrained_window_views_browsertest.cc index 835bbce..8bcabba 100644 --- a/chrome/browser/ui/views/constrained_window_views_browsertest.cc +++ b/chrome/browser/ui/views/constrained_window_views_browsertest.cc
@@ -32,6 +32,9 @@ TestDialog() { SetFocusBehavior(FocusBehavior::ALWAYS); SetModalType(ui::MODAL_TYPE_CHILD); + // Dialogs that take focus must have a name and role to pass accessibility + // checks. + GetViewAccessibility().OverrideRole(ax::mojom::Role::kDialog); GetViewAccessibility().OverrideName("Test dialog"); }
diff --git a/chrome/browser/ui/views/global_media_controls/media_dialog_view_interactive_browsertest.cc b/chrome/browser/ui/views/global_media_controls/media_dialog_view_interactive_browsertest.cc index e75c44e..ccd9e3fde 100644 --- a/chrome/browser/ui/views/global_media_controls/media_dialog_view_interactive_browsertest.cc +++ b/chrome/browser/ui/views/global_media_controls/media_dialog_view_interactive_browsertest.cc
@@ -33,6 +33,7 @@ #include "components/media_router/browser/presentation/web_contents_presentation_manager.h" #include "components/media_router/browser/test/mock_media_router.h" #include "components/soda/constants.h" +#include "content/public/browser/presentation_observer.h" #include "content/public/browser/presentation_request.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_features.h" @@ -265,18 +266,17 @@ class TestWebContentsPresentationManager : public media_router::WebContentsPresentationManager { public: - void NotifyMediaRoutesChanged( - const std::vector<media_router::MediaRoute>& routes) { + void NotifyPresentationsChanged(bool has_presentation) { for (auto& observer : observers_) { - observer.OnMediaRoutesChanged(routes); + observer.OnPresentationsChanged(has_presentation); } } - void AddObserver(Observer* observer) override { + void AddObserver(content::PresentationObserver* observer) override { observers_.AddObserver(observer); } - void RemoveObserver(Observer* observer) override { + void RemoveObserver(content::PresentationObserver* observer) override { observers_.RemoveObserver(observer); } @@ -295,7 +295,7 @@ } private: - base::ObserverList<Observer> observers_; + base::ObserverList<content::PresentationObserver> observers_; base::WeakPtrFactory<TestWebContentsPresentationManager> weak_factory_{this}; }; @@ -808,7 +808,7 @@ route.set_controller_type(media_router::RouteControllerType::kGeneric); media_router_->NotifyMediaRoutesChanged({route}); base::RunLoop().RunUntilIdle(); - presentation_manager_->NotifyMediaRoutesChanged({route}); + presentation_manager_->NotifyPresentationsChanged(true); EXPECT_TRUE(ui_.WaitForToolbarIconShown()); ui_.ClickToolbarIcon();
diff --git a/chrome/browser/ui/views/page_info/page_info_cookies_content_view.cc b/chrome/browser/ui/views/page_info/page_info_cookies_content_view.cc index d64b9dd..ec1e3ec 100644 --- a/chrome/browser/ui/views/page_info/page_info_cookies_content_view.cc +++ b/chrome/browser/ui/views/page_info/page_info_cookies_content_view.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/page_info/page_info_cookies_content_view.h" #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" +#include "chrome/browser/ui/views/page_info/page_info_main_view.h" #include "chrome/browser/ui/views/page_info/page_info_view_factory.h" #include "components/strings/grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" @@ -60,8 +61,10 @@ cookies_description_label->SetText(description_text); cookies_description_label->AddStyleRange(link_range, link_style); - // TODO(crbug.com/1346305): Remove after implementation of data flow. - EnsureCookieInfo(); + // We need the container to have a placeholder to put the buttons in, + // to ensure the views order. + cookies_buttons_container_view_ = + AddChildView(std::make_unique<PageInfoMainView::ContainerView>()); presenter_->InitializeUiState(this, base::DoNothing()); } @@ -79,18 +82,20 @@ const std::u16string& tooltip = l10n_util::GetStringUTF16(IDS_PAGE_INFO_COOKIES_TOOLTIP); - // Create the cookie button, leaving the secondary text blank since the - // site count is not yet known. + // Create the cookie button, with a temporary value for the subtitle text + // since the site count is not yet known. // TODO(crbug.com/1346305): Change to correct final string. - cookies_dialog_button_ = AddChildView(std::make_unique<PageInfoHoverButton>( - base::BindRepeating( - [](PageInfoCookiesContentView* view) { - view->presenter_->OpenCookiesDialog(); - }, - this), - icon, IDS_PAGE_INFO_COOKIES, /*secondary_text=*/u"", - PageInfoViewFactory::VIEW_ID_PAGE_INFO_LINK_OR_BUTTON_COOKIE_DIALOG, - tooltip, std::u16string(), PageInfoViewFactory::GetLaunchIcon())); + cookies_dialog_button_ = cookies_buttons_container_view_->AddChildView( + std::make_unique<PageInfoHoverButton>( + base::BindRepeating( + [](PageInfoCookiesContentView* view) { + view->presenter_->OpenCookiesDialog(); + }, + this), + icon, IDS_PAGE_INFO_COOKIES, std::u16string(), + PageInfoViewFactory::VIEW_ID_PAGE_INFO_LINK_OR_BUTTON_COOKIE_DIALOG, + tooltip, /*subtitle_text=*/u" ", + PageInfoViewFactory::GetLaunchIcon())); } } @@ -98,3 +103,20 @@ const ui::Event& event) { presenter_->OpenCookiesSettingsView(); } + +void PageInfoCookiesContentView::SetCookieInfo( + const CookiesNewInfo& cookie_info) { + const std::u16string num_sites_text = l10n_util::GetPluralStringFUTF16( + IDS_PAGE_INFO_COOKIES_ALLOWED_SITES_COUNT, + cookie_info.allowed_sites_count); + + // Create the cookie button if it doesn't yet exist. This method gets called + // each time site data is updated, so if it *does* already exist, skip this + // part and just update the text. + EnsureCookieInfo(); + + // Update the text displaying the number of allowed sites. + cookies_dialog_button_->SetSubtitleText(num_sites_text); + + PreferredSizeChanged(); +}
diff --git a/chrome/browser/ui/views/page_info/page_info_cookies_content_view.h b/chrome/browser/ui/views/page_info/page_info_cookies_content_view.h index 027ac04..d661688 100644 --- a/chrome/browser/ui/views/page_info/page_info_cookies_content_view.h +++ b/chrome/browser/ui/views/page_info/page_info_cookies_content_view.h
@@ -18,6 +18,9 @@ ~PageInfoCookiesContentView() override; + // PageInfoUI implementations. + void SetCookieInfo(const CookiesNewInfo& cookie_info) override; + void CookiesSettingsLinkClicked(const ui::Event& event); private: @@ -27,6 +30,9 @@ raw_ptr<PageInfo> presenter_; + // The view that contains the fps_button and cookies_dialog_button. + raw_ptr<views::View> cookies_buttons_container_view_ = nullptr; + // The button that opens Cookie Dialog and displays a number of allowed sites. raw_ptr<PageInfoHoverButton> cookies_dialog_button_ = nullptr;
diff --git a/chrome/browser/ui/views/page_info/page_info_hover_button.cc b/chrome/browser/ui/views/page_info/page_info_hover_button.cc index eee10bc..6d4d16d 100644 --- a/chrome/browser/ui/views/page_info/page_info_hover_button.cc +++ b/chrome/browser/ui/views/page_info/page_info_hover_button.cc
@@ -152,6 +152,12 @@ UpdateAccessibleName(); } +void PageInfoHoverButton::SetSubtitleText(const std::u16string& subtitle_text) { + DCHECK(subtitle_); + subtitle_->SetText(subtitle_text); + UpdateAccessibleName(); +} + void PageInfoHoverButton::SetSubtitleMultiline(bool is_multiline) { subtitle()->SetMultiLine(is_multiline); }
diff --git a/chrome/browser/ui/views/page_info/page_info_hover_button.h b/chrome/browser/ui/views/page_info/page_info_hover_button.h index a200ea1..bd74d1d 100644 --- a/chrome/browser/ui/views/page_info/page_info_hover_button.h +++ b/chrome/browser/ui/views/page_info/page_info_hover_button.h
@@ -74,6 +74,8 @@ void SetTitleText(const std::u16string& title_text); + void SetSubtitleText(const std::u16string& subtitle_text); + void SetSubtitleMultiline(bool is_multiline); protected:
diff --git a/chrome/browser/ui/views/site_data/OWNERS b/chrome/browser/ui/views/site_data/OWNERS new file mode 100644 index 0000000..21440920 --- /dev/null +++ b/chrome/browser/ui/views/site_data/OWNERS
@@ -0,0 +1,2 @@ +olesiamarukhno@google.com +sauski@google.com
diff --git a/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.cc b/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.cc new file mode 100644 index 0000000..e0512e65 --- /dev/null +++ b/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.cc
@@ -0,0 +1,21 @@ +// Copyright 2022 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. + +#include "chrome/browser/ui/views/site_data/page_specific_site_data_dialog.h" + +#include "chrome/grit/generated_resources.h" +#include "components/constrained_window/constrained_window_views.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/models/dialog_model.h" + +// static +views::Widget* ShowPageSpecificSiteDataDialog( + content::WebContents* web_contents) { + auto builder = ui::DialogModel::Builder(); + builder.SetTitle( + l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_DIALOG_TITLE)); + // TODO(crbug.com/1344787): Build the rest of the dialog. Add action handling. + // Remove the dialog from WebContentsUserData when destroyed. + return constrained_window::ShowWebModal(builder.Build(), web_contents); +}
diff --git a/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.h b/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.h new file mode 100644 index 0000000..9137bcd6 --- /dev/null +++ b/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.h
@@ -0,0 +1,19 @@ +// Copyright 2022 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. + +#ifndef CHROME_BROWSER_UI_VIEWS_SITE_DATA_PAGE_SPECIFIC_SITE_DATA_DIALOG_H_ +#define CHROME_BROWSER_UI_VIEWS_SITE_DATA_PAGE_SPECIFIC_SITE_DATA_DIALOG_H_ + +namespace views { +class Widget; +} // namespace views + +namespace content { +class WebContents; +} // namespace content + +views::Widget* ShowPageSpecificSiteDataDialog( + content::WebContents* web_contents); + +#endif // CHROME_BROWSER_UI_VIEWS_SITE_DATA_PAGE_SPECIFIC_SITE_DATA_DIALOG_H_
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc index f50903c..c7b363937 100644 --- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -314,6 +314,7 @@ ash::ReauthReason::INVALID_TOKEN_HANDLE, ash::ReauthReason::SYNC_FAILED, ash::ReauthReason::PASSWORD_UPDATE_SKIPPED, + ash::ReauthReason::FORGOT_PASSWORD, }; user_manager::KnownUser known_user(g_browser_process->local_state()); absl::optional<int> reauth_reason = known_user.FindReauthReason(account_id);
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index 1bfd93b..8e19576e 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -325,7 +325,7 @@ IDS_NEW_TAB_OTR_COOKIE_CONTROLS_CONTROLLED_TOOLTIP_TEXT); const ui::ThemeProvider& tp = - ThemeService::GetThemeProviderForProfile(profile_); + ThemeService::GetThemeProviderForProfile(incognito_profile); replacements["hasCustomBackground"] = tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND) ? "true" : "false"; @@ -421,8 +421,8 @@ const ui::NativeTheme* native_theme = webui::GetNativeTheme(web_contents); DCHECK(native_theme); - const ui::ThemeProvider& tp = - ThemeService::GetThemeProviderForProfile(profile_); + const ui::ThemeProvider& tp = ThemeService::GetThemeProviderForProfile( + profile_->GetPrimaryOTRProfile(/*create_if_needed=*/true)); // Generate the replacements. ui::TemplateReplacements substitutions;
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index 7e368f2..980c418 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1095,6 +1095,10 @@ {"importPasswordsTitle", IDS_SETTINGS_PASSWORDS_IMPORT_TITLE}, {"importPasswordsChooseFile", IDS_SETTINGS_PASSWORDS_IMPORT_CHOOSE_FILE}, {"importPasswordsSuccessTip", IDS_SETTINGS_PASSWORDS_IMPORT_SUCCESS_TIP}, + {"importPasswordsUnknownError", + IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_UNKNOWN}, + {"importPasswordsBadFormatError", + IDS_SETTINGS_PASSWORDS_IMPORT_ERROR_BAD_FORMAT}, {"importPasswordsGenericDescription", IDS_SETTINGS_PASSWORDS_IMPORT_DESCRIPTION_GENERIC}, {"exportMenuItem", IDS_SETTINGS_PASSWORDS_EXPORT_MENU_ITEM},
diff --git a/chrome/browser/ui/webui/signin/inline_login_dialog_chromeos_browsertest.cc b/chrome/browser/ui/webui/signin/inline_login_dialog_chromeos_browsertest.cc index 0a2e5f0a..396cd530 100644 --- a/chrome/browser/ui/webui/signin/inline_login_dialog_chromeos_browsertest.cc +++ b/chrome/browser/ui/webui/signin/inline_login_dialog_chromeos_browsertest.cc
@@ -36,7 +36,9 @@ DCHECK(owned_by_widget()); SetModalType(ui::MODAL_TYPE_CHILD); SetFocusBehavior(FocusBehavior::ALWAYS); - // Dialogs that take focus must have a name to pass accessibility checks. + // Dialogs that take focus must have a name and role to pass accessibility + // checks. + GetViewAccessibility().OverrideRole(ax::mojom::Role::kDialog); GetViewAccessibility().OverrideName("Test dialog"); } ChildModalDialogDelegate(const ChildModalDialogDelegate&) = delete;
diff --git a/chrome/browser/ui/webui/version/version_handler.cc b/chrome/browser/ui/webui/version/version_handler.cc index 1fc7153..79b6795 100644 --- a/chrome/browser/ui/webui/version/version_handler.cc +++ b/chrome/browser/ui/webui/version/version_handler.cc
@@ -92,12 +92,11 @@ const std::string& callback_id = args[0].GetString(); const bool include_variations_cmd = args[1].GetBool(); - base::Value response(base::Value::Type::DICTIONARY); - response.SetKey(version_ui::kKeyVariationsList, - version_ui::GetVariationsList()); + base::Value::Dict response; + response.Set(version_ui::kKeyVariationsList, version_ui::GetVariationsList()); if (include_variations_cmd) { - response.SetKey(version_ui::kKeyVariationsCmd, - version_ui::GetVariationsCommandLineAsValue()); + response.Set(version_ui::kKeyVariationsCmd, + version_ui::GetVariationsCommandLineAsValue()); } ResolveJavascriptCallback(base::Value(callback_id), response); } @@ -127,8 +126,8 @@ std::u16string* executable_path_data, std::u16string* profile_path_data) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - base::Value response(base::Value::Type::DICTIONARY); - response.SetKey(version_ui::kKeyExecPath, base::Value(*executable_path_data)); - response.SetKey(version_ui::kKeyProfilePath, base::Value(*profile_path_data)); + base::Value::Dict response; + response.Set(version_ui::kKeyExecPath, *executable_path_data); + response.Set(version_ui::kKeyProfilePath, *profile_path_data); ResolveJavascriptCallback(base::Value(callback_id), response); }
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 54316dd1..6ac78560 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1659571197-4c81cce6700087fd9957c31c9c8bcda7bde3719f.profdata +chrome-linux-main-1659614384-91caaaf9d8fbabc2eef30f5e2585194003a68cb1.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 58696395..5c9bf41 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1659571197-d740b382a0ffe61c54eafa5419ba43f39463fb66.profdata +chrome-mac-arm-main-1659592512-3ba956ced21049c9e53b30ceea31464f75312627.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 80f5731..a7229229 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1659571197-9514832ba7704be70bbaad14bf8f74381c5094a0.profdata +chrome-mac-main-1659592512-049720c0e7ad8491c5d47034c60968ccb6c45996.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 6ea199e..01f0f65 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1659566430-fe05d2d9bbf12f3e80a465121005d66334cc612f.profdata +chrome-win32-main-1659592512-6f72313d5a2e88f3c9471a577a12666546741ae1.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 730edcd..2fc1778 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1659571197-6bc81f1865e1c69e461a140d681e26dc3e3ac1c1.profdata +chrome-win64-main-1659602984-b9240d355e73493814058bd7e67c6f3fca96ded3.profdata
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 965fa32..f84d6cc 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -200,7 +200,7 @@ base::FEATURE_ENABLED_BY_DEFAULT}; // Enables starting of Data Leak Prevention Files Daemon by sending the -// DLP policy there. The daemond might restrict access to some protected files. +// DLP policy there. The daemon might restrict access to some protected files. const base::Feature kDataLeakPreventionFilesRestriction{ "DataLeakPreventionFilesRestriction", base::FEATURE_DISABLED_BY_DEFAULT}; #endif
diff --git a/chrome/common/extensions/api/passwords_private.idl b/chrome/common/extensions/api/passwords_private.idl index a8479343..0143ac5 100644 --- a/chrome/common/extensions/api/passwords_private.idl +++ b/chrome/common/extensions/api/passwords_private.idl
@@ -68,6 +68,8 @@ }; enum ImportResultsStatus { + // Any other error state. + UNKNOWN_ERROR, // Data was fully or partially imported. SUCCESS, // Failed to read provided file. @@ -75,16 +77,28 @@ // Header is missing, invalid or could not be read. BAD_FORMAT, // File selection dismissed. - DISMISSED + DISMISSED, + // Size of the chosen file exceeds the limit. + MAX_FILE_SIZE, + // User has already started the import flow in a different window. + IMPORT_ALREADY_ACTIVE, + // User tried to import too many passwords from one file. + NUM_PASSWORDS_EXCEEDED }; enum ImportEntryStatus { + // Any other error state. + UNKNOWN_ERROR, // Missing password field. MISSING_PASSWORD, // Missing url field. MISSING_URL, // Bad url formatting. INVALID_URL, + // URL contains non-ASCII chars. + NON_ASCII_URL, + // URL is too long. + LONG_URL, // Password is too long. LONG_PASSWORD, // Username is too long.
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index a7ac792..77ad833e 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -667,9 +667,11 @@ } #if BUILDFLAG(ENABLE_EXTENSIONS) - associated_interfaces->AddInterface(base::BindRepeating( - &extensions::MimeHandlerViewContainerManager::BindReceiver, - render_frame->GetRoutingID())); + associated_interfaces + ->AddInterface<extensions::mojom::MimeHandlerViewContainerManager>( + base::BindRepeating( + &extensions::MimeHandlerViewContainerManager::BindReceiver, + render_frame->GetRoutingID())); #endif // Owned by |render_frame|. @@ -732,8 +734,10 @@ #if BUILDFLAG(IS_WIN) if (render_frame->IsMainFrame()) { - associated_interfaces->AddInterface(base::BindRepeating( - &RenderFrameFontFamilyAccessor::Bind, render_frame)); + associated_interfaces + ->AddInterface<chrome::mojom::RenderFrameFontFamilyAccessor>( + base::BindRepeating(&RenderFrameFontFamilyAccessor::Bind, + render_frame)); } #endif }
diff --git a/chrome/renderer/chrome_render_frame_observer.cc b/chrome/renderer/chrome_render_frame_observer.cc index 156a3f3..d5355ef8 100644 --- a/chrome/renderer/chrome_render_frame_observer.cc +++ b/chrome/renderer/chrome_render_frame_observer.cc
@@ -179,8 +179,8 @@ translate_agent_(nullptr), page_text_agent_(new optimization_guide::PageTextAgent(render_frame)), web_cache_impl_(web_cache_impl) { - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating( + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<chrome::mojom::ChromeRenderFrame>(base::BindRepeating( &ChromeRenderFrameObserver::OnRenderFrameObserverRequest, base::Unretained(this)));
diff --git a/chrome/renderer/chrome_render_thread_observer.cc b/chrome/renderer/chrome_render_thread_observer.cc index d566a876..ade87e6 100644 --- a/chrome/renderer/chrome_render_thread_observer.cc +++ b/chrome/renderer/chrome_render_thread_observer.cc
@@ -221,9 +221,10 @@ void ChromeRenderThreadObserver::RegisterMojoInterfaces( blink::AssociatedInterfaceRegistry* associated_interfaces) { - associated_interfaces->AddInterface(base::BindRepeating( - &ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest, - base::Unretained(this))); + associated_interfaces->AddInterface<chrome::mojom::RendererConfiguration>( + base::BindRepeating( + &ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest, + base::Unretained(this))); } void ChromeRenderThreadObserver::UnregisterMojoInterfaces(
diff --git a/chrome/renderer/net/net_error_helper.cc b/chrome/renderer/net/net_error_helper.cc index ecf13077..a3b7e23 100644 --- a/chrome/renderer/net/net_error_helper.cc +++ b/chrome/renderer/net/net_error_helper.cc
@@ -122,9 +122,11 @@ // subframes don't need any of the NetErrorHelperCore's extra logic. core_ = std::make_unique<NetErrorHelperCore>(this); - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&NetErrorHelper::OnNetworkDiagnosticsClientRequest, - base::Unretained(this))); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<chrome::mojom::NetworkDiagnosticsClient>( + base::BindRepeating( + &NetErrorHelper::OnNetworkDiagnosticsClientRequest, + base::Unretained(this))); } NetErrorHelper::~NetErrorHelper() = default;
diff --git a/chrome/renderer/sandbox_status_extension_android.cc b/chrome/renderer/sandbox_status_extension_android.cc index 1b23af4..58fe747 100644 --- a/chrome/renderer/sandbox_status_extension_android.cc +++ b/chrome/renderer/sandbox_status_extension_android.cc
@@ -31,9 +31,10 @@ // Don't do anything else for subframes. if (!frame->IsMainFrame()) return; - frame->GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( - &SandboxStatusExtension::OnSandboxStatusExtensionRequest, - base::RetainedRef(this))); + frame->GetAssociatedInterfaceRegistry() + ->AddInterface<chrome::mojom::SandboxStatusExtension>(base::BindRepeating( + &SandboxStatusExtension::OnSandboxStatusExtensionRequest, + base::RetainedRef(this))); } SandboxStatusExtension::~SandboxStatusExtension() {}
diff --git a/chrome/test/data/webui/chromeos/os_feedback_ui/help_content_test.js b/chrome/test/data/webui/chromeos/os_feedback_ui/help_content_test.js index 6513091..eef9f703b 100644 --- a/chrome/test/data/webui/chromeos/os_feedback_ui/help_content_test.js +++ b/chrome/test/data/webui/chromeos/os_feedback_ui/help_content_test.js
@@ -142,7 +142,8 @@ assertEquals('Suggested help content', title.textContent); // The help content icon is visible. - assertTrue(isVisible(getElement('#helpContentIcon'))); + const helpContentIcon = getElement('#helpContentIcon'); + assertTrue(isVisible(helpContentIcon)); // Verify the help content is populated with correct number of items. assertEquals(5, getElement('dom-repeat').items.length);
diff --git a/chrome/test/data/webui/settings/password_check_test.ts b/chrome/test/data/webui/settings/password_check_test.ts index 62fba6cb..21b6f2c 100644 --- a/chrome/test/data/webui/settings/password_check_test.ts +++ b/chrome/test/data/webui/settings/password_check_test.ts
@@ -12,7 +12,7 @@ import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {PasswordCheckListItemElement, SettingsPasswordCheckEditDialogElement, SettingsPasswordCheckElement, SettingsPasswordRemoveConfirmationDialogElement} from 'chrome://settings/lazy_load.js'; +import {PasswordCheckListItemElement, SettingsPasswordCheckElement, SettingsPasswordRemoveConfirmationDialogElement} from 'chrome://settings/lazy_load.js'; import {OpenWindowProxyImpl, PasswordCheckInteraction, PasswordManagerImpl, Router, routes, StatusAction, SyncBrowserProxyImpl} from 'chrome://settings/settings.js'; import {assertEquals, assertFalse, assertNotEquals, assertTrue} from 'chrome://webui-test/chai_assert.js'; // <if expr="chromeos_ash"> @@ -38,17 +38,6 @@ return passwordsSection; } -function createEditDialog( - leakedCredential: chrome.passwordsPrivate.PasswordUiEntry): - SettingsPasswordCheckEditDialogElement { - const editDialog = - document.createElement('settings-password-check-edit-dialog'); - editDialog.item = leakedCredential; - document.body.appendChild(editDialog); - flush(); - return editDialog; -} - /** * Helper method used to create a compromised list item. */ @@ -1823,113 +1812,6 @@ validateLeakedPasswordsList(checkPasswordSection, leakedPasswords); }); - // Verify that the edit dialog is not shown if a plaintext password could - // not be obtained. - test('editDialogWithoutPlaintextPassword', async function() { - passwordManager.data.leakedCredentials = [ - makeCompromisedCredential( - /*url*/ 'google.com', /*username*/ 'jdoerrie', - /*type*/ CompromiseType.LEAKED), - ]; - - const checkPasswordSection = createCheckPasswordSection(); - await passwordManager.whenCalled('getCompromisedCredentials'); - flush(); - const listElements = checkPasswordSection.$.leakedPasswordList; - const node = listElements.children[0] as PasswordCheckListItemElement; - - // Open the more actions menu and click 'Edit Password'. - node.$.more.click(); - checkPasswordSection.$.menuEditPassword.click(); - // Since we did not specify a plaintext password above, this request - // should fail. - await passwordManager.whenCalled('requestPlaintextPassword'); - // Verify that the edit dialog has not become visible. - await flushTasks(); - assertFalse(isElementVisible(checkPasswordSection.shadowRoot!.querySelector( - 'settings-password-check-edit-dialog')!)); - - // Verify that the more actions menu is closed. - assertFalse(checkPasswordSection.$.moreActionsMenu.open); - }); - - // Verify edit a password on the edit dialog. - test('editDialogWithPlaintextPassword', async function() { - passwordManager.data.leakedCredentials = [ - makeCompromisedCredential( - /*url*/ 'google.com', /*username*/ 'jdoerrie', - /*type*/ CompromiseType.LEAKED), - ]; - - passwordManager.setPlaintextPassword('password'); - const checkPasswordSection = createCheckPasswordSection(); - await passwordManager.whenCalled('getCompromisedCredentials'); - flush(); - const listElements = checkPasswordSection.$.leakedPasswordList; - const node = listElements.children[0] as PasswordCheckListItemElement; - - // Open the more actions menu and click 'Edit Password'. - node.$.more.click(); - checkPasswordSection.$.menuEditPassword.click(); - const {id, reason} = - await passwordManager.whenCalled('requestPlaintextPassword'); - await flushTasks(); - assertEquals(passwordManager.data.leakedCredentials[0]!.id, id); - assertEquals(chrome.passwordsPrivate.PlaintextReason.EDIT, reason); - - // Verify that the edit dialog has become visible. - assertTrue(isElementVisible(checkPasswordSection.shadowRoot!.querySelector( - 'settings-password-check-edit-dialog')!)); - - // Verify that the more actions menu is closed. - assertFalse(checkPasswordSection.$.moreActionsMenu.open); - }); - - test('editDialogChangePassword', async function() { - const leakedPassword = makeCompromisedCredential( - /*url*/ 'google.com', /*username*/ 'jdoerrie', - /*type*/ CompromiseType.LEAKED); - leakedPassword.password = 'mybirthday'; - const editDialog = createEditDialog(leakedPassword); - - assertEquals(leakedPassword.password, editDialog.$.passwordInput.value); - - // Test that an empty password is considered invalid and disables the change - // button. - editDialog.$.passwordInput.value = ''; - assertTrue(editDialog.$.passwordInput.invalid); - assertTrue(editDialog.$.save.disabled); - - editDialog.$.passwordInput.value = 'yadhtribym'; - assertFalse(editDialog.$.passwordInput.invalid); - assertFalse(editDialog.$.save.disabled); - passwordManager.setChangeSavedPasswordResponse(1); - editDialog.$.save.click(); - - const interaction = - await passwordManager.whenCalled('recordPasswordCheckInteraction'); - const {id, params} = - await passwordManager.whenCalled('changeSavedPassword'); - - assertEquals(PasswordCheckInteraction.EDIT_PASSWORD, interaction); - assertEquals(leakedPassword.id, id); - assertEquals('yadhtribym', params.password); - }); - - test('editDialogCancel', function() { - const leakedPassword = makeCompromisedCredential( - /*url*/ 'google.com', /*username*/ 'jdoerrie', - /*type*/ CompromiseType.LEAKED); - leakedPassword.password = 'mybirthday'; - const editDialog = createEditDialog(leakedPassword); - - assertEquals(leakedPassword.password, editDialog.$.passwordInput.value); - editDialog.$.passwordInput.value = 'yadhtribym'; - editDialog.$.cancel.click(); - - assertEquals(0, passwordManager.getCallCount('changeSavedPassword')); - }); - test('startEqualsTrueSearchParameterStartsCheck', async function() { Router.getInstance().navigateTo( routes.CHECK_PASSWORDS, new URLSearchParams('start=true'));
diff --git a/chrome/test/data/webui/settings/passwords_import_dialog_test.ts b/chrome/test/data/webui/settings/passwords_import_dialog_test.ts index 483314e3..a907add3 100644 --- a/chrome/test/data/webui/settings/passwords_import_dialog_test.ts +++ b/chrome/test/data/webui/settings/passwords_import_dialog_test.ts
@@ -8,9 +8,9 @@ import 'chrome://settings/lazy_load.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {ImportDialogState} from 'chrome://settings/lazy_load.js'; +import {ImportDialogState, PasswordsImportDialogElement} from 'chrome://settings/lazy_load.js'; import {PasswordManagerImpl, SettingsPluralStringProxyImpl} from 'chrome://settings/settings.js'; -import {assertEquals, assertTrue, assertFalse} from 'chrome://webui-test/chai_assert.js'; +import {assertEquals, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {TestPluralStringProxy} from 'chrome://webui-test/test_plural_string_proxy.js'; import {eventToPromise, isVisible} from 'chrome://webui-test/test_util.js'; @@ -19,6 +19,18 @@ // clang-format on +async function triggerImportHelper( + importDialog: PasswordsImportDialogElement, + passwordManager: TestPasswordManagerProxy) { + const chooseFile = + importDialog.shadowRoot!.querySelector<HTMLElement>('#chooseFile'); + assertTrue(!!chooseFile); + assertTrue(isVisible(chooseFile)); + chooseFile.click(); + // Import flow should have been triggered. + await passwordManager.whenCalled('importPasswords'); +} + suite('PasswordsImportDialog', function() { let passwordManager: TestPasswordManagerProxy; let pluralString: TestPluralStringProxy; @@ -70,18 +82,11 @@ fileName: 'test.csv', }); - const chooseFile = - importDialog.shadowRoot!.querySelector<HTMLElement>('#chooseFile'); - assertTrue(!!chooseFile); - assertTrue(isVisible(chooseFile)); - chooseFile.click(); - // Import flow should have been triggered. - await passwordManager.whenCalled('importPasswords'); + await triggerImportHelper(importDialog, passwordManager); await pluralString.whenCalled('getPluralString'); flush(); // After the import, the dialog should switch to SUCCESS state. assertEquals(ImportDialogState.SUCCESS, importDialog.dialogState); - assertFalse(isVisible(chooseFile)); const successTip = importDialog.shadowRoot!.querySelector<HTMLElement>('#successTip'); @@ -97,4 +102,58 @@ done.click(); await eventToPromise('close', importDialog); }); + + test('hasCorrectFileErrorState', async function() { + const importDialog = elementFactory.createPasswordsImportDialog(); + assertEquals(ImportDialogState.START, importDialog.dialogState); + passwordManager.setImportResults({ + status: chrome.passwordsPrivate.ImportResultsStatus.BAD_FORMAT, + numberImported: 0, + failedImports: [], + fileName: 'test.csv', + }); + + await triggerImportHelper(importDialog, passwordManager); + flush(); + // After the import, the dialog should switch to ERROR state. + assertEquals(ImportDialogState.ERROR, importDialog.dialogState); + + assertEquals( + importDialog.i18n('importPasswordsBadFormatError', 'test.csv'), + importDialog.$.descriptionText.textContent!.trim()); + + const close = importDialog.shadowRoot!.querySelector<HTMLElement>('#close'); + assertTrue(!!close); + assertEquals(importDialog.i18n('close'), close.textContent!.trim()); + assertTrue(isVisible(close)); + close.click(); + await eventToPromise('close', importDialog); + }); + + test('hasCorrectUnknownErrorState', async function() { + const importDialog = elementFactory.createPasswordsImportDialog(); + assertEquals(ImportDialogState.START, importDialog.dialogState); + passwordManager.setImportResults({ + status: chrome.passwordsPrivate.ImportResultsStatus.IO_ERROR, + numberImported: 0, + failedImports: [], + fileName: 'test.csv', + }); + + await triggerImportHelper(importDialog, passwordManager); + flush(); + // After the import, the dialog should switch to ERROR state. + assertEquals(ImportDialogState.ERROR, importDialog.dialogState); + + assertEquals( + importDialog.i18n('importPasswordsUnknownError'), + importDialog.$.descriptionText.textContent!.trim()); + + const close = importDialog.shadowRoot!.querySelector<HTMLElement>('#close'); + assertTrue(!!close); + assertEquals(importDialog.i18n('close'), close.textContent!.trim()); + assertTrue(isVisible(close)); + close.click(); + await eventToPromise('close', importDialog); + }); });
diff --git a/chrome/test/data/webui/settings/passwords_section_test.ts b/chrome/test/data/webui/settings/passwords_section_test.ts index 03b246e..5c8d683 100644 --- a/chrome/test/data/webui/settings/passwords_section_test.ts +++ b/chrome/test/data/webui/settings/passwords_section_test.ts
@@ -1305,6 +1305,8 @@ const passwordsSection = elementFactory.createPasswordsSection( passwordManager, passwordList, []); return passwordManager.whenCalled('getPasswordCheckStatus').then(() => { + simulateSyncStatus( + {signedIn: true, statusAction: StatusAction.NO_ACTION}); flush(); assertFalse(passwordsSection.$.checkPasswordsBannerContainer.hidden); assertFalse(passwordsSection.$.checkPasswordsButtonRow.hidden); @@ -1496,6 +1498,8 @@ const passwordsSection = elementFactory.createPasswordsSection( passwordManager, passwordList, []); return passwordManager.whenCalled('getPasswordCheckStatus').then(() => { + simulateSyncStatus( + {signedIn: true, statusAction: StatusAction.NO_ACTION}); flush(); assertFalse(passwordsSection.$.checkPasswordsBannerContainer.hidden); assertFalse(passwordsSection.$.checkPasswordsButtonRow.hidden);
diff --git a/chrome/test/views/accessibility_checker.cc b/chrome/test/views/accessibility_checker.cc index 58e149b..888881e 100644 --- a/chrome/test/views/accessibility_checker.cc +++ b/chrome/test/views/accessibility_checker.cc
@@ -76,8 +76,13 @@ if (DoesViewHaveAccessibleNameOrLabelError(&node_data)) { violations += "\n- Focusable View has no accessible name or placeholder, and the " - "name attribute does not use kAttributeExplicitlyEmpty."; + "name attribute does not use kAttributeExplicitlyEmpty. " + "The accessible name is spoken by screen readers to end users. Thus " + "if this is production code, the accessible name should be " + "localized."; } + if (node_data.role == Role::kNone || node_data.role == Role::kUnknown) + violations += "\n- Focusable View needs a valid role."; if (node_data.HasState(State::kIgnored)) violations += "\n- Focusable View should not be ignored."; if (node_data.IsInvisible())
diff --git a/chrome/test/views/accessibility_checker_unittest.cc b/chrome/test/views/accessibility_checker_unittest.cc index 01a0d53..5d80985 100644 --- a/chrome/test/views/accessibility_checker_unittest.cc +++ b/chrome/test/views/accessibility_checker_unittest.cc
@@ -44,4 +44,14 @@ button->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); EXPECT_NONFATAL_FAILURE(AddFailureOnWidgetAccessibilityError(&widget), "Accessibility"); + + // Restore the name of the button so that it is not the source of failure. + button->SetAccessibleName(u"Some name"); + + // Accessibility test should fail if the focusable view lacks a valid role. + auto* generic_view = + widget.GetContentsView()->AddChildView(std::make_unique<views::View>()); + generic_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); + EXPECT_NONFATAL_FAILURE(AddFailureOnWidgetAccessibilityError(&widget), + "Accessibility"); }
diff --git a/chromecast/browser/cast_content_browser_client_receiver_bindings.cc b/chromecast/browser/cast_content_browser_client_receiver_bindings.cc index 091c98f1..723bc58 100644 --- a/chromecast/browser/cast_content_browser_client_receiver_bindings.cc +++ b/chromecast/browser/cast_content_browser_client_receiver_bindings.cc
@@ -77,13 +77,13 @@ service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* render_process_host) { - registry->AddInterface( + registry->AddInterface<media::mojom::MediaCaps>( base::BindRepeating( &media::MediaCapsImpl::AddReceiver, base::Unretained(cast_browser_main_parts_->media_caps())), base::ThreadTaskRunnerHandle::Get()); - registry->AddInterface( + registry->AddInterface<metrics::mojom::MetricsHelper>( base::BindRepeating( &metrics::MetricsHelperImpl::AddReceiver, base::Unretained(cast_browser_main_parts_->metrics_helper())), @@ -94,7 +94,7 @@ memory_pressure_controller_.reset(new MemoryPressureControllerImpl()); } - registry->AddInterface( + registry->AddInterface<mojom::MemoryPressureController>( base::BindRepeating(&MemoryPressureControllerImpl::AddReceiver, base::Unretained(memory_pressure_controller_.get())), base::ThreadTaskRunnerHandle::Get());
diff --git a/chromecast/renderer/cast_activity_url_filter_manager.cc b/chromecast/renderer/cast_activity_url_filter_manager.cc index 985e4539..83f704b 100644 --- a/chromecast/renderer/cast_activity_url_filter_manager.cc +++ b/chromecast/renderer/cast_activity_url_filter_manager.cc
@@ -20,10 +20,12 @@ on_removed_callback_(std::move(on_removed_callback)), weak_factory_(this) { weak_this_ = weak_factory_.GetWeakPtr(); - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&CastActivityUrlFilterManager::UrlFilterReceiver:: - OnActivityUrlFilterConfigurationAssociatedRequest, - weak_this_)); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<chromecast::mojom::ActivityUrlFilterConfiguration>( + base::BindRepeating( + &CastActivityUrlFilterManager::UrlFilterReceiver:: + OnActivityUrlFilterConfigurationAssociatedRequest, + weak_this_)); } CastActivityUrlFilterManager::UrlFilterReceiver::~UrlFilterReceiver() {
diff --git a/chromecast/renderer/feature_manager_on_associated_interface.cc b/chromecast/renderer/feature_manager_on_associated_interface.cc index 12886bc..21d15b2 100644 --- a/chromecast/renderer/feature_manager_on_associated_interface.cc +++ b/chromecast/renderer/feature_manager_on_associated_interface.cc
@@ -16,7 +16,7 @@ FeatureManagerOnAssociatedInterface::FeatureManagerOnAssociatedInterface( content::RenderFrame* render_frame) : content::RenderFrameObserver(render_frame), configured_(false) { - registry_.AddInterface(base::BindRepeating( + registry_.AddInterface<shell::mojom::FeatureManager>(base::BindRepeating( &FeatureManagerOnAssociatedInterface::OnFeatureManagerAssociatedRequest, base::Unretained(this))); }
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 5f64d63..ac83d35 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -14997.0.0 \ No newline at end of file +15019.0.0 \ No newline at end of file
diff --git a/chromeos/ash/components/dbus/userdataauth/fake_userdataauth_client.cc b/chromeos/ash/components/dbus/userdataauth/fake_userdataauth_client.cc index ae5bfe50..ff166bf 100644 --- a/chromeos/ash/components/dbus/userdataauth/fake_userdataauth_client.cc +++ b/chromeos/ash/components/dbus/userdataauth/fake_userdataauth_client.cc
@@ -470,9 +470,41 @@ void FakeUserDataAuthClient::Remove( const ::user_data_auth::RemoveRequest& request, RemoveCallback callback) { - ReturnProtobufMethodCallback(::user_data_auth::RemoveReply(), - std::move(callback)); + ::user_data_auth::RemoveReply reply; + ReplyOnReturn auto_reply(&reply, std::move(callback)); + + cryptohome::AccountIdentifier account_id; + if (request.has_identifier()) { + account_id = request.identifier(); + } else { + auto auth_session = auth_sessions_.find(request.auth_session_id()); + CHECK(auth_session != std::end(auth_sessions_)) << "Invalid auth session"; + account_id = auth_session->second.account; + } + + const auto user_it = users_.find(account_id); + if (user_it == users_.end()) { + reply.set_error(::user_data_auth::CRYPTOHOME_ERROR_ACCOUNT_NOT_FOUND); + return; + } + + const absl::optional<base::FilePath> profile_dir = + GetUserProfileDir(account_id); + if (profile_dir) { + base::ScopedAllowBlockingForTesting allow_blocking; + CHECK(base::DeletePathRecursively(*profile_dir)); + } else { + LOG(WARNING) << "User data directory has not been set, will not delete " + "user profile directory"; + } + + users_.erase(user_it); + if (!request.auth_session_id().empty()) { + // Removing the user also invalidates the AuthSession. + auth_sessions_.erase(request.auth_session_id()); + } } + void FakeUserDataAuthClient::GetKeyData( const ::user_data_auth::GetKeyDataRequest& request, GetKeyDataCallback callback) {
diff --git a/chromeos/ash/services/auth_factor_config/OWNERS b/chromeos/ash/services/auth_factor_config/OWNERS index 3aa4c12..a804d40 100644 --- a/chromeos/ash/services/auth_factor_config/OWNERS +++ b/chromeos/ash/services/auth_factor_config/OWNERS
@@ -1,3 +1,4 @@ +mbid@google.com antrim@chromium.org file://ash/login/LOGIN_LOCK_OWNERS
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index 04a4ea4..5ee08b0 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -3421,6 +3421,9 @@ <message name="IDS_FEEDBACK_TOOL_HELP_CONTENT_OFFLINE_ALT_TEXT" desc="The alt text for the illustration shown when the suggested help content is unavailable because the user is offline."> Device is offline </message> + <message name="IDS_FEEDBACK_TOOL_HELP_CONTENT_LABEL_TOOLTIP" desc="The tooltip text shown next to the suggested help content label."> + Suggestions are based on your description + </message> <!-- Share Data Page --> <message name="IDS_FEEDBACK_TOOL_BACK_BUTTON_LABEL" desc="label for the back button to return to a prior page"> Back
diff --git a/chromeos/chromeos_strings_grd/IDS_FEEDBACK_TOOL_HELP_CONTENT_LABEL_TOOLTIP.png.sha1 b/chromeos/chromeos_strings_grd/IDS_FEEDBACK_TOOL_HELP_CONTENT_LABEL_TOOLTIP.png.sha1 new file mode 100644 index 0000000..6caecdc --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_FEEDBACK_TOOL_HELP_CONTENT_LABEL_TOOLTIP.png.sha1
@@ -0,0 +1 @@ +31135b3158220d5943605e8167f217c2ce2fcec1 \ No newline at end of file
diff --git a/chromeos/crosapi/mojom/BUILD.gn b/chromeos/crosapi/mojom/BUILD.gn index 60676db..64d9719 100644 --- a/chromeos/crosapi/mojom/BUILD.gn +++ b/chromeos/crosapi/mojom/BUILD.gn
@@ -30,6 +30,7 @@ "device_attributes.mojom", "device_oauth2_token_service.mojom", "device_settings_service.mojom", + "diagnostics_service.mojom", "digital_goods.mojom", "dlp.mojom", "document_scan.mojom",
diff --git a/ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom b/chromeos/crosapi/mojom/diagnostics_service.mojom similarity index 83% rename from ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom rename to chromeos/crosapi/mojom/diagnostics_service.mojom index ae37319..2443df20 100644 --- a/ash/webui/telemetry_extension_ui/mojom/diagnostics_service.mojom +++ b/chromeos/crosapi/mojom/diagnostics_service.mojom
@@ -12,16 +12,17 @@ // between the source (cros_healthd) and the clients // (third-party telemetry extensions). -module ash.health.mojom; +module crosapi.mojom; // Interface for exposing diagnostics service. Implemented in ash-chrome. // // Next ID: 17 -[Stable, Uuid="14bc6194-c059-4048-9bea-ca6823eeda82"] +[Stable, Uuid="14bc6194-c059-4048-9bea-ca6823eeda82", +RenamedFrom="ash.health.mojom.DiagnosticsService"] interface DiagnosticsService { // Returns an array of all diagnostic routines that the platform supports. GetAvailableRoutines@0() - => (array<DiagnosticRoutineEnum> available_routines); + => (array<DiagnosticsRoutineEnum> available_routines); // Sends commands to an existing routine. Also returns status information for // the routine. @@ -37,9 +38,9 @@ // The response: // * |routine_update| - status information for the specified routine. See // cros_healthd_diagnostics.mojom for the structure. - GetRoutineUpdate@1(int32 id, DiagnosticRoutineCommandEnum command, + GetRoutineUpdate@1(int32 id, DiagnosticsRoutineCommandEnum command, bool include_output) - => (RoutineUpdate routine_update); + => (DiagnosticsRoutineUpdate routine_update); // Requests that the BatteryCapacity routine is created and started on the // platform. This routine checks the battery's design capacity against inputs @@ -52,7 +53,7 @@ // The response: // * |response| - contains a unique identifier and status for the created // routine. - RunBatteryCapacityRoutine@2() => (RunRoutineResponse response); + RunBatteryCapacityRoutine@2() => (DiagnosticsRunRoutineResponse response); // Requests that the BatteryHealth routine is created and started on the // platform. This routine checks the cycle count and percent wear of the @@ -65,7 +66,7 @@ // The response: // * |response| - contains a unique identifier and status for the created // routine. - RunBatteryHealthRoutine@3() => (RunRoutineResponse response); + RunBatteryHealthRoutine@3() => (DiagnosticsRunRoutineResponse response); // Requests that the SmartctlCheck routine is created and started on the // platform. This routine checks available spare NVMe capacity against the @@ -75,7 +76,7 @@ // The response: // * |response| - contains a unique identifier and status for the created // routine. - RunSmartctlCheckRoutine@4() => (RunRoutineResponse response); + RunSmartctlCheckRoutine@4() => (DiagnosticsRunRoutineResponse response); // Requests that the AcPower routine is created and started on the // platform. This routine checks the status of the power supply, and if @@ -91,9 +92,9 @@ // The response: // * |response| - contains a unique identifier and status for the created // routine. - RunAcPowerRoutine@5(AcPowerStatusEnum expected_status, + RunAcPowerRoutine@5(DiagnosticsAcPowerStatusEnum expected_status, string? expected_power_type) - => (RunRoutineResponse response); + => (DiagnosticsRunRoutineResponse response); // Requests that the CPU cache routine is created and started on the // platform. This routine runs the stressapptest to test the CPU caches. @@ -109,7 +110,7 @@ // * |response| - contains a unique identifier and status for the created // routine. RunCpuCacheRoutine@6(uint32 length_seconds) - => (RunRoutineResponse response); + => (DiagnosticsRunRoutineResponse response); // Requests that the CPU stress routine is created and started on the // platform. This routine runs the stressapptest to stress test the CPU. @@ -125,7 +126,7 @@ // * |response| - contains a unique identifier and status for the created // routine. RunCpuStressRoutine@7(uint32 length_seconds) - => (RunRoutineResponse response); + => (DiagnosticsRunRoutineResponse response); // Requests that the FloatingPointAccuracy routine is created and started // on the platform. This routine executes millions of floating-point @@ -144,7 +145,7 @@ // * |response| - contains a unique identifier and status for the created // routine. RunFloatingPointAccuracyRoutine@8(uint32 length_seconds) - => (RunRoutineResponse response); + => (DiagnosticsRunRoutineResponse response); // Requests that the NvmeWearLevel routine is created and started on the // platform. This routine examines wear level of NVMe against input @@ -159,7 +160,7 @@ // * |response| - contains a unique identifier and status for the created // routine. RunNvmeWearLevelRoutine@9(uint32 wear_level_threshold) - => (RunRoutineResponse response); + => (DiagnosticsRunRoutineResponse response); // Requests that the NvmeSelfTest routine is created and started on the // platform. This routine launches the NVMe self-test, a tool to perform @@ -173,8 +174,8 @@ // The response: // * |response| - contains a unique identifier and status for the created // routine. - RunNvmeSelfTestRoutine@10(NvmeSelfTestTypeEnum nvme_self_test_type) - => (RunRoutineResponse response); + RunNvmeSelfTestRoutine@10(DiagnosticsNvmeSelfTestTypeEnum nvme_self_test_type) + => (DiagnosticsRunRoutineResponse response); // Requests that the DiskRead routine is created and started on the platform. // The routine will create a test file with md5 checksum, read the test file @@ -194,9 +195,9 @@ // The response: // * |response| - contains a unique identifier and status for the created // routine. - RunDiskReadRoutine@11(DiskReadRoutineTypeEnum type, uint32 length_seconds, - uint32 file_size_mb) - => (RunRoutineResponse response); + RunDiskReadRoutine@11(DiagnosticsDiskReadRoutineTypeEnum type, + uint32 length_seconds, uint32 file_size_mb) + => (DiagnosticsRunRoutineResponse response); // Requests that the PrimeSearch routine is created and started on the // platform. Calculate prime numbers and verifies the calculation repeatedly @@ -212,7 +213,7 @@ // * |response| - contains a unique identifier and status for the created // routine. RunPrimeSearchRoutine@12(uint32 length_seconds) - => (RunRoutineResponse response); + => (DiagnosticsRunRoutineResponse response); // Requests that the BatteryDischarge routine is created and started on the // platform. This routine checks the battery's discharge rate over a period of @@ -230,7 +231,7 @@ // routine. RunBatteryDischargeRoutine@13(uint32 length_seconds, uint32 maximum_discharge_percent_allowed) - => (RunRoutineResponse response); + => (DiagnosticsRunRoutineResponse response); // Requests that the BatteryCharge routine is created and started on the // platform. This routine checks the battery's charge rate over a period of @@ -247,7 +248,7 @@ // routine. RunBatteryChargeRoutine@14(uint32 length_seconds, uint32 minimum_charge_percent_required) - => (RunRoutineResponse response); + => (DiagnosticsRunRoutineResponse response); // Requests that the Memory routine is created and started on the platform. // This routine checks that the device's memory is working correctly. This @@ -256,7 +257,7 @@ // The response: // * |response| - contains a unique identifier and status for the created // routine. - RunMemoryRoutine@15() => (RunRoutineResponse response); + RunMemoryRoutine@15() => (DiagnosticsRunRoutineResponse response); // Requests that the LanConnectivity routine is created and started on the // platform. This routine checks whether the device is connected to a LAN. @@ -266,14 +267,14 @@ // The response: // * |response| - contains a unique identifier and status for the created // routine. - RunLanConnectivityRoutine@16() => (RunRoutineResponse response); + RunLanConnectivityRoutine@16() => (DiagnosticsRunRoutineResponse response); }; // Enumeration of each of the diagnostics routines the platform may support. // // Next ID: 16 -[Stable, Extensible] -enum DiagnosticRoutineEnum { +[Stable, Extensible, RenamedFrom="ash.health.mojom.DiagnosticRoutineEnum"] +enum DiagnosticsRoutineEnum { [Default] kUnknown = 15, kBatteryCapacity = 0, kBatteryHealth = 1, @@ -295,8 +296,8 @@ // Enumeration of each of the possible statuses for a diagnostics routine. // // Next ID: 13 -[Stable, Extensible] -enum DiagnosticRoutineStatusEnum { +[Stable, Extensible, RenamedFrom="ash.health.mojom.DiagnosticRoutineStatusEnum"] +enum DiagnosticsRoutineStatusEnum { [Default] kUnknown = 12, kReady = 0, // Routine is ready to start. kRunning = 1, // Routine is currently running. @@ -318,8 +319,9 @@ // These messages prompt interaction from the user of the routine. // // Next ID: 3 -[Stable, Extensible] -enum DiagnosticRoutineUserMessageEnum { +[Stable, Extensible, +RenamedFrom="ash.health.mojom.DiagnosticRoutineUserMessageEnum"] +enum DiagnosticsRoutineUserMessageEnum { [Default] kUnknown = 2, kUnplugACPower = 0, // The user needs to unplug the AC power cord. kPlugInACPower = 1, // The user needs to plug in the AC power cord. @@ -328,8 +330,9 @@ // Enumeration of the possible commands to send a diagnostics routine. // // Next ID: 5 -[Stable, Extensible] -enum DiagnosticRoutineCommandEnum { +[Stable, Extensible, +RenamedFrom="ash.health.mojom.DiagnosticRoutineCommandEnum"] +enum DiagnosticsRoutineCommandEnum { [Default] kUnknown = 4, kContinue = 0, // Resume a routine that is waiting. kCancel = 1, // Cancelled routines must still be removed before the routine @@ -343,20 +346,20 @@ // Status fields specific to interactive routines. // // Next ID: 1 -[Stable] -struct InteractiveRoutineUpdate { +[Stable, RenamedFrom="ash.health.mojom.InteractiveRoutineUpdate"] +struct DiagnosticsInteractiveRoutineUpdate { // Request for user action. This message should be localized and displayed to // the user. - DiagnosticRoutineUserMessageEnum user_message@0; + DiagnosticsRoutineUserMessageEnum user_message@0; }; // Status fields specific to noninteractive routines. // // Next ID: 2 -[Stable] -struct NonInteractiveRoutineUpdate { +[Stable, RenamedFrom="ash.health.mojom.NonInteractiveRoutineUpdate"] +struct DiagnosticsNonInteractiveRoutineUpdate { // Current status of the routine. - DiagnosticRoutineStatusEnum status@0; + DiagnosticsRoutineStatusEnum status@0; // More detailed status - for example, if |status| was kError, // |status_message| would describe the error encountered, like "failed to // read file." @@ -364,17 +367,17 @@ }; // Responses will be either interactive or noninteractive. -[Stable] -union RoutineUpdateUnion { - InteractiveRoutineUpdate interactive_update; - NonInteractiveRoutineUpdate noninteractive_update; +[Stable, RenamedFrom="ash.health.mojom.RoutineUpdateUnion"] +union DiagnosticsRoutineUpdateUnion { + DiagnosticsInteractiveRoutineUpdate interactive_update; + DiagnosticsNonInteractiveRoutineUpdate noninteractive_update; }; // Response type for GetRoutineUpdate. // // Next ID: 3 -[Stable] -struct RoutineUpdate { +[Stable, RenamedFrom="ash.health.mojom.RoutineUpdate"] +struct DiagnosticsRoutineUpdate { // Percent complete, must be between 0 and 100, inclusive. uint32 progress_percent@0; // Any accumulated output, like logs, from the routine. This field is only @@ -384,29 +387,29 @@ // Information specific to the type of response - interactive or // noninteractive. - RoutineUpdateUnion routine_update_union@2; + DiagnosticsRoutineUpdateUnion routine_update_union@2; }; // Generic return value for a RunSomeRoutine call. // // Next ID: 2 -[Stable] -struct RunRoutineResponse { +[Stable, RenamedFrom="ash.health.mojom.RunRoutineResponse"] +struct DiagnosticsRunRoutineResponse { // Unique identifier for the newly-created routine. An id of kFailedToStartId // means that the routine was unable to be created. Can be used in a // GetRoutineUpdate call to control or get the status of the created routine. int32 id@0; // Current status of the newly-created routine. A status of kFailedToStart // means the routine was unable to be created. - DiagnosticRoutineStatusEnum status@1; + DiagnosticsRoutineStatusEnum status@1; }; // Enumeration of the possible statuses for a power supply in the AC power // routine. // // Next ID: 3 -[Stable, Extensible] -enum AcPowerStatusEnum { +[Stable, Extensible, RenamedFrom="ash.health.mojom.AcPowerStatusEnum"] +enum DiagnosticsAcPowerStatusEnum { [Default] kUnknown = 2, kConnected = 0, // Power supply is connected. kDisconnected = 1, // Power supply is disconnected. @@ -415,16 +418,16 @@ // Enumeration of the self-test type in nvme_self_test routine // // Next ID: 3 -[Stable, Extensible] -enum NvmeSelfTestTypeEnum { +[Stable, Extensible, RenamedFrom="ash.health.mojom.NvmeSelfTestTypeEnum"] +enum DiagnosticsNvmeSelfTestTypeEnum { [Default] kUnknown = 2, kShortSelfTest = 0, // Short time self-test. kLongSelfTest = 1, // Long time self-test. }; // Enumeration of the possible DiskRead routine's command type -[Stable, Extensible] -enum DiskReadRoutineTypeEnum { +[Stable, Extensible, RenamedFrom="ash.health.mojom.DiskReadRoutineTypeEnum"] +enum DiagnosticsDiskReadRoutineTypeEnum { kLinearRead = 0, kRandomRead = 1, // Sending this to the underlying cros_healthd will result in an error.
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index 6a6e38cf..a7c48a6 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -238,7 +238,7 @@ render_frame->GetWebFrame()->SetAutofillClient(this); password_autofill_agent->SetAutofillAgent(this); AddFormObserver(this); - registry->AddInterface(base::BindRepeating( + registry->AddInterface<mojom::AutofillAgent>(base::BindRepeating( &AutofillAgent::BindPendingReceiver, base::Unretained(this))); }
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index 9853f342..748e189a 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -626,7 +626,7 @@ checked_safe_browsing_reputation_(false), focus_state_notifier_(this), password_generation_agent_(nullptr) { - registry->AddInterface(base::BindRepeating( + registry->AddInterface<mojom::PasswordAutofillAgent>(base::BindRepeating( &PasswordAutofillAgent::BindPendingReceiver, base::Unretained(this))); }
diff --git a/components/autofill/content/renderer/password_generation_agent.cc b/components/autofill/content/renderer/password_generation_agent.cc index c6e055f..ce8c5c7 100644 --- a/components/autofill/content/renderer/password_generation_agent.cc +++ b/components/autofill/content/renderer/password_generation_agent.cc
@@ -217,7 +217,7 @@ base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kShowAutofillSignatures)), password_agent_(password_agent) { - registry->AddInterface(base::BindRepeating( + registry->AddInterface<mojom::PasswordGenerationAgent>(base::BindRepeating( &PasswordGenerationAgent::BindPendingReceiver, base::Unretained(this))); password_agent_->SetPasswordGenerationAgent(this); }
diff --git a/components/autofill_assistant/content/renderer/autofill_assistant_agent.cc b/components/autofill_assistant/content/renderer/autofill_assistant_agent.cc index 682c36e..4daf7994 100644 --- a/components/autofill_assistant/content/renderer/autofill_assistant_agent.cc +++ b/components/autofill_assistant/content/renderer/autofill_assistant_agent.cc
@@ -105,7 +105,7 @@ content::RenderFrame* render_frame, blink::AssociatedInterfaceRegistry* registry) : content::RenderFrameObserver(render_frame) { - registry->AddInterface(base::BindRepeating( + registry->AddInterface<mojom::AutofillAssistantAgent>(base::BindRepeating( &AutofillAssistantAgent::BindPendingReceiver, base::Unretained(this))); }
diff --git a/components/constrained_window/constrained_window_views.cc b/components/constrained_window/constrained_window_views.cc index df70e533..259f446 100644 --- a/components/constrained_window/constrained_window_views.cc +++ b/components/constrained_window/constrained_window_views.cc
@@ -267,9 +267,9 @@ ->Show(); } -void ShowWebModal(std::unique_ptr<ui::DialogModel> dialog_model, - content::WebContents* web_contents) { - constrained_window::ShowWebModalDialogViews( +views::Widget* ShowWebModal(std::unique_ptr<ui::DialogModel> dialog_model, + content::WebContents* web_contents) { + return constrained_window::ShowWebModalDialogViews( views::BubbleDialogModelHost::CreateModal(std::move(dialog_model), ui::MODAL_TYPE_CHILD) .release(),
diff --git a/components/constrained_window/constrained_window_views.h b/components/constrained_window/constrained_window_views.h index c24827b..0c5d6a7 100644 --- a/components/constrained_window/constrained_window_views.h +++ b/components/constrained_window/constrained_window_views.h
@@ -92,9 +92,9 @@ void ShowBrowserModal(std::unique_ptr<ui::DialogModel> dialog_model, gfx::NativeWindow parent); -// Shows a web/tab-modal dialog based on `dialog_model`. -void ShowWebModal(std::unique_ptr<ui::DialogModel> dialog_model, - content::WebContents* web_contents); +// Shows a web/tab-modal dialog based on `dialog_model` and returns its widget. +views::Widget* ShowWebModal(std::unique_ptr<ui::DialogModel> dialog_model, + content::WebContents* web_contents); } // namespace constrained_window
diff --git a/components/content_capture/renderer/content_capture_sender.cc b/components/content_capture/renderer/content_capture_sender.cc index 45a55cf..faa9f7a 100644 --- a/components/content_capture/renderer/content_capture_sender.cc +++ b/components/content_capture/renderer/content_capture_sender.cc
@@ -22,7 +22,7 @@ content::RenderFrame* render_frame, blink::AssociatedInterfaceRegistry* registry) : content::RenderFrameObserver(render_frame) { - registry->AddInterface(base::BindRepeating( + registry->AddInterface<mojom::ContentCaptureSender>(base::BindRepeating( &ContentCaptureSender::BindPendingReceiver, base::Unretained(this))); }
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc index 272fef3..ffca613 100644 --- a/components/content_settings/core/browser/content_settings_registry.cc +++ b/components/content_settings/core/browser/content_settings_registry.cc
@@ -131,23 +131,24 @@ // PrefProvider::DiscardOrMigrateObsoletePreferences() and // DefaultProvider::DiscardOrMigrateObsoletePreferences() accordingly. - Register(ContentSettingsType::COOKIES, "cookies", CONTENT_SETTING_ALLOW, - WebsiteSettingsInfo::SYNCABLE, - AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), - ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, - CONTENT_SETTING_SESSION_ONLY), - WebsiteSettingsInfo::COOKIES_SCOPE, - WebsiteSettingsRegistry::ALL_PLATFORMS, - ContentSettingsInfo::INHERIT_IN_INCOGNITO, - ContentSettingsInfo::PERSISTENT, - ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS); + Register( + ContentSettingsType::COOKIES, "cookies", CONTENT_SETTING_ALLOW, + WebsiteSettingsInfo::SYNCABLE, + AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), + ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, + CONTENT_SETTING_SESSION_ONLY), + WebsiteSettingsInfo::REQUESTING_ORIGIN_WITH_TOP_ORIGIN_EXCEPTIONS_SCOPE, + WebsiteSettingsRegistry::ALL_PLATFORMS, + ContentSettingsInfo::INHERIT_IN_INCOGNITO, + ContentSettingsInfo::PERSISTENT, + ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS); Register(ContentSettingsType::IMAGES, "images", CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::SYNCABLE, AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme, kExtensionScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_WITH_RESOURCE_EXCEPTIONS_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::PERSISTENT, @@ -158,7 +159,7 @@ AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme, kExtensionScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_WITH_RESOURCE_EXCEPTIONS_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -169,7 +170,7 @@ "get-display-media-set-select-all-screens", CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::SYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -180,7 +181,7 @@ AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme, kExtensionScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::PERSISTENT, @@ -190,7 +191,7 @@ WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -202,7 +203,7 @@ AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, // See also NotificationPermissionContext::DecidePermission which @@ -216,7 +217,7 @@ AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -228,19 +229,21 @@ AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, ContentSettingsInfo::EXCEPTIONS_ON_SECURE_ORIGINS_ONLY); + // TODO(crbug.com/1341356) Move this to deprecated settings since it's no + // longer used. Register(ContentSettingsType::PPAPI_BROKER, "ppapi-broker", CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_WITH_RESOURCE_EXCEPTIONS_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -252,7 +255,7 @@ kExtensionScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -266,7 +269,7 @@ WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -295,7 +298,7 @@ #else // BUILDFLAG(IS_ANDROID) ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), #endif // else - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::PLATFORM_ANDROID | WebsiteSettingsRegistry::PLATFORM_CHROMEOS | WebsiteSettingsRegistry::PLATFORM_WINDOWS, @@ -310,7 +313,7 @@ AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -321,7 +324,7 @@ CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -331,7 +334,7 @@ Register(ContentSettingsType::AUTOPLAY, "autoplay", CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -341,7 +344,7 @@ Register(ContentSettingsType::SOUND, "sound", CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -352,7 +355,7 @@ CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -363,7 +366,7 @@ CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::PERSISTENT, @@ -376,7 +379,7 @@ Register(ContentSettingsType::PROTOCOL_HANDLERS, "protocol-handler", CONTENT_SETTING_DEFAULT, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -386,7 +389,7 @@ CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -396,7 +399,7 @@ CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -408,7 +411,7 @@ AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -421,7 +424,7 @@ Register(ContentSettingsType::SENSORS, "sensors", CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -433,7 +436,7 @@ AllowlistedSchemes(kChromeUIScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -444,7 +447,7 @@ CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -454,7 +457,7 @@ Register(ContentSettingsType::USB_GUARD, "usb-guard", CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -465,7 +468,7 @@ CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -475,7 +478,7 @@ CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -485,7 +488,7 @@ Register(ContentSettingsType::HID_GUARD, "hid-guard", CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -496,7 +499,7 @@ WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -507,7 +510,7 @@ WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -519,7 +522,7 @@ WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -530,7 +533,7 @@ WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -541,7 +544,7 @@ WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -553,7 +556,7 @@ AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK, CONTENT_SETTING_SESSION_ONLY), - WebsiteSettingsInfo::STORAGE_ACCESS_SCOPE, + WebsiteSettingsInfo::REQUESTING_AND_TOP_ORIGIN_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::PERSISTENT, @@ -564,7 +567,7 @@ AllowlistedSchemes(kChromeUIScheme, kChromeDevToolsScheme), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK, CONTENT_SETTING_ASK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -576,7 +579,7 @@ AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, @@ -587,7 +590,7 @@ "insecure-private-network", CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::PERSISTENT, @@ -597,7 +600,7 @@ WebsiteSettingsInfo::SYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -608,7 +611,7 @@ AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, ContentSettingsInfo::INHERIT_IF_LESS_PERMISSIVE, ContentSettingsInfo::PERSISTENT, @@ -618,7 +621,7 @@ CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -638,7 +641,7 @@ auto_dark_web_content_setting, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::PLATFORM_ANDROID, ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::PERSISTENT, @@ -648,7 +651,7 @@ CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::PLATFORM_ANDROID | WebsiteSettingsRegistry::PLATFORM_IOS, ContentSettingsInfo::INHERIT_IN_INCOGNITO, @@ -659,7 +662,7 @@ CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::UNSYNCABLE, AllowlistedSchemes(), ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK), - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, ContentSettingsInfo::INHERIT_IN_INCOGNITO, ContentSettingsInfo::PERSISTENT,
diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc index 9dd9c007..db99f22 100644 --- a/components/content_settings/core/browser/host_content_settings_map.cc +++ b/components/content_settings/core/browser/host_content_settings_map.cc
@@ -159,18 +159,21 @@ content_settings::PatternPair patterns; switch (scoping_type) { - case WebsiteSettingsInfo::COOKIES_SCOPE: + case WebsiteSettingsInfo:: + REQUESTING_ORIGIN_WITH_TOP_ORIGIN_EXCEPTIONS_SCOPE: patterns.first = ContentSettingsPattern::FromURL(primary_url); patterns.second = ContentSettingsPattern::Wildcard(); break; - case WebsiteSettingsInfo::STORAGE_ACCESS_SCOPE: + case WebsiteSettingsInfo::REQUESTING_AND_TOP_ORIGIN_SCOPE: DCHECK(!secondary_url.is_empty()); patterns.first = ContentSettingsPattern::FromURLNoWildcard(primary_url); patterns.second = ContentSettingsPattern::FromURLNoWildcard(secondary_url); break; - case WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE: - case WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE: + case WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE: + case WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE: + case WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE: + case WebsiteSettingsInfo::TOP_ORIGIN_WITH_RESOURCE_EXCEPTIONS_SCOPE: patterns.first = ContentSettingsPattern::FromURLNoWildcard(primary_url); patterns.second = ContentSettingsPattern::Wildcard(); break;
diff --git a/components/content_settings/core/browser/website_settings_info.cc b/components/content_settings/core/browser/website_settings_info.cc index f5cba1dc..9a4c622 100644 --- a/components/content_settings/core/browser/website_settings_info.cc +++ b/components/content_settings/core/browser/website_settings_info.cc
@@ -65,9 +65,9 @@ } bool WebsiteSettingsInfo::SupportsSecondaryPattern() const { - return scoping_type_ == COOKIES_SCOPE || - scoping_type_ == STORAGE_ACCESS_SCOPE || - scoping_type_ == SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE; + return scoping_type_ == REQUESTING_ORIGIN_WITH_TOP_ORIGIN_EXCEPTIONS_SCOPE || + scoping_type_ == REQUESTING_AND_TOP_ORIGIN_SCOPE || + scoping_type_ == TOP_ORIGIN_WITH_RESOURCE_EXCEPTIONS_SCOPE; } } // namespace content_settings
diff --git a/components/content_settings/core/browser/website_settings_info.h b/components/content_settings/core/browser/website_settings_info.h index 858cdb7..5e2a0ab 100644 --- a/components/content_settings/core/browser/website_settings_info.h +++ b/components/content_settings/core/browser/website_settings_info.h
@@ -35,24 +35,43 @@ }; enum ScopingType { - // Settings scoped to the domain of the requesting frame by default. - // Embedded settings can be stored. - COOKIES_SCOPE, + // Settings scoped to the origin of the requesting frame that can have + // exceptions for specific top-level frame origin. + // Use only after strongly considering if this is the right choice; + // preseting settings that are scoped on two origins is difficult to get + // right and often result in surprising UX. + REQUESTING_ORIGIN_WITH_TOP_ORIGIN_EXCEPTIONS_SCOPE, - // Storage access specific scoped that is scoped to the pair of requesting - // and embedding origin. - STORAGE_ACCESS_SCOPE, + // Settings scoped to the origin of the requesting frame and the top-level + // frame. + // Use only after strongly considering if this is the right choice; + // preseting settings that are scoped on two origins is difficult to get + // right and often result in surprising UX. + REQUESTING_AND_TOP_ORIGIN_SCOPE, - // Settings scoped to a single origin (generally either the requesting - // origin or the top level origin of a frame) for a request. Embedded - // exceptions are not allowed. - SINGLE_ORIGIN_ONLY_SCOPE, + // Settings scoped to the top-level origin that can have exceptions for + // specific resource origins. + TOP_ORIGIN_WITH_RESOURCE_EXCEPTIONS_SCOPE, - // Settings scoped to a single origin (generally either the requesting - // origin or the top level origin of a frame) for a request. Embedded - // exceptions are allowed. This should only be used after careful thought. - // Allowing embedded exceptions requires much more complicated UI. - SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + // Setting scoped to the origin of the requesting frame only. + REQUESTING_ORIGIN_ONLY_SCOPE, + + // Setting scoped to the origin of the top-level frame only. + TOP_ORIGIN_ONLY_SCOPE, + + // Setting scoped to a single origin. This does not fit into a + // requesting/top-level origin paradigm and instead simply refers to + // settings stored on a per-origin basis without defining which origin that + // is. Use only when |REQUESTING_ORIGIN_ONLY_SCOPE| and + // |TOP_ORIGIN_ONLY_SCOPE| don't apply. + // + // Use this comment section to keep track of cases where a better option + // than GENERIC_SINGLE_ORIGIN_SCOPE should exist but it's not one of the + // choices above. If the use cases are sufficient, consider adding new + // scoping types to account for them: + // * MEDIA_ENGAGEMENT is always scoped to the origin of the frame that a + // video is played in. A `FRAME_ORIGIN_ONLY` scope could be considered. + GENERIC_SINGLE_ORIGIN_SCOPE, }; enum IncognitoBehavior {
diff --git a/components/content_settings/core/browser/website_settings_registry.cc b/components/content_settings/core/browser/website_settings_registry.cc index c2b56b3..4bb8c0dd 100644 --- a/components/content_settings/core/browser/website_settings_registry.cc +++ b/components/content_settings/core/browser/website_settings_registry.cc
@@ -123,62 +123,62 @@ Register(ContentSettingsType::AUTO_SELECT_CERTIFICATE, "auto-select-certificate", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, - ALL_PLATFORMS, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, ALL_PLATFORMS, + WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register(ContentSettingsType::SSL_CERT_DECISIONS, "ssl-cert-decisions", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register(ContentSettingsType::APP_BANNER, "app-banner", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register( ContentSettingsType::SITE_ENGAGEMENT, "site-engagement", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register( ContentSettingsType::USB_CHOOSER_DATA, "usb-chooser-data", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, DESKTOP | PLATFORM_ANDROID, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::IMPORTANT_SITE_INFO, "important-site-info", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register(ContentSettingsType::PERMISSION_AUTOBLOCKER_DATA, "permission-autoblocking-data", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register(ContentSettingsType::PASSWORD_PROTECTION, "password-protection", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, - ALL_PLATFORMS, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, ALL_PLATFORMS, + WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); // Set when an origin is activated for subresource filtering and the // associated UI is shown to the user. Cleared when a site is de-activated or // the first URL matching the origin is removed from history. Register( ContentSettingsType::ADS_DATA, "subresource-filter-data", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, - DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, DESKTOP | PLATFORM_ANDROID, + WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register( ContentSettingsType::MEDIA_ENGAGEMENT, "media-engagement", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register(ContentSettingsType::CLIENT_HINTS, "client-hints", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); // Set to keep track of dismissals without user's interaction for intent @@ -186,73 +186,75 @@ Register(ContentSettingsType::INTENT_PICKER_DISPLAY, "intent-picker-auto-display", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, - DESKTOP, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, DESKTOP, + WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::SERIAL_CHOOSER_DATA, "serial-chooser-data", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, DESKTOP, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, DESKTOP, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::HID_CHOOSER_DATA, "hid-chooser-data", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, DESKTOP, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, DESKTOP, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); + // TODO(crbug.com/1341356) Move this to deprecated settings since it's no + // longer used. Register(ContentSettingsType::INSTALLED_WEB_APP_METADATA, "installed-web-app-metadata", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, DESKTOP, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, DESKTOP, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register( ContentSettingsType::BLUETOOTH_CHOOSER_DATA, "bluetooth-chooser-data", /*initial_default_value=*/base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, DESKTOP | PLATFORM_ANDROID, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::SAFE_BROWSING_URL_CHECK_DATA, "safe-browsing-url-check-data", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, ALL_PLATFORMS, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, ALL_PLATFORMS, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::PERMISSION_AUTOREVOCATION_DATA, "permission-autorevocation-data", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::FILE_SYSTEM_ACCESS_CHOOSER_DATA, "file-system-access-chooser-data", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, DESKTOP, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, DESKTOP, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::FILE_SYSTEM_LAST_PICKED_DIRECTORY, "file-system-last-picked-directory", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, DESKTOP, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, DESKTOP, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::FEDERATED_IDENTITY_SHARING, "fedcm-share", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, ALL_PLATFORMS, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, ALL_PLATFORMS, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::HTTP_ALLOWED, "http-allowed", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_WITH_EMBEDDED_EXCEPTIONS_SCOPE, - ALL_PLATFORMS, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, ALL_PLATFORMS, + WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register(ContentSettingsType::FORMFILL_METADATA, "formfill-metadata", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, ALL_PLATFORMS, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, ALL_PLATFORMS, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); Register(ContentSettingsType::FEDERATED_IDENTITY_ACTIVE_SESSION, "fedcm-active-session", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, ALL_PLATFORMS, + WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE, ALL_PLATFORMS, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); Register(ContentSettingsType::NOTIFICATION_INTERACTIONS, "notification-interactions", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO); }
diff --git a/components/content_settings/core/browser/website_settings_registry_unittest.cc b/components/content_settings/core/browser/website_settings_registry_unittest.cc index f0fa549..e88f4cf 100644 --- a/components/content_settings/core/browser/website_settings_registry_unittest.cc +++ b/components/content_settings/core/browser/website_settings_registry_unittest.cc
@@ -51,7 +51,7 @@ registry()->Register(static_cast<ContentSettingsType>(10), "test", base::Value(), WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); info = registry()->GetByName("test"); @@ -91,7 +91,7 @@ registry()->Register(static_cast<ContentSettingsType>(10), "test", base::Value(999), WebsiteSettingsInfo::SYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); info = registry()->Get(static_cast<ContentSettingsType>(10)); @@ -108,8 +108,7 @@ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF, info->GetPrefRegistrationFlags()); #endif - EXPECT_EQ(WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, - info->scoping_type()); + EXPECT_EQ(WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, info->scoping_type()); EXPECT_EQ(WebsiteSettingsInfo::INHERIT_IN_INCOGNITO, info->incognito_behavior()); } @@ -118,7 +117,7 @@ registry()->Register(static_cast<ContentSettingsType>(10), "test", base::Value(999), WebsiteSettingsInfo::SYNCABLE, WebsiteSettingsInfo::LOSSY, - WebsiteSettingsInfo::SINGLE_ORIGIN_ONLY_SCOPE, + WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE, WebsiteSettingsRegistry::ALL_PLATFORMS, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO);
diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc b/components/content_settings/renderer/content_settings_agent_impl.cc index 3e0be5b6..701d6a51 100644 --- a/components/content_settings/renderer/content_settings_agent_impl.cc +++ b/components/content_settings/renderer/content_settings_agent_impl.cc
@@ -87,8 +87,8 @@ ClearBlockedContentSettings(); render_frame->GetWebFrame()->SetContentSettingsClient(this); - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating( + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::ContentSettingsAgent>(base::BindRepeating( &ContentSettingsAgentImpl::OnContentSettingsAgentRequest, base::Unretained(this)));
diff --git a/components/continuous_search/renderer/search_result_extractor_impl.cc b/components/continuous_search/renderer/search_result_extractor_impl.cc index 34dde19..36b0fd59 100644 --- a/components/continuous_search/renderer/search_result_extractor_impl.cc +++ b/components/continuous_search/renderer/search_result_extractor_impl.cc
@@ -211,9 +211,10 @@ SearchResultExtractorImpl::SearchResultExtractorImpl( content::RenderFrame* render_frame) : content::RenderFrameObserver(render_frame) { - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&SearchResultExtractorImpl::BindSearchResultExtractor, - weak_ptr_factory_.GetWeakPtr())); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::SearchResultExtractor>(base::BindRepeating( + &SearchResultExtractorImpl::BindSearchResultExtractor, + weak_ptr_factory_.GetWeakPtr())); } SearchResultExtractorImpl::~SearchResultExtractorImpl() = default;
diff --git a/components/cronet/BUILD.gn b/components/cronet/BUILD.gn index fb8a291..7fa6eb50a 100644 --- a/components/cronet/BUILD.gn +++ b/components/cronet/BUILD.gn
@@ -59,7 +59,6 @@ "//base", "//components/prefs:prefs", "//net", - "//third_party/metrics_proto", ] if (!disable_histogram_support) {
diff --git a/components/cronet/android/BUILD.gn b/components/cronet/android/BUILD.gn index 08a47f8..fe77af4 100644 --- a/components/cronet/android/BUILD.gn +++ b/components/cronet/android/BUILD.gn
@@ -147,7 +147,6 @@ "//components/cronet:cronet_version_header", "//components/cronet:metrics_util", "//components/cronet/native:cronet_native_impl", - "//components/metrics", "//components/prefs", "//net", "//third_party/zlib:zlib", @@ -358,22 +357,6 @@ ] } -cronet_impl_native_java_srcjar_deps = [ - ":net_idempotency_java", - ":net_request_priority_java", - ":network_quality_observation_source_java", - ":url_request_error_java", -] - -cronet_impl_native_java_deps_to_package = [ - ":cronet_urlconnection_impl_java", - "//base:base_java", - "//base:jni_java", - "//build/android:build_java", - "//net/android:net_java", - "//url:url_java", -] - android_library("cronet_urlconnection_impl_java") { sources = [ "java/src/org/chromium/net/urlconnection/CronetBufferedOutputStream.java", @@ -392,6 +375,22 @@ ] } +cronet_impl_native_java_srcjar_deps = [ + ":net_idempotency_java", + ":net_request_priority_java", + ":network_quality_observation_source_java", + ":url_request_error_java", +] + +cronet_impl_native_java_deps_to_package = [ + ":cronet_urlconnection_impl_java", + "//base:base_java", + "//base:jni_java", + "//build/android:build_java", + "//net/android:net_java", + "//url:url_java", +] + # cronet_impl_native_base_java.jar - native implementation of the Cronet engine. android_library("cronet_impl_native_base_java") { sources = [ @@ -1244,7 +1243,6 @@ "//base/test:test_support", "//components/cronet:cronet_common_unittests", "//components/cronet/native:cronet_native_unittests", - "//components/metrics", "//components/prefs:test_support", "//net", "//net:test_support", @@ -1268,7 +1266,6 @@ "//base", "//base/test:test_support", "//components/cronet/native/test:cronet_native_tests", - "//components/metrics", "//components/prefs:test_support", "//net", "//net:test_support",
diff --git a/components/cronet/cronet_context.cc b/components/cronet/cronet_context.cc index 81885ac..b940d8c 100644 --- a/components/cronet/cronet_context.cc +++ b/components/cronet/cronet_context.cc
@@ -24,7 +24,6 @@ #include "base/logging.h" #include "base/memory/raw_ptr.h" #include "base/message_loop/message_pump_type.h" -#include "base/metrics/histogram_macros.h" #include "base/metrics/statistics_recorder.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_restrictions.h"
diff --git a/components/js_injection/renderer/js_communication.cc b/components/js_injection/renderer/js_communication.cc index 2aab94b..0c4e0cc 100644 --- a/components/js_injection/renderer/js_communication.cc +++ b/components/js_injection/renderer/js_communication.cc
@@ -31,9 +31,9 @@ JsCommunication::JsCommunication(content::RenderFrame* render_frame) : RenderFrameObserver(render_frame), RenderFrameObserverTracker<JsCommunication>(render_frame) { - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&JsCommunication::BindPendingReceiver, - base::Unretained(this))); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::JsCommunication>(base::BindRepeating( + &JsCommunication::BindPendingReceiver, base::Unretained(this))); } JsCommunication::~JsCommunication() = default;
diff --git a/components/media_control/renderer/media_playback_options.cc b/components/media_control/renderer/media_playback_options.cc index a904284f..6bddc60 100644 --- a/components/media_control/renderer/media_playback_options.cc +++ b/components/media_control/renderer/media_playback_options.cc
@@ -36,10 +36,11 @@ render_frame->SetRenderFrameMediaPlaybackOptions( renderer_media_playback_options_); - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating( - &MediaPlaybackOptions::OnMediaPlaybackOptionsAssociatedReceiver, - base::Unretained(this))); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<components::media_control::mojom::MediaPlaybackOptions>( + base::BindRepeating( + &MediaPlaybackOptions::OnMediaPlaybackOptionsAssociatedReceiver, + base::Unretained(this))); } MediaPlaybackOptions::~MediaPlaybackOptions() {
diff --git a/components/media_router/browser/presentation/presentation_service_delegate_impl.cc b/components/media_router/browser/presentation/presentation_service_delegate_impl.cc index d3510df..a19652f 100644 --- a/components/media_router/browser/presentation/presentation_service_delegate_impl.cc +++ b/components/media_router/browser/presentation/presentation_service_delegate_impl.cc
@@ -32,6 +32,7 @@ #include "components/media_router/common/media_sink.h" #include "components/media_router/common/media_source.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/presentation_observer.h" #include "content/public/browser/presentation_request.h" #include "content/public/browser/presentation_screen_availability_listener.h" #include "content/public/browser/render_frame_host.h" @@ -605,12 +606,12 @@ } void PresentationServiceDelegateImpl::AddObserver( - WebContentsPresentationManager::Observer* observer) { + content::PresentationObserver* observer) { presentation_observers_.AddObserver(observer); } void PresentationServiceDelegateImpl::RemoveObserver( - WebContentsPresentationManager::Observer* observer) { + content::PresentationObserver* observer) { presentation_observers_.RemoveObserver(observer); } @@ -751,7 +752,7 @@ void PresentationServiceDelegateImpl::NotifyMediaRoutesChanged() { auto routes = GetMediaRoutes(); for (auto& presentation_observer : presentation_observers_) - presentation_observer.OnMediaRoutesChanged(routes); + presentation_observer.OnPresentationsChanged(!routes.empty()); } void PresentationServiceDelegateImpl::OnConnectionStateChanged(
diff --git a/components/media_router/browser/presentation/presentation_service_delegate_impl.h b/components/media_router/browser/presentation/presentation_service_delegate_impl.h index bebfa22..84e8d8618 100644 --- a/components/media_router/browser/presentation/presentation_service_delegate_impl.h +++ b/components/media_router/browser/presentation/presentation_service_delegate_impl.h
@@ -115,9 +115,8 @@ state_changed_cb) override; // WebContentsPresentationManager implementation. - void AddObserver(WebContentsPresentationManager::Observer* observer) override; - void RemoveObserver( - WebContentsPresentationManager::Observer* observer) override; + void AddObserver(content::PresentationObserver* observer) override; + void RemoveObserver(content::PresentationObserver* observer) override; bool HasDefaultPresentationRequest() const override; const content::PresentationRequest& GetDefaultPresentationRequest() const override; @@ -237,8 +236,7 @@ // References to the observers listening for changes to the default // presentation and presentation MediaRoutes associated with the // WebContents. - base::ObserverList<WebContentsPresentationManager::Observer> - presentation_observers_; + base::ObserverList<content::PresentationObserver> presentation_observers_; // Default presentation request for the owning WebContents. absl::optional<content::PresentationRequest> default_presentation_request_;
diff --git a/components/media_router/browser/presentation/web_contents_presentation_manager.h b/components/media_router/browser/presentation/web_contents_presentation_manager.h index 143b528..1c34526 100644 --- a/components/media_router/browser/presentation/web_contents_presentation_manager.h +++ b/components/media_router/browser/presentation/web_contents_presentation_manager.h
@@ -14,6 +14,7 @@ namespace content { struct PresentationRequest; +class PresentationObserver; class WebContents; } // namespace content @@ -27,21 +28,6 @@ // WebContents. class WebContentsPresentationManager { public: - class Observer : public base::CheckedObserver { - public: - // Called whenever presentation MediaRoutes associated with the WebContents - // are added, removed, or have their attributes changed. - virtual void OnMediaRoutesChanged(const std::vector<MediaRoute>& routes) {} - - // |presentation_request| is a nullptr if the default PresentationRequest - // has been removed. - virtual void OnDefaultPresentationChanged( - const content::PresentationRequest* presentation_request) {} - - protected: - Observer() = default; - }; - static base::WeakPtr<WebContentsPresentationManager> Get( content::WebContents* web_contents); @@ -51,8 +37,8 @@ virtual ~WebContentsPresentationManager() = 0; - virtual void AddObserver(Observer* observer) = 0; - virtual void RemoveObserver(Observer* observer) = 0; + virtual void AddObserver(content::PresentationObserver* observer) = 0; + virtual void RemoveObserver(content::PresentationObserver* observer) = 0; // Returns true if there is a default presentation request for the // WebContents.
diff --git a/components/no_state_prefetch/renderer/prerender_render_frame_observer.cc b/components/no_state_prefetch/renderer/prerender_render_frame_observer.cc index 17a48a8..3d2a4b6 100644 --- a/components/no_state_prefetch/renderer/prerender_render_frame_observer.cc +++ b/components/no_state_prefetch/renderer/prerender_render_frame_observer.cc
@@ -14,8 +14,8 @@ PrerenderRenderFrameObserver::PrerenderRenderFrameObserver( content::RenderFrame* render_frame) : content::RenderFrameObserver(render_frame) { - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating( + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<prerender::mojom::PrerenderMessages>(base::BindRepeating( &PrerenderRenderFrameObserver::OnRenderFrameObserverRequest, base::Unretained(this))); }
diff --git a/components/on_load_script_injector/renderer/on_load_script_injector.cc b/components/on_load_script_injector/renderer/on_load_script_injector.cc index 09efc78..0a9f0825 100644 --- a/components/on_load_script_injector/renderer/on_load_script_injector.cc +++ b/components/on_load_script_injector/renderer/on_load_script_injector.cc
@@ -16,9 +16,11 @@ OnLoadScriptInjector::OnLoadScriptInjector(content::RenderFrame* frame) : RenderFrameObserver(frame), weak_ptr_factory_(this) { - render_frame()->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&OnLoadScriptInjector::BindToReceiver, - weak_ptr_factory_.GetWeakPtr())); + render_frame() + ->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::OnLoadScriptInjector>( + base::BindRepeating(&OnLoadScriptInjector::BindToReceiver, + weak_ptr_factory_.GetWeakPtr())); } OnLoadScriptInjector::~OnLoadScriptInjector() {}
diff --git a/components/optimization_guide/content/renderer/page_text_agent.cc b/components/optimization_guide/content/renderer/page_text_agent.cc index 02ac22e2..93845a89 100644 --- a/components/optimization_guide/content/renderer/page_text_agent.cc +++ b/components/optimization_guide/content/renderer/page_text_agent.cc
@@ -39,7 +39,7 @@ // For unittesting. return; } - frame->GetAssociatedInterfaceRegistry()->AddInterface( + frame->GetAssociatedInterfaceRegistry()->AddInterface<mojom::PageTextService>( base::BindRepeating(&PageTextAgent::Bind, weak_factory_.GetWeakPtr())); } PageTextAgent::~PageTextAgent() = default;
diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc index 7d37631..93cada1 100644 --- a/components/page_info/page_info.cc +++ b/components/page_info/page_info.cc
@@ -1130,22 +1130,38 @@ if (!web_contents_ || web_contents_->IsBeingDestroyed()) return; - CookieInfoList cookie_info_list; + bool is_cookies_subpage_enabled = false; +#if !BUILDFLAG(IS_ANDROID) + is_cookies_subpage_enabled = + base::FeatureList::IsEnabled(page_info::kPageInfoCookiesSubpage); +#endif - // Add first party cookie and site data counts. - PageInfoUI::CookieInfo cookie_info; - cookie_info.allowed = GetFirstPartyAllowedCookiesCount(site_url_); - cookie_info.blocked = GetFirstPartyBlockedCookiesCount(site_url_); - cookie_info.is_first_party = true; - cookie_info_list.push_back(cookie_info); + if (is_cookies_subpage_enabled) { + // Add allowed sites count. + PageInfoUI::CookiesNewInfo cookies_info; + cookies_info.allowed_sites_count = GetSitesWithAllowedCookiesCount(); - // Add third party cookie counts. - cookie_info.allowed = GetThirdPartyAllowedCookiesCount(site_url_); - cookie_info.blocked = GetThirdPartyBlockedCookiesCount(site_url_); - cookie_info.is_first_party = false; - cookie_info_list.push_back(cookie_info); + // TODO(crbug.com/1346305): Add data flow for FPS. - ui_->SetCookieInfo(cookie_info_list); + ui_->SetCookieInfo(cookies_info); + } else { + CookieInfoList cookie_info_list; + + // Add first party cookie and site data counts. + PageInfoUI::CookieInfo cookie_info; + cookie_info.allowed = GetFirstPartyAllowedCookiesCount(site_url_); + cookie_info.blocked = GetFirstPartyBlockedCookiesCount(site_url_); + cookie_info.is_first_party = true; + cookie_info_list.push_back(cookie_info); + + // Add third party cookie counts. + cookie_info.allowed = GetThirdPartyAllowedCookiesCount(site_url_); + cookie_info.blocked = GetThirdPartyBlockedCookiesCount(site_url_); + cookie_info.is_first_party = false; + cookie_info_list.push_back(cookie_info); + + ui_->SetCookieInfo(cookie_info_list); + } std::move(done).Run(); } @@ -1330,6 +1346,13 @@ site_url); } +int PageInfo::GetSitesWithAllowedCookiesCount() { + auto* settings = GetPageSpecificContentSettings(); + if (!settings) + return 0; + return settings->allowed_local_shared_objects().GetDomainCount(); +} + int PageInfo::GetFirstPartyBlockedCookiesCount(const GURL& site_url) { auto* settings = GetPageSpecificContentSettings(); if (!settings)
diff --git a/components/page_info/page_info.h b/components/page_info/page_info.h index f2548f2..ac069ac 100644 --- a/components/page_info/page_info.h +++ b/components/page_info/page_info.h
@@ -367,6 +367,9 @@ int GetThirdPartyAllowedCookiesCount(const GURL& site_url); int GetThirdPartyBlockedCookiesCount(const GURL& site_url); + // Get the count of sites allowed to access cookies. + int GetSitesWithAllowedCookiesCount(); + // The page info UI displays information and controls for site- // specific data (local stored objects like cookies), site-specific // permissions (location, pop-up, plugin, etc. permissions) and site-specific
diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_info_ui.cc index 811a0d3..f60f6908 100644 --- a/components/page_info/page_info_ui.cc +++ b/components/page_info/page_info_ui.cc
@@ -371,6 +371,12 @@ PageInfoUI::CookieInfo::CookieInfo() : allowed(-1), blocked(-1) {} +PageInfoUI::CookiesNewInfo::CookiesNewInfo() = default; + +PageInfoUI::CookiesFPSInfo::CookiesFPSInfo() = default; + +PageInfoUI::CookiesFPSInfo::~CookiesFPSInfo() = default; + PageInfoUI::ChosenObjectInfo::ChosenObjectInfo( const PageInfo::ChooserUIInfo& ui_info, std::unique_ptr<permissions::ObjectPermissionContextBase::Object>
diff --git a/components/page_info/page_info_ui.h b/components/page_info/page_info_ui.h index 965e357..90d88c5f 100644 --- a/components/page_info/page_info_ui.h +++ b/components/page_info/page_info_ui.h
@@ -72,6 +72,8 @@ // |CookieInfo| contains information about the cookies from a specific source. // A source can for example be a specific origin or an entire wildcard domain. + // TODO(crbug.com/1346305): Remove after finishing cookies subpage + // implementation. struct CookieInfo { CookieInfo(); @@ -85,6 +87,31 @@ bool is_first_party; }; + // |CookiesFPSInfo| contains information about a specific First-Party Set. + struct CookiesFPSInfo { + CookiesFPSInfo(); + ~CookiesFPSInfo(); + + // The number of sites in the same FPS. + int sites_accessing_data_count = -1; + + // The name of the owner of the FPS. + std::string owner_name; + }; + + // |CookiesNewInfo| contains information about the sites that are allowed + // to access cookies and fps cookies info for new UI. + // TODO(crbug.com/1346305): Change the name to "CookieInfo" after finishing + // cookies subpage implementation + struct CookiesNewInfo { + CookiesNewInfo(); + + // The number of sites allowed to access cookies. + int allowed_sites_count = -1; + + CookiesFPSInfo fps_info; + }; + // |ChosenObjectInfo| contains information about a single |chooser_object| of // a chooser |type| that the current website has been granted access to. struct ChosenObjectInfo { @@ -242,7 +269,10 @@ CreateSafetyTipSecurityDescription(const security_state::SafetyTipInfo& info); // Sets cookie information. + // TODO(crbug.com/1346305) remove unused function overload after finished + // project. Sets cookie information. virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) {} + virtual void SetCookieInfo(const CookiesNewInfo& cookie_info) {} // Sets permission information. virtual void SetPermissionInfo(const PermissionInfoList& permission_info_list,
diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp index 1d012d9..10d7aff 100644 --- a/components/page_info_strings.grdp +++ b/components/page_info_strings.grdp
@@ -712,6 +712,9 @@ <message name="IDS_PAGE_INFO_COOKIES_SETTINGS_LINK" desc="The text of the link to cookies settings." translateable="false"> Settings </message> + <message name="IDS_PAGE_INFO_COOKIES_ALLOWED_SITES_COUNT" desc="The label of the count for sites with allowed cookies on the page. This text will be shown on the cookies dialog button." translateable="false"> + {NUM_COOKIES, plural, =1 {1 site allowed} other {# sites allowed}} + </message> <!-- History strings --> <message name="IDS_PAGE_INFO_HISTORY" desc="The button label of the 'History' row in Page Info bubble. The button opens history page for the site.">
diff --git a/components/paint_preview/renderer/paint_preview_recorder_impl.cc b/components/paint_preview/renderer/paint_preview_recorder_impl.cc index 961cd83..0649372 100644 --- a/components/paint_preview/renderer/paint_preview_recorder_impl.cc +++ b/components/paint_preview/renderer/paint_preview_recorder_impl.cc
@@ -205,9 +205,10 @@ is_painting_preview_(false), is_main_frame_(render_frame->IsMainFrame() && !render_frame->IsInFencedFrameTree()) { - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&PaintPreviewRecorderImpl::BindPaintPreviewRecorder, - weak_ptr_factory_.GetWeakPtr())); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::PaintPreviewRecorder>(base::BindRepeating( + &PaintPreviewRecorderImpl::BindPaintPreviewRecorder, + weak_ptr_factory_.GetWeakPtr())); } PaintPreviewRecorderImpl::~PaintPreviewRecorderImpl() = default;
diff --git a/components/policy/core/browser/cloud/user_policy_signin_service_base.cc b/components/policy/core/browser/cloud/user_policy_signin_service_base.cc index 6c064061..669d7b37 100644 --- a/components/policy/core/browser/cloud/user_policy_signin_service_base.cc +++ b/components/policy/core/browser/cloud/user_policy_signin_service_base.cc
@@ -78,7 +78,15 @@ InitializeUserCloudPolicyManager(account_id, std::move(client)); } - DCHECK(manager->IsClientRegistered()); + DCHECK(manager->core()->client()); + + if (!manager->IsClientRegistered()) { + // The manager already has a client but it's still registering. + // `UserCloudPolicyManager` will initiate a policy fetch when the client + // registration completes. Invoke `callback` after the policy is fetched. + policy_fetch_callbacks_.AddUnsafe(std::move(callback)); + return; + } // Now initiate a policy fetch. manager->core()->service()->RefreshPolicy(std::move(callback)); @@ -119,6 +127,7 @@ void UserPolicySigninServiceBase::PrepareForUserCloudPolicyManagerShutdown() { registration_helper_.reset(); registration_helper_for_temporary_client_.reset(); + policy_fetch_callbacks_.Notify(/*success=*/false); UserCloudPolicyManager* manager = policy_manager(); if (manager && manager->core()->client()) manager->core()->client()->RemoveObserver(this); @@ -339,6 +348,10 @@ ProhibitSignoutIfNeeded(); } +void UserPolicySigninServiceBase::OnPolicyRefreshed(bool success) { + policy_fetch_callbacks_.Notify(success); +} + void UserPolicySigninServiceBase::ProhibitSignoutIfNeeded() {} bool UserPolicySigninServiceBase::CanApplyPolicies(
diff --git a/components/policy/core/browser/cloud/user_policy_signin_service_base.h b/components/policy/core/browser/cloud/user_policy_signin_service_base.h index f05c0ea..77cfa42 100644 --- a/components/policy/core/browser/cloud/user_policy_signin_service_base.h +++ b/components/policy/core/browser/cloud/user_policy_signin_service_base.h
@@ -9,6 +9,7 @@ #include <string> #include "base/callback.h" +#include "base/callback_list.h" #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -84,6 +85,7 @@ // CloudPolicyService::Observer implementation: void OnCloudPolicyServiceInitializationCompleted() override; + void OnPolicyRefreshed(bool success) override; // CloudPolicyClient::Observer implementation: void OnPolicyFetched(CloudPolicyClient* client) override; @@ -206,6 +208,9 @@ signin::ConsentLevel consent_level_ = signin::ConsentLevel::kSignin; + // Callbacks to invoke upon policy fetch. + base::OnceCallbackList<void(bool)> policy_fetch_callbacks_; + // Helper for registering the client to DMServer to get a DM token using a // cloud policy client. When there is an instance of |registration_helper_|, // it means that registration is ongoing. There is no registration when null.
diff --git a/components/policy/core/common/policy_map.cc b/components/policy/core/common/policy_map.cc index e57d5cc..527b94f0 100644 --- a/components/policy/core/common/policy_map.cc +++ b/components/policy/core/common/policy_map.cc
@@ -7,7 +7,9 @@ #include <algorithm> #include <utility> +#include "base/bind.h" #include "base/callback.h" +#include "base/logging.h" #include "base/stl_util.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" @@ -15,6 +17,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "components/policy/core/common/cloud/affiliation.h" +#include "components/policy/core/common/policy_details.h" #include "components/policy/core/common/policy_merger.h" #include "components/policy/policy_constants.h" #include "components/strings/grit/components_strings.h" @@ -303,7 +306,8 @@ return entry_; } -PolicyMap::PolicyMap() = default; +PolicyMap::PolicyMap() + : details_callback_{base::BindRepeating(&GetChromePolicyDetails)} {}; PolicyMap::PolicyMap(PolicyMap&&) noexcept = default; PolicyMap& PolicyMap::operator=(PolicyMap&&) noexcept = default; PolicyMap::~PolicyMap() = default; @@ -526,12 +530,28 @@ it->Merge(this); } +void PolicyMap::set_chrome_policy_details_callback_for_test( + const GetChromePolicyDetailsCallback& details_callback) { + details_callback_ = details_callback; +} + +bool PolicyMap::IsPolicyExternal(const std::string& policy) { + const PolicyDetails* policy_details = details_callback_.Run(policy); + if (policy_details && policy_details->max_external_data_size > 0) + return true; + return false; +} + void PolicyMap::LoadFrom(const base::DictionaryValue* policies, PolicyLevel level, PolicyScope scope, PolicySource source) { for (base::DictionaryValue::Iterator it(*policies); !it.IsAtEnd(); it.Advance()) { + if (IsPolicyExternal(it.key())) { + LOG(WARNING) << "Ignoring external policy: " << it.key(); + continue; + } Set(it.key(), level, scope, source, it.value().Clone(), nullptr); } }
diff --git a/components/policy/core/common/policy_map.h b/components/policy/core/common/policy_map.h index a42928fc..e63dac3e 100644 --- a/components/policy/core/common/policy_map.h +++ b/components/policy/core/common/policy_map.h
@@ -17,6 +17,7 @@ #include "base/gtest_prod_util.h" #include "base/values.h" #include "components/policy/core/common/external_data_fetcher.h" +#include "components/policy/core/common/policy_details.h" #include "components/policy/core/common/policy_types.h" #include "components/policy/policy_export.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -322,6 +323,11 @@ // Returns the set containing device affiliation ID strings. const base::flat_set<std::string>& GetDeviceAffiliationIds() const; + // Sets the ChromePolicyDetailsCallback, which is used in IsPolicyExternal(), + // in test environments + void set_chrome_policy_details_callback_for_test( + const GetChromePolicyDetailsCallback& details_callback); + bool Equals(const PolicyMap& other) const; bool empty() const; size_t size() const; @@ -359,8 +365,13 @@ // Updates the stored state of user affiliation. void UpdateStoredUserAffiliation(); + // Returns True if the passed policy has a max_external_data_size > 0 + bool IsPolicyExternal(const std::string& policy); + PolicyMapType map_; + GetChromePolicyDetailsCallback details_callback_; + // Affiliation bool is_user_affiliated_ = false; bool cloud_policy_overrides_platform_policy_ = false;
diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc index c5d1c9a4..48477a8 100644 --- a/components/policy/core/common/policy_map_unittest.cc +++ b/components/policy/core/common/policy_map_unittest.cc
@@ -15,6 +15,7 @@ #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "components/policy/core/common/external_data_manager.h" +#include "components/policy/core/common/policy_details.h" #include "components/policy/core/common/policy_merger.h" #include "components/policy/core/common/policy_types.h" #include "components/policy/policy_constants.h" @@ -74,7 +75,21 @@ base::WeakPtr<ExternalDataManager>(), policy); } -class PolicyMapTest : public PolicyMapTestBase, public testing::Test {}; +class PolicyMapTest : public PolicyMapTestBase, public testing::Test { + public: + const PolicyDetails* GetPolicyDetailsExternalCallback( + const std::string& policy_name) { + return &externalDetails_; + } + + const PolicyDetails* GetPolicyDetailsNonExternalCallback( + const std::string& policy_name) { + return &nonExternalDetails_; + } + + PolicyDetails externalDetails_ = {false, false, false, 0, 10, {}}; + PolicyDetails nonExternalDetails_ = {false, false, false, 0, 0, {}}; +}; TEST_F(PolicyMapTest, SetAndGet) { PolicyMap map; @@ -1028,6 +1043,25 @@ EXPECT_TRUE(loaded.Equals(expected)); } +TEST_F(PolicyMapTest, LoadFromCheckForExternalPolicy) { + base::DictionaryValue policies; + policies.SetStringKey("TestPolicy1", "google.com"); + + PolicyMap loaded; + loaded.set_chrome_policy_details_callback_for_test( + base::BindRepeating(&PolicyMapTest::GetPolicyDetailsExternalCallback, + base::Unretained(this))); + loaded.LoadFrom(&policies, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM); + EXPECT_TRUE(loaded.empty()); + loaded.set_chrome_policy_details_callback_for_test( + base::BindRepeating(&PolicyMapTest::GetPolicyDetailsNonExternalCallback, + base::Unretained(this))); + loaded.LoadFrom(&policies, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_PLATFORM); + EXPECT_FALSE(loaded.empty()); +} + bool IsMandatory(const PolicyMap::PolicyMapType::const_iterator iter) { return iter->second.level == POLICY_LEVEL_MANDATORY; }
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index adda79a..52a6dcb 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -10377,7 +10377,7 @@ From <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> version 92, this policy is also supported in the headless mode. - Note: Blocking internal chrome://* URLs can lead to unexpected errors.''', + Note: Blocking internal chrome://* and chrome-untrusted://* URLs can lead to unexpected errors or may be circumvented in special cases. Instead of blocking certain internal URLs, see if there are more specific policies available. Common cases: Instead of blocking chrome://settings/certificates, use <ph name="CA_CERTIFICATE_MANAGEMENT_ALLOWED_POLICY_NAME">CACertificateManagementAllowed</ph>. Instead of blocking chrome-untrusted://crosh, use <ph name="SYSTEM_FEATURES_DISABLE_LIST_POLICY_NAME">SystemFeaturesDisableList</ph>.''', 'arc_support': 'Android apps may voluntarily choose to honor this list. You cannot force them to honor it.', }, { @@ -14060,7 +14060,7 @@ 'id': 807, 'caption': '''Set the user experience of disabled features''', 'tags': [], - 'desc': '''Controls the user experience of disabled features listed in <ph name="SYSTEM_FEATURES_DISABLE_LIST">SystemFeaturesDisableList</ph>. + 'desc': '''Controls the user experience of disabled features listed in <ph name="SYSTEM_FEATURES_DISABLE_LIST_POLICY_NAME">SystemFeaturesDisableList</ph>. If this policy is set to "blocked", the disabled features will become unusable but still visible to users. @@ -15312,7 +15312,7 @@ }, { 'name': 'VirtualKeyboardEnabled', - 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], + 'owners': ['shend@google.com','e14s-eng@google.com'], 'type': 'main', 'schema': { 'type': 'boolean' }, 'supported_on': ['chrome_os:34-'], @@ -23017,7 +23017,6 @@ 'dynamic_refresh': True, 'per_profile': True, }, - 'max_size': 1048576, 'example_value': [{ 'url': 'https://www.google.com/maps', 'default_launch_container': 'window',
diff --git a/components/policy/tools/syntax_check_policy_template_json.py b/components/policy/tools/syntax_check_policy_template_json.py index a419698f..9873d38 100755 --- a/components/policy/tools/syntax_check_policy_template_json.py +++ b/components/policy/tools/syntax_check_policy_template_json.py
@@ -1238,6 +1238,12 @@ # Each policy referencing external data must specify a maximum data # size. self._CheckContains(policy, 'max_size', int) + else: + max_size = self._CheckContains(policy, 'max_size', int, True) + if max_size: + self._Error( + "%s: \'max_size\' is only allowed for external policies." % + policy.get('name')) def _CheckPlatform(self, platforms, field_name, policy_name): ''' Verifies the |platforms| list. Records any error with |field_name| and
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc index fe8cd8bc..2331b4d 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -1191,9 +1191,10 @@ if (!delegate_->IsPrintPreviewEnabled()) DisablePreview(); - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&PrintRenderFrameHelper::BindPrintRenderFrameReceiver, - weak_ptr_factory_.GetWeakPtr())); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::PrintRenderFrame>(base::BindRepeating( + &PrintRenderFrameHelper::BindPrintRenderFrameReceiver, + weak_ptr_factory_.GetWeakPtr())); } PrintRenderFrameHelper::~PrintRenderFrameHelper() {}
diff --git a/components/safe_browsing/content/renderer/phishing_classifier/phishing_classifier_delegate.cc b/components/safe_browsing/content/renderer/phishing_classifier/phishing_classifier_delegate.cc index c894382..522acb9 100644 --- a/components/safe_browsing/content/renderer/phishing_classifier/phishing_classifier_delegate.cc +++ b/components/safe_browsing/content/renderer/phishing_classifier/phishing_classifier_delegate.cc
@@ -57,9 +57,10 @@ classifier_.reset(classifier); - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&PhishingClassifierDelegate::PhishingDetectorReceiver, - base::Unretained(this))); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::PhishingDetector>(base::BindRepeating( + &PhishingClassifierDelegate::PhishingDetectorReceiver, + base::Unretained(this))); model_change_observation_.Observe(ScorerStorage::GetInstance()); }
diff --git a/components/safe_browsing/content/renderer/phishing_classifier/phishing_model_setter_impl.cc b/components/safe_browsing/content/renderer/phishing_classifier/phishing_model_setter_impl.cc index 5f1521f..77b05ed 100644 --- a/components/safe_browsing/content/renderer/phishing_classifier/phishing_model_setter_impl.cc +++ b/components/safe_browsing/content/renderer/phishing_classifier/phishing_model_setter_impl.cc
@@ -16,7 +16,7 @@ void PhishingModelSetterImpl::RegisterMojoInterfaces( blink::AssociatedInterfaceRegistry* associated_interfaces) { - associated_interfaces->AddInterface( + associated_interfaces->AddInterface<mojom::PhishingModelSetter>( base::BindRepeating(&PhishingModelSetterImpl::OnRendererAssociatedRequest, base::Unretained(this))); }
diff --git a/components/subresource_filter/content/renderer/subresource_filter_agent.cc b/components/subresource_filter/content/renderer/subresource_filter_agent.cc index 4487075..62608f2 100644 --- a/components/subresource_filter/content/renderer/subresource_filter_agent.cc +++ b/components/subresource_filter/content/renderer/subresource_filter_agent.cc
@@ -98,8 +98,9 @@ // `render_frame()` can be null in unit tests. if (render_frame()) { - render_frame()->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating( + render_frame() + ->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::SubresourceFilterAgent>(base::BindRepeating( &SubresourceFilterAgent::OnSubresourceFilterAgentRequest, base::Unretained(this)));
diff --git a/components/subresource_filter/content/renderer/unverified_ruleset_dealer.cc b/components/subresource_filter/content/renderer/unverified_ruleset_dealer.cc index 63a3d8f..572c2190 100644 --- a/components/subresource_filter/content/renderer/unverified_ruleset_dealer.cc +++ b/components/subresource_filter/content/renderer/unverified_ruleset_dealer.cc
@@ -16,7 +16,7 @@ // base::Unretained can be used here because the associated_interfaces // is owned by the RenderThread and will live for the duration of the // RenderThread. - associated_interfaces->AddInterface( + associated_interfaces->AddInterface<mojom::SubresourceFilterRulesetObserver>( base::BindRepeating(&UnverifiedRulesetDealer::OnRendererAssociatedRequest, base::Unretained(this))); }
diff --git a/components/translate/content/renderer/per_frame_translate_agent.cc b/components/translate/content/renderer/per_frame_translate_agent.cc index 34974e0b..4426d4b 100644 --- a/components/translate/content/renderer/per_frame_translate_agent.cc +++ b/components/translate/content/renderer/per_frame_translate_agent.cc
@@ -73,7 +73,7 @@ int world_id, blink::AssociatedInterfaceRegistry* registry) : content::RenderFrameObserver(render_frame), world_id_(world_id) { - registry->AddInterface(base::BindRepeating( + registry->AddInterface<mojom::TranslateAgent>(base::BindRepeating( &PerFrameTranslateAgent::BindReceiver, base::Unretained(this))); }
diff --git a/components/url_rewrite/renderer/url_request_rules_receiver.cc b/components/url_rewrite/renderer/url_request_rules_receiver.cc index 93b8b2f9..e126403 100644 --- a/components/url_rewrite/renderer/url_request_rules_receiver.cc +++ b/components/url_rewrite/renderer/url_request_rules_receiver.cc
@@ -17,8 +17,8 @@ // It is fine to use an unretained pointer to |this| here as the // AssociatedInterfaceRegistry, owned by |render_frame| will be torn-down at // the same time as |this|. - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating( + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::UrlRequestRulesReceiver>(base::BindRepeating( &UrlRequestRulesReceiver::OnUrlRequestRulesReceiverAssociatedReceiver, base::Unretained(this))); }
diff --git a/components/version_ui/version_handler_helper.cc b/components/version_ui/version_handler_helper.cc index ea5335b..15accd1b 100644 --- a/components/version_ui/version_handler_helper.cc +++ b/components/version_ui/version_handler_helper.cc
@@ -11,13 +11,12 @@ #include "base/metrics/field_trial.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" -#include "base/values.h" #include "components/variations/active_field_trials.h" #include "components/variations/net/variations_command_line.h" namespace version_ui { -base::Value GetVariationsList() { +base::Value::List GetVariationsList() { std::vector<std::string> variations; #if !defined(NDEBUG) base::FieldTrial::ActiveGroups active_groups; @@ -37,7 +36,7 @@ &variations); #endif - base::Value variations_list(base::Value::Type::LIST); + base::Value::List variations_list; for (std::string& variation : variations) variations_list.Append(std::move(variation));
diff --git a/components/version_ui/version_handler_helper.h b/components/version_ui/version_handler_helper.h index c450ed1..0b51ad83 100644 --- a/components/version_ui/version_handler_helper.h +++ b/components/version_ui/version_handler_helper.h
@@ -5,14 +5,12 @@ #ifndef COMPONENTS_VERSION_UI_VERSION_HANDLER_HELPER_H_ #define COMPONENTS_VERSION_UI_VERSION_HANDLER_HELPER_H_ -namespace base { -class Value; -} +#include "base/values.h" namespace version_ui { // Returns the list of variations to be displayed on the chrome:://version page. -base::Value GetVariationsList(); +base::Value::List GetVariationsList(); // Returns the variations information in command line format to be displayed on // the chrome:://version page.
diff --git a/components/webapps/renderer/web_page_metadata_agent.cc b/components/webapps/renderer/web_page_metadata_agent.cc index c0a5ae64..007ba778 100644 --- a/components/webapps/renderer/web_page_metadata_agent.cc +++ b/components/webapps/renderer/web_page_metadata_agent.cc
@@ -21,9 +21,10 @@ WebPageMetadataAgent::WebPageMetadataAgent(content::RenderFrame* render_frame) : content::RenderFrameObserver(render_frame) { - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&WebPageMetadataAgent::OnRenderFrameObserverRequest, - base::Unretained(this))); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::WebPageMetadataAgent>(base::BindRepeating( + &WebPageMetadataAgent::OnRenderFrameObserverRequest, + base::Unretained(this))); } WebPageMetadataAgent::~WebPageMetadataAgent() = default;
diff --git a/content/browser/devtools/web_contents_devtools_agent_host.cc b/content/browser/devtools/web_contents_devtools_agent_host.cc index 9f1270f4..331e0df 100644 --- a/content/browser/devtools/web_contents_devtools_agent_host.cc +++ b/content/browser/devtools/web_contents_devtools_agent_host.cc
@@ -30,6 +30,12 @@ } } // namespace +// static +scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetOrCreateForTab( + WebContents* wc) { + return WebContentsDevToolsAgentHost::GetOrCreateFor(wc); +} + class WebContentsDevToolsAgentHost::AutoAttacher : public protocol::TargetAutoAttacher { public:
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 3288b33..fafad100 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -9240,10 +9240,11 @@ impl->CreateMessageFilterForAssociatedReceiver( mojom::FrameHost::Name_)); }; - associated_registry_->AddInterface( + associated_registry_->AddInterface<mojom::FrameHost>( base::BindRepeating(bind_frame_host_receiver, base::Unretained(this))); - associated_registry_->AddInterface(base::BindRepeating( + associated_registry_->AddInterface< + blink::mojom::BackForwardCacheControllerHost>(base::BindRepeating( [](RenderFrameHostImpl* impl, mojo::PendingAssociatedReceiver< blink::mojom::BackForwardCacheControllerHost> receiver) { @@ -9256,26 +9257,30 @@ }, base::Unretained(this))); - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* self, - mojo::PendingAssociatedReceiver<blink::mojom::PortalHost> receiver) { - Portal::BindPortalHostReceiver(self, std::move(receiver)); - }, - base::Unretained(this))); + associated_registry_->AddInterface<blink::mojom::PortalHost>( + base::BindRepeating( + [](RenderFrameHostImpl* self, + mojo::PendingAssociatedReceiver<blink::mojom::PortalHost> + receiver) { + Portal::BindPortalHostReceiver(self, std::move(receiver)); + }, + base::Unretained(this))); - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* impl, - mojo::PendingAssociatedReceiver<blink::mojom::LocalFrameHost> - receiver) { - impl->local_frame_host_receiver_.Bind(std::move(receiver)); - impl->local_frame_host_receiver_.SetFilter( - impl->CreateMessageFilterForAssociatedReceiver( - blink::mojom::LocalFrameHost::Name_)); - }, - base::Unretained(this))); + associated_registry_->AddInterface<blink::mojom::LocalFrameHost>( + base::BindRepeating( + [](RenderFrameHostImpl* impl, + mojo::PendingAssociatedReceiver<blink::mojom::LocalFrameHost> + receiver) { + impl->local_frame_host_receiver_.Bind(std::move(receiver)); + impl->local_frame_host_receiver_.SetFilter( + impl->CreateMessageFilterForAssociatedReceiver( + blink::mojom::LocalFrameHost::Name_)); + }, + base::Unretained(this))); if (base::FeatureList::IsEnabled(blink::features::kSharedStorageAPI)) { - associated_registry_->AddInterface(base::BindRepeating( + associated_registry_->AddInterface< + blink::mojom::SharedStorageDocumentService>(base::BindRepeating( [](RenderFrameHostImpl* impl, mojo::PendingAssociatedReceiver< blink::mojom::SharedStorageDocumentService> receiver) { @@ -9296,36 +9301,39 @@ } if (is_main_frame()) { - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* impl, - mojo::PendingAssociatedReceiver<blink::mojom::LocalMainFrameHost> - receiver) { - impl->local_main_frame_host_receiver_.Bind(std::move(receiver)); - impl->local_main_frame_host_receiver_.SetFilter( - impl->CreateMessageFilterForAssociatedReceiver( - blink::mojom::LocalMainFrameHost::Name_)); - }, - base::Unretained(this))); + associated_registry_->AddInterface<blink::mojom::LocalMainFrameHost>( + base::BindRepeating( + [](RenderFrameHostImpl* impl, + mojo::PendingAssociatedReceiver<blink::mojom::LocalMainFrameHost> + receiver) { + impl->local_main_frame_host_receiver_.Bind(std::move(receiver)); + impl->local_main_frame_host_receiver_.SetFilter( + impl->CreateMessageFilterForAssociatedReceiver( + blink::mojom::LocalMainFrameHost::Name_)); + }, + base::Unretained(this))); - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* impl, - mojo::PendingAssociatedReceiver< - blink::mojom::ManifestUrlChangeObserver> receiver) { - ManifestManagerHost::GetOrCreateForPage(impl->GetPage()) - ->BindObserver(std::move(receiver)); - }, - base::Unretained(this))); + associated_registry_->AddInterface<blink::mojom::ManifestUrlChangeObserver>( + base::BindRepeating( + [](RenderFrameHostImpl* impl, + mojo::PendingAssociatedReceiver< + blink::mojom::ManifestUrlChangeObserver> receiver) { + ManifestManagerHost::GetOrCreateForPage(impl->GetPage()) + ->BindObserver(std::move(receiver)); + }, + base::Unretained(this))); } // TODO(crbug.com/1047354): How to avoid binding if the // BINDINGS_POLICY_DOM_AUTOMATION policy is not set? - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* impl, - mojo::PendingAssociatedReceiver<mojom::DomAutomationControllerHost> - receiver) { - impl->BindDomOperationControllerHostReceiver(std::move(receiver)); - }, - base::Unretained(this))); + associated_registry_->AddInterface<mojom::DomAutomationControllerHost>( + base::BindRepeating( + [](RenderFrameHostImpl* impl, + mojo::PendingAssociatedReceiver<mojom::DomAutomationControllerHost> + receiver) { + impl->BindDomOperationControllerHostReceiver(std::move(receiver)); + }, + base::Unretained(this))); file_system_manager_.reset(new FileSystemManagerImpl( GetProcess()->GetID(), @@ -9333,7 +9341,7 @@ ChromeBlobStorageContext::GetFor(GetProcess()->GetBrowserContext()))); #if BUILDFLAG(ENABLE_PLUGINS) - associated_registry_->AddInterface(base::BindRepeating( + associated_registry_->AddInterface<mojom::PepperHost>(base::BindRepeating( [](RenderFrameHostImpl* impl, mojo::PendingAssociatedReceiver<mojom::PepperHost> receiver) { impl->pepper_host_receiver_.Bind(std::move(receiver)); @@ -9344,40 +9352,44 @@ base::Unretained(this))); #endif - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* impl, - mojo::PendingAssociatedReceiver<media::mojom::MediaPlayerHost> - receiver) { - impl->delegate()->CreateMediaPlayerHostForRenderFrameHost( - impl, std::move(receiver)); - }, - base::Unretained(this))); + associated_registry_->AddInterface<media::mojom::MediaPlayerHost>( + base::BindRepeating( + [](RenderFrameHostImpl* impl, + mojo::PendingAssociatedReceiver<media::mojom::MediaPlayerHost> + receiver) { + impl->delegate()->CreateMediaPlayerHostForRenderFrameHost( + impl, std::move(receiver)); + }, + base::Unretained(this))); - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* impl, - mojo::PendingAssociatedReceiver<blink::mojom::DisplayCutoutHost> - receiver) { - impl->delegate()->BindDisplayCutoutHost(impl, std::move(receiver)); - }, - base::Unretained(this))); + associated_registry_->AddInterface<blink::mojom::DisplayCutoutHost>( + base::BindRepeating( + [](RenderFrameHostImpl* impl, + mojo::PendingAssociatedReceiver<blink::mojom::DisplayCutoutHost> + receiver) { + impl->delegate()->BindDisplayCutoutHost(impl, std::move(receiver)); + }, + base::Unretained(this))); - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* impl, - mojo::PendingAssociatedReceiver<blink::mojom::ConversionHost> - receiver) { - AttributionHost::BindReceiver(std::move(receiver), impl); - }, - base::Unretained(this))); + associated_registry_->AddInterface<blink::mojom::ConversionHost>( + base::BindRepeating( + [](RenderFrameHostImpl* impl, + mojo::PendingAssociatedReceiver<blink::mojom::ConversionHost> + receiver) { + AttributionHost::BindReceiver(std::move(receiver), impl); + }, + base::Unretained(this))); - associated_registry_->AddInterface(base::BindRepeating( - [](RenderFrameHostImpl* impl, - mojo::PendingAssociatedReceiver<device::mojom::ScreenOrientation> - receiver) { - impl->delegate()->BindScreenOrientation(impl, std::move(receiver)); - }, - base::Unretained(this))); + associated_registry_->AddInterface<device::mojom::ScreenOrientation>( + base::BindRepeating( + [](RenderFrameHostImpl* impl, + mojo::PendingAssociatedReceiver<device::mojom::ScreenOrientation> + receiver) { + impl->delegate()->BindScreenOrientation(impl, std::move(receiver)); + }, + base::Unretained(this))); - associated_registry_->AddInterface( + associated_registry_->AddInterface<blink::mojom::BroadcastChannelProvider>( base::BindRepeating(&RenderFrameHostImpl::CreateBroadcastChannelProvider, base::Unretained(this)));
diff --git a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc index dfb98ba..fb5e1c6 100644 --- a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc
@@ -6948,6 +6948,14 @@ #endif // BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(RenderFrameHostImplBrowsingContextStateNameTest, MAYBE_BlockNameUpdateForBackForwardCache) { + const bool disable_frame_name_update = base::FeatureList::IsEnabled( + features::kDisableFrameNameUpdateOnNonCurrentRenderFrameHost); + + // TODO(1326943): This configuration is flaky. + if (!disable_frame_name_update) { + GTEST_SKIP(); + } + // Create the RenderFrameHost and store it in the BackForwardCache. GURL url_a(embedded_test_server()->GetURL("a.com", "/title1.html")); GURL url_b(embedded_test_server()->GetURL("b.com", "/title2.html")); @@ -6981,8 +6989,7 @@ ->current_replication_state() .unique_name; - if (base::FeatureList::IsEnabled( - features::kDisableFrameNameUpdateOnNonCurrentRenderFrameHost)) { + if (disable_frame_name_update) { // Verify that the frame name and unique name haven't been changed, even // though a name change was triggered by the Javascript. EXPECT_EQ(frame_name, "page_name"); @@ -7008,6 +7015,14 @@ #endif // BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(RenderFrameHostImplBrowsingContextStateNameTest, MAYBE_BlockNameUpdateForPendingDelete) { + const bool disable_frame_name_update = base::FeatureList::IsEnabled( + features::kDisableFrameNameUpdateOnNonCurrentRenderFrameHost); + + // TODO(1326944): This configuration is flaky. + if (!disable_frame_name_update) { + GTEST_SKIP(); + } + // Disable BackForwardCache so that a pending delete state can be forced. web_contents()->GetController().GetBackForwardCache().DisableForTesting( content::BackForwardCache::TEST_USES_UNLOAD_EVENT); @@ -7046,8 +7061,7 @@ ->current_replication_state() .unique_name; - if (base::FeatureList::IsEnabled( - features::kDisableFrameNameUpdateOnNonCurrentRenderFrameHost)) { + if (disable_frame_name_update) { // Verify that the frame name and unique name haven't been changed, even // though a name change was triggered by the Javascript. EXPECT_EQ(frame_name, "page_name");
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 997ce2ca..0ed76d6 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2368,7 +2368,7 @@ // This base::Unretained() usage is safe since the associated_registry is // owned by this RPHI. - associated_registry->AddInterface(base::BindRepeating( + associated_registry->AddInterface<mojom::RendererHost>(base::BindRepeating( &RenderProcessHostImpl::CreateRendererHost, base::Unretained(this))); registry->AddInterface(
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_vk_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_aura_vk_browsertest.cc index 1eb1caac..47747d7 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_vk_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_vk_browsertest.cc
@@ -21,6 +21,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h" +#include "content/public/test/prerender_test_util.h" #include "content/public/test/text_input_test_utils.h" #include "content/shell/browser/shell.h" #include "net/base/filename_util.h" @@ -421,4 +422,94 @@ } #endif // BUILDFLAG(IS_WIN) +// This class observes TextInputManager for changes in `active_view_`. +class TextInputManagerStateObserver : public TextInputManagerObserverBase { + public: + explicit TextInputManagerStateObserver(WebContents* web_contents) + : TextInputManagerObserverBase(web_contents) { + tester()->SetUpdateTextInputStateCalledCallback(base::BindRepeating( + &TextInputManagerStateObserver::VerifyActiveViewOnStateUpdate, + base::Unretained(this))); + } + ~TextInputManagerStateObserver() override = default; + + void WaitUntilActiveViewIsUpdated() { + base::RunLoop run_loop; + quit_callback_ = run_loop.QuitClosure(); + run_loop.Run(); + } + + RenderWidgetHostView* last_updated_active_view() { + return last_updated_active_view_; + } + + private: + void VerifyActiveViewOnStateUpdate() { + RenderWidgetHostView* active_view = + const_cast<RenderWidgetHostView*>(tester()->GetActiveView()); + EXPECT_TRUE(active_view); + last_updated_active_view_ = active_view; + RenderWidgetHostImpl* widget_host = + static_cast<RenderWidgetHostImpl*>(active_view->GetRenderWidgetHost()); + EXPECT_EQ(widget_host->frame_tree()->type(), FrameTree::Type::kPrimary); + OnSuccess(); + if (quit_callback_) + std::move(quit_callback_).Run(); + } + + RenderWidgetHostView* last_updated_active_view_ = nullptr; + base::OnceClosure quit_callback_; +}; + +class RenderWidgetHostViewAuraPrerenderingBrowserTest + : public ContentBrowserTest { + public: + RenderWidgetHostViewAuraPrerenderingBrowserTest() + : prerender_helper_(base::BindRepeating( + &RenderWidgetHostViewAuraPrerenderingBrowserTest::GetWebContents, + base::Unretained(this))) {} + ~RenderWidgetHostViewAuraPrerenderingBrowserTest() override = default; + + WebContents* GetWebContents() { return shell()->web_contents(); } + + test::PrerenderTestHelper& prerender_helper() { return prerender_helper_; } + + void SetUpOnMainThread() override { + host_resolver()->AddRule("*", "127.0.0.1"); + ASSERT_TRUE(test_server_handle_ = + embedded_test_server()->StartAndReturnHandle()); + } + + private: + test::PrerenderTestHelper prerender_helper_; + net::test_server::EmbeddedTestServerHandle test_server_handle_; +}; + +// Tests that `active_view_` from TextInputManager is not set for prerendering. +IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewAuraPrerenderingBrowserTest, + TextInputManagerActiveView) { + const GURL kVirtualKeyboardUrl = + embedded_test_server()->GetURL("/virtual-keyboard.html"); + const GURL kEmptyUrl = embedded_test_server()->GetURL("/empty.html"); + + auto* web_contents = GetWebContents(); + TextInputManagerStateObserver type_observer_show(web_contents); + // Navigate to a simple page. + ASSERT_TRUE(NavigateToURL(shell(), kEmptyUrl)); + EXPECT_EQ(web_contents->GetLastCommittedURL(), kEmptyUrl); + EXPECT_EQ(type_observer_show.last_updated_active_view(), nullptr); + + // Start prerendering `kVirtualKeyboardUrl`. + prerender_helper().AddPrerender(kVirtualKeyboardUrl); + // Prerendering shouldn't update `active_view_` from TextInputManager. + EXPECT_EQ(type_observer_show.last_updated_active_view(), nullptr); + + prerender_helper().NavigatePrimaryPage(kVirtualKeyboardUrl); + type_observer_show.WaitUntilActiveViewIsUpdated(); + // If the page is activated, it updates `active_view_` from TextInputManager. + EXPECT_EQ(web_contents->GetLastCommittedURL(), kVirtualKeyboardUrl); + EXPECT_EQ(type_observer_show.last_updated_active_view(), + web_contents->GetPrimaryMainFrame()->GetView()); +} + } // namespace content
diff --git a/content/browser/site_per_process_layout_browsertest.cc b/content/browser/site_per_process_layout_browsertest.cc index b73cded..aa7ee15 100644 --- a/content/browser/site_per_process_layout_browsertest.cc +++ b/content/browser/site_per_process_layout_browsertest.cc
@@ -1154,17 +1154,9 @@ node->current_frame_host()->GetProcess()->GetIntersectsViewport()); } -// TODO(https://crbug.com/1348408): Flakes on Linux, Linux ASAN/LSAN, Linux -// ChromeOS. -// // Tests that when a non-root frame in an iframe, performs a RAF to emulate a // scroll, that metrics are reported. -#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) -#define MAYBE_ScrollByRAF DISABLED_ScrollByRAF -#else -#define MAYBE_ScrollByRAF ScrollByRAF -#endif -IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, MAYBE_ScrollByRAF) { +IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, ScrollByRAF) { base::HistogramTester histogram_tester; GURL main_url(embedded_test_server()->GetURL( "a.com", "/cross_site_iframe_factory.html?a(b(b))"));
diff --git a/content/browser/web_package/signed_exchange_subresource_prefetch_browsertest.cc b/content/browser/web_package/signed_exchange_subresource_prefetch_browsertest.cc index a954dcb..9316d7a 100644 --- a/content/browser/web_package/signed_exchange_subresource_prefetch_browsertest.cc +++ b/content/browser/web_package/signed_exchange_subresource_prefetch_browsertest.cc
@@ -1884,7 +1884,9 @@ EXPECT_EQ(1, script2_request_counter->GetRequestCount()); } -IN_PROC_BROWSER_TEST_F(SignedExchangeSubresourcePrefetchBrowserTest, CORS) { +// TODO(crbug.com/1350046): Flaky. +IN_PROC_BROWSER_TEST_F(SignedExchangeSubresourcePrefetchBrowserTest, + DISABLED_CORS) { std::unique_ptr<net::EmbeddedTestServer> data_server = std::make_unique<net::EmbeddedTestServer>( net::EmbeddedTestServer::TYPE_HTTPS);
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java index 53e53c9..40c186ae 100644 --- a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java
@@ -1043,6 +1043,13 @@ @CalledByNative private boolean requestStartStylusWriting() { if (mWebContents.getStylusWritingHandler() == null) return false; + + // It is possible that current view is not focused when stylus writing is started just after + // interaction with some other view like Url bar, or share view. We need to focus it so that + // current web page also gets focused, allowing us to commit text into web input elements. + View containerView = getContainerView(); + if (!ViewUtils.hasFocus(containerView)) ViewUtils.requestFocus(containerView); + updateInputStateForStylusWriting(); return mWebContents.getStylusWritingHandler().requestStartStylusWriting( new StylusWritingImeCallback() {
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn index 127128001..83d16fbf 100644 --- a/content/public/browser/BUILD.gn +++ b/content/public/browser/BUILD.gn
@@ -292,6 +292,7 @@ "preloading_data.h", "prerender_handle.h", "prerender_trigger_type.h", + "presentation_observer.h", "presentation_receiver_flags.h", "presentation_request.cc", "presentation_request.h",
diff --git a/content/public/browser/devtools_agent_host.h b/content/public/browser/devtools_agent_host.h index 96c4d77..cb17cdb 100644 --- a/content/public/browser/devtools_agent_host.h +++ b/content/public/browser/devtools_agent_host.h
@@ -70,6 +70,12 @@ static scoped_refptr<DevToolsAgentHost> GetOrCreateFor( WebContents* web_contents); + // Similar to the above, but returns a DevToolsAgentHost representing 'tab' + // target. Unlike the one for RenderFrame, this will remain the same through + // all possible transitions of underlying frame trees. + static scoped_refptr<DevToolsAgentHost> GetOrCreateForTab( + WebContents* web_contents); + // Returns true iff an instance of DevToolsAgentHost for the |web_contents| // exists. This is equivalent to if a DevToolsAgentHost has ever been // created for the |web_contents|.
diff --git a/content/public/browser/presentation_observer.h b/content/public/browser/presentation_observer.h new file mode 100644 index 0000000..c05560d --- /dev/null +++ b/content/public/browser/presentation_observer.h
@@ -0,0 +1,29 @@ +// Copyright 2022 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. + +#ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_OBSERVER_H_ +#define CONTENT_PUBLIC_BROWSER_PRESENTATION_OBSERVER_H_ + +#include "base/observer_list_types.h" +#include "content/common/content_export.h" + +namespace content { + +struct PresentationRequest; + +// Observes changes to presentations associated with a WebContents. +class CONTENT_EXPORT PresentationObserver : public base::CheckedObserver { + public: + // Called whenever presentations are added or removed. + virtual void OnPresentationsChanged(bool has_presentation) {} + + // `presentation_request` is a nullptr if the default PresentationRequest + // has been removed. + virtual void OnDefaultPresentationChanged( + const content::PresentationRequest* presentation_request) {} +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_OBSERVER_H_
diff --git a/content/renderer/media/media_factory.cc b/content/renderer/media/media_factory.cc index 46656d4..6f7f730 100644 --- a/content/renderer/media/media_factory.cc +++ b/content/renderer/media/media_factory.cc
@@ -355,10 +355,12 @@ cast_streaming_resource_provider_ = GetContentClient()->renderer()->CreateCastStreamingResourceProvider(); if (cast_streaming_resource_provider_) { - render_frame_->GetAssociatedInterfaceRegistry()->AddInterface( - cast_streaming_resource_provider_->GetRendererControllerBinder()); - render_frame_->GetAssociatedInterfaceRegistry()->AddInterface( - cast_streaming_resource_provider_->GetDemuxerConnectorBinder()); + render_frame_->GetAssociatedInterfaceRegistry() + ->AddInterface<cast_streaming::mojom::RendererController>( + cast_streaming_resource_provider_->GetRendererControllerBinder()); + render_frame_->GetAssociatedInterfaceRegistry() + ->AddInterface<cast_streaming::mojom::DemuxerConnector>( + cast_streaming_resource_provider_->GetDemuxerConnectorBinder()); } }
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index ab9b43f..40ac146 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -5785,22 +5785,28 @@ void RenderFrameImpl::RegisterMojoInterfaces() { // TODO(dcheng): Fold this interface into mojom::Frame. - GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( - &RenderFrameImpl::BindAutoplayConfiguration, weak_factory_.GetWeakPtr())); + GetAssociatedInterfaceRegistry() + ->AddInterface<blink::mojom::AutoplayConfigurationClient>( + base::BindRepeating(&RenderFrameImpl::BindAutoplayConfiguration, + weak_factory_.GetWeakPtr())); - GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( - &RenderFrameImpl::BindFrameBindingsControl, weak_factory_.GetWeakPtr())); + GetAssociatedInterfaceRegistry()->AddInterface<mojom::FrameBindingsControl>( + base::BindRepeating(&RenderFrameImpl::BindFrameBindingsControl, + weak_factory_.GetWeakPtr())); - GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( - &RenderFrameImpl::BindNavigationClient, weak_factory_.GetWeakPtr())); + GetAssociatedInterfaceRegistry()->AddInterface<mojom::NavigationClient>( + base::BindRepeating(&RenderFrameImpl::BindNavigationClient, + weak_factory_.GetWeakPtr())); // TODO(dcheng): Fold this interface into mojom::Frame. - GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( - &RenderFrameImpl::BindMhtmlFileWriter, base::Unretained(this))); + GetAssociatedInterfaceRegistry()->AddInterface<mojom::MhtmlFileWriter>( + base::BindRepeating(&RenderFrameImpl::BindMhtmlFileWriter, + base::Unretained(this))); - GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( - &RenderAccessibilityManager::BindReceiver, - base::Unretained(render_accessibility_manager_.get()))); + GetAssociatedInterfaceRegistry() + ->AddInterface<blink::mojom::RenderAccessibility>(base::BindRepeating( + &RenderAccessibilityManager::BindReceiver, + base::Unretained(render_accessibility_manager_.get()))); } void RenderFrameImpl::BindMhtmlFileWriter(
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 14985e39..c68231a 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -608,8 +608,9 @@ GetContentClient()->renderer()->CreateURLLoaderThrottleProvider( blink::URLLoaderThrottleProviderType::kFrame); - GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( - &RenderThreadImpl::OnRendererInterfaceReceiver, base::Unretained(this))); + GetAssociatedInterfaceRegistry()->AddInterface<mojom::Renderer>( + base::BindRepeating(&RenderThreadImpl::OnRendererInterfaceReceiver, + base::Unretained(this))); const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
diff --git a/content/renderer/variations_render_thread_observer.cc b/content/renderer/variations_render_thread_observer.cc index 0163b7c..5cf75057 100644 --- a/content/renderer/variations_render_thread_observer.cc +++ b/content/renderer/variations_render_thread_observer.cc
@@ -69,7 +69,8 @@ void VariationsRenderThreadObserver::RegisterMojoInterfaces( blink::AssociatedInterfaceRegistry* associated_interfaces) { - associated_interfaces->AddInterface(base::BindRepeating( + associated_interfaces->AddInterface< + mojom::RendererVariationsConfiguration>(base::BindRepeating( &VariationsRenderThreadObserver::OnRendererConfigurationAssociatedRequest, base::Unretained(this))); }
diff --git a/content/test/data/gpu/pixel_webgpu_canvas_capture_to_video.html b/content/test/data/gpu/pixel_webgpu_canvas_capture_to_video.html index 3ddd1bcf..8137e31 100644 --- a/content/test/data/gpu/pixel_webgpu_canvas_capture_to_video.html +++ b/content/test/data/gpu/pixel_webgpu_canvas_capture_to_video.html
@@ -11,18 +11,20 @@ <script type="text/javascript" src="pixel_webgpu_util.js"></script> <script type="text/javascript"> var g_swapsBeforeAck = 15; + var g_videoFrameReceived = false; async function main() { - loadWebrtc(); - const gpuCanvas = document.getElementById('canvas_gpu'); - const [device, swapChain] = await webGpuUtils.init(gpuCanvas); + const [device, swapChain] = await webGpuUtils.init(gpuCanvas, /*has_alpha=*/false); if (!device || !swapChain) { console.error("Failed to initialize WebGPU - skipping test"); domAutomationController.send("FAILURE"); return; } + const video = document.getElementById('video_player'); + video.srcObject = gpuCanvas.captureStream(); + function render() { const gpuContext = gpuCanvas.getContext('webgpu'); @@ -32,100 +34,31 @@ waitForFinish(); } + function videoFrameReceived() { + g_videoFrameReceived = true; + } + function waitForFinish() { if (g_swapsBeforeAck == 0) { domAutomationController.send("SUCCESS"); } else { - g_swapsBeforeAck--; + // only start count down when a video frame has been received + if (g_videoFrameReceived) + g_swapsBeforeAck--; window.requestAnimationFrame(render); } } + // Start rendering loop window.requestAnimationFrame(render); - } - function loadWebrtc() { - const gpuCanvas = document.getElementById('canvas_gpu'); - const video = document.getElementById('video_player'); - - const stream = gpuCanvas.captureStream(); - - const servers = null; - var pc1 = new RTCPeerConnection(servers); - pc1.onicecandidate = e => onIceCandidate(pc1, e); - var pc2 = new RTCPeerConnection(servers); - pc2.onicecandidate = e => onIceCandidate(pc2, e); - - pc1.oniceconnectionstatechange = e => onIceStateChange(pc1, e); - pc2.oniceconnectionstatechange = e => onIceStateChange(pc2, e); - pc2.ontrack = gotRemoteStream; - - stream.getTracks().forEach( - track => { - pc1.addTrack( - track, - stream - ); - } - ); - - pc1.createOffer(onCreateOfferSuccess, onCreateSessionDescriptionError); - - function onCreateSessionDescriptionError(error) { - console.error(`Failed to create session description: ${error.toString()}`); + // register a callback to be invoked when a video frame has been received. + if (video.requestVideoFrameCallback) { + video.requestVideoFrameCallback(videoFrameReceived); } - - function onCreateOfferSuccess(desc) { - pc1.setLocalDescription(desc, () => onSetLocalSuccess(pc1), onSetSessionDescriptionError); - pc2.setRemoteDescription(desc, () => onSetRemoteSuccess(pc2), onSetSessionDescriptionError); - pc2.createAnswer(onCreateAnswerSuccess, onCreateSessionDescriptionError); - } - - function onSetLocalSuccess(pc) { - } - - function onSetRemoteSuccess(pc) { - } - - function onSetSessionDescriptionError(error) { - console.error(`Failed to set session description: ${error.toString()}`); - } - - function gotRemoteStream(e) { - if (video.srcObject !== e.streams[0]) { - video.srcObject = e.streams[0]; - } - } - - function onCreateAnswerSuccess(desc) { - pc2.setLocalDescription(desc, () => onSetLocalSuccess(pc2), onSetSessionDescriptionError); - pc1.setRemoteDescription(desc, () => onSetRemoteSuccess(pc1), onSetSessionDescriptionError); - } - - function onIceCandidate(pc, event) { - getOtherPc(pc).addIceCandidate(event.candidate) - .then( - () => onAddIceCandidateSuccess(pc), - err => onAddIceCandidateError(pc, err) - ); - } - - function onAddIceCandidateSuccess(pc) { - } - - function onAddIceCandidateError(pc, error) { - console.error(`${getName(pc)} failed to add ICE Candidate: ${error.toString()}`); - } - - function onIceStateChange(pc, event) { - } - - function getName(pc) { - return (pc === pc1) ? 'pc1' : 'pc2'; - } - - function getOtherPc(pc) { - return (pc === pc1) ? pc2 : pc1; + else { + // requestVideoFrameCallback not available + g_videoFrameReceived = true; } } </script>
diff --git a/content/test/data/gpu/pixel_webgpu_util.js b/content/test/data/gpu/pixel_webgpu_util.js index 6b6729f..df3f321 100644 --- a/content/test/data/gpu/pixel_webgpu_util.js +++ b/content/test/data/gpu/pixel_webgpu_util.js
@@ -62,7 +62,7 @@ }; return { - init: async function(gpuCanvas) { + init: async function(gpuCanvas, has_alpha = true) { const adapter = navigator.gpu && await navigator.gpu.requestAdapter(); if (!adapter) { console.error('navigator.gpu && navigator.gpu.requestAdapter failed'); @@ -85,6 +85,7 @@ device: device, format: outputFormat, usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC, + alphaMode: has_alpha ? "premultiplied" : "opaque", }); return [device, context];
diff --git a/content/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc index 6abdcf70..c4517eb 100644 --- a/content/web_test/browser/web_test_content_browser_client.cc +++ b/content/web_test/browser/web_test_content_browser_client.cc
@@ -310,9 +310,10 @@ base::Unretained(this)), ui_task_runner); - associated_registry->AddInterface(base::BindRepeating( - &WebTestContentBrowserClient::BindWebTestControlHost, - base::Unretained(this), render_process_host->GetID())); + associated_registry->AddInterface<mojom::WebTestControlHost>( + base::BindRepeating(&WebTestContentBrowserClient::BindWebTestControlHost, + base::Unretained(this), + render_process_host->GetID())); } void WebTestContentBrowserClient::BindPermissionAutomation(
diff --git a/content/web_test/renderer/web_frame_test_proxy.cc b/content/web_test/renderer/web_frame_test_proxy.cc index ce0c8ce36..fb57e53 100644 --- a/content/web_test/renderer/web_frame_test_proxy.cc +++ b/content/web_test/renderer/web_frame_test_proxy.cc
@@ -251,7 +251,7 @@ spell_check_ = std::make_unique<SpellCheckClient>(GetWebFrame()); GetWebFrame()->SetTextCheckClient(spell_check_.get()); - GetAssociatedInterfaceRegistry()->AddInterface( + GetAssociatedInterfaceRegistry()->AddInterface<mojom::WebTestRenderFrame>( base::BindRepeating(&WebFrameTestProxy::BindReceiver, // The registry goes away and stops using this // callback when RenderFrameImpl (which is this class)
diff --git a/content/web_test/renderer/web_test_render_thread_observer.cc b/content/web_test/renderer/web_test_render_thread_observer.cc index 433fd80..0e5c6ab 100644 --- a/content/web_test/renderer/web_test_render_thread_observer.cc +++ b/content/web_test/renderer/web_test_render_thread_observer.cc
@@ -41,9 +41,10 @@ void WebTestRenderThreadObserver::RegisterMojoInterfaces( blink::AssociatedInterfaceRegistry* associated_interfaces) { - associated_interfaces->AddInterface(base::BindRepeating( - &WebTestRenderThreadObserver::OnWebTestRenderThreadAssociatedRequest, - base::Unretained(this))); + associated_interfaces->AddInterface<mojom::WebTestRenderThread>( + base::BindRepeating( + &WebTestRenderThreadObserver::OnWebTestRenderThreadAssociatedRequest, + base::Unretained(this))); } void WebTestRenderThreadObserver::UnregisterMojoInterfaces(
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc index 3c3576848..dbf392b 100644 --- a/extensions/browser/app_window/app_window.cc +++ b/extensions/browser/app_window/app_window.cc
@@ -291,8 +291,8 @@ show_in_shelf_ = params.show_in_shelf; AppWindowClient* app_window_client = AppWindowClient::Get(); - native_app_window_.reset( - app_window_client->CreateNativeAppWindow(this, &new_params)); + native_app_window_ = + app_window_client->CreateNativeAppWindow(this, &new_params); helper_ = std::make_unique<AppWebContentsHelper>( browser_context_, extension_id_, web_contents(), app_delegate_.get());
diff --git a/extensions/browser/app_window/app_window_client.h b/extensions/browser/app_window/app_window_client.h index 53e42a1..73530a7 100644 --- a/extensions/browser/app_window/app_window_client.h +++ b/extensions/browser/app_window/app_window_client.h
@@ -12,7 +12,7 @@ namespace content { class BrowserContext; class WebContents; -} +} // namespace content namespace extensions { @@ -41,7 +41,7 @@ api::app_runtime::ActionType action) = 0; // Creates a new extensions::NativeAppWindow for |window|. - virtual NativeAppWindow* CreateNativeAppWindow( + virtual std::unique_ptr<NativeAppWindow> CreateNativeAppWindow( AppWindow* window, AppWindow::CreateParams* params) = 0;
diff --git a/extensions/renderer/api/automation/automation_api_helper.cc b/extensions/renderer/api/automation/automation_api_helper.cc index 9df9acfc1..6066cb7 100644 --- a/extensions/renderer/api/automation/automation_api_helper.cc +++ b/extensions/renderer/api/automation/automation_api_helper.cc
@@ -17,9 +17,10 @@ AutomationApiHelper::AutomationApiHelper(content::RenderFrame* render_frame) : content::RenderFrameObserver(render_frame) { DCHECK(render_frame->GetWebFrame()->IsOutermostMainFrame()); - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&AutomationApiHelper::BindAutomationQueryReceiver, - base::Unretained(this))); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::AutomationQuery>( + base::BindRepeating(&AutomationApiHelper::BindAutomationQueryReceiver, + base::Unretained(this))); } AutomationApiHelper::~AutomationApiHelper() = default;
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index c9810316..e1aa7352 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc
@@ -990,10 +990,11 @@ // As well the Dispatcher is owned by the // ExtensionsRendererClient, which in turn is a leaky LazyInstance (and thus // never deleted). - associated_interfaces->AddInterface(base::BindRepeating( + associated_interfaces->AddInterface<mojom::Renderer>(base::BindRepeating( &Dispatcher::OnRendererAssociatedRequest, base::Unretained(this))); - associated_interfaces->AddInterface(base::BindRepeating( - &Dispatcher::OnEventDispatcherRequest, base::Unretained(this))); + associated_interfaces->AddInterface<mojom::EventDispatcher>( + base::BindRepeating(&Dispatcher::OnEventDispatcherRequest, + base::Unretained(this))); } void Dispatcher::UnregisterMojoInterfaces(
diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc index 619344c..d068b23 100644 --- a/extensions/renderer/extension_frame_helper.cc +++ b/extensions/renderer/extension_frame_helper.cc
@@ -139,9 +139,10 @@ new AutomationApiHelper(render_frame); } - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&ExtensionFrameHelper::BindLocalFrame, - weak_ptr_factory_.GetWeakPtr())); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::LocalFrame>( + base::BindRepeating(&ExtensionFrameHelper::BindLocalFrame, + weak_ptr_factory_.GetWeakPtr())); } ExtensionFrameHelper::~ExtensionFrameHelper() {
diff --git a/extensions/shell/browser/root_window_controller_unittest.cc b/extensions/shell/browser/root_window_controller_unittest.cc index f6df368..4e509cef 100644 --- a/extensions/shell/browser/root_window_controller_unittest.cc +++ b/extensions/shell/browser/root_window_controller_unittest.cc
@@ -74,10 +74,10 @@ TestAppWindowClient() = default; ~TestAppWindowClient() override = default; - NativeAppWindow* CreateNativeAppWindow( + std::unique_ptr<NativeAppWindow> CreateNativeAppWindow( AppWindow* window, AppWindow::CreateParams* params) override { - return new ShellNativeAppWindowAura(window, *params); + return std::make_unique<ShellNativeAppWindowAura>(window, *params); } };
diff --git a/extensions/shell/browser/shell_app_window_client.h b/extensions/shell/browser/shell_app_window_client.h index 798ad69..fb2d42e 100644 --- a/extensions/shell/browser/shell_app_window_client.h +++ b/extensions/shell/browser/shell_app_window_client.h
@@ -29,7 +29,7 @@ api::app_runtime::ActionType action) override; // Note that CreateNativeAppWindow is defined in separate (per-framework) // implementation files. - NativeAppWindow* CreateNativeAppWindow( + std::unique_ptr<NativeAppWindow> CreateNativeAppWindow( AppWindow* window, AppWindow::CreateParams* params) override; void OpenDevToolsWindow(content::WebContents* web_contents,
diff --git a/extensions/shell/browser/shell_app_window_client_aura.cc b/extensions/shell/browser/shell_app_window_client_aura.cc index ce297a4..5c7f364 100644 --- a/extensions/shell/browser/shell_app_window_client_aura.cc +++ b/extensions/shell/browser/shell_app_window_client_aura.cc
@@ -4,17 +4,19 @@ #include "extensions/shell/browser/shell_app_window_client.h" +#include <memory> + #include "extensions/browser/app_window/app_window.h" #include "extensions/shell/browser/desktop_controller.h" #include "extensions/shell/browser/shell_native_app_window_aura.h" namespace extensions { -NativeAppWindow* ShellAppWindowClient::CreateNativeAppWindow( +std::unique_ptr<NativeAppWindow> ShellAppWindowClient::CreateNativeAppWindow( AppWindow* window, AppWindow::CreateParams* params) { - ShellNativeAppWindow* native_app_window = - new ShellNativeAppWindowAura(window, *params); + auto native_app_window = + std::make_unique<ShellNativeAppWindowAura>(window, *params); DesktopController::instance()->AddAppWindow( window, native_app_window->GetNativeWindow()); return native_app_window;
diff --git a/extensions/shell/browser/shell_app_window_client_mac.mm b/extensions/shell/browser/shell_app_window_client_mac.mm index 155967ce0..902c6af8 100644 --- a/extensions/shell/browser/shell_app_window_client_mac.mm +++ b/extensions/shell/browser/shell_app_window_client_mac.mm
@@ -4,17 +4,20 @@ #include "extensions/shell/browser/shell_app_window_client.h" +#include <memory> + #include "extensions/browser/app_window/app_window.h" +#include "extensions/browser/app_window/native_app_window.h" #include "extensions/shell/browser/desktop_controller.h" #import "extensions/shell/browser/shell_native_app_window_mac.h" namespace extensions { -NativeAppWindow* ShellAppWindowClient::CreateNativeAppWindow( +std::unique_ptr<NativeAppWindow> ShellAppWindowClient::CreateNativeAppWindow( AppWindow* window, AppWindow::CreateParams* params) { - ShellNativeAppWindow* native_app_window = - new ShellNativeAppWindowMac(window, *params); + auto native_app_window = + std::make_unique<ShellNativeAppWindowMac>(window, *params); DesktopController::instance()->AddAppWindow( window, native_app_window->GetNativeWindow()); return native_app_window;
diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc index 16465f1a..4f047d8 100644 --- a/extensions/shell/browser/shell_content_browser_client.cc +++ b/extensions/shell/browser/shell_content_browser_client.cc
@@ -228,26 +228,29 @@ service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* render_process_host) { - associated_registry->AddInterface(base::BindRepeating( + associated_registry->AddInterface<mojom::EventRouter>(base::BindRepeating( &EventRouter::BindForRenderer, render_process_host->GetID())); - associated_registry->AddInterface(base::BindRepeating( - &ExtensionsGuestView::CreateForComponents, render_process_host->GetID())); - associated_registry->AddInterface(base::BindRepeating( - &ExtensionsGuestView::CreateForExtensions, render_process_host->GetID())); + associated_registry->AddInterface<guest_view::mojom::GuestViewHost>( + base::BindRepeating(&ExtensionsGuestView::CreateForComponents, + render_process_host->GetID())); + associated_registry->AddInterface<extensions::mojom::GuestView>( + base::BindRepeating(&ExtensionsGuestView::CreateForExtensions, + render_process_host->GetID())); } void ShellContentBrowserClient:: RegisterAssociatedInterfaceBindersForRenderFrameHost( content::RenderFrameHost& render_frame_host, blink::AssociatedInterfaceRegistry& associated_registry) { - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost> - receiver) { - ExtensionWebContentsObserver::BindLocalFrameHost(std::move(receiver), - render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<extensions::mojom::LocalFrameHost>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost> + receiver) { + ExtensionWebContentsObserver::BindLocalFrameHost( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); } std::vector<std::unique_ptr<content::NavigationThrottle>>
diff --git a/extensions/shell/browser/shell_extension_loader_unittest.cc b/extensions/shell/browser/shell_extension_loader_unittest.cc index 5c3796d..f295af95 100644 --- a/extensions/shell/browser/shell_extension_loader_unittest.cc +++ b/extensions/shell/browser/shell_extension_loader_unittest.cc
@@ -71,10 +71,10 @@ ~TestAppWindowClient() override = default; // ShellAppWindowClient: - NativeAppWindow* CreateNativeAppWindow( + std::unique_ptr<NativeAppWindow> CreateNativeAppWindow( AppWindow* window, AppWindow::CreateParams* params) override { - return new ShellNativeAppWindowAura(window, *params); + return std::make_unique<ShellNativeAppWindowAura>(window, *params); } }; #endif
diff --git a/headless/lib/browser/headless_content_browser_client.cc b/headless/lib/browser/headless_content_browser_client.cc index 9bc8593..2052711 100644 --- a/headless/lib/browser/headless_content_browser_client.cc +++ b/headless/lib/browser/headless_content_browser_client.cc
@@ -149,14 +149,15 @@ // TODO(https://crbug.com/1265864): Move the registry logic below to a // dedicated file to ensure security review coverage. #if BUILDFLAG(ENABLE_PRINTING) - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> - receiver) { - HeadlessPrintManager::BindPrintManagerHost(std::move(receiver), - render_frame_host); - }, - &render_frame_host)); + associated_registry.AddInterface<printing::mojom::PrintManagerHost>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> + receiver) { + HeadlessPrintManager::BindPrintManagerHost(std::move(receiver), + render_frame_host); + }, + &render_frame_host)); #endif }
diff --git a/infra/config/generated/builders/ci/ToTiOS/properties.json b/infra/config/generated/builders/ci/ToTiOS/properties.json index 23f5f28..2dbb94fe 100644 --- a/infra/config/generated/builders/ci/ToTiOS/properties.json +++ b/infra/config/generated/builders/ci/ToTiOS/properties.json
@@ -12,5 +12,5 @@ "sheriff_rotations": [ "chromium.clang" ], - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTiOSDevice/properties.json b/infra/config/generated/builders/ci/ToTiOSDevice/properties.json index 23f5f28..2dbb94fe 100644 --- a/infra/config/generated/builders/ci/ToTiOSDevice/properties.json +++ b/infra/config/generated/builders/ci/ToTiOSDevice/properties.json
@@ -12,5 +12,5 @@ "sheriff_rotations": [ "chromium.clang" ], - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-asan/properties.json b/infra/config/generated/builders/ci/ios-asan/properties.json index e1812840..734e34c 100644 --- a/infra/config/generated/builders/ci/ios-asan/properties.json +++ b/infra/config/generated/builders/ci/ios-asan/properties.json
@@ -72,5 +72,5 @@ "sheriff_rotations": [ "ios" ], - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ios-device \050reclient shadow\051/properties.json" "b/infra/config/generated/builders/ci/ios-device \050reclient shadow\051/properties.json" index 3a2973b1..ba2dd18b 100644 --- "a/infra/config/generated/builders/ci/ios-device \050reclient shadow\051/properties.json" +++ "b/infra/config/generated/builders/ci/ios-device \050reclient shadow\051/properties.json"
@@ -52,5 +52,5 @@ }, "builder_group": "chromium.mac", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-device/properties.json b/infra/config/generated/builders/ci/ios-device/properties.json index fcb43a8..fdfc2bb 100644 --- a/infra/config/generated/builders/ci/ios-device/properties.json +++ b/infra/config/generated/builders/ci/ios-device/properties.json
@@ -63,5 +63,5 @@ "chromium", "ios" ], - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-fieldtrial-rel/properties.json b/infra/config/generated/builders/ci/ios-fieldtrial-rel/properties.json index 84de154..a0b29eb 100644 --- a/infra/config/generated/builders/ci/ios-fieldtrial-rel/properties.json +++ b/infra/config/generated/builders/ci/ios-fieldtrial-rel/properties.json
@@ -58,5 +58,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-m1-simulator-cronet/properties.json b/infra/config/generated/builders/ci/ios-m1-simulator-cronet/properties.json index b95d9ef..a9afdcd 100644 --- a/infra/config/generated/builders/ci/ios-m1-simulator-cronet/properties.json +++ b/infra/config/generated/builders/ci/ios-m1-simulator-cronet/properties.json
@@ -58,5 +58,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-m1-simulator/properties.json b/infra/config/generated/builders/ci/ios-m1-simulator/properties.json index 3d9ac96..5f97f14 100644 --- a/infra/config/generated/builders/ci/ios-m1-simulator/properties.json +++ b/infra/config/generated/builders/ci/ios-m1-simulator/properties.json
@@ -58,5 +58,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-reclient/properties.json b/infra/config/generated/builders/ci/ios-reclient/properties.json index a10a379..3b20b3a45 100644 --- a/infra/config/generated/builders/ci/ios-reclient/properties.json +++ b/infra/config/generated/builders/ci/ios-reclient/properties.json
@@ -17,5 +17,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-simulator-code-coverage/properties.json b/infra/config/generated/builders/ci/ios-simulator-code-coverage/properties.json index 94ed5b8..1ff363c 100644 --- a/infra/config/generated/builders/ci/ios-simulator-code-coverage/properties.json +++ b/infra/config/generated/builders/ci/ios-simulator-code-coverage/properties.json
@@ -21,5 +21,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ios-simulator-cronet \050reclient shadow\051/properties.json" "b/infra/config/generated/builders/ci/ios-simulator-cronet \050reclient shadow\051/properties.json" index a1f0c8c4..e996cc3 100644 --- "a/infra/config/generated/builders/ci/ios-simulator-cronet \050reclient shadow\051/properties.json" +++ "b/infra/config/generated/builders/ci/ios-simulator-cronet \050reclient shadow\051/properties.json"
@@ -53,5 +53,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-simulator-cronet/properties.json b/infra/config/generated/builders/ci/ios-simulator-cronet/properties.json index a7f22e2e..744100c 100644 --- a/infra/config/generated/builders/ci/ios-simulator-cronet/properties.json +++ b/infra/config/generated/builders/ci/ios-simulator-cronet/properties.json
@@ -59,5 +59,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-simulator-full-configs/properties.json b/infra/config/generated/builders/ci/ios-simulator-full-configs/properties.json index b012a427..eb50af3d 100644 --- a/infra/config/generated/builders/ci/ios-simulator-full-configs/properties.json +++ b/infra/config/generated/builders/ci/ios-simulator-full-configs/properties.json
@@ -66,5 +66,5 @@ "chromium", "ios" ], - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-simulator-multi-window/properties.json b/infra/config/generated/builders/ci/ios-simulator-multi-window/properties.json index f374d105..593d92af 100644 --- a/infra/config/generated/builders/ci/ios-simulator-multi-window/properties.json +++ b/infra/config/generated/builders/ci/ios-simulator-multi-window/properties.json
@@ -13,5 +13,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-simulator-noncq/properties.json b/infra/config/generated/builders/ci/ios-simulator-noncq/properties.json index 70c69af..0f3a146f 100644 --- a/infra/config/generated/builders/ci/ios-simulator-noncq/properties.json +++ b/infra/config/generated/builders/ci/ios-simulator-noncq/properties.json
@@ -63,5 +63,5 @@ "chromium", "ios" ], - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios-simulator/properties.json b/infra/config/generated/builders/ci/ios-simulator/properties.json index d8d195f..57748ba 100644 --- a/infra/config/generated/builders/ci/ios-simulator/properties.json +++ b/infra/config/generated/builders/ci/ios-simulator/properties.json
@@ -74,5 +74,5 @@ "chromium", "ios" ], - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios15-beta-simulator/properties.json b/infra/config/generated/builders/ci/ios15-beta-simulator/properties.json index f374d105..593d92af 100644 --- a/infra/config/generated/builders/ci/ios15-beta-simulator/properties.json +++ b/infra/config/generated/builders/ci/ios15-beta-simulator/properties.json
@@ -13,5 +13,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios15-sdk-device/properties.json b/infra/config/generated/builders/ci/ios15-sdk-device/properties.json index f374d105..593d92af 100644 --- a/infra/config/generated/builders/ci/ios15-sdk-device/properties.json +++ b/infra/config/generated/builders/ci/ios15-sdk-device/properties.json
@@ -13,5 +13,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios15-sdk-simulator/properties.json b/infra/config/generated/builders/ci/ios15-sdk-simulator/properties.json index f374d105..593d92af 100644 --- a/infra/config/generated/builders/ci/ios15-sdk-simulator/properties.json +++ b/infra/config/generated/builders/ci/ios15-sdk-simulator/properties.json
@@ -13,5 +13,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ios16-beta-simulator/properties.json b/infra/config/generated/builders/ci/ios16-beta-simulator/properties.json index 4520d9b3..208c524 100644 --- a/infra/config/generated/builders/ci/ios16-beta-simulator/properties.json +++ b/infra/config/generated/builders/ci/ios16-beta-simulator/properties.json
@@ -59,5 +59,5 @@ }, "builder_group": "chromium.fyi", "recipe": "chromium", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-asan/properties.json b/infra/config/generated/builders/try/ios-asan/properties.json index 7fdc3b88..642630f 100644 --- a/infra/config/generated/builders/try/ios-asan/properties.json +++ b/infra/config/generated/builders/try/ios-asan/properties.json
@@ -58,5 +58,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-catalyst/properties.json b/infra/config/generated/builders/try/ios-catalyst/properties.json index dd387d9b..190c466 100644 --- a/infra/config/generated/builders/try/ios-catalyst/properties.json +++ b/infra/config/generated/builders/try/ios-catalyst/properties.json
@@ -53,5 +53,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-device/properties.json b/infra/config/generated/builders/try/ios-device/properties.json index 9947b9135..5a0a1cf 100644 --- a/infra/config/generated/builders/try/ios-device/properties.json +++ b/infra/config/generated/builders/try/ios-device/properties.json
@@ -53,5 +53,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-fieldtrial-rel/properties.json b/infra/config/generated/builders/try/ios-fieldtrial-rel/properties.json index d227fcd4..2e923934 100644 --- a/infra/config/generated/builders/try/ios-fieldtrial-rel/properties.json +++ b/infra/config/generated/builders/try/ios-fieldtrial-rel/properties.json
@@ -52,5 +52,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-m1-simulator-cronet/properties.json b/infra/config/generated/builders/try/ios-m1-simulator-cronet/properties.json index fdecef5..d0c77f6 100644 --- a/infra/config/generated/builders/try/ios-m1-simulator-cronet/properties.json +++ b/infra/config/generated/builders/try/ios-m1-simulator-cronet/properties.json
@@ -52,5 +52,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-m1-simulator/properties.json b/infra/config/generated/builders/try/ios-m1-simulator/properties.json index 419f8a6..1464ebf 100644 --- a/infra/config/generated/builders/try/ios-m1-simulator/properties.json +++ b/infra/config/generated/builders/try/ios-m1-simulator/properties.json
@@ -52,5 +52,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-simulator-cronet/properties.json b/infra/config/generated/builders/try/ios-simulator-cronet/properties.json index 866f073..1d741cf 100644 --- a/infra/config/generated/builders/try/ios-simulator-cronet/properties.json +++ b/infra/config/generated/builders/try/ios-simulator-cronet/properties.json
@@ -56,5 +56,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-simulator-full-configs/properties.json b/infra/config/generated/builders/try/ios-simulator-full-configs/properties.json index 3b4c631..a62a8c16 100644 --- a/infra/config/generated/builders/try/ios-simulator-full-configs/properties.json +++ b/infra/config/generated/builders/try/ios-simulator-full-configs/properties.json
@@ -67,5 +67,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-simulator-inverse-fieldtrials-fyi/properties.json b/infra/config/generated/builders/try/ios-simulator-inverse-fieldtrials-fyi/properties.json index d7e33ce..732cf39 100644 --- a/infra/config/generated/builders/try/ios-simulator-inverse-fieldtrials-fyi/properties.json +++ b/infra/config/generated/builders/try/ios-simulator-inverse-fieldtrials-fyi/properties.json
@@ -56,5 +56,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-simulator-multi-window/properties.json b/infra/config/generated/builders/try/ios-simulator-multi-window/properties.json index af93700..b93e9eaa 100644 --- a/infra/config/generated/builders/try/ios-simulator-multi-window/properties.json +++ b/infra/config/generated/builders/try/ios-simulator-multi-window/properties.json
@@ -13,5 +13,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-simulator-noncq/properties.json b/infra/config/generated/builders/try/ios-simulator-noncq/properties.json index a8e95c9..f9497671 100644 --- a/infra/config/generated/builders/try/ios-simulator-noncq/properties.json +++ b/infra/config/generated/builders/try/ios-simulator-noncq/properties.json
@@ -53,5 +53,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-simulator-rts/properties.json b/infra/config/generated/builders/try/ios-simulator-rts/properties.json index 002fe08..8a2eeed6 100644 --- a/infra/config/generated/builders/try/ios-simulator-rts/properties.json +++ b/infra/config/generated/builders/try/ios-simulator-rts/properties.json
@@ -70,5 +70,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios-simulator/properties.json b/infra/config/generated/builders/try/ios-simulator/properties.json index 2bf890a0..ffeeda5 100644 --- a/infra/config/generated/builders/try/ios-simulator/properties.json +++ b/infra/config/generated/builders/try/ios-simulator/properties.json
@@ -67,5 +67,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios15-beta-simulator/properties.json b/infra/config/generated/builders/try/ios15-beta-simulator/properties.json index af93700..b93e9eaa 100644 --- a/infra/config/generated/builders/try/ios15-beta-simulator/properties.json +++ b/infra/config/generated/builders/try/ios15-beta-simulator/properties.json
@@ -13,5 +13,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios15-sdk-simulator/properties.json b/infra/config/generated/builders/try/ios15-sdk-simulator/properties.json index af93700..b93e9eaa 100644 --- a/infra/config/generated/builders/try/ios15-sdk-simulator/properties.json +++ b/infra/config/generated/builders/try/ios15-sdk-simulator/properties.json
@@ -13,5 +13,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/builders/try/ios16-beta-simulator/properties.json b/infra/config/generated/builders/try/ios16-beta-simulator/properties.json index 950e3c6..ead9455 100644 --- a/infra/config/generated/builders/try/ios16-beta-simulator/properties.json +++ b/infra/config/generated/builders/try/ios16-beta-simulator/properties.json
@@ -53,5 +53,5 @@ }, "builder_group": "tryserver.chromium.mac", "recipe": "chromium_trybot", - "xcode_build_version": "14a5270f" + "xcode_build_version": "14a5284g" } \ No newline at end of file
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index d27bc27..d366925 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -4031,12 +4031,12 @@ ' },' ' "builder_group": "chromium.fyi",' ' "recipe": "reclient_goma_comparison",' - ' "xcode_build_version": "14a5270f"' + ' "xcode_build_version": "14a5284g"' '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -4114,12 +4114,12 @@ ' },' ' "builder_group": "chromium.fyi",' ' "recipe": "reclient_goma_comparison",' - ' "xcode_build_version": "14a5270f"' + ' "xcode_build_version": "14a5284g"' '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -10030,12 +10030,12 @@ ' },' ' "builder_group": "chromium.fuzz",' ' "recipe": "chromium_libfuzzer",' - ' "xcode_build_version": "14a5270f"' + ' "xcode_build_version": "14a5284g"' '}' execution_timeout_secs: 14400 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -19675,8 +19675,8 @@ '}' execution_timeout_secs: 50400 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -19760,8 +19760,8 @@ '}' execution_timeout_secs: 50400 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -31812,12 +31812,12 @@ ' "sheriff_rotations": [' ' "angle"' ' ],' - ' "xcode_build_version": "14a5270f"' + ' "xcode_build_version": "14a5284g"' '}' execution_timeout_secs: 10800 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32056,8 +32056,8 @@ '}' execution_timeout_secs: 10800 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32226,8 +32226,8 @@ '}' execution_timeout_secs: 10800 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32308,8 +32308,8 @@ '}' execution_timeout_secs: 10800 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32388,8 +32388,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32469,8 +32469,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32550,8 +32550,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32632,8 +32632,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32718,8 +32718,8 @@ '}' execution_timeout_secs: 10800 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32800,8 +32800,8 @@ '}' execution_timeout_secs: 72000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32880,8 +32880,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -32962,8 +32962,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -33047,8 +33047,8 @@ '}' execution_timeout_secs: 10800 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -33127,8 +33127,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -33212,8 +33212,8 @@ '}' execution_timeout_secs: 10800 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -33373,8 +33373,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -33454,8 +33454,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -33535,8 +33535,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -33616,8 +33616,8 @@ '}' execution_timeout_secs: 36000 caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -64715,8 +64715,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -64807,8 +64807,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -64985,8 +64985,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65077,8 +65077,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65169,8 +65169,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65261,8 +65261,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65353,8 +65353,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65449,8 +65449,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65541,8 +65541,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65633,8 +65633,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65725,8 +65725,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65817,8 +65817,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -65909,8 +65909,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -66001,8 +66001,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -66093,8 +66093,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -66185,8 +66185,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_14a5270f" - path: "xcode_ios_14a5270f.app" + name: "xcode_ios_14a5284g" + path: "xcode_ios_14a5284g.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com"
diff --git a/infra/config/lib/builders.star b/infra/config/lib/builders.star index 8e78c72..0c1bee7e 100644 --- a/infra/config/lib/builders.star +++ b/infra/config/lib/builders.star
@@ -185,8 +185,8 @@ x13main = xcode_enum("13c100"), # A newer Xcode 13 version used on beta bots. x13betabots = xcode_enum("13f17a"), - # Xcode14 beta 3 will be used to build Main iOS - x14main = xcode_enum("14a5270f"), + # Xcode14 beta 4 will be used to build Main iOS + x14main = xcode_enum("14a5284g"), # A newer Xcode 14 version used on beta bots. x14betabots = xcode_enum("14a5284g"), # in use by ios-webkit-tot
diff --git a/ios/chrome/app/feed_app_agent.mm b/ios/chrome/app/feed_app_agent.mm index 7a77d2a..d74caab59 100644 --- a/ios/chrome/app/feed_app_agent.mm +++ b/ios/chrome/app/feed_app_agent.mm
@@ -157,16 +157,11 @@ [self feedService]->HandleBackgroundRefreshTaskExpiration(); [self maybeNotifyRefreshSuccess:NO]; }; - if (IsAttemptFeedBackgroundRefreshEnabled()) { - // This is expected to crash if FeedService is not available. - [self feedService]->PerformBackgroundRefreshes(^(BOOL success) { - [self maybeNotifyRefreshSuccess:success]; - [task setTaskCompletedWithSuccess:success]; - }); - } else { - [self maybeNotifyFetchTriggered]; - [task setTaskCompletedWithSuccess:YES]; - } + // This is expected to crash if FeedService is not available. + [self feedService]->PerformBackgroundRefreshes(^(BOOL success) { + [self maybeNotifyRefreshSuccess:success]; + [task setTaskCompletedWithSuccess:success]; + }); } #pragma mark - Refresh Completion Notifications (only enabled by Experimental Settings) @@ -211,17 +206,6 @@ [center addNotificationRequest:request withCompletionHandler:nil]; } -// Requests OS to send a local user notification when a background fetch is -// triggered, but an actual feed refresh is not attempted. -- (void)maybeNotifyFetchTriggered { - // Disable triggering notification if actual refresh attempt is enabled so - // that user doesn't get unnecessary notifications. - if (IsAttemptFeedBackgroundRefreshEnabled()) { - return; - } - [self maybeRequestNotification:@"Background Fetch Triggered"]; -} - // Requests OS to send a local user notification that a feed refresh has been // attempted in the background. The notification title says 'success' or // 'failure' based on `success`.
diff --git a/ios/chrome/browser/ntp/features.h b/ios/chrome/browser/ntp/features.h index 124bc22..5eebfa9 100644 --- a/ios/chrome/browser/ntp/features.h +++ b/ios/chrome/browser/ntp/features.h
@@ -48,11 +48,6 @@ // buildflag is not defined. bool IsFeedBackgroundRefreshEnabled(); -// Whether feed background refresh is attempted, if background refresh is -// enabled. Disabling this value allows for testing the background fetch -// capability independent of the feed background refresh codepaths. -bool IsAttemptFeedBackgroundRefreshEnabled(); - // Saves the current value for feature `kEnableFeedBackgroundRefresh`. This call // DCHECKs on the availability of `base::FeatureList`. void SaveFeedBackgroundRefreshEnabledForNextColdStart();
diff --git a/ios/chrome/browser/ntp/features.mm b/ios/chrome/browser/ntp/features.mm index a983d58..ea6541b 100644 --- a/ios/chrome/browser/ntp/features.mm +++ b/ios/chrome/browser/ntp/features.mm
@@ -35,8 +35,6 @@ const char kEnableFollowingFeedBackgroundRefresh[] = "EnableFollowingFeedBackgroundRefresh"; -const char kEnableAttemptFeedBackgroundRefresh[] = - "EnableAttemptFeedBackgroundRefresh"; const char kEnableServerDrivenBackgroundRefreshSchedule[] = "EnableServerDrivenBackgroundRefreshSchedule"; const char kEnableRecurringBackgroundRefreshSchedule[] = @@ -61,15 +59,6 @@ #endif // BUILDFLAG(IOS_BACKGROUND_MODE_ENABLED) } -bool IsAttemptFeedBackgroundRefreshEnabled() { - if (!IsFeedBackgroundRefreshEnabled()) { - return false; - } - return base::GetFieldTrialParamByFeatureAsBool( - kEnableFeedBackgroundRefresh, kEnableAttemptFeedBackgroundRefresh, - /*default=*/false); -} - void SaveFeedBackgroundRefreshEnabledForNextColdStart() { DCHECK(base::FeatureList::GetInstance()); [[NSUserDefaults standardUserDefaults]
diff --git a/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm b/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm index 0481207..18b78ef 100644 --- a/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm +++ b/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm
@@ -78,7 +78,7 @@ web_ui()->CallJavascriptFunction("cr.webUIListenerCallback", incognito_args); base::Value variations_event("notify-about-variations"); - base::Value variations_list = version_ui::GetVariationsList(); + base::Value::List variations_list = version_ui::GetVariationsList(); base::ValueView variations_args[] = {variations_event, variations_list}; web_ui()->CallJavascriptFunction("cr.webUIListenerCallback", variations_args); StartSubscription();
diff --git a/ios/chrome/browser/ui/webui/version_handler.cc b/ios/chrome/browser/ui/webui/version_handler.cc index b63df3f..360702d 100644 --- a/ios/chrome/browser/ui/webui/version_handler.cc +++ b/ios/chrome/browser/ui/webui/version_handler.cc
@@ -27,8 +27,7 @@ CHECK_EQ(2U, args.size()); std::string callback_id = args[0].GetString(); - base::Value response(base::Value::Type::DICTIONARY); - response.SetKey(version_ui::kKeyVariationsList, - version_ui::GetVariationsList()); + base::Value::Dict response; + response.Set(version_ui::kKeyVariationsList, version_ui::GetVariationsList()); web_ui()->ResolveJavascriptCallback(base::Value(callback_id), response); }
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 4b6f5f7..e8e9d65c 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -90d769964f35df9def662e9b1837486e5deb82a6 \ No newline at end of file +d275853f6ba560bdc61941c31e110b0d99d0928d \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index 581242e7..4256db5 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -ad5e7f7079dee1a54914917522630c0515a06838 \ No newline at end of file +f81a7ca11baed688505501be35a5b976582fd903 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index 723880c..64bd9a9 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -16e3aa32ec02f054ae73c57a93667a3e7336b44e \ No newline at end of file +a5ef25d21e3ee924ad4bd9d8b6bc662eed30540c \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index cac7d4e9..a7209ada 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -a34b4235b70cec4b2f9f96037bce1623b1a248fc \ No newline at end of file +6a21ac5131c4c44a2068e21cbafb7c23aa609e28 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index 997f868..891df18 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -2497e593b3eaee2f65963ee4324288de68b25c1f \ No newline at end of file +9d916f306951bbcc38051d5af5a22bf4318a3348 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index 2ab4984..05b691f 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -32a4aad951ef8ca92befc1df037b5122339d6746 \ No newline at end of file +19d37e0cd9239abd38d146392ab75806d8f494d6 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index 43e10e3f8..b6841ef 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -436dfa038b538798cf7992902c514191550a80fc \ No newline at end of file +3ec89b045732e69e574f202ce31fe48833dfc7d5 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index fca8d6ec..711a2934 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -54743b23a5d296a8670df88cd7dd6124a745aa25 \ No newline at end of file +4df0029612fae99f77f86669389812e1e1c57046 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index 8077b76..6d266a2 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -2d4c9db8862d7705b44e916a93e8031c7c904e1a \ No newline at end of file +7a98dbbb2b0d1d13942f99f1ccc79a36638c58d1 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index b82e9bd..fd65e4e4 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -d95540c7eb0dcd9337cdb44c134fdd0faa03bd56 \ No newline at end of file +44f263d840c983d653a94ce3739929118b70cfd1 \ No newline at end of file
diff --git a/ipc/ipc_mojo_param_traits.cc b/ipc/ipc_mojo_param_traits.cc index da5b0d22..a1611f9 100644 --- a/ipc/ipc_mojo_param_traits.cc +++ b/ipc/ipc_mojo_param_traits.cc
@@ -38,7 +38,7 @@ void ParamTraits<mojo::MessagePipeHandle>::Log(const param_type& p, std::string* l) { l->append("mojo::MessagePipeHandle("); - LogParam(p.value(), l); + LogParam(static_cast<uint64_t>(p.value()), l); l->append(")"); } @@ -88,7 +88,7 @@ void ParamTraits<mojo::DataPipeConsumerHandle>::Log(const param_type& p, std::string* l) { l->append("mojo::DataPipeConsumerHandle("); - LogParam(p.value(), l); + LogParam(static_cast<uint64_t>(p.value()), l); l->append(")"); }
diff --git a/mojo/core/entrypoints.cc b/mojo/core/entrypoints.cc index ab4b516..0eab6c9 100644 --- a/mojo/core/entrypoints.cc +++ b/mojo/core/entrypoints.cc
@@ -359,52 +359,52 @@ } // extern "C" -MojoSystemThunks64 g_thunks = {sizeof(g_thunks), - MojoInitializeImpl, - MojoGetTimeTicksNowImpl, - MojoCloseImpl, - MojoQueryHandleSignalsStateImpl, - MojoCreateMessagePipeImpl, - MojoWriteMessageImpl, - MojoReadMessageImpl, - MojoFuseMessagePipesImpl, - MojoCreateMessageImpl, - MojoDestroyMessageImpl, - MojoSerializeMessageImpl, - MojoAppendMessageDataImpl, - MojoGetMessageDataImpl, - MojoSetMessageContextImpl, - MojoGetMessageContextImpl, - MojoNotifyBadMessageImpl, - MojoCreateDataPipeImpl, - MojoWriteDataImpl, - MojoBeginWriteDataImpl, - MojoEndWriteDataImpl, - MojoReadDataImpl, - MojoBeginReadDataImpl, - MojoEndReadDataImpl, - MojoCreateSharedBufferImpl, - MojoDuplicateBufferHandleImpl, - MojoMapBufferImpl, - MojoUnmapBufferImpl, - MojoGetBufferInfoImpl, - MojoCreateTrapImpl, - MojoAddTriggerImpl, - MojoRemoveTriggerImpl, - MojoArmTrapImpl, - MojoWrapPlatformHandleImpl, - MojoUnwrapPlatformHandleImpl, - MojoWrapPlatformSharedMemoryRegionImpl, - MojoUnwrapPlatformSharedMemoryRegionImpl, - MojoCreateInvitationImpl, - MojoAttachMessagePipeToInvitationImpl, - MojoExtractMessagePipeFromInvitationImpl, - MojoSendInvitationImpl, - MojoAcceptInvitationImpl, - MojoSetQuotaImpl, - MojoQueryQuotaImpl, - MojoShutdownImpl, - MojoSetDefaultProcessErrorHandlerImpl}; +MojoSystemThunks2 g_thunks = {sizeof(g_thunks), + MojoInitializeImpl, + MojoGetTimeTicksNowImpl, + MojoCloseImpl, + MojoQueryHandleSignalsStateImpl, + MojoCreateMessagePipeImpl, + MojoWriteMessageImpl, + MojoReadMessageImpl, + MojoFuseMessagePipesImpl, + MojoCreateMessageImpl, + MojoDestroyMessageImpl, + MojoSerializeMessageImpl, + MojoAppendMessageDataImpl, + MojoGetMessageDataImpl, + MojoSetMessageContextImpl, + MojoGetMessageContextImpl, + MojoNotifyBadMessageImpl, + MojoCreateDataPipeImpl, + MojoWriteDataImpl, + MojoBeginWriteDataImpl, + MojoEndWriteDataImpl, + MojoReadDataImpl, + MojoBeginReadDataImpl, + MojoEndReadDataImpl, + MojoCreateSharedBufferImpl, + MojoDuplicateBufferHandleImpl, + MojoMapBufferImpl, + MojoUnmapBufferImpl, + MojoGetBufferInfoImpl, + MojoCreateTrapImpl, + MojoAddTriggerImpl, + MojoRemoveTriggerImpl, + MojoArmTrapImpl, + MojoWrapPlatformHandleImpl, + MojoUnwrapPlatformHandleImpl, + MojoWrapPlatformSharedMemoryRegionImpl, + MojoUnwrapPlatformSharedMemoryRegionImpl, + MojoCreateInvitationImpl, + MojoAttachMessagePipeToInvitationImpl, + MojoExtractMessagePipeFromInvitationImpl, + MojoSendInvitationImpl, + MojoAcceptInvitationImpl, + MojoSetQuotaImpl, + MojoQueryQuotaImpl, + MojoShutdownImpl, + MojoSetDefaultProcessErrorHandlerImpl}; } // namespace @@ -421,7 +421,7 @@ g_core = core_instance.get(); } -const MojoSystemThunks64& GetSystemThunks() { +const MojoSystemThunks2& GetSystemThunks() { return g_thunks; }
diff --git a/mojo/core/entrypoints.h b/mojo/core/entrypoints.h index 6ac59d08..1989978 100644 --- a/mojo/core/entrypoints.h +++ b/mojo/core/entrypoints.h
@@ -14,10 +14,10 @@ // Initializes the global Core object. MOJO_SYSTEM_IMPL_EXPORT void InitializeCore(); -// Returns a MojoSystemThunks64 struct populated with the EDK's implementation +// Returns a MojoSystemThunks2 struct populated with the EDK's implementation // of each function. This may be used by embedders to populate thunks for // application loading. -MOJO_SYSTEM_IMPL_EXPORT const MojoSystemThunks64& GetSystemThunks(); +MOJO_SYSTEM_IMPL_EXPORT const MojoSystemThunks2& GetSystemThunks(); } // namespace core } // namespace mojo
diff --git a/mojo/core/handle_table.cc b/mojo/core/handle_table.cc index 29fb8d4..6507ddb 100644 --- a/mojo/core/handle_table.cc +++ b/mojo/core/handle_table.cc
@@ -137,8 +137,8 @@ DCHECK_GE(next_available_handle_, 1u); // If this insertion would cause handle overflow, we're out of handles. - const uint64_t num_handles_available = - std::numeric_limits<uint64_t>::max() - next_available_handle_ + 1; + const uintptr_t num_handles_available = + std::numeric_limits<uintptr_t>::max() - next_available_handle_ + 1; if (num_handles_available < dispatchers.size()) { return false; }
diff --git a/mojo/core/handle_table.h b/mojo/core/handle_table.h index e761432..f4435bd 100644 --- a/mojo/core/handle_table.h +++ b/mojo/core/handle_table.h
@@ -122,7 +122,7 @@ base::Lock lock_; - uint64_t next_available_handle_ = 1; + uintptr_t next_available_handle_ = 1; }; } // namespace core
diff --git a/mojo/core/mojo_core.cc b/mojo/core/mojo_core.cc index f7866ff..9768872 100644 --- a/mojo/core/mojo_core.cc +++ b/mojo/core/mojo_core.cc
@@ -183,7 +183,7 @@ return MOJO_RESULT_OK; } -MojoSystemThunks64 g_thunks = {0}; +MojoSystemThunks2 g_thunks = {0}; } // namespace @@ -193,7 +193,7 @@ #define EXPORT_FROM_MOJO_CORE __attribute__((visibility("default"))) #endif -EXPORT_FROM_MOJO_CORE void MojoGetSystemThunks(MojoSystemThunks64* thunks) { +EXPORT_FROM_MOJO_CORE void MojoGetSystemThunks(MojoSystemThunks2* thunks) { if (!g_thunks.size) { g_thunks = mojo::core::GetSystemThunks(); g_thunks.Initialize = InitializeImpl; @@ -202,7 +202,7 @@ // Caller must provide a thunk structure at least large enough to hold Core // ABI version 0. SetQuota is the first function introduced in ABI version 1. - CHECK_GE(thunks->size, offsetof(MojoSystemThunks64, SetQuota)); + CHECK_GE(thunks->size, offsetof(MojoSystemThunks2, SetQuota)); // NOTE: This also overrites |thunks->size| with the actual size of our own // thunks if smaller than the caller's. This informs the caller that we
diff --git a/mojo/public/c/system/thunks.cc b/mojo/public/c/system/thunks.cc index 8cec68d..2d608b0 100644 --- a/mojo/public/c/system/thunks.cc +++ b/mojo/public/c/system/thunks.cc
@@ -34,9 +34,9 @@ namespace { -typedef void (*MojoGetSystemThunksFunction)(MojoSystemThunks64* thunks); +typedef void (*MojoGetSystemThunksFunction)(MojoSystemThunks2* thunks); -MojoSystemThunks64 g_thunks; +MojoSystemThunks2 g_thunks; MojoResult NotImplemented(const char* name) { if (g_thunks.size > 0) { @@ -54,9 +54,9 @@ } // namespace -#define INVOKE_THUNK(name, ...) \ - offsetof(MojoSystemThunks64, name) < g_thunks.size \ - ? g_thunks.name(__VA_ARGS__) \ +#define INVOKE_THUNK(name, ...) \ + offsetof(MojoSystemThunks2, name) < g_thunks.size \ + ? g_thunks.name(__VA_ARGS__) \ : NotImplemented(#name) namespace mojo { @@ -863,7 +863,7 @@ } // extern "C" -const MojoSystemThunks64* MojoEmbedderGetSystemThunks64() { +const MojoSystemThunks2* MojoEmbedderGetSystemThunks2() { return &g_thunks; } @@ -871,7 +871,7 @@ return &g_thunks_32; } -void MojoEmbedderSetSystemThunks(const MojoSystemThunks64* thunks) { +void MojoEmbedderSetSystemThunks(const MojoSystemThunks2* thunks) { // Assume embedders will always use matching versions of the Mojo Core and // public APIs. DCHECK_EQ(thunks->size, sizeof(g_thunks));
diff --git a/mojo/public/c/system/thunks.h b/mojo/public/c/system/thunks.h index c7e3b14..c7071a8 100644 --- a/mojo/public/c/system/thunks.h +++ b/mojo/public/c/system/thunks.h
@@ -29,7 +29,7 @@ // (e.g. an optional "Options" structure as many functions here have). // #pragma pack(push, 8) -struct MojoSystemThunks64 { +struct MojoSystemThunks2 { uint32_t size; // Should be set to sizeof(MojoSystemThunks). MojoResult (*Initialize)(const struct MojoInitializeOptions* options); @@ -235,7 +235,7 @@ const struct MojoSetDefaultProcessErrorHandlerOptions* options); }; -// Hacks: This is a copy of the ABI from before it was switched to 64-bit +// Hacks: This is a copy of the ABI from before it was switched to pointer-sized // MojoHandle values. It can be removed once the Chrome OS IME service is // longer consuming it. typedef uint32_t MojoHandle32; @@ -441,12 +441,12 @@ typedef struct MojoSystemThunks MojoSystemThunks32; -MOJO_SYSTEM_EXPORT const struct MojoSystemThunks64* -MojoEmbedderGetSystemThunks64(); +MOJO_SYSTEM_EXPORT const struct MojoSystemThunks2* +MojoEmbedderGetSystemThunks2(); MOJO_SYSTEM_EXPORT const MojoSystemThunks32* MojoEmbedderGetSystemThunks32(); MOJO_SYSTEM_EXPORT void MojoEmbedderSetSystemThunks( - const struct MojoSystemThunks64* system_thunks); + const struct MojoSystemThunks2* system_thunks); #endif // MOJO_PUBLIC_C_SYSTEM_THUNKS_H_
diff --git a/mojo/public/c/system/types.h b/mojo/public/c/system/types.h index 0e1d16ad..481957a 100644 --- a/mojo/public/c/system/types.h +++ b/mojo/public/c/system/types.h
@@ -22,7 +22,7 @@ // |MojoHandle|: Handles to Mojo objects. // |MOJO_HANDLE_INVALID| - A value that is never a valid handle. -typedef uint64_t MojoHandle; +typedef uintptr_t MojoHandle; #ifdef __cplusplus const MojoHandle MOJO_HANDLE_INVALID = 0;
diff --git a/mojo/public/java/system/core_impl.cc b/mojo/public/java/system/core_impl.cc index 203323f..f798ef0 100644 --- a/mojo/public/java/system/core_impl.cc +++ b/mojo/public/java/system/core_impl.cc
@@ -120,18 +120,22 @@ DCHECK(env->GetDirectBufferCapacity(bytes) >= num_bytes); buffer_size = num_bytes; } - const MojoHandle* handles = 0; + const jlong* java_handles = nullptr; uint32_t num_handles = 0; if (handles_buffer) { - handles = - static_cast<MojoHandle*>(env->GetDirectBufferAddress(handles_buffer)); - num_handles = - env->GetDirectBufferCapacity(handles_buffer) / sizeof(MojoHandle); + java_handles = + static_cast<jlong*>(env->GetDirectBufferAddress(handles_buffer)); + num_handles = env->GetDirectBufferCapacity(handles_buffer) / sizeof(jlong); } + + // Truncate handle values if necessary. + std::vector<MojoHandle> handles(num_handles); + std::copy(java_handles, java_handles + num_handles, handles.begin()); + // Java code will handle invalidating handles if the write succeeded. return WriteMessageRaw( MessagePipeHandle(static_cast<MojoHandle>(mojo_handle)), buffer_start, - buffer_size, handles, num_handles, flags); + buffer_size, handles.data(), num_handles, flags); } static ScopedJavaLocalRef<jobject> JNI_CoreImpl_ReadMessage( @@ -167,12 +171,14 @@ if (result != MOJO_RESULT_OK) return Java_CoreImpl_newReadMessageResult(env, result, nullptr, nullptr); + // Extend handles to 64-bit values if necessary. + std::vector<jlong> java_handles(handles.size()); + std::copy(handles.begin(), handles.end(), java_handles.begin()); return Java_CoreImpl_newReadMessageResult( env, result, base::android::ToJavaByteArray(env, static_cast<uint8_t*>(buffer), num_bytes), - base::android::ToJavaLongArray( - env, reinterpret_cast<jlong*>(handles.data()), num_handles)); + base::android::ToJavaLongArray(env, java_handles.data(), num_handles)); } static ScopedJavaLocalRef<jobject> JNI_CoreImpl_ReadData(
diff --git a/skia/BUILD.gn b/skia/BUILD.gn index d03e5195..993dbf6 100644 --- a/skia/BUILD.gn +++ b/skia/BUILD.gn
@@ -836,7 +836,7 @@ if (is_fuchsia) { copy("copy_fuchsia_fonts_manifest") { sources = [ "ext/data/test_fonts/fuchsia_test_fonts_manifest.json" ] - outputs = [ "$root_out_dir/test_fonts/{{source_file_part}}" ] + outputs = [ "$root_out_dir/test_fonts/all.font_manifest.json" ] } } if (is_apple) { @@ -903,6 +903,35 @@ } } +# Fuchsia components that use the test fonts must include +# "//build/config/fuchsia/test/test_fonts.shard.test-cml" in their +# `additional_manifest_fragments`. +# TODO(https://crbug.com/1287051): Once all consumers are migrated to CFv2, +# move the `is_fuchsia` section below up into `test_fonts` above and remove this +# target. +source_set("test_fonts_cfv2") { + testonly = true + + deps = [ ":test_fonts_resources" ] + + if (is_fuchsia) { + public = [ + "ext/test_fonts.h", + "ext/test_fonts_fuchsia.h", + ] + sources = [ + "ext/test_fonts_fuchsia.cc", + "ext/test_fonts_fuchsia_cfv2.cc", + ] + public_deps = [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts" ] + deps += [ + "//base", + "//skia", + "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp", + ] + } +} + test("skia_unittests") { sources = [ "ext/convolver_unittest.cc", @@ -925,7 +954,6 @@ deps = [ ":skia", - ":test_fonts", "//base", "//base/test:test_support", "//mojo/core/test:run_all_unittests", @@ -946,12 +974,16 @@ } if (is_fuchsia) { - # TODO(https://crbug.com/1287051): fuchsia.sys.Launcher is used to launch - # fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx with specific test - # args. - use_cfv2 = false + use_cfv1 = false sources += [ "ext/fontmgr_fuchsia_unittest.cc" ] - deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts" ] + deps += [ + ":test_fonts_cfv2", + "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts", + ] + additional_manifest_fragments = + [ "//build/config/fuchsia/test/test_fonts.shard.test-cml" ] + } else { + deps += [ ":test_fonts" ] } if (skia_support_skottie) {
diff --git a/skia/ext/test_fonts_fuchsia_cfv1.cc b/skia/ext/test_fonts_fuchsia_cfv1.cc index de3d1dc..0278faea 100644 --- a/skia/ext/test_fonts_fuchsia_cfv1.cc +++ b/skia/ext/test_fonts_fuchsia_cfv1.cc
@@ -46,8 +46,11 @@ // fonts, which must be bundled in the calling process' package. fuchsia::sys::LaunchInfo launch_info; launch_info.url = "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx"; + // Note: the manifest name here matches the default used by the Fuchsia fonts + // component so that the file can be found automagically by the modern (cfv2) + // variant. launch_info.arguments.emplace( - {"--font-manifest", "/test_fonts/fuchsia_test_fonts_manifest.json"}); + {"--font-manifest", "/test_fonts/all.font_manifest.json"}); launch_info.flat_namespace = fuchsia::sys::FlatNamespace::New(); launch_info.flat_namespace->paths.push_back("/test_fonts");
diff --git a/skia/ext/test_fonts_fuchsia_cfv2.cc b/skia/ext/test_fonts_fuchsia_cfv2.cc new file mode 100644 index 0000000..7c14c56 --- /dev/null +++ b/skia/ext/test_fonts_fuchsia_cfv2.cc
@@ -0,0 +1,23 @@ +// Copyright 2022 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. + +#include "skia/ext/test_fonts_fuchsia.h" + +#include <lib/sys/cpp/component_context.h> +#include <lib/sys/cpp/service_directory.h> + +#include "base/fuchsia/process_context.h" + +namespace skia { + +fuchsia::fonts::ProviderHandle GetTestFontsProvider() { + // //build/config/fuchsia/test/test_fonts.shard.test-cml must be in the + // current test component's manifest. It configures a fonts.Provider to serve + // fonts from the package's test_fonts directory for the test process. + fuchsia::fonts::ProviderHandle provider; + base::ComponentContextForProcess()->svc()->Connect(provider.NewRequest()); + return provider; +} + +} // namespace skia
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 57aa6ad..904c7a47 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -5750,21 +5750,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5217.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -5777,7 +5777,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "isolate_profile_data": true, @@ -5915,21 +5915,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -5941,7 +5941,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "args": [ @@ -6061,21 +6061,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -6087,7 +6087,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "isolate_profile_data": true,
diff --git a/testing/buildbot/chromium.clang.json b/testing/buildbot/chromium.clang.json index 2a6e823..55ee7f45 100644 --- a/testing/buildbot/chromium.clang.json +++ b/testing/buildbot/chromium.clang.json
@@ -8914,6 +8914,24 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "kvm": "1", + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" }, @@ -10483,6 +10501,25 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64", + "inside_docker": "1", + "os": "Ubuntu-20.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" },
diff --git a/testing/buildbot/chromium.dawn.json b/testing/buildbot/chromium.dawn.json index 7dd0ff69..73402f6 100644 --- a/testing/buildbot/chromium.dawn.json +++ b/testing/buildbot/chromium.dawn.json
@@ -329,45 +329,6 @@ }, { "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu --enable-features=Vulkan", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:9bc5-20.0.8", - "os": "Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "--flag-specific=webgpu-swiftshader", "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--no-xvfb", @@ -479,47 +440,6 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu --enable-features=Vulkan", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:9bc5-20.0.8", - "os": "Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] }, @@ -1367,45 +1287,6 @@ }, { "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu --enable-features=Vulkan", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:9bc5-20.0.8", - "os": "Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "--flag-specific=webgpu-swiftshader", "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--no-xvfb", @@ -1517,47 +1398,6 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu --enable-features=Vulkan", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:9bc5-20.0.8", - "os": "Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] }, @@ -2432,48 +2272,6 @@ }, { "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "--flag-specific=webgpu-swiftshader", "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--platform=mac-mac11", @@ -2592,50 +2390,6 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] }, @@ -4626,48 +4380,6 @@ }, { "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "--flag-specific=webgpu-swiftshader", "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--platform=mac-mac11", @@ -4786,50 +4498,6 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] }, @@ -6019,45 +5687,6 @@ }, { "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "--flag-specific=webgpu-swiftshader", "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--target=Release_x64", @@ -6167,47 +5796,6 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] }, @@ -7037,45 +6625,6 @@ }, { "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "--flag-specific=webgpu-swiftshader", "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--target=Release_x64", @@ -7185,47 +6734,6 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] }, @@ -8028,45 +7536,6 @@ }, { "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "--flag-specific=webgpu-swiftshader", "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--git-revision=${got_revision}" @@ -8174,47 +7643,6 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] }, @@ -9011,45 +8439,6 @@ }, { "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 14 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "--flag-specific=webgpu-swiftshader", "--initialize-webgpu-adapter-at-startup-timeout-ms=60000", "--git-revision=${got_revision}" @@ -9157,47 +8546,6 @@ "shards": 2 }, "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ - "webgpu_cts", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --force_high_performance_gpu", - "--use-webgpu-adapter=swiftshader", - "--test-filter=*web_platform*", - "--enable-dawn-backend-validation", - "--retry-limit=3", - "--jobs=4" - ], - "ci_only": true, - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "webgpu_swiftshader_web_platform_cts_with_validation_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 2 - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" } ] },
diff --git a/testing/buildbot/chromium.fuchsia.fyi.json b/testing/buildbot/chromium.fuchsia.fyi.json index 00d84c71..d954c7f 100644 --- a/testing/buildbot/chromium.fuchsia.fyi.json +++ b/testing/buildbot/chromium.fuchsia.fyi.json
@@ -269,6 +269,25 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64", + "inside_docker": "1", + "os": "Ubuntu-20.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" }, @@ -1399,6 +1418,24 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "kvm": "1", + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" }, @@ -2679,6 +2716,24 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "kvm": "1", + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" },
diff --git a/testing/buildbot/chromium.fuchsia.json b/testing/buildbot/chromium.fuchsia.json index 695656a3..43bc434 100644 --- a/testing/buildbot/chromium.fuchsia.json +++ b/testing/buildbot/chromium.fuchsia.json
@@ -269,6 +269,25 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64", + "inside_docker": "1", + "os": "Ubuntu-20.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" }, @@ -1413,6 +1432,24 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "kvm": "1", + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" },
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index a01b212a..c5c1a8f5 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -24221,6 +24221,29 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "args": [ + "--ram-size-mb=16384", + "--code-coverage", + "--code-coverage-dir=${ISOLATED_OUTDIR}" + ], + "isolate_profile_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" }, @@ -25760,6 +25783,25 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64", + "inside_docker": "1", + "os": "Ubuntu-20.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" }, @@ -27083,6 +27125,26 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64", + "inside_docker": "1", + "os": "Ubuntu-20.04", + "pool": "chromium.tests.fuchsia" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" }, @@ -28208,25 +28270,6 @@ "test_id_prefix": "ninja://chrome/test:browser_tests/" }, { - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "arm64", - "inside_docker": "1", - "os": "Ubuntu-20.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "cast_runner_integration_tests", - "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" - }, - { "args": [ "--", "--disable-gpu", @@ -28527,6 +28570,24 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "cast_runner_integration_tests", + "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "kvm": "1", + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "cast_runner_integration_tests_cfv1", "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests_cfv1/" }, @@ -29545,24 +29606,6 @@ "test_id_prefix": "ninja://chrome/test:browser_tests/" }, { - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "kvm": "1", - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "cast_runner_integration_tests", - "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" - }, - { "args": [ "--", "--disable-gpu", @@ -30968,27 +31011,6 @@ }, { "args": [ - "--custom-image=workstation.qemu-x64-release" - ], - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_gtest_merge.py" - }, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "kvm": "1", - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test": "cast_runner_integration_tests", - "test_id_prefix": "ninja://fuchsia_web/runners:cast_runner_integration_tests/" - }, - { - "args": [ "--", "--disable-gpu", "--headless", @@ -90524,21 +90546,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5217.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", @@ -90546,7 +90568,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "isolate_profile_data": true, @@ -90659,28 +90681,28 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "args": [ @@ -90780,28 +90802,28 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "isolate_profile_data": true, @@ -92139,20 +92161,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5217.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -92166,7 +92188,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "merge": { @@ -92304,20 +92326,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -92330,7 +92352,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "args": [ @@ -92450,20 +92472,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -92476,7 +92498,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "merge": { @@ -93972,20 +93994,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5217.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -93999,7 +94021,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "merge": { @@ -94137,20 +94159,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -94163,7 +94185,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "args": [ @@ -94283,20 +94305,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -94309,7 +94331,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "merge": { @@ -95044,20 +95066,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5217.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -95070,7 +95092,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" } ] },
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 1b6ea86..d3f45c9 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -20871,21 +20871,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5217.0", + "name": "interactive_ui_tests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -20898,7 +20898,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "isolate_profile_data": true, @@ -21036,21 +21036,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -21062,7 +21062,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "args": [ @@ -21182,21 +21182,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5217.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 106.0.5218.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v106.0.5217.0", - "revision": "version:106.0.5217.0" + "location": "lacros_version_skew_tests_v106.0.5218.0", + "revision": "version:106.0.5218.0" } ], "dimension_sets": [ @@ -21208,7 +21208,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 106.0.5217.0" + "variant_id": "Lacros version skew testing ash 106.0.5218.0" }, { "isolate_profile_data": true,
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 4b17d1d..ad6a99c 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -2054,7 +2054,6 @@ 'shards': 40, }, }, - 'cast_runner_integration_tests': {}, 'content_browsertests': { 'args': [ '--', @@ -2414,41 +2413,6 @@ }, }, - # Test suites to run the CTS with validation layers only on CI for - # configurations where capacity is constrained. - 'gpu_dawn_telemetry_cts_tests_with_ci_only_validation': { - 'webgpu_cts_with_validation': { - 'ci_only': True, - 'args': [ - '--enable-dawn-backend-validation', - ], - 'mixins': [ - 'has_native_resultdb_integration', - 'webgpu_telemetry_cts', - ], - 'swarming': { - 'shards': 14, - }, - 'telemetry_test_name': 'webgpu_cts', - }, - 'webgpu_swiftshader_web_platform_cts_with_validation': { - 'ci_only': True, - 'args': [ - '--use-webgpu-adapter=swiftshader', - '--test-filter=*web_platform*', - '--enable-dawn-backend-validation', - ], - 'mixins': [ - 'has_native_resultdb_integration', - 'webgpu_telemetry_cts', - ], - 'swarming': { - 'shards': 2, - }, - 'telemetry_test_name': 'webgpu_cts', - }, - }, - 'gpu_dawn_telemetry_cts_tests_with_validation': { 'webgpu_cts_with_validation': { 'args': [ @@ -4857,6 +4821,7 @@ 'web_engine_gtests': { 'cast_runner_browsertests': {}, + 'cast_runner_integration_tests': {}, 'cast_runner_integration_tests_cfv1': {}, 'cast_runner_unittests': {}, 'web_engine_browsertests': {}, @@ -5837,9 +5802,8 @@ 'gpu_webgpu_integration_partial_backend_validation_isolated_scripts', ], - 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation': [ + 'gpu_dawn_telemetry_cts_regular': [ 'gpu_dawn_telemetry_cts_tests', - 'gpu_dawn_telemetry_cts_tests_with_ci_only_validation', ], 'gpu_dawn_telemetry_cts_regular_and_validation': [
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index 4d9e634..9130d900 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -22,15 +22,15 @@ }, 'LACROS_VERSION_SKEW_CANARY': { 'args': [ - '--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5217.0/test_ash_chrome', + '--ash-chrome-path-override=../../lacros_version_skew_tests_v106.0.5218.0/test_ash_chrome', ], - 'identifier': 'Lacros version skew testing ash 106.0.5217.0', + 'identifier': 'Lacros version skew testing ash 106.0.5218.0', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/linux-ash-chromium/x86_64/ash.zip', - 'location': 'lacros_version_skew_tests_v106.0.5217.0', - 'revision': 'version:106.0.5217.0', + 'location': 'lacros_version_skew_tests_v106.0.5218.0', + 'revision': 'version:106.0.5218.0', }, ], },
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 75537ac..ffbec9d 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -2187,7 +2187,7 @@ 'linux_intel_uhd_630_stable', ], 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation', + 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', 'isolated_scripts': 'gpu_dawn_isolated_scripts', }, @@ -2211,7 +2211,7 @@ 'linux_intel_uhd_630_stable', ], 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation', + 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', 'isolated_scripts': 'gpu_dawn_isolated_scripts', }, @@ -2237,7 +2237,7 @@ 'mac_retina_amd_gpu_stable', ], 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation', + 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', 'isolated_scripts': 'gpu_dawn_isolated_scripts', }, @@ -2290,7 +2290,7 @@ 'mac_retina_amd_gpu_stable', ], 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation', + 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough', 'isolated_scripts': 'gpu_dawn_isolated_scripts', }, @@ -2329,7 +2329,7 @@ 'win10_intel_hd_630_stable', ], 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation', + 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough_win_intel', 'isolated_scripts': 'gpu_dawn_isolated_scripts_win', }, @@ -2353,7 +2353,7 @@ 'win10_intel_hd_630_stable', ], 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation', + 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough_win_intel', 'isolated_scripts': 'gpu_dawn_isolated_scripts_win', }, @@ -2379,7 +2379,7 @@ 'win10_intel_hd_630_stable', ], 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation', + 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough_win_intel', 'isolated_scripts': 'gpu_dawn_isolated_scripts_win', }, @@ -2403,7 +2403,7 @@ 'win10_intel_hd_630_stable', ], 'test_suites': { - 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular_and_ci_only_validation', + 'gpu_telemetry_tests': 'gpu_dawn_telemetry_cts_regular', 'gtest_tests': 'gpu_dawn_integration_gtests_passthrough_win_intel', 'isolated_scripts': 'gpu_dawn_isolated_scripts_win', },
diff --git a/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc b/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc index 7fa18338..a67beeb4 100644 --- a/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc +++ b/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc
@@ -161,7 +161,12 @@ const float kSlack = 0.0001; const float before_length = FloatValueForLength(before, 100); const float after_length = FloatValueForLength(after, 100); - if (std::isfinite(before_length) && std::isfinite(after_length)) { + // Length values may be constructed from integers, floating point values, or + // layout units (64ths of a pixel). If converted from a layout unit, any + /// value greater than max_int64 / 64 cannot be precisely expressed + // (crbug.com/1349686). + if (std::isfinite(before_length) && std::isfinite(after_length) && + std::abs(before_length) < kIntMaxForLayoutUnit) { // Test relative difference for large values to avoid floating point // inaccuracies tripping the check. const float delta = std::abs(before_length) < kSlack
diff --git a/third_party/blink/renderer/core/css/css_math_expression_node.cc b/third_party/blink/renderer/core/css/css_math_expression_node.cc index ed7ade4..f8515d61 100644 --- a/third_party/blink/renderer/core/css/css_math_expression_node.cc +++ b/third_party/blink/renderer/core/css/css_math_expression_node.cc
@@ -476,6 +476,11 @@ value = cos(ValueAsRadian(operands[0], error)); break; } + case CSSValueID::kTan: { + DCHECK_EQ(operands.size(), 1u); + value = tan(ValueAsRadian(operands[0], error)); + break; + } default: return nullptr; } @@ -1189,6 +1194,7 @@ // TODO(crbug.com/1190444): Add other trigonometric functions case CSSValueID::kSin: case CSSValueID::kCos: + case CSSValueID::kTan: return RuntimeEnabledFeatures::CSSTrigonometricFunctionsEnabled(); case CSSValueID::kAnchor: case CSSValueID::kAnchorSize: @@ -1291,6 +1297,7 @@ break; case CSSValueID::kSin: case CSSValueID::kCos: + case CSSValueID::kTan: DCHECK(RuntimeEnabledFeatures::CSSTrigonometricFunctionsEnabled()); max_argument_count = 1; min_argument_count = 1; @@ -1334,6 +1341,7 @@ std::move(nodes), CSSMathOperator::kClamp); case CSSValueID::kSin: case CSSValueID::kCos: + case CSSValueID::kTan: DCHECK(RuntimeEnabledFeatures::CSSTrigonometricFunctionsEnabled()); return CSSMathExpressionOperation:: CreateTrigonometricFunctionSimplified(std::move(nodes),
diff --git a/third_party/blink/renderer/core/css/layout_upgrade.cc b/third_party/blink/renderer/core/css/layout_upgrade.cc index 599fe3b..c10da3e 100644 --- a/third_party/blink/renderer/core/css/layout_upgrade.cc +++ b/third_party/blink/renderer/core/css/layout_upgrade.cc
@@ -37,6 +37,8 @@ } bool NodeLayoutUpgrade::ShouldUpgrade() { + if (!node_.isConnected()) + return false; // We do not allow any elements to remain in a skipped state after a style // update, therefore we always upgrade whenever we've skipped something, even // if the current ancestors chain does not depend on layout.
diff --git a/third_party/blink/renderer/core/html/build.gni b/third_party/blink/renderer/core/html/build.gni index 225ecaef..c18d792 100644 --- a/third_party/blink/renderer/core/html/build.gni +++ b/third_party/blink/renderer/core/html/build.gni
@@ -630,6 +630,7 @@ "parser/preload_request.h", "parser/resource_preloader.cc", "parser/resource_preloader.h", + "parser/tag_parsing_group.h", "parser/text_document_parser.cc", "parser/text_document_parser.h", "parser/text_resource_decoder.cc", @@ -722,6 +723,7 @@ "parser/html_resource_preloader_test.cc", "parser/html_srcset_parser_test.cc", "parser/html_tokenizer_metrics_reporter_test.cc", + "parser/html_tree_builder_test.cc", "parser/html_tokenizer_test.cc", "parser/html_view_source_parser_test.cc", "parser/text_resource_decoder_builder_test.cc",
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc index b391d4d..8b9046f 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -721,6 +721,11 @@ WebGraphicsContext3DVideoFramePool:: IsGpuMemoryBufferReadbackFromTextureEnabled()); } + + const bool context_color_is_opaque = + context_ ? context_->CanvasRenderingContextSkColorInfo().isOpaque() + : false; + for (CanvasDrawListener* listener : listeners_) { if (!listener->NeedsNewFrame()) continue; @@ -734,7 +739,7 @@ // First attempt to copy directly from the rendering context to a video // frame. Not all rendering contexts need to support this (for contexts // where GetSourceImageForCanvasInternal is zero-copy, this is superfluous). - if (context_ && can_discard_alpha && + if (context_ && (context_color_is_opaque || can_discard_alpha) && base::FeatureList::IsEnabled(kOneCopyCanvasCapture)) { if (context_->CopyRenderingResultsToVideoFrame( copier_->GetAcceleratedVideoFramePool(
diff --git a/third_party/blink/renderer/core/html/forms/html_text_area_element.cc b/third_party/blink/renderer/core/html/forms/html_text_area_element.cc index 4ec8d71c..2d7caef8 100644 --- a/third_party/blink/renderer/core/html/forms/html_text_area_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_text_area_element.cc
@@ -736,4 +736,10 @@ TextControlElement::CloneNonAttributePropertiesFrom(source, flag); } +String HTMLTextAreaElement::DefaultToolTip() const { + if (FastHasAttribute(html_names::kNovalidateAttr)) + return String(); + return validationMessage(); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/html/forms/html_text_area_element.h b/third_party/blink/renderer/core/html/forms/html_text_area_element.h index a6e3560..b5323e8f 100644 --- a/third_party/blink/renderer/core/html/forms/html_text_area_element.h +++ b/third_party/blink/renderer/core/html/forms/html_text_area_element.h
@@ -72,6 +72,8 @@ void setCols(unsigned); void setRows(unsigned); + String DefaultToolTip() const override; + private: FRIEND_TEST_ALL_PREFIXES(HTMLTextAreaElementTest, SanitizeUserInputValue);
diff --git a/third_party/blink/renderer/core/html/forms/html_text_area_element_test.cc b/third_party/blink/renderer/core/html/forms/html_text_area_element_test.cc index 57b324e..dd4132c6 100644 --- a/third_party/blink/renderer/core/html/forms/html_text_area_element_test.cc +++ b/third_party/blink/renderer/core/html/forms/html_text_area_element_test.cc
@@ -112,4 +112,23 @@ #undef RTO } +TEST_P(HTMLTextAreaElementTest, DefaultToolTip) { + LoadAhem(); + + SetBodyContent(R"HTML( + <textarea id=test></textarea> + )HTML"); + HTMLTextAreaElement& textarea = TestElement(); + + textarea.SetBooleanAttribute(html_names::kRequiredAttr, true); + EXPECT_EQ("<<ValidationValueMissing>>", textarea.DefaultToolTip()); + + textarea.SetBooleanAttribute(html_names::kNovalidateAttr, true); + EXPECT_EQ(String(), textarea.DefaultToolTip()); + + textarea.removeAttribute(html_names::kNovalidateAttr); + textarea.SetValue("1234567890\n"); + EXPECT_EQ(String(), textarea.DefaultToolTip()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/html/html_tag_names.json5 b/third_party/blink/renderer/core/html/html_tag_names.json5 index 492fc6f9..61e1a3a 100644 --- a/third_party/blink/renderer/core/html/html_tag_names.json5 +++ b/third_party/blink/renderer/core/html/html_tag_names.json5
@@ -7,6 +7,7 @@ export: "CORE_EXPORT", }, + // If you add any tag names here, remember to update html_tree_builder_test.cc. data: [ { name: "a",
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder.cc b/third_party/blink/renderer/core/html/parser/html_tree_builder.cc index 535ff7f..887deab 100644 --- a/third_party/blink/renderer/core/html/parser/html_tree_builder.cc +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder.cc
@@ -43,6 +43,7 @@ #include "third_party/blink/renderer/core/html/parser/html_stack_item.h" #include "third_party/blink/renderer/core/html/parser/html_token.h" #include "third_party/blink/renderer/core/html/parser/html_tokenizer.h" +#include "third_party/blink/renderer/core/html/parser/tag_parsing_group.h" #include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/mathml_names.h" @@ -67,7 +68,7 @@ inline bool IsHTMLSpaceOrReplacementCharacter(UChar character) { return IsHTMLSpace<UChar>(character) || character == kReplacementCharacter; } -} +} // namespace static TextPosition UninitializedPositionValue1() { return TextPosition(OrdinalNumber::FromOneBasedInt(-1), @@ -84,27 +85,6 @@ .IsAllSpecialCharacters<IsHTMLSpaceOrReplacementCharacter>(); } -static bool IsNumberedHeaderTag(const AtomicString& tag_name) { - return tag_name == html_names::kH1Tag || tag_name == html_names::kH2Tag || - tag_name == html_names::kH3Tag || tag_name == html_names::kH4Tag || - tag_name == html_names::kH5Tag || tag_name == html_names::kH6Tag; -} - -static bool IsCaptionColOrColgroupTag(const AtomicString& tag_name) { - return tag_name == html_names::kCaptionTag || - tag_name == html_names::kColTag || - tag_name == html_names::kColgroupTag; -} - -static bool IsTableCellContextTag(const AtomicString& tag_name) { - return tag_name == html_names::kThTag || tag_name == html_names::kTdTag; -} - -static bool IsTableBodyContextTag(const AtomicString& tag_name) { - return tag_name == html_names::kTbodyTag || - tag_name == html_names::kTfootTag || tag_name == html_names::kTheadTag; -} - static bool IsNonAnchorNonNobrFormattingTag(const AtomicString& tag_name) { return tag_name == html_names::kBTag || tag_name == html_names::kBigTag || tag_name == html_names::kCodeTag || tag_name == html_names::kEmTag || @@ -488,7 +468,7 @@ static PrefixedNameToQualifiedNameMap* case_map = nullptr; if (!case_map) { case_map = new PrefixedNameToQualifiedNameMap; - std::unique_ptr<const SVGQualifiedName* []> svg_tags = svg_names::GetTags(); + std::unique_ptr<const SVGQualifiedName*[]> svg_tags = svg_names::GetTags(); MapLoweredLocalNameToName(case_map, svg_tags.get(), svg_names::kTagsCount); // These tags aren't implemented by Chromium, so they don't exist in // svg_tag_names.json5. @@ -512,7 +492,7 @@ static PrefixedNameToQualifiedNameMap* case_map = nullptr; if (!case_map) { case_map = new PrefixedNameToQualifiedNameMap; - std::unique_ptr<const QualifiedName* []> attrs = getAttrs(); + std::unique_ptr<const QualifiedName*[]> attrs = getAttrs(); MapLoweredLocalNameToName(case_map, attrs.get(), length); if (forSVG) { // This attribute isn't implemented by Chromium, so it doesn't exist in @@ -560,11 +540,11 @@ if (!map) { map = new PrefixedNameToQualifiedNameMap; - std::unique_ptr<const QualifiedName* []> attrs = xlink_names::GetAttrs(); + std::unique_ptr<const QualifiedName*[]> attrs = xlink_names::GetAttrs(); AddNamesWithPrefix(map, g_xlink_atom, attrs.get(), xlink_names::kAttrsCount); - std::unique_ptr<const QualifiedName* []> xml_attrs = xml_names::GetAttrs(); + std::unique_ptr<const QualifiedName*[]> xml_attrs = xml_names::GetAttrs(); AddNamesWithPrefix(map, g_xml_atom, xml_attrs.get(), xml_names::kAttrsCount); @@ -587,345 +567,276 @@ void HTMLTreeBuilder::ProcessStartTagForInBody(AtomicHTMLToken* token) { DCHECK_EQ(token->GetType(), HTMLToken::kStartTag); - if (token->GetName() == html_names::kHTMLTag) { - ProcessHtmlStartTagForInBody(token); - return; - } - if (token->GetName() == html_names::kBaseTag || - token->GetName() == html_names::kBasefontTag || - token->GetName() == html_names::kBgsoundTag || - token->GetName() == html_names::kCommandTag || - token->GetName() == html_names::kLinkTag || - token->GetName() == html_names::kMetaTag || - token->GetName() == html_names::kNoframesTag || - token->GetName() == html_names::kScriptTag || - token->GetName() == html_names::kStyleTag || - token->GetName() == html_names::kTitleTag || - token->GetName() == html_names::kTemplateTag) { - bool did_process = ProcessStartTagForInHead(token); - DCHECK(did_process); - return; - } - if (token->GetName() == html_names::kBodyTag) { - ParseError(token); - if (!tree_.OpenElements()->SecondElementIsHTMLBodyElement() || - tree_.OpenElements()->HasOnlyOneElement() || - tree_.OpenElements()->HasTemplateInHTMLScope()) { - DCHECK(IsParsingFragmentOrTemplateContents()); - return; + switch (GetTagParsingGroup(token->GetName())) { + case TagParsingGroup::kHTMLTag: + ProcessHtmlStartTagForInBody(token); + break; + case TagParsingGroup::kTagsThatBelongInHead: { + bool did_process = ProcessStartTagForInHead(token); + DCHECK(did_process); + break; } - frameset_ok_ = false; - tree_.InsertHTMLBodyStartTagInBody(token); - return; - } - if (token->GetName() == html_names::kFramesetTag) { - ParseError(token); - if (!tree_.OpenElements()->SecondElementIsHTMLBodyElement() || - tree_.OpenElements()->HasOnlyOneElement()) { - DCHECK(IsParsingFragmentOrTemplateContents()); - return; - } - if (!frameset_ok_) - return; - tree_.OpenElements()->BodyElement()->remove(ASSERT_NO_EXCEPTION); - tree_.OpenElements()->PopUntil(tree_.OpenElements()->BodyElement()); - tree_.OpenElements()->PopHTMLBodyElement(); - - // Note: in the fragment case the root is a DocumentFragment instead of - // a proper html element which is a quirk in Blink's implementation. - DCHECK(!IsParsingTemplateContents()); - DCHECK(!IsParsingFragment() || - To<DocumentFragment>(tree_.OpenElements()->TopNode())); - DCHECK(IsParsingFragment() || - tree_.OpenElements()->Top() == tree_.OpenElements()->HtmlElement()); - tree_.InsertHTMLElement(token); - SetInsertionMode(kInFramesetMode); - return; - } - // Spec: - // https://html.spec.whatwg.org/multipage/parsing.html#:~:text=A%20start%20tag%20whose%20tag%20name%20is%20one%20of%3A%20%22address%22%2C - if (token->GetName() == html_names::kAddressTag || - token->GetName() == html_names::kArticleTag || - token->GetName() == html_names::kAsideTag || - token->GetName() == html_names::kBlockquoteTag || - token->GetName() == html_names::kCenterTag || - token->GetName() == html_names::kDetailsTag || - token->GetName() == html_names::kDialogTag || - token->GetName() == html_names::kDirTag || - token->GetName() == html_names::kDivTag || - token->GetName() == html_names::kDlTag || - token->GetName() == html_names::kFieldsetTag || - token->GetName() == html_names::kFigcaptionTag || - token->GetName() == html_names::kFigureTag || - token->GetName() == html_names::kFooterTag || - token->GetName() == html_names::kHeaderTag || - token->GetName() == html_names::kHgroupTag || - token->GetName() == html_names::kMainTag || - token->GetName() == html_names::kMenuTag || - token->GetName() == html_names::kNavTag || - token->GetName() == html_names::kOlTag || - token->GetName() == html_names::kPTag || - token->GetName() == html_names::kSectionTag || - token->GetName() == html_names::kSummaryTag || - token->GetName() == html_names::kUlTag) { - ProcessFakePEndTagIfPInButtonScope(); - tree_.InsertHTMLElement(token); - return; - } - if (IsNumberedHeaderTag(token->GetName())) { - ProcessFakePEndTagIfPInButtonScope(); - if (tree_.CurrentStackItem()->IsNumberedHeaderElement()) { + case TagParsingGroup::kBodyTag: ParseError(token); - tree_.OpenElements()->Pop(); - } - tree_.InsertHTMLElement(token); - return; - } - if (token->GetName() == html_names::kPreTag || - token->GetName() == html_names::kListingTag) { - ProcessFakePEndTagIfPInButtonScope(); - tree_.InsertHTMLElement(token); - should_skip_leading_newline_ = true; - frameset_ok_ = false; - return; - } - if (token->GetName() == html_names::kFormTag) { - if (tree_.IsFormElementPointerNonNull() && !IsParsingTemplateContents()) { - ParseError(token); - UseCounter::Count(tree_.CurrentNode()->GetDocument(), - WebFeature::kHTMLParseErrorNestedForm); - return; - } - ProcessFakePEndTagIfPInButtonScope(); - tree_.InsertHTMLFormElement(token); - return; - } - if (token->GetName() == html_names::kLiTag) { - ProcessCloseWhenNestedTag<IsLi>(token); - return; - } - if (token->GetName() == html_names::kDdTag || - token->GetName() == html_names::kDtTag) { - ProcessCloseWhenNestedTag<IsDdOrDt>(token); - return; - } - if (token->GetName() == html_names::kPlaintextTag) { - ProcessFakePEndTagIfPInButtonScope(); - tree_.InsertHTMLElement(token); - parser_->SetTokenizerState(*token, HTMLTokenizer::kPLAINTEXTState); - return; - } - if (token->GetName() == html_names::kButtonTag) { - if (tree_.OpenElements()->InScope(html_names::kButtonTag)) { - ParseError(token); - ProcessFakeEndTag(html_names::kButtonTag); - ProcessStartTag(token); // FIXME: Could we just fall through here? - return; - } - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertHTMLElement(token); - frameset_ok_ = false; - return; - } - if (token->GetName() == html_names::kATag) { - Element* active_a_tag = - tree_.ActiveFormattingElements()->ClosestElementInScopeWithName( - html_names::kATag.LocalName()); - if (active_a_tag) { - ParseError(token); - ProcessFakeEndTag(html_names::kATag); - tree_.ActiveFormattingElements()->Remove(active_a_tag); - if (tree_.OpenElements()->Contains(active_a_tag)) - tree_.OpenElements()->Remove(active_a_tag); - } - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertFormattingElement(token); - return; - } - if (IsNonAnchorNonNobrFormattingTag(token->GetName())) { - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertFormattingElement(token); - return; - } - if (token->GetName() == html_names::kNobrTag) { - tree_.ReconstructTheActiveFormattingElements(); - if (tree_.OpenElements()->InScope(html_names::kNobrTag)) { - ParseError(token); - ProcessFakeEndTag(html_names::kNobrTag); - tree_.ReconstructTheActiveFormattingElements(); - } - tree_.InsertFormattingElement(token); - return; - } - if (token->GetName() == html_names::kAppletTag || - token->GetName() == html_names::kEmbedTag || - token->GetName() == html_names::kObjectTag) { - if (!PluginContentIsAllowed(tree_.GetParserContentPolicy())) - return; - } - if (token->GetName() == html_names::kAppletTag || - token->GetName() == html_names::kMarqueeTag || - token->GetName() == html_names::kObjectTag) { - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertHTMLElement(token); - tree_.ActiveFormattingElements()->AppendMarker(); - frameset_ok_ = false; - return; - } - if (token->GetName() == html_names::kTableTag) { - if (!tree_.InQuirksMode() && - tree_.OpenElements()->InButtonScope(html_names::kPTag)) - ProcessFakeEndTag(html_names::kPTag); - tree_.InsertHTMLElement(token); - frameset_ok_ = false; - SetInsertionMode(kInTableMode); - return; - } - if (token->GetName() == html_names::kImageTag) { - ParseError(token); - // Apparently we're not supposed to ask. - token->SetName(html_names::kImgTag.LocalName()); - // Note the fall through to the kImgTag handling below! - } - if (token->GetName() == html_names::kAreaTag || - token->GetName() == html_names::kBrTag || - token->GetName() == html_names::kEmbedTag || - token->GetName() == html_names::kImgTag || - token->GetName() == html_names::kKeygenTag || - token->GetName() == html_names::kWbrTag) { - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertSelfClosingHTMLElementDestroyingToken(token); - frameset_ok_ = false; - return; - } - if (token->GetName() == html_names::kInputTag) { - // Per spec https://html.spec.whatwg.org/C/#parsing-main-inbody, - // section "A start tag whose tag name is "input"" - - Attribute* type_attribute = token->GetAttributeItem(html_names::kTypeAttr); - bool disable_frameset = - !type_attribute || - !EqualIgnoringASCIICase(type_attribute->Value(), "hidden"); - - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertSelfClosingHTMLElementDestroyingToken(token); - - if (disable_frameset) + if (!tree_.OpenElements()->SecondElementIsHTMLBodyElement() || + tree_.OpenElements()->HasOnlyOneElement() || + tree_.OpenElements()->HasTemplateInHTMLScope()) { + DCHECK(IsParsingFragmentOrTemplateContents()); + break; + } frameset_ok_ = false; - return; - } - if (token->GetName() == html_names::kParamTag || - token->GetName() == html_names::kSourceTag || - token->GetName() == html_names::kTrackTag) { - tree_.InsertSelfClosingHTMLElementDestroyingToken(token); - return; - } - if (token->GetName() == html_names::kHrTag) { - ProcessFakePEndTagIfPInButtonScope(); - tree_.InsertSelfClosingHTMLElementDestroyingToken(token); - frameset_ok_ = false; - return; - } - if (token->GetName() == html_names::kTextareaTag) { - tree_.InsertHTMLElement(token); - should_skip_leading_newline_ = true; - parser_->SetTokenizerState(*token, HTMLTokenizer::kRCDATAState); - original_insertion_mode_ = insertion_mode_; - frameset_ok_ = false; - SetInsertionMode(kTextMode); - return; - } - if (token->GetName() == html_names::kXmpTag) { - ProcessFakePEndTagIfPInButtonScope(); - tree_.ReconstructTheActiveFormattingElements(); - frameset_ok_ = false; - ProcessGenericRawTextStartTag(token); - return; - } - if (token->GetName() == html_names::kIFrameTag) { - frameset_ok_ = false; - ProcessGenericRawTextStartTag(token); - return; - } - if (token->GetName() == html_names::kNoembedTag) { - ProcessGenericRawTextStartTag(token); - return; - } - if (token->GetName() == html_names::kNoscriptTag && options_.scripting_flag) { - ProcessGenericRawTextStartTag(token); - return; - } - if (token->GetName() == html_names::kSelectTag) { - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertHTMLElement(token); - frameset_ok_ = false; - if (insertion_mode_ == kInTableMode || insertion_mode_ == kInCaptionMode || - insertion_mode_ == kInColumnGroupMode || - insertion_mode_ == kInTableBodyMode || insertion_mode_ == kInRowMode || - insertion_mode_ == kInCellMode) - SetInsertionMode(kInSelectInTableMode); - else - SetInsertionMode(kInSelectMode); - return; - } - if (token->GetName() == html_names::kOptgroupTag || - token->GetName() == html_names::kOptionTag) { - if (tree_.CurrentStackItem()->HasTagName(html_names::kOptionTag)) { - AtomicHTMLToken end_option(HTMLToken::kEndTag, - html_names::kOptionTag.LocalName()); - ProcessEndTag(&end_option); + tree_.InsertHTMLBodyStartTagInBody(token); + break; + case TagParsingGroup::kFramesetTag: + ParseError(token); + if (!tree_.OpenElements()->SecondElementIsHTMLBodyElement() || + tree_.OpenElements()->HasOnlyOneElement()) { + DCHECK(IsParsingFragmentOrTemplateContents()); + break; + } + if (!frameset_ok_) + break; + tree_.OpenElements()->BodyElement()->remove(ASSERT_NO_EXCEPTION); + tree_.OpenElements()->PopUntil(tree_.OpenElements()->BodyElement()); + tree_.OpenElements()->PopHTMLBodyElement(); + + // Note: in the fragment case the root is a DocumentFragment instead of + // a proper html element which is a quirk in Blink's implementation. + DCHECK(!IsParsingTemplateContents()); + DCHECK(!IsParsingFragment() || + To<DocumentFragment>(tree_.OpenElements()->TopNode())); + DCHECK(IsParsingFragment() || tree_.OpenElements()->Top() == + tree_.OpenElements()->HtmlElement()); + tree_.InsertHTMLElement(token); + SetInsertionMode(kInFramesetMode); + break; + case TagParsingGroup::kTagsThatCloseP: + // Spec: + // https://html.spec.whatwg.org/multipage/parsing.html#:~:text=A%20start%20tag%20whose%20tag%20name%20is%20one%20of%3A%20%22address%22%2C + ProcessFakePEndTagIfPInButtonScope(); + tree_.InsertHTMLElement(token); + break; + case TagParsingGroup::kLiTag: + ProcessCloseWhenNestedTag<IsLi>(token); + break; + case TagParsingGroup::kInputTag: { + // Per spec https://html.spec.whatwg.org/C/#parsing-main-inbody, + // section "A start tag whose tag name is "input"" + + Attribute* type_attribute = + token->GetAttributeItem(html_names::kTypeAttr); + bool disable_frameset = + !type_attribute || + !EqualIgnoringASCIICase(type_attribute->Value(), "hidden"); + + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + + if (disable_frameset) + frameset_ok_ = false; + break; } - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertHTMLElement(token); - return; - } - if (token->GetName() == html_names::kRbTag || - token->GetName() == html_names::kRTCTag) { - if (tree_.OpenElements()->InScope(html_names::kRubyTag.LocalName())) { - tree_.GenerateImpliedEndTags(); - if (!tree_.CurrentStackItem()->HasTagName(html_names::kRubyTag)) + case TagParsingGroup::kButtonTag: + if (tree_.OpenElements()->InScope(html_names::kButtonTag)) { ParseError(token); - } - tree_.InsertHTMLElement(token); - return; - } - if (token->GetName() == html_names::kRtTag || - token->GetName() == html_names::kRpTag) { - if (tree_.OpenElements()->InScope(html_names::kRubyTag.LocalName())) { - tree_.GenerateImpliedEndTagsWithExclusion( - html_names::kRTCTag.LocalName()); - if (!tree_.CurrentStackItem()->HasTagName(html_names::kRubyTag) && - !tree_.CurrentStackItem()->HasTagName(html_names::kRTCTag)) + ProcessFakeEndTag(html_names::kButtonTag); + ProcessStartTag(token); // FIXME: Could we just fall through here? + break; + } + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertHTMLElement(token); + frameset_ok_ = false; + break; + case TagParsingGroup::kNumberedHeaderTag: + ProcessFakePEndTagIfPInButtonScope(); + if (tree_.CurrentStackItem()->IsNumberedHeaderElement()) { ParseError(token); + tree_.OpenElements()->Pop(); + } + tree_.InsertHTMLElement(token); + break; + case TagParsingGroup::kListingOrPreTag: + ProcessFakePEndTagIfPInButtonScope(); + tree_.InsertHTMLElement(token); + should_skip_leading_newline_ = true; + frameset_ok_ = false; + break; + case TagParsingGroup::kFormTag: + if (tree_.IsFormElementPointerNonNull() && !IsParsingTemplateContents()) { + ParseError(token); + UseCounter::Count(tree_.CurrentNode()->GetDocument(), + WebFeature::kHTMLParseErrorNestedForm); + break; + } + ProcessFakePEndTagIfPInButtonScope(); + tree_.InsertHTMLFormElement(token); + break; + case TagParsingGroup::kDdOrDtTag: + ProcessCloseWhenNestedTag<IsDdOrDt>(token); + break; + case TagParsingGroup::kPlaintextTag: + ProcessFakePEndTagIfPInButtonScope(); + tree_.InsertHTMLElement(token); + parser_->SetTokenizerState(*token, HTMLTokenizer::kPLAINTEXTState); + break; + case TagParsingGroup::kATag: { + Element* active_a_tag = + tree_.ActiveFormattingElements()->ClosestElementInScopeWithName( + html_names::kATag.LocalName()); + if (active_a_tag) { + ParseError(token); + ProcessFakeEndTag(html_names::kATag); + tree_.ActiveFormattingElements()->Remove(active_a_tag); + if (tree_.OpenElements()->Contains(active_a_tag)) + tree_.OpenElements()->Remove(active_a_tag); + } + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertFormattingElement(token); + break; } - tree_.InsertHTMLElement(token); - return; + case TagParsingGroup::kNonAnchorNonNobrFormattingTag: + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertFormattingElement(token); + break; + case TagParsingGroup::kNobrTag: + tree_.ReconstructTheActiveFormattingElements(); + if (tree_.OpenElements()->InScope(html_names::kNobrTag)) { + ParseError(token); + ProcessFakeEndTag(html_names::kNobrTag); + tree_.ReconstructTheActiveFormattingElements(); + } + tree_.InsertFormattingElement(token); + break; + case TagParsingGroup::kAppletOrObjectTag: + if (!PluginContentIsAllowed(tree_.GetParserContentPolicy())) + break; + [[fallthrough]]; + case TagParsingGroup::kMarqueeTag: + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertHTMLElement(token); + tree_.ActiveFormattingElements()->AppendMarker(); + frameset_ok_ = false; + break; + case TagParsingGroup::kTableTag: + if (!tree_.InQuirksMode() && + tree_.OpenElements()->InButtonScope(html_names::kPTag)) + ProcessFakeEndTag(html_names::kPTag); + tree_.InsertHTMLElement(token); + frameset_ok_ = false; + SetInsertionMode(kInTableMode); + break; + case TagParsingGroup::kImageTag: + ParseError(token); + // Apparently we're not supposed to ask. + token->SetName(html_names::kImgTag.LocalName()); + [[fallthrough]]; + case TagParsingGroup::kReconstructFormattingTags: // Includes kImgTag, thus + // the fallthrough. + if (token->GetName() == html_names::kEmbedTag && + !PluginContentIsAllowed(tree_.GetParserContentPolicy())) { + break; + } + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + frameset_ok_ = false; + break; + case TagParsingGroup::kParamOrSourceOrTrackTag: + tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + break; + case TagParsingGroup::kHrTag: + ProcessFakePEndTagIfPInButtonScope(); + tree_.InsertSelfClosingHTMLElementDestroyingToken(token); + frameset_ok_ = false; + break; + case TagParsingGroup::kTextareaTag: + tree_.InsertHTMLElement(token); + should_skip_leading_newline_ = true; + parser_->SetTokenizerState(*token, HTMLTokenizer::kRCDATAState); + original_insertion_mode_ = insertion_mode_; + frameset_ok_ = false; + SetInsertionMode(kTextMode); + break; + case TagParsingGroup::kXmpTag: + ProcessFakePEndTagIfPInButtonScope(); + tree_.ReconstructTheActiveFormattingElements(); + frameset_ok_ = false; + ProcessGenericRawTextStartTag(token); + break; + case TagParsingGroup::kIFrameTag: + frameset_ok_ = false; + ProcessGenericRawTextStartTag(token); + break; + case TagParsingGroup::kNoembedTag: + ProcessGenericRawTextStartTag(token); + break; + case TagParsingGroup::kNoscriptTag: + if (options_.scripting_flag) { + ProcessGenericRawTextStartTag(token); + } else { + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertHTMLElement(token); + } + break; + case TagParsingGroup::kSelectTag: + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertHTMLElement(token); + frameset_ok_ = false; + if (insertion_mode_ == kInTableMode || + insertion_mode_ == kInCaptionMode || + insertion_mode_ == kInColumnGroupMode || + insertion_mode_ == kInTableBodyMode || + insertion_mode_ == kInRowMode || insertion_mode_ == kInCellMode) + SetInsertionMode(kInSelectInTableMode); + else + SetInsertionMode(kInSelectMode); + break; + case TagParsingGroup::kOptgroupOrOptionTag: + if (tree_.CurrentStackItem()->HasTagName(html_names::kOptionTag)) { + AtomicHTMLToken end_option(HTMLToken::kEndTag, + html_names::kOptionTag.LocalName()); + ProcessEndTag(&end_option); + } + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertHTMLElement(token); + break; + case TagParsingGroup::kRbOrRtcTag: + if (tree_.OpenElements()->InScope(html_names::kRubyTag.LocalName())) { + tree_.GenerateImpliedEndTags(); + if (!tree_.CurrentStackItem()->HasTagName(html_names::kRubyTag)) + ParseError(token); + } + tree_.InsertHTMLElement(token); + break; + case TagParsingGroup::kRtOrRpTag: + if (tree_.OpenElements()->InScope(html_names::kRubyTag.LocalName())) { + tree_.GenerateImpliedEndTagsWithExclusion( + html_names::kRTCTag.LocalName()); + if (!tree_.CurrentStackItem()->HasTagName(html_names::kRubyTag) && + !tree_.CurrentStackItem()->HasTagName(html_names::kRTCTag)) + ParseError(token); + } + tree_.InsertHTMLElement(token); + break; + case TagParsingGroup::kMathTag: + tree_.ReconstructTheActiveFormattingElements(); + AdjustMathMLAttributes(token); + AdjustForeignAttributes(token); + tree_.InsertForeignElement(token, mathml_names::kNamespaceURI); + break; + case TagParsingGroup::kSVGTag: + tree_.ReconstructTheActiveFormattingElements(); + AdjustSVGAttributes(token); + AdjustForeignAttributes(token); + tree_.InsertForeignElement(token, svg_names::kNamespaceURI); + break; + case TagParsingGroup::kParseErrorTag: + ParseError(token); + break; + case TagParsingGroup::kNoGroup: + tree_.ReconstructTheActiveFormattingElements(); + tree_.InsertHTMLElement(token); + break; } - if (token->GetName() == mathml_names::kMathTag.LocalName()) { - tree_.ReconstructTheActiveFormattingElements(); - AdjustMathMLAttributes(token); - AdjustForeignAttributes(token); - tree_.InsertForeignElement(token, mathml_names::kNamespaceURI); - return; - } - if (token->GetName() == svg_names::kSVGTag.LocalName()) { - tree_.ReconstructTheActiveFormattingElements(); - AdjustSVGAttributes(token); - AdjustForeignAttributes(token); - tree_.InsertForeignElement(token, svg_names::kNamespaceURI); - return; - } - if (IsCaptionColOrColgroupTag(token->GetName()) || - token->GetName() == html_names::kFrameTag || - token->GetName() == html_names::kHeadTag || - IsTableBodyContextTag(token->GetName()) || - IsTableCellContextTag(token->GetName()) || - token->GetName() == html_names::kTrTag) { - ParseError(token); - return; - } - tree_.ReconstructTheActiveFormattingElements(); - tree_.InsertHTMLElement(token); } namespace {
diff --git a/third_party/blink/renderer/core/html/parser/html_tree_builder_test.cc b/third_party/blink/renderer/core/html/parser/html_tree_builder_test.cc new file mode 100644 index 0000000..e4b6498 --- /dev/null +++ b/third_party/blink/renderer/core/html/parser/html_tree_builder_test.cc
@@ -0,0 +1,178 @@ +// Copyright 2022 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. + +#include "third_party/blink/renderer/core/html/parser/tag_parsing_group.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/html_names.h" +#include "third_party/blink/renderer/platform/wtf/hash_set.h" +#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" +#include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" + +namespace blink { + +TEST(HTMLTreeBuilderTest, GetTagParsingGroup) { + HashSet<AtomicString> checked_tags; + auto get = [&checked_tags](const char* tag) -> TagParsingGroup { + checked_tags.insert(tag); + return GetTagParsingGroup(tag); + }; + + // These are all the tags that exist in html_tag_names.h. + EXPECT_EQ(TagParsingGroup::kATag, get("a")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("abbr")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("acronym")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("address")); + EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("area")); + EXPECT_EQ(TagParsingGroup::kAppletOrObjectTag, get("applet")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("article")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("aside")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("audio")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("b")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("base")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("basefont")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("bdi")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("bdo")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("bgsound")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("big")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("blockquote")); + EXPECT_EQ(TagParsingGroup::kBodyTag, get("body")); + EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("br")); + EXPECT_EQ(TagParsingGroup::kButtonTag, get("button")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("canvas")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("caption")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("center")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("cite")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("code")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("col")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("colgroup")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("command")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("data")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("datalist")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("del")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("details")); + EXPECT_EQ(TagParsingGroup::kDdOrDtTag, get("dd")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("dfn")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("dialog")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("dir")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("div")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("dl")); + EXPECT_EQ(TagParsingGroup::kDdOrDtTag, get("dt")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("em")); + EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("embed")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("fencedframe")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("fieldset")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("figcaption")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("figure")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("footer")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("font")); + EXPECT_EQ(TagParsingGroup::kFormTag, get("form")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("frame")); + EXPECT_EQ(TagParsingGroup::kFramesetTag, get("frameset")); + EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h1")); + EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h2")); + EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h3")); + EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h4")); + EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h5")); + EXPECT_EQ(TagParsingGroup::kNumberedHeaderTag, get("h6")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("head")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("header")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("hgroup")); + EXPECT_EQ(TagParsingGroup::kHrTag, get("hr")); + EXPECT_EQ(TagParsingGroup::kHTMLTag, get("html")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("i")); + EXPECT_EQ(TagParsingGroup::kIFrameTag, get("iframe")); + EXPECT_EQ(TagParsingGroup::kImageTag, get("image")); + EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("img")); + EXPECT_EQ(TagParsingGroup::kInputTag, get("input")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("ins")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("kbd")); + EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("keygen")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("label")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("layer")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("legend")); + EXPECT_EQ(TagParsingGroup::kLiTag, get("li")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("link")); + EXPECT_EQ(TagParsingGroup::kListingOrPreTag, get("listing")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("main")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("map")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("mark")); + EXPECT_EQ(TagParsingGroup::kMarqueeTag, get("marquee")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("menu")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("meta")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("meter")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("nav")); + EXPECT_EQ(TagParsingGroup::kNobrTag, get("nobr")); + EXPECT_EQ(TagParsingGroup::kNoembedTag, get("noembed")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("noframes")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("nolayer")); + EXPECT_EQ(TagParsingGroup::kNoscriptTag, get("noscript")); + EXPECT_EQ(TagParsingGroup::kAppletOrObjectTag, get("object")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("ol")); + EXPECT_EQ(TagParsingGroup::kOptgroupOrOptionTag, get("optgroup")); + EXPECT_EQ(TagParsingGroup::kOptgroupOrOptionTag, get("option")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("output")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("p")); + EXPECT_EQ(TagParsingGroup::kParamOrSourceOrTrackTag, get("param")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("picture")); + EXPECT_EQ(TagParsingGroup::kPlaintextTag, get("plaintext")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("portal")); + EXPECT_EQ(TagParsingGroup::kListingOrPreTag, get("pre")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("progress")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("q")); + EXPECT_EQ(TagParsingGroup::kRbOrRtcTag, get("rb")); + EXPECT_EQ(TagParsingGroup::kRtOrRpTag, get("rp")); + EXPECT_EQ(TagParsingGroup::kRtOrRpTag, get("rt")); + EXPECT_EQ(TagParsingGroup::kRbOrRtcTag, get("rtc")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("ruby")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("s")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("samp")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("script")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("section")); + EXPECT_EQ(TagParsingGroup::kSelectTag, get("select")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("selectmenu")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("slot")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("small")); + EXPECT_EQ(TagParsingGroup::kParamOrSourceOrTrackTag, get("source")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("span")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("strike")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("strong")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("style")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("sub")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("summary")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("sup")); + EXPECT_EQ(TagParsingGroup::kTableTag, get("table")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("tbody")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("td")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("template")); + EXPECT_EQ(TagParsingGroup::kTextareaTag, get("textarea")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("tfoot")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("th")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("thead")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("time")); + EXPECT_EQ(TagParsingGroup::kTagsThatBelongInHead, get("title")); + EXPECT_EQ(TagParsingGroup::kParseErrorTag, get("tr")); + EXPECT_EQ(TagParsingGroup::kParamOrSourceOrTrackTag, get("track")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("tt")); + EXPECT_EQ(TagParsingGroup::kNonAnchorNonNobrFormattingTag, get("u")); + EXPECT_EQ(TagParsingGroup::kTagsThatCloseP, get("ul")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("var")); + EXPECT_EQ(TagParsingGroup::kNoGroup, get("video")); + EXPECT_EQ(TagParsingGroup::kReconstructFormattingTags, get("wbr")); + EXPECT_EQ(TagParsingGroup::kXmpTag, get("xmp")); + + EXPECT_EQ(TagParsingGroup::kNoGroup, + GetTagParsingGroup("thistagdoesnotexist")); + + // Verify that we've checked all the tags. + std::unique_ptr<const HTMLQualifiedName*[]> qualified_names = + html_names::GetTags(); + EXPECT_EQ(checked_tags.size(), html_names::kTagsCount); + for (wtf_size_t i = 0; i < html_names::kTagsCount; ++i) { + SCOPED_TRACE(qualified_names[i]->LocalName()); + EXPECT_TRUE(checked_tags.Contains(qualified_names[i]->LocalName())); + } +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/html/parser/tag_parsing_group.h b/third_party/blink/renderer/core/html/parser/tag_parsing_group.h new file mode 100644 index 0000000..4d36886 --- /dev/null +++ b/third_party/blink/renderer/core/html/parser/tag_parsing_group.h
@@ -0,0 +1,395 @@ +// Copyright 2022 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. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_PARSER_TAG_PARSING_GROUP_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_PARSER_TAG_PARSING_GROUP_H_ + +// This file has been split out from html_tree_builder.cc for unit testing +// purposes. + +#include "third_party/blink/renderer/core/html_names.h" +#include "third_party/blink/renderer/core/mathml_names.h" +#include "third_party/blink/renderer/core/svg_names.h" + +namespace blink { + +static bool IsCaptionColOrColgroupTag(const AtomicString& tag_name) { + return tag_name == html_names::kCaptionTag || + tag_name == html_names::kColTag || + tag_name == html_names::kColgroupTag; +} + +static bool IsTableBodyContextTag(const AtomicString& tag_name) { + return tag_name == html_names::kTbodyTag || + tag_name == html_names::kTfootTag || tag_name == html_names::kTheadTag; +} + +static bool IsTableCellContextTag(const AtomicString& tag_name) { + return tag_name == html_names::kThTag || tag_name == html_names::kTdTag; +} + +static bool IsNumberedHeaderTag(const AtomicString& tag_name) { + return tag_name == html_names::kH1Tag || tag_name == html_names::kH2Tag || + tag_name == html_names::kH3Tag || tag_name == html_names::kH4Tag || + tag_name == html_names::kH5Tag || tag_name == html_names::kH6Tag; +} + +// A grouping that exists solely as a helper for ProcessStartTagForInBody() +// (although it may also be useful for related functions at some future point). +// Certain tags trigger exactly the same behavior when we see their opening; +// e.g., <base>, <link>, <meta>, <bgsound>, etc. within the document body are +// all sent on to parsing as if they occurred in the header instead. +// GetTagParsingGroup() will take a tag name in AtomicString form and map it +// into a numerical value we can switch on. +// +// Note that these tags are grouped by their role relating to start tags +// within <body>, which is the phase we optimize the most for. +enum class TagParsingGroup { + kNoGroup = 0, + + // Groups consisting of a single tag or a group of tags. + kATag, + kAppletOrObjectTag, + kBodyTag, + kButtonTag, + kDdOrDtTag, + kFormTag, + kFramesetTag, + kHTMLTag, + kHrTag, + kIFrameTag, + kImageTag, + kInputTag, + kLiTag, + kListingOrPreTag, + kMarqueeTag, + kMathTag, + kNobrTag, + kNoembedTag, + kNoscriptTag, + kOptgroupOrOptionTag, + kParamOrSourceOrTrackTag, + kPlaintextTag, + kRbOrRtcTag, + kRtOrRpTag, + kSelectTag, + kSVGTag, + kTableTag, + kTextareaTag, + kXmpTag, + + // Specifically named groups. + kTagsThatCloseP, + kReconstructFormattingTags, + kTagsThatBelongInHead, + kNumberedHeaderTag, // IsNumberedHeaderTag(). + kNonAnchorNonNobrFormattingTag, // IsNonAnchorNonNobrFormattingTag(). + kParseErrorTag, +}; + +// Convert a tag name in AtomicString form and map it into a numerical value we +// can switch on, based on the desired behavior (see TagParsingGroup). Since we +// have so many different tags to test for, it is more efficient to group by the +// first letter before we do testing (otherwise, a tag not in the list would +// need to go through 70–80 tests in turn). +// +// This is not the only possible design for this; we could e.g. use a hash table +// instead. Also, it would be possible to put the code directly in this switch, +// instead of returning a value and then switching on that value. However, +// that would lead to duplication, and hopefully, the compiler can figure out +// the jumps directly. In any case, the strategy seems to be successful enough +// in making ProcessStartTagForInBody() not a bottleneck during parsing. +static inline TagParsingGroup GetTagParsingGroup(const AtomicString& tag) { + DCHECK(!tag.IsEmpty()); + switch (tag[0]) { + case 'a': + if (tag == html_names::kAddressTag || tag == html_names::kArticleTag || + tag == html_names::kAsideTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kATag) { + return TagParsingGroup::kATag; + } + if (tag == html_names::kAppletTag) { + return TagParsingGroup::kAppletOrObjectTag; + } + if (tag == html_names::kAreaTag) { + return TagParsingGroup::kReconstructFormattingTags; + } + break; + + case 'b': + if (tag == html_names::kBlockquoteTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kButtonTag) { + return TagParsingGroup::kButtonTag; + } + if (tag == html_names::kBrTag) { + return TagParsingGroup::kReconstructFormattingTags; + } + if (tag == html_names::kBaseTag || tag == html_names::kBasefontTag || + tag == html_names::kBgsoundTag) { + return TagParsingGroup::kTagsThatBelongInHead; + } + if (tag == html_names::kBodyTag) { + return TagParsingGroup::kBodyTag; + } + if (tag == html_names::kBTag || tag == html_names::kBigTag) { + return TagParsingGroup::kNonAnchorNonNobrFormattingTag; + } + if (tag == html_names::kBrTag) { + return TagParsingGroup::kReconstructFormattingTags; + } + break; + + case 'c': + if (tag == html_names::kCommandTag) { + return TagParsingGroup::kTagsThatBelongInHead; + } + if (tag == html_names::kCenterTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kCodeTag) { + return TagParsingGroup::kNonAnchorNonNobrFormattingTag; + } + if (IsCaptionColOrColgroupTag(tag)) { + return TagParsingGroup::kParseErrorTag; + } + break; + + case 'd': + if (tag == html_names::kDetailsTag || tag == html_names::kDialogTag || + tag == html_names::kDirTag || tag == html_names::kDivTag || + tag == html_names::kDlTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kDdTag || tag == html_names::kDtTag) { + return TagParsingGroup::kDdOrDtTag; + } + break; + + case 'e': + if (tag == html_names::kEmTag) { + return TagParsingGroup::kNonAnchorNonNobrFormattingTag; + } + if (tag == html_names::kEmbedTag) { + return TagParsingGroup::kReconstructFormattingTags; + } + break; + + case 'f': + if (tag == html_names::kFieldsetTag || + tag == html_names::kFigcaptionTag || tag == html_names::kFigureTag || + tag == html_names::kFooterTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kFramesetTag) { + return TagParsingGroup::kFramesetTag; + } + if (tag == html_names::kFormTag) { + return TagParsingGroup::kFormTag; + } + if (tag == html_names::kFontTag) { + return TagParsingGroup::kNonAnchorNonNobrFormattingTag; + } + if (tag == html_names::kFrameTag) { + return TagParsingGroup::kParseErrorTag; + } + break; + + case 'h': + if (tag == html_names::kHTMLTag) { + return TagParsingGroup::kHTMLTag; + } + if (tag == html_names::kHeaderTag || tag == html_names::kHgroupTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (IsNumberedHeaderTag(tag)) { + return TagParsingGroup::kNumberedHeaderTag; + } + if (tag == html_names::kHrTag) { + return TagParsingGroup::kHrTag; + } + if (tag == html_names::kHeadTag) { + return TagParsingGroup::kParseErrorTag; + } + break; + + case 'i': + if (tag == html_names::kInputTag) { + return TagParsingGroup::kInputTag; + } + if (tag == html_names::kITag) { + return TagParsingGroup::kNonAnchorNonNobrFormattingTag; + } + if (tag == html_names::kImgTag) { + return TagParsingGroup::kReconstructFormattingTags; + } + if (tag == html_names::kImageTag) { + return TagParsingGroup::kImageTag; + } + if (tag == html_names::kIFrameTag) { + return TagParsingGroup::kIFrameTag; + } + break; + + case 'k': + if (tag == html_names::kKeygenTag) { + return TagParsingGroup::kReconstructFormattingTags; + } + break; + + case 'l': + if (tag == html_names::kLiTag) { + return TagParsingGroup::kLiTag; + } + if (tag == html_names::kLinkTag) { + return TagParsingGroup::kTagsThatBelongInHead; + } + if (tag == html_names::kListingTag) { + return TagParsingGroup::kListingOrPreTag; + } + break; + + case 'm': + if (tag == html_names::kMetaTag) { + return TagParsingGroup::kTagsThatBelongInHead; + } + if (tag == html_names::kMainTag || tag == html_names::kMenuTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kMarqueeTag) { + return TagParsingGroup::kMarqueeTag; + } + if (tag == mathml_names::kMathTag.LocalName()) { + return TagParsingGroup::kMathTag; + } + break; + + case 'n': + if (tag == html_names::kNoframesTag) { + return TagParsingGroup::kTagsThatBelongInHead; + } + if (tag == html_names::kNavTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kNobrTag) { + return TagParsingGroup::kNobrTag; + } + if (tag == html_names::kNoembedTag) { + return TagParsingGroup::kNoembedTag; + } + if (tag == html_names::kNoscriptTag) { + return TagParsingGroup::kNoscriptTag; + } + break; + + case 'o': + if (tag == html_names::kOlTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kObjectTag) { + return TagParsingGroup::kAppletOrObjectTag; + } + if (tag == html_names::kOptgroupTag || tag == html_names::kOptionTag) { + return TagParsingGroup::kOptgroupOrOptionTag; + } + break; + + case 'p': + if (tag == html_names::kParamTag) { + return TagParsingGroup::kParamOrSourceOrTrackTag; + } + if (tag == html_names::kPTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kPreTag) { + return TagParsingGroup::kListingOrPreTag; + } + if (tag == html_names::kPlaintextTag) { + return TagParsingGroup::kPlaintextTag; + } + break; + + case 'r': + if (tag == html_names::kRbTag || tag == html_names::kRTCTag) { + return TagParsingGroup::kRbOrRtcTag; + } + if (tag == html_names::kRtTag || tag == html_names::kRpTag) { + return TagParsingGroup::kRtOrRpTag; + } + break; + + case 's': + if (tag == html_names::kScriptTag || tag == html_names::kStyleTag) { + return TagParsingGroup::kTagsThatBelongInHead; + } + if (tag == html_names::kSectionTag || tag == html_names::kSummaryTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kSTag || tag == html_names::kSmallTag || + tag == html_names::kStrikeTag || tag == html_names::kStrongTag) { + return TagParsingGroup::kNonAnchorNonNobrFormattingTag; + } + if (tag == html_names::kSelectTag) { + return TagParsingGroup::kSelectTag; + } + if (tag == svg_names::kSVGTag.LocalName()) { + return TagParsingGroup::kSVGTag; + } + if (tag == html_names::kSourceTag) { + return TagParsingGroup::kParamOrSourceOrTrackTag; + } + break; + + case 't': + if (tag == html_names::kTitleTag || tag == html_names::kTemplateTag) { + return TagParsingGroup::kTagsThatBelongInHead; + } + if (tag == html_names::kTtTag) { + return TagParsingGroup::kNonAnchorNonNobrFormattingTag; + } + if (tag == html_names::kTableTag) { + return TagParsingGroup::kTableTag; + } + if (tag == html_names::kTextareaTag) { + return TagParsingGroup::kTextareaTag; + } + if (IsTableBodyContextTag(tag) || IsTableCellContextTag(tag) || + tag == html_names::kTrTag) { + return TagParsingGroup::kParseErrorTag; + } + if (tag == html_names::kTrackTag) { + return TagParsingGroup::kParamOrSourceOrTrackTag; + } + break; + + case 'u': + if (tag == html_names::kUlTag) { + return TagParsingGroup::kTagsThatCloseP; + } + if (tag == html_names::kUTag) { + return TagParsingGroup::kNonAnchorNonNobrFormattingTag; + } + break; + + case 'w': + if (tag == html_names::kWbrTag) { + return TagParsingGroup::kReconstructFormattingTags; + } + break; + + case 'x': + if (tag == html_names::kXmpTag) { + return TagParsingGroup::kXmpTag; + } + break; + } + return TagParsingGroup::kNoGroup; +} + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_PARSER_TAG_PARSING_GROUP_H_
diff --git a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc index e4a9381c..c65cbb6 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_column_layout_algorithm.cc
@@ -397,7 +397,8 @@ // The block layout algorithm skips spanners for min/max calculation (since // they shouldn't be part of the column-count multiplication above). Calculate // min/max inline-size for spanners now. - result.sizes.Encompass(ComputeSpannersMinMaxSizes(Node()).sizes); + if (!Node().ShouldApplyInlineSizeContainment()) + result.sizes.Encompass(ComputeSpannersMinMaxSizes(Node()).sizes); result.sizes += BorderScrollbarPadding().InlineSum(); return result;
diff --git a/third_party/blink/renderer/core/page/print_context_test.cc b/third_party/blink/renderer/core/page/print_context_test.cc index 0d12ad3..79c6f26 100644 --- a/third_party/blink/renderer/core/page/print_context_test.cc +++ b/third_party/blink/renderer/core/page/print_context_test.cc
@@ -354,9 +354,9 @@ EXPECT_EQ(MockPageContextCanvas::kDrawPoint, operations[5].type); EXPECT_SKRECT_EQ(0, 0, 0, 0, operations[5].rect); EXPECT_EQ(MockPageContextCanvas::kDrawPoint, operations[6].type); - EXPECT_SKRECT_EQ(0, 0, 0, 0, operations[6].rect); + EXPECT_SKRECT_EQ(450, 60, 0, 0, operations[6].rect); EXPECT_EQ(MockPageContextCanvas::kDrawPoint, operations[7].type); - EXPECT_SKRECT_EQ(450, 60, 0, 0, operations[7].rect); + EXPECT_SKRECT_EQ(0, 0, 0, 0, operations[7].rect); } TEST_P(PrintContextTest, EmptyLinkedTarget) {
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc index b310015..c79b484a 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc
@@ -1006,6 +1006,15 @@ ScriptState* script_state, const MediaEncodingConfiguration* config, ExceptionState& exception_state) { + if (config->type() == "record" && + !RuntimeEnabledFeatures::MediaCapabilitiesEncodingInfoEnabled()) { + exception_state.ThrowTypeError( + "The provided value 'record' is not a valid enum value of type " + "MediaEncodingType."); + return ScriptPromise(); + ; + } + const base::TimeTicks request_time = base::TimeTicks::Now(); const bool is_webrtc = config->type() == "webrtc"; @@ -1087,31 +1096,21 @@ return promise; } - if (config->type() == "record") { - if (!RuntimeEnabledFeatures::MediaCapabilitiesEncodingInfoEnabled()) { - exception_state.ThrowTypeError( - "The provided value 'record' is not a valid enum value of type " - "MediaEncodingType."); - return promise; - } + DCHECK_EQ(config->type(), "record"); + DCHECK(RuntimeEnabledFeatures::MediaCapabilitiesEncodingInfoEnabled()); - if (auto* handler = MakeGarbageCollected<MediaRecorderHandler>( - ExecutionContext::From(script_state) - ->GetTaskRunner(TaskType::kInternalMediaRealTime))) { - handler->EncodingInfo(ToWebMediaConfiguration(config), - WTF::Bind(&OnMediaCapabilitiesEncodingInfo, - WrapPersistent(resolver))); - return promise; - } - resolver->Reject(MakeGarbageCollected<DOMException>( - DOMExceptionCode::kInvalidStateError, - "Platform error: could not create MediaRecorderHandler.")); + if (auto* handler = MakeGarbageCollected<MediaRecorderHandler>( + ExecutionContext::From(script_state) + ->GetTaskRunner(TaskType::kInternalMediaRealTime))) { + handler->EncodingInfo( + ToWebMediaConfiguration(config), + WTF::Bind(&OnMediaCapabilitiesEncodingInfo, WrapPersistent(resolver))); return promise; } - exception_state.ThrowTypeError( - "The provided value is not a valid enum value of type " - "MediaEncodingType."); + DVLOG(2) << __func__ << " Could not get MediaRecorderHandler."; + MediaCapabilitiesInfo* info = CreateEncodingInfoWith(false); + resolver->Resolve(info); return promise; }
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_encoding_configuration.idl b/third_party/blink/renderer/modules/media_capabilities/media_encoding_configuration.idl index 0138db7..0ebc3e6 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_encoding_configuration.idl +++ b/third_party/blink/renderer/modules/media_capabilities/media_encoding_configuration.idl
@@ -6,7 +6,6 @@ enum MediaEncodingType { "record", - "transmission", "webrtc", };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc index fa33a58..83d41fa5 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc +++ b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.cc
@@ -181,6 +181,17 @@ return MakeGarbageCollected<V8OffscreenRenderingContext>(this); } +SkColorInfo GPUCanvasContext::CanvasRenderingContextSkColorInfo() const { + if (!swap_buffers_) + return CanvasRenderingContext::CanvasRenderingContextSkColorInfo(); + return SkColorInfo(viz::ResourceFormatToClosestSkColorType( + /*gpu_compositing=*/true, swap_buffers_->Format()), + alpha_mode_ == V8GPUCanvasAlphaMode::Enum::kOpaque + ? kOpaque_SkAlphaType + : kPremul_SkAlphaType, + SkColorSpace::MakeSRGB()); +} + void GPUCanvasContext::Stop() { UnconfigureInternal(); stopped_ = true;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h index 7118c98..490e97b5 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h
@@ -58,6 +58,7 @@ // CanvasRenderingContext implementation V8RenderingContext* AsV8RenderingContext() final; V8OffscreenRenderingContext* AsV8OffscreenRenderingContext() final; + SkColorInfo CanvasRenderingContextSkColorInfo() const override; // Produces a snapshot of the current contents of the swap chain if possible. // If that texture has already been sent to the compositor, will produce a // snapshot of the just released texture associated to this gpu context.
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 0ef70142..01f1e47 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1947,15 +1947,13 @@ deps = [ ":blink_platform_unittests_sources" ] if (is_fuchsia) { + use_cfv1 = false + additional_manifest_fragments = + [ "//build/config/fuchsia/test/test_fonts.shard.test-cml" ] + # Oilpan reuses V8's v8::PageAllocator which generally requires JIT # permissions. - # TODO(https://crbug.com/1287051): Requires fuchsia.sys.Launcher. - use_cfv2 = false - additional_manifest_fragments = - [ "//build/config/fuchsia/test/jit_capabilities.test-cmx" ] - - # Use the following when switching to CFv2: - # test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml" + test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml" } if (is_android) { @@ -2248,7 +2246,6 @@ "//services/viz/public/mojom", "//skia", "//skia:skcms", - "//skia:test_fonts", "//testing/gmock", "//testing/gtest", "//third_party:freetype_harfbuzz", @@ -2285,6 +2282,12 @@ if (use_minikin_hyphenation) { defines += [ "USE_MINIKIN_HYPHENATION" ] } + + if (is_fuchsia) { + deps += [ "//skia:test_fonts_cfv2" ] + } else { + deps += [ "//skia:test_fonts" ] + } } executable("image_decode_bench") { @@ -2398,7 +2401,6 @@ ":test_support", "//base/test:test_support", "//mojo/core/embedder:embedder", - "//skia:test_fonts", "//third_party/blink/public:test_support", ] @@ -2411,9 +2413,13 @@ } if (is_fuchsia) { - use_cfv2 = false + use_cfv1 = false + deps += [ "//skia:test_fonts_cfv2" ] + test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml" additional_manifest_fragments = - [ "//build/config/fuchsia/test/jit_capabilities.test-cmx" ] + [ "//build/config/fuchsia/test/test_fonts.shard.test-cml" ] + } else { + deps += [ "//skia:test_fonts" ] } }
diff --git a/third_party/blink/renderer/platform/heap/BUILD.gn b/third_party/blink/renderer/platform/heap/BUILD.gn index d725c0e..4f0d20d 100644 --- a/third_party/blink/renderer/platform/heap/BUILD.gn +++ b/third_party/blink/renderer/platform/heap/BUILD.gn
@@ -122,16 +122,14 @@ } if (is_fuchsia) { - # TODO(https://crbug.com/1287051): Requires fuchsia.sys.Launcher. - use_cfv2 = false + use_cfv1 = false + + additional_manifest_fragments = + [ "//build/config/fuchsia/test/test_fonts.shard.test-cml" ] # Oilpan reuses V8's v8::PageAllocator which generally requires JIT # permissions. - additional_manifest_fragments = - [ "//build/config/fuchsia/test/jit_capabilities.test-cmx" ] - - # Use the following when switching to CFv2: - # test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml" + test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml" } } @@ -167,12 +165,17 @@ "//base/test:test_support", "//gin:gin", "//mojo/core/embedder:embedder", - "//skia:test_fonts", "//testing/gmock", "//testing/gtest", "//third_party/blink/renderer/platform:test_support", "//third_party/blink/renderer/platform/wtf", ] + + if (is_fuchsia) { + deps += [ "//skia:test_fonts_cfv2" ] + } else { + deps += [ "//skia:test_fonts" ] + } } test("blink_heap_perftests") {
diff --git a/third_party/blink/renderer/platform/wtf/hash_table.h b/third_party/blink/renderer/platform/wtf/hash_table.h index 168ff0a..0ed43a6 100644 --- a/third_party/blink/renderer/platform/wtf/hash_table.h +++ b/third_party/blink/renderer/platform/wtf/hash_table.h
@@ -1055,15 +1055,6 @@ "off-heap collection."); } -inline unsigned DoubleHash(unsigned key) { - key = ~key + (key >> 23); - key ^= (key << 12); - key ^= (key >> 7); - key ^= (key << 2); - key ^= (key >> 20); - return key; -} - inline unsigned CalculateCapacity(unsigned size) { for (unsigned mask = size; mask; mask >>= 1) size |= mask; // 00110101010 -> 00111111111 @@ -1131,10 +1122,10 @@ if (!table) return nullptr; - size_t k = 0; size_t size_mask = TableSizeMask(); unsigned h = HashTranslator::GetHash(key); size_t i = h & size_mask; + size_t probe_count = 0; UPDATE_ACCESS_COUNTS(); @@ -1155,10 +1146,9 @@ HashTranslator::Equal(Extractor::Extract(*entry), key)) return entry; } + ++probe_count; UPDATE_PROBE_COUNTS(); - if (!k) - k = 1 | DoubleHash(h); - i = (i + k) & size_mask; + i = (i + probe_count) & size_mask; } } @@ -1184,10 +1174,10 @@ RegisterModification(); ValueType* table = table_; - size_t k = 0; size_t size_mask = TableSizeMask(); unsigned h = HashTranslator::GetHash(key); size_t i = h & size_mask; + size_t probe_count = 0; UPDATE_ACCESS_COUNTS(); @@ -1211,10 +1201,10 @@ else if (HashTranslator::Equal(Extractor::Extract(*entry), key)) return LookupType(entry, true); } + + ++probe_count; UPDATE_PROBE_COUNTS(); - if (!k) - k = 1 | DoubleHash(h); - i = (i + k) & size_mask; + i = (i + probe_count) & size_mask; } } @@ -1240,10 +1230,10 @@ RegisterModification(); ValueType* table = table_; - size_t k = 0; size_t size_mask = TableSizeMask(); unsigned h = HashTranslator::GetHash(key); size_t i = h & size_mask; + size_t probe_count = 0; UPDATE_ACCESS_COUNTS(); @@ -1267,10 +1257,9 @@ else if (HashTranslator::Equal(Extractor::Extract(*entry), key)) return MakeLookupResult(entry, true, h); } + ++probe_count; UPDATE_PROBE_COUNTS(); - if (!k) - k = 1 | DoubleHash(h); - i = (i + k) & size_mask; + i = (i + probe_count) & size_mask; } } @@ -1375,10 +1364,10 @@ DCHECK(table_); ValueType* table = table_; - size_t k = 0; size_t size_mask = TableSizeMask(); unsigned h = HashTranslator::GetHash(key); size_t i = h & size_mask; + size_t probe_count = 0; UPDATE_ACCESS_COUNTS(); @@ -1405,10 +1394,9 @@ else if (HashTranslator::Equal(Extractor::Extract(*entry), key)) return AddResult(this, entry, false); } + ++probe_count; UPDATE_PROBE_COUNTS(); - if (!k) - k = 1 | DoubleHash(h); - i = (i + k) & size_mask; + i = (i + probe_count) & size_mask; } RegisterModification();
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 40449f5d..65d5825 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -3148,11 +3148,10 @@ crbug.com/1053965 external/wpt/css/css-values/ex-unit-004.html [ Failure ] crbug.com/759914 external/wpt/css/css-values/ch-unit-011.html [ Failure ] crbug.com/965366 external/wpt/css/css-values/ch-unit-017.html [ Failure ] -crbug.com/937101 [ Mac ] external/wpt/css/css-values/ic-unit-002.html [ Failure ] -crbug.com/937101 [ Mac ] external/wpt/css/css-values/ic-unit-003.html [ Failure ] -crbug.com/937101 [ Mac ] external/wpt/css/css-values/ic-unit-009.html [ Failure ] -crbug.com/937101 [ Mac ] external/wpt/css/css-values/ic-unit-010.html [ Failure ] -crbug.com/937101 external/wpt/css/css-values/ic-unit-012.html [ Failure ] +crbug.com/1350027 [ Mac ] external/wpt/css/css-values/ic-unit-002.html [ Failure ] +crbug.com/1350027 [ Mac ] external/wpt/css/css-values/ic-unit-003.html [ Failure ] +crbug.com/1350027 [ Mac ] external/wpt/css/css-values/ic-unit-009.html [ Failure ] +crbug.com/1350027 [ Mac ] external/wpt/css/css-values/ic-unit-010.html [ Failure ] crbug.com/937104 external/wpt/css/css-values/lh-unit-002.html [ Failure ] crbug.com/937104 external/wpt/css/css-values/lh-unit-001.html [ Failure ] @@ -6815,6 +6814,8 @@ crbug.com/1288839 virtual/feature-policy-permissions/external/wpt/mediacapture-streams/MediaStreamTrack-iframe-transfer.https.html [ Skip ] crbug.com/1288839 external/wpt/mediacapture-streams/MediaStreamTrack-transfer-video.https.html [ Skip ] crbug.com/1288839 virtual/feature-policy-permissions/external/wpt/mediacapture-streams/MediaStreamTrack-transfer-video.https.html [ Skip ] +# Explicit PASS expectation for the virtual suite, to stop it inheriting "Skip". +crbug.com/1288839 virtual/mediastreamtrack-transfer/external/wpt/mediacapture-streams/MediaStreamTrack-iframe-transfer.https.html [ Pass ] # Sheriff 2022-04-22 crbug.com/1318695 http/tests/devtools/elements/highlight/highlight-multiple-css-grid.js [ Failure Pass ]
diff --git a/third_party/blink/web_tests/accessibility/contenteditable-notifications.html b/third_party/blink/web_tests/accessibility/contenteditable-notifications.html index 7dcc8a0..5e32a24 100644 --- a/third_party/blink/web_tests/accessibility/contenteditable-notifications.html +++ b/third_party/blink/web_tests/accessibility/contenteditable-notifications.html
@@ -82,8 +82,8 @@ ]); // SelectedTextChanged at 4. expectedSelectedTextChangedIntents.push([ - 'AXEventIntent(setSelection,none,character,forward)', - 'AXEventIntent(insert,insertText,none,none)' + 'AXEventIntent(insert,insertText,none,none)', + 'AXEventIntent(setSelection,none,character,forward)' ]); eventSender.keyDown('x', []); @@ -111,8 +111,8 @@ ]); // SelectedTextChanged at 7. expectedSelectedTextChangedIntents.push([ - 'AXEventIntent(setSelection,none,character,forward)', - 'AXEventIntent(insert,insertText,none,none)' + 'AXEventIntent(insert,insertText,none,none)', + 'AXEventIntent(setSelection,none,character,forward)' ]); eventSender.keyDown('y', []);
diff --git a/third_party/blink/web_tests/animations/interpolation/length-interpolation-2-crash.html b/third_party/blink/web_tests/animations/interpolation/length-interpolation-2-crash.html new file mode 100644 index 0000000..1436b25 --- /dev/null +++ b/third_party/blink/web_tests/animations/interpolation/length-interpolation-2-crash.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>Stress test length interpolation.</title> +<body> + <marquee id="marquee"> + <wbr id="wbr"></wbr> + </marquee> + <output name="answer">Test passes if there is no crash.</output> +</body> +<script type="text/javascript"> + // Test passes if it does not crash (crbug.com/1349686). + // Lengths created via layout units are clamped to a maximum value. + if (window.testRunner) + testRunner.dumpAsText(); + + async function rAF() { + return new Promise(resolve => { + requestAnimationFrame(() => { + requestAnimationFrame(() => { + resolve(); + }); + }); + }); + } + + window.onload = async function(){ + const anim = wbr.animate({ right: ['20%', '5e192pt'] }, + { duration: 1000 }); + anim.currentTime = 900; + anim.pause(); + marquee.animate({ zoom: ['68%', '100%'] }, + { duration: 1000 }).pause(); + await rAF(); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/contain-inline-size-multicol.html b/third_party/blink/web_tests/external/wpt/css/css-contain/contain-inline-size-multicol.html index e693423..43510677 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/contain-inline-size-multicol.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/contain-inline-size-multicol.html
@@ -6,5 +6,6 @@ <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> <div style="columns:4; column-gap:0; contain:inline-size; width:fit-content; border:solid green; border-width:0 50px; background:red;"> - <div style="width:25px; height:400px;"></div> + <div style="width:25px; height:200px;"></div> + <div style="column-span:all; width:400px; height:50px;"></div> </div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/crashtests/marker-gcs-after-disconnect-crash.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/crashtests/marker-gcs-after-disconnect-crash.html new file mode 100644 index 0000000..3680c79 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/crashtests/marker-gcs-after-disconnect-crash.html
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<title>Don't crash during getComputedStyle which removes ::marker</title> +<link rel="help" href="https://drafts.csswg.org/css-contain-3"> +<link rel="help" href="https://crbug.com/1349732"> +<style> +#container { + width: 100px; + height: 100px; + container-type: size; +} +@container (width) { + span { color: green; } +} +</style> +<ul> + <li id="target"></li> +</ul> +<div id=container> + <span>PASS if no crash</span> +</div> +<script> +let li = document.querySelector('li'); +getComputedStyle(target, '::marker').width; +li.style.listStyleType = 'none'; +getComputedStyle(target, '::marker').width; +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-multicol/crashtests/size-containment-become-multicol-add-inline-child.html b/third_party/blink/web_tests/external/wpt/css/css-multicol/crashtests/size-containment-become-multicol-add-inline-child.html new file mode 100644 index 0000000..6933592 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-multicol/crashtests/size-containment-become-multicol-add-inline-child.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1348714"> +<div id="container" style="width:fit-content; container-type:size;"> + <span></span> + <span id="boo" style="display:none;"></span> +</div> +<script> + document.body.offsetTop; + container.style.columnCount = "2"; + boo.style.display = "inline"; +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-values/ic-unit-012.html b/third_party/blink/web_tests/external/wpt/css/css-values/ic-unit-012.html index e8603570..e5d8027d 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-values/ic-unit-012.html +++ b/third_party/blink/web_tests/external/wpt/css/css-values/ic-unit-012.html
@@ -6,7 +6,7 @@ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> <link rel="help" href="https://www.w3.org/TR/css-values-4/#font-relative-lengths"> - <link rel="match" href="reference/ic-unit-009-ref.html"> + <link rel="match" href="reference/ic-unit-012-ref.html"> <meta name="assert" content="In this test, the ic unit is the advance width measure of the 水 (CJK water ideograph, U+6C34) glyph.">
diff --git a/third_party/blink/web_tests/external/wpt/css/css-values/reference/ic-unit-012-ref.html b/third_party/blink/web_tests/external/wpt/css/css-values/reference/ic-unit-012-ref.html new file mode 100644 index 0000000..43069859 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-values/reference/ic-unit-012-ref.html
@@ -0,0 +1,51 @@ +<!DOCTYPE html> + + <meta charset="UTF-8"> + + <title>CSS Values and Units Test Reference File</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> + + <style> + @font-face + { + font-family: IcTestFullWidth; + src: url(/css/css-values/resources/IcTestFullWidth.woff2); + } + + div + { + float: left; + font-family: IcTestFullWidth; + font-size: 80px; /* arbitrary font size */ + line-height: 1.8; /* arbitrary line-height */ + text-orientation: sideways; + writing-mode: vertical-rl; + } + + div#blue + { + background-color: blue; + color: blue; + } + + div#orange + { + background-color: orange; + color: orange; + } + </style> + + <p>Test passes if there is a blue rectangle with the <strong>same height</strong> as an orange rectangle. + + <div id="blue">水水水水水</div> + + <div id="orange">水水水水水</div> + + <!-- + + 水 (CJK water ideograph, U+6C34) glyph == 水 + + 水 (CJK water ideograph, U+6C34) glyph == 水 + + -->
diff --git a/third_party/blink/web_tests/external/wpt/css/css-values/sin-cos-tan-serialize.html b/third_party/blink/web_tests/external/wpt/css/css-values/sin-cos-tan-serialize.html index 278940b..e5d57c13 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-values/sin-cos-tan-serialize.html +++ b/third_party/blink/web_tests/external/wpt/css/css-values/sin-cos-tan-serialize.html
@@ -34,7 +34,10 @@ "cos(1.047197551rad)" :"calc(0.5)", "cos(0.16666666666turn)" :"calc(0.5)", "tan(45deg)" :"calc(1)", - "tan(45deg)" :"calc(1)", + "tan(50grad)" :"calc(1)", + "tan(0.78539816)" :"calc(1)", + "tan(0.78539816rad)" :"calc(1)", + "tan(0.125turn)" :"calc(1)", "calc(sin(30deg) + cos(60deg) + tan(45deg)" :"calc(2)", "calc(sin(infinity))" :"calc(NaN)", "calc(cos(infinity))" :"calc(NaN)",
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt b/third_party/blink/web_tests/flag-specific/disable-layout-ng/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt index 1351014a8..496565b 100644 --- a/third_party/blink/web_tests/flag-specific/disable-layout-ng/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt
@@ -47,8 +47,8 @@ ⇦⇧⇨⇩←↑→↓⟀ #text_presentation_arrows_maths: -"Noto Sans CJK JP" : 4, "DejaVu Sans" : 4, +"Noto Sans CJK JP" : 4, "Tinos" : 1
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt b/third_party/blink/web_tests/flag-specific/highdpi/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt index 1351014a8..496565b 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt +++ b/third_party/blink/web_tests/flag-specific/highdpi/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt
@@ -47,8 +47,8 @@ ⇦⇧⇨⇩←↑→↓⟀ #text_presentation_arrows_maths: -"Noto Sans CJK JP" : 4, "DejaVu Sans" : 4, +"Noto Sans CJK JP" : 4, "Tinos" : 1
diff --git a/third_party/blink/web_tests/platform/generic/animations/interpolation/length-interpolation-2-crash-expected.txt b/third_party/blink/web_tests/platform/generic/animations/interpolation/length-interpolation-2-crash-expected.txt new file mode 100644 index 0000000..faa90b4 --- /dev/null +++ b/third_party/blink/web_tests/platform/generic/animations/interpolation/length-interpolation-2-crash-expected.txt
@@ -0,0 +1 @@ + Test passes if there is no crash.
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/css/css-values/sin-cos-tan-computed-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/css/css-values/sin-cos-tan-computed-expected.txt index b82c2af..4dce501 100644 --- a/third_party/blink/web_tests/platform/generic/external/wpt/css/css-values/sin-cos-tan-computed-expected.txt +++ b/third_party/blink/web_tests/platform/generic/external/wpt/css/css-values/sin-cos-tan-computed-expected.txt
@@ -1,7 +1,7 @@ This is a testharness.js-based test. PASS cos(0) should be used-value-equivalent to 1 PASS sin(0) should be used-value-equivalent to 0 -FAIL tan(0) should be used-value-equivalent to 0 assert_not_equals: tan(0) isn't valid in 'transform'; got the default value instead. got disallowed value "none" +PASS tan(0) should be used-value-equivalent to 0 FAIL calc(sin(pi/2 - pi/2) ) should be used-value-equivalent to 0 assert_not_equals: calc(sin(pi/2 - pi/2) ) isn't valid in 'transform'; got the default value instead. got disallowed value "none" FAIL calc(cos(pi - 3.14159265358979323846) ) should be used-value-equivalent to 1 assert_not_equals: calc(cos(pi - 3.14159265358979323846) ) isn't valid in 'transform'; got the default value instead. got disallowed value "none" FAIL calc(cos(e - 2.7182818284590452354) ) should be used-value-equivalent to 1 assert_not_equals: calc(cos(e - 2.7182818284590452354) ) isn't valid in 'transform'; got the default value instead. got disallowed value "none" @@ -10,9 +10,9 @@ PASS calc(sin(3.14159 / 2 + 1 - 1) ) should be used-value-equivalent to 1 PASS calc(sin(100grad) ) should be used-value-equivalent to 1 PASS calc(cos(0 / 2 + 1 - 1) ) should be used-value-equivalent to 1 -FAIL calc(tan(30deg + 0.261799rad ) ) should be used-value-equivalent to 1 assert_not_equals: calc(tan(30deg + 0.261799rad ) ) isn't valid in 'transform'; got the default value instead. got disallowed value "none" -FAIL calc(tan(0.7853975rad ) ) should be used-value-equivalent to 1 assert_not_equals: calc(tan(0.7853975rad ) ) isn't valid in 'transform'; got the default value instead. got disallowed value "none" -FAIL calc(tan(3.14159 / 4 + 1 - 1) ) should be used-value-equivalent to 1 assert_not_equals: calc(tan(3.14159 / 4 + 1 - 1) ) isn't valid in 'transform'; got the default value instead. got disallowed value "none" +PASS calc(tan(30deg + 0.261799rad ) ) should be used-value-equivalent to 1 +PASS calc(tan(0.7853975rad ) ) should be used-value-equivalent to 1 +PASS calc(tan(3.14159 / 4 + 1 - 1) ) should be used-value-equivalent to 1 PASS calc(sin(0.25turn) ) should be used-value-equivalent to 1 FAIL calc(cos(sin(cos(pi) + 1))) should be used-value-equivalent to 1 assert_not_equals: calc(cos(sin(cos(pi) + 1))) isn't valid in 'transform'; got the default value instead. got disallowed value "none" FAIL calc(sin(tan(pi/4)*pi/2) ) should be used-value-equivalent to 1 assert_not_equals: calc(sin(tan(pi/4)*pi/2) ) isn't valid in 'transform'; got the default value instead. got disallowed value "none"
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/css/css-values/sin-cos-tan-serialize-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/css/css-values/sin-cos-tan-serialize-expected.txt deleted file mode 100644 index f9336f27..0000000 --- a/third_party/blink/web_tests/platform/generic/external/wpt/css/css-values/sin-cos-tan-serialize-expected.txt +++ /dev/null
@@ -1,60 +0,0 @@ -This is a testharness.js-based test. -Found 56 tests; 40 PASS, 16 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS 'scale(calc(cos(0)))' as a specified value should serialize as 'scale(calc(1))'. -PASS 'scale(cos(0))' as a specified value should serialize as 'scale(calc(1))'. -PASS 'scale(calc(sin(0)))' as a specified value should serialize as 'scale(calc(0))'. -PASS 'scale(sin(0))' as a specified value should serialize as 'scale(calc(0))'. -FAIL 'scale(calc(tan(0)))' as a specified value should serialize as 'scale(calc(0))'. assert_not_equals: 'scale(calc(tan(0)))' should be valid in transform. got disallowed value "" -FAIL 'scale(tan(0))' as a specified value should serialize as 'scale(calc(0))'. assert_not_equals: 'scale(tan(0))' should be valid in transform. got disallowed value "" -PASS 'scale(calc(calc(sin(0) + 0.5)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(sin(0) + 0.5))' as a specified value should serialize as 'scale(calc(0.5))'. -FAIL 'scale(calc(calc(sin(0) + cos(0) + tan(0)))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(calc(sin(0) + cos(0) + tan(0)))' should be valid in transform. got disallowed value "" -FAIL 'scale(calc(sin(0) + cos(0) + tan(0))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(sin(0) + cos(0) + tan(0))' should be valid in transform. got disallowed value "" -PASS 'scale(calc(calc(cos(0) + 0.5)))' as a specified value should serialize as 'scale(calc(1.5))'. -PASS 'scale(calc(cos(0) + 0.5))' as a specified value should serialize as 'scale(calc(1.5))'. -FAIL 'scale(calc(calc(tan(0) + 0.5)))' as a specified value should serialize as 'scale(calc(0.5))'. assert_not_equals: 'scale(calc(calc(tan(0) + 0.5)))' should be valid in transform. got disallowed value "" -FAIL 'scale(calc(tan(0) + 0.5))' as a specified value should serialize as 'scale(calc(0.5))'. assert_not_equals: 'scale(calc(tan(0) + 0.5))' should be valid in transform. got disallowed value "" -PASS 'scale(calc(cos(0deg)))' as a specified value should serialize as 'scale(calc(1))'. -PASS 'scale(cos(0deg))' as a specified value should serialize as 'scale(calc(1))'. -PASS 'scale(calc(sin(0deg)))' as a specified value should serialize as 'scale(calc(0))'. -PASS 'scale(sin(0deg))' as a specified value should serialize as 'scale(calc(0))'. -FAIL 'scale(calc(tan(0deg)))' as a specified value should serialize as 'scale(calc(0))'. assert_not_equals: 'scale(calc(tan(0deg)))' should be valid in transform. got disallowed value "" -FAIL 'scale(tan(0deg))' as a specified value should serialize as 'scale(calc(0))'. assert_not_equals: 'scale(tan(0deg))' should be valid in transform. got disallowed value "" -PASS 'scale(calc(sin(30deg)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(sin(30deg))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(sin(0.523599)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(sin(0.523599))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(sin(0.523599rad)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(sin(0.523599rad))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(sin(33.333333grad)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(sin(33.333333grad))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(sin(0.08333333turn)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(sin(0.08333333turn))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(cos(60deg)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(cos(60deg))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(cos(66.66666666grad)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(cos(66.66666666grad))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(cos(1.047197551)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(cos(1.047197551))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(cos(1.047197551rad)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(cos(1.047197551rad))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(calc(cos(0.16666666666turn)))' as a specified value should serialize as 'scale(calc(0.5))'. -PASS 'scale(cos(0.16666666666turn))' as a specified value should serialize as 'scale(calc(0.5))'. -FAIL 'scale(calc(tan(45deg)))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(tan(45deg)))' should be valid in transform. got disallowed value "" -FAIL 'scale(tan(45deg))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(tan(45deg))' should be valid in transform. got disallowed value "" -FAIL 'scale(calc(calc(sin(30deg) + cos(60deg) + tan(45deg)))' as a specified value should serialize as 'scale(calc(2))'. assert_not_equals: 'scale(calc(calc(sin(30deg) + cos(60deg) + tan(45deg)))' should be valid in transform. got disallowed value "" -FAIL 'scale(calc(sin(30deg) + cos(60deg) + tan(45deg))' as a specified value should serialize as 'scale(calc(2))'. assert_not_equals: 'scale(calc(sin(30deg) + cos(60deg) + tan(45deg))' should be valid in transform. got disallowed value "" -PASS 'scale(calc(calc(sin(infinity))))' as a specified value should serialize as 'scale(calc(NaN))'. -PASS 'scale(calc(sin(infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. -PASS 'scale(calc(calc(cos(infinity))))' as a specified value should serialize as 'scale(calc(NaN))'. -PASS 'scale(calc(cos(infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. -FAIL 'scale(calc(calc(tan(infinity))))' as a specified value should serialize as 'scale(calc(NaN))'. assert_not_equals: 'scale(calc(calc(tan(infinity))))' should be valid in transform. got disallowed value "" -FAIL 'scale(calc(tan(infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. assert_not_equals: 'scale(calc(tan(infinity)))' should be valid in transform. got disallowed value "" -PASS 'scale(calc(calc(sin(-infinity))))' as a specified value should serialize as 'scale(calc(NaN))'. -PASS 'scale(calc(sin(-infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. -PASS 'scale(calc(calc(cos(-infinity))))' as a specified value should serialize as 'scale(calc(NaN))'. -PASS 'scale(calc(cos(-infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. -FAIL 'scale(calc(calc(tan(-infinity))))' as a specified value should serialize as 'scale(calc(NaN))'. assert_not_equals: 'scale(calc(calc(tan(-infinity))))' should be valid in transform. got disallowed value "" -FAIL 'scale(calc(tan(-infinity)))' as a specified value should serialize as 'scale(calc(NaN))'. assert_not_equals: 'scale(calc(tan(-infinity)))' should be valid in transform. got disallowed value "" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/devtools/elements/highlight/highlight-css-grid-area-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/devtools/elements/highlight/highlight-css-grid-area-expected.txt index 46f164ff..27056a35 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/devtools/elements/highlight/highlight-css-grid-area-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/devtools/elements/highlight/highlight-css-grid-area-expected.txt
@@ -315,13 +315,13 @@ "rowLineNameOffsets": [ { "x": 0, - "y": 601, - "name": "sidebar-end" + "y": 0, + "name": "header-start" }, { "x": 0, - "y": 300.5, - "name": "sidebar-start" + "y": 601, + "name": "sidebar-end" }, { "x": 0, @@ -340,22 +340,22 @@ }, { "x": 0, - "y": 0, - "name": "header-start" + "y": 300.5, + "name": "sidebar-start" } ], "columnLineNameOffsets": [ { + "x": 0, + "y": 0, + "name": "header-start" + }, + { "x": 200.5, "y": 0, "name": "sidebar-end" }, { - "x": 0, - "y": 0, - "name": "sidebar-start" - }, - { "x": 401, "y": 0, "name": "header-end" @@ -373,7 +373,7 @@ { "x": 0, "y": 0, - "name": "header-start" + "name": "sidebar-start" } ], "gridBorder": [
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/devtools/elements/highlight/highlight-css-persistent-grid-iframe-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/devtools/elements/highlight/highlight-css-persistent-grid-iframe-expected.txt index 2aff520..f83643d 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/devtools/elements/highlight/highlight-css-persistent-grid-iframe-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/devtools/elements/highlight/highlight-css-persistent-grid-iframe-expected.txt
@@ -260,45 +260,50 @@ "rowLineNameOffsets": [ { "x": 98, + "y": 98, + "name": "header-start" + }, + { + "x": 98, "y": 598, "name": "sidebar-end" }, { "x": 98, "y": 348, - "name": "sidebar-start" - }, - { - "x": 98, - "y": 348, - "name": "content-start" - }, - { - "x": 98, - "y": 348, "name": "header-end" }, { "x": 98, + "y": 348, + "name": "content-start" + }, + { + "x": 98, "y": 598, "name": "content-end" }, { "x": 98, - "y": 98, - "name": "header-start" + "y": 348, + "name": "sidebar-start" } ], "columnLineNameOffsets": [ { "x": 223, "y": 98, + "name": "header-start" + }, + { + "x": 223, + "y": 98, "name": "sidebar-end" }, { - "x": 98, + "x": 478, "y": 98, - "name": "sidebar-start" + "name": "header-end" }, { "x": 223, @@ -308,17 +313,12 @@ { "x": 478, "y": 98, - "name": "header-end" - }, - { - "x": 478, - "y": 98, "name": "content-end" }, { - "x": 223, + "x": 98, "y": 98, - "name": "header-start" + "name": "sidebar-start" } ], "gridBorder": [
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/eventsource/eventsource-cors-non-http-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/eventsource/eventsource-cors-non-http-expected.txt index 07bb316..0a46fb5 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/eventsource/eventsource-cors-non-http-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/eventsource/eventsource-cors-non-http-expected.txt
@@ -1,7 +1,7 @@ CONSOLE ERROR: Not allowed to load local resource: motd -CONSOLE ERROR: Access to resource at 'ftp://127.0.0.1/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to resource at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to resource at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. +CONSOLE ERROR: Access to resource at 'ftp://127.0.0.1/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to resource at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to resource at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. Test EventSource with non-HTTP protocol schemes in the URL. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/eventsource/workers/eventsource-cors-non-http-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/eventsource/workers/eventsource-cors-non-http-expected.txt index 33b762a..e1a2fed 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/eventsource/workers/eventsource-cors-non-http-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/eventsource/workers/eventsource-cors-non-http-expected.txt
@@ -1,7 +1,7 @@ CONSOLE ERROR: Not allowed to load local resource: motd -CONSOLE ERROR: Access to resource at 'ftp://127.0.0.1/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to resource at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to resource at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. +CONSOLE ERROR: Access to resource at 'ftp://127.0.0.1/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to resource at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to resource at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. [Worker] Test EventSource with non-HTTP protocol schemes in the URL. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/xmlhttprequest/cross-origin-unsupported-url-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/xmlhttprequest/cross-origin-unsupported-url-expected.txt index 688f10d9..b381e3a0 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/xmlhttprequest/cross-origin-unsupported-url-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/xmlhttprequest/cross-origin-unsupported-url-expected.txt
@@ -1,15 +1,15 @@ -CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. +CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. This is a testharness.js-based test. PASS sync test for url=mailto:foo@bar.com, contentType=undefined PASS sync test for url=mailto:foo@bar.com, contentType=application/json
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/xmlhttprequest/workers/cross-origin-unsupported-url-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/xmlhttprequest/workers/cross-origin-unsupported-url-expected.txt index 688f10d9..b381e3a0 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/xmlhttprequest/workers/cross-origin-unsupported-url-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/xmlhttprequest/workers/cross-origin-unsupported-url-expected.txt
@@ -1,15 +1,15 @@ -CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. -CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. +CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'mailto:foo@bar.com' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'localhost:8080/' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. +CONSOLE ERROR: Access to XMLHttpRequest at 'tel:1234' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. This is a testharness.js-based test. PASS sync test for url=mailto:foo@bar.com, contentType=undefined PASS sync test for url=mailto:foo@bar.com, contentType=application/json
diff --git a/third_party/blink/web_tests/platform/generic/mhtml/cid_in_html_resource-expected.txt b/third_party/blink/web_tests/platform/generic/mhtml/cid_in_html_resource-expected.txt index 9ce2af1..679e6f66 100644 --- a/third_party/blink/web_tests/platform/generic/mhtml/cid_in_html_resource-expected.txt +++ b/third_party/blink/web_tests/platform/generic/mhtml/cid_in_html_resource-expected.txt
@@ -1,2 +1,2 @@ -CONSOLE ERROR: Access to font at 'cid:xxxxxx' from origin '' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https. +CONSOLE ERROR: Access to font at 'cid:xxxxxx' from origin '' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https, chrome-untrusted. No Content-ID url are expected outside of an MHTML document. The document should load without crashing.
diff --git a/third_party/blink/web_tests/platform/generic/virtual/css-trigonometric-functions-disabled/external/wpt/css/css-values/sin-cos-tan-serialize-expected.txt b/third_party/blink/web_tests/platform/generic/virtual/css-trigonometric-functions-disabled/external/wpt/css/css-values/sin-cos-tan-serialize-expected.txt index 7ee327d..91946ad 100644 --- a/third_party/blink/web_tests/platform/generic/virtual/css-trigonometric-functions-disabled/external/wpt/css/css-values/sin-cos-tan-serialize-expected.txt +++ b/third_party/blink/web_tests/platform/generic/virtual/css-trigonometric-functions-disabled/external/wpt/css/css-values/sin-cos-tan-serialize-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 56 tests; 0 PASS, 56 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 64 tests; 0 PASS, 64 FAIL, 0 TIMEOUT, 0 NOTRUN. FAIL 'scale(calc(cos(0)))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(cos(0)))' should be valid in transform. got disallowed value "" FAIL 'scale(cos(0))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(cos(0))' should be valid in transform. got disallowed value "" FAIL 'scale(calc(sin(0)))' as a specified value should serialize as 'scale(calc(0))'. assert_not_equals: 'scale(calc(sin(0)))' should be valid in transform. got disallowed value "" @@ -42,6 +42,14 @@ FAIL 'scale(cos(0.16666666666turn))' as a specified value should serialize as 'scale(calc(0.5))'. assert_not_equals: 'scale(cos(0.16666666666turn))' should be valid in transform. got disallowed value "" FAIL 'scale(calc(tan(45deg)))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(tan(45deg)))' should be valid in transform. got disallowed value "" FAIL 'scale(tan(45deg))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(tan(45deg))' should be valid in transform. got disallowed value "" +FAIL 'scale(calc(tan(50grad)))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(tan(50grad)))' should be valid in transform. got disallowed value "" +FAIL 'scale(tan(50grad))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(tan(50grad))' should be valid in transform. got disallowed value "" +FAIL 'scale(calc(tan(0.78539816)))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(tan(0.78539816)))' should be valid in transform. got disallowed value "" +FAIL 'scale(tan(0.78539816))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(tan(0.78539816))' should be valid in transform. got disallowed value "" +FAIL 'scale(calc(tan(0.78539816rad)))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(tan(0.78539816rad)))' should be valid in transform. got disallowed value "" +FAIL 'scale(tan(0.78539816rad))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(tan(0.78539816rad))' should be valid in transform. got disallowed value "" +FAIL 'scale(calc(tan(0.125turn)))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(calc(tan(0.125turn)))' should be valid in transform. got disallowed value "" +FAIL 'scale(tan(0.125turn))' as a specified value should serialize as 'scale(calc(1))'. assert_not_equals: 'scale(tan(0.125turn))' should be valid in transform. got disallowed value "" FAIL 'scale(calc(calc(sin(30deg) + cos(60deg) + tan(45deg)))' as a specified value should serialize as 'scale(calc(2))'. assert_not_equals: 'scale(calc(calc(sin(30deg) + cos(60deg) + tan(45deg)))' should be valid in transform. got disallowed value "" FAIL 'scale(calc(sin(30deg) + cos(60deg) + tan(45deg))' as a specified value should serialize as 'scale(calc(2))'. assert_not_equals: 'scale(calc(sin(30deg) + cos(60deg) + tan(45deg))' should be valid in transform. got disallowed value "" FAIL 'scale(calc(calc(sin(infinity))))' as a specified value should serialize as 'scale(calc(NaN))'. assert_not_equals: 'scale(calc(calc(sin(infinity))))' should be valid in transform. got disallowed value ""
diff --git a/third_party/blink/web_tests/platform/linux/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt b/third_party/blink/web_tests/platform/linux/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt index 39acb2a..eb0a92b 100644 --- a/third_party/blink/web_tests/platform/linux/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt +++ b/third_party/blink/web_tests/platform/linux/inspector-protocol/layout-fonts/languages-emoji-rare-glyphs-expected.txt
@@ -47,8 +47,8 @@ ⇦⇧⇨⇩←↑→↓⟀ #text_presentation_arrows_maths: -"Noto Sans CJK JP" : 4, "DejaVu Sans" : 4, +"Noto Sans CJK JP" : 4, "Tinos" : 1
diff --git a/third_party/closure_compiler/externs/passwords_private.js b/third_party/closure_compiler/externs/passwords_private.js index 42d1e34..b96870f 100644 --- a/third_party/closure_compiler/externs/passwords_private.js +++ b/third_party/closure_compiler/externs/passwords_private.js
@@ -70,19 +70,26 @@ * @enum {string} */ chrome.passwordsPrivate.ImportResultsStatus = { + UNKNOWN_ERROR: 'UNKNOWN_ERROR', SUCCESS: 'SUCCESS', IO_ERROR: 'IO_ERROR', BAD_FORMAT: 'BAD_FORMAT', DISMISSED: 'DISMISSED', + MAX_FILE_SIZE: 'MAX_FILE_SIZE', + IMPORT_ALREADY_ACTIVE: 'IMPORT_ALREADY_ACTIVE', + NUM_PASSWORDS_EXCEEDED: 'NUM_PASSWORDS_EXCEEDED', }; /** * @enum {string} */ chrome.passwordsPrivate.ImportEntryStatus = { + UNKNOWN_ERROR: 'UNKNOWN_ERROR', MISSING_PASSWORD: 'MISSING_PASSWORD', MISSING_URL: 'MISSING_URL', INVALID_URL: 'INVALID_URL', + NON_ASCII_URL: 'NON_ASCII_URL', + LONG_URL: 'LONG_URL', LONG_PASSWORD: 'LONG_PASSWORD', LONG_USERNAME: 'LONG_USERNAME', CONFLICT_PROFILE: 'CONFLICT_PROFILE',
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index bb6d224..fdc52101 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-12-1-74-gdcb5fc5bc -Revision: dcb5fc5bcd1d73b6510ce20579ccbd8e96b639c5 +Version: VER-2-12-1-75-g90e1e39f5 +Revision: 90e1e39f50f9431e41fc3fb21b8d8f75fd5b4b9c CPEPrefix: cpe:/a:freetype:freetype:2.11.1 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses"
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index bcf5c44d..f500ca9 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -56738,6 +56738,7 @@ <int value="-1373048294" label="ChromeCleanupScanCompletedNotification:enabled"/> <int value="-1372926635" label="AndroidManagedByMenuItem:disabled"/> + <int value="-1372833098" label="CrOSLateBootAudioHFPMicSR:enabled"/> <int value="-1371984027" label="CrostiniWebUIUpgrader:disabled"/> <int value="-1371239786" label="EnablePasswordsAccountStorage:enabled"/> <int value="-1370883795" label="TerminalTmuxIntegration:disabled"/> @@ -61738,6 +61739,7 @@ <int value="1824931483" label="EnableHistoryFaviconsGoogleServerQuery:disabled"/> <int value="1825369164" label="EnableNewBadgeOnMenuItems:disabled"/> + <int value="1825605721" label="CrOSLateBootAudioHFPMicSR:disabled"/> <int value="1825812252" label="EnableNeuralPalmAdaptiveHold:disabled"/> <int value="1825940786" label="ChromeHomePromo:disabled"/> <int value="1827369558" label="AndroidPayIntegrationV1:disabled"/>
diff --git a/tools/typescript/definitions/passwords_private.d.ts b/tools/typescript/definitions/passwords_private.d.ts index 490a82a..ca79875 100644 --- a/tools/typescript/definitions/passwords_private.d.ts +++ b/tools/typescript/definitions/passwords_private.d.ts
@@ -48,16 +48,23 @@ } export enum ImportResultsStatus { + UNKNOWN_ERROR = 'UNKNOWN_ERROR', SUCCESS = 'SUCCESS', IO_ERROR = 'IO_ERROR', BAD_FORMAT = 'BAD_FORMAT', DISMISSED = 'DISMISSED', + MAX_FILE_SIZE = 'MAX_FILE_SIZE', + IMPORT_ALREADY_ACTIVE = 'IMPORT_ALREADY_ACTIVE', + NUM_PASSWORDS_EXCEEDED = 'NUM_PASSWORDS_EXCEEDED', } export enum ImportEntryStatus { + UNKNOWN_ERROR = 'UNKNOWN_ERROR', MISSING_PASSWORD = 'MISSING_PASSWORD', MISSING_URL = 'MISSING_URL', INVALID_URL = 'INVALID_URL', + NON_ASCII_URL = 'NON_ASCII_URL', + LONG_URL = 'LONG_URL', LONG_PASSWORD = 'LONG_PASSWORD', LONG_USERNAME = 'LONG_USERNAME', CONFLICT_PROFILE = 'CONFLICT_PROFILE',
diff --git a/ui/chromeos/file_manager_strings.grdp b/ui/chromeos/file_manager_strings.grdp index d7f333d..f943df1 100644 --- a/ui/chromeos/file_manager_strings.grdp +++ b/ui/chromeos/file_manager_strings.grdp
@@ -1551,5 +1551,8 @@ <message name="IDS_FILE_BROWSER_DLP_RESTRICTION_DETAILS" desc="Context menu item that shows the DLP restriction details for the selected file."> Restriction details </message> + <message name="IDS_FILE_BROWSER_DLP_MANAGED_ICON_TOOLTIP" desc="Tooltip of the data leak prevention managed icon."> + This file is confidential and subject to restrictions by administrator policy. <ph name="BEGIN_LINK_HELP"><a target='_blank' href='$1'></ph>Learn more<ph name="END_LINK_HELP"></a></ph> + </message> </grit-part>
diff --git a/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_DLP_MANAGED_ICON_TOOLTIP.png.sha1 b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_DLP_MANAGED_ICON_TOOLTIP.png.sha1 new file mode 100644 index 0000000..0cbb064 --- /dev/null +++ b/ui/chromeos/file_manager_strings_grdp/IDS_FILE_BROWSER_DLP_MANAGED_ICON_TOOLTIP.png.sha1
@@ -0,0 +1 @@ +212372c7c46b37887c8ba8c47d6237fcb5f1b8db \ No newline at end of file
diff --git a/ui/file_manager/BUILD.gn b/ui/file_manager/BUILD.gn index 0251652..6ab9680 100644 --- a/ui/file_manager/BUILD.gn +++ b/ui/file_manager/BUILD.gn
@@ -153,6 +153,7 @@ definitions = [ "//ui/file_manager/file_manager/definitions/file_manager.d.ts", + "//ui/file_manager/file_manager/definitions/file_manager_private.d.ts", "//ui/file_manager/file_manager/definitions/volume_manager.d.ts", ] } @@ -279,6 +280,13 @@ target_gen_dir), ] + definitions = [ + "//ui/file_manager/file_manager/definitions/file_manager_private.d.ts", + "//ui/file_manager/file_manager/definitions/file_error.d.ts", + "//ui/file_manager/file_manager/definitions/file_manager.d.ts", + "//ui/file_manager/file_manager/definitions/volume_manager.d.ts", + ] + deps = [ ":build_ts" ] extra_deps = [ ":copy_ts_test" ] }
diff --git a/ui/file_manager/file_manager/background/js/BUILD.gn b/ui/file_manager/file_manager/background/js/BUILD.gn index 59d9e1c..0f88443 100644 --- a/ui/file_manager/file_manager/background/js/BUILD.gn +++ b/ui/file_manager/file_manager/background/js/BUILD.gn
@@ -84,6 +84,7 @@ closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=./gen/ui", "js_module_root=../../ui", "browser_resolver_prefix_replacements=\"chrome://webui-test/=./\"", @@ -105,6 +106,7 @@ ] closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=./gen/ui", "js_module_root=../../ui", "browser_resolver_prefix_replacements=\"chrome://webui-test/=./\"", @@ -796,6 +798,7 @@ closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=./gen/ui", "js_module_root=../../ui", "browser_resolver_prefix_replacements=\"chrome://webui-test/=./\"",
diff --git a/ui/file_manager/file_manager/background/js/mock_volume_manager.js b/ui/file_manager/file_manager/background/js/mock_volume_manager.js index 8b548f6..de3da94d 100644 --- a/ui/file_manager/file_manager/background/js/mock_volume_manager.js +++ b/ui/file_manager/file_manager/background/js/mock_volume_manager.js
@@ -75,17 +75,14 @@ str('DOWNLOADS_DIRECTORY_LABEL')); } - /** @override */ getFuseBoxOnlyFilterEnabled() { return false; } - /** @override */ getMediaStoreFilesOnlyFilterEnabled() { return false; } - /** @override */ dispose() {} /** @@ -173,7 +170,6 @@ /** * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. * @return {?VolumeInfo} Volume info. - * @override */ getCurrentProfileVolumeInfo(volumeType) { for (let i = 0; i < this.volumeInfoList.length; i++) { @@ -281,19 +277,15 @@ /** @private {?VolumeManager} */ MockVolumeManager.instance_ = null; -/** @override */ MockVolumeManager.prototype.getVolumeInfo = VolumeManagerImpl.prototype.getVolumeInfo; -/** @override */ MockVolumeManager.prototype.getDefaultDisplayRoot = VolumeManagerImpl.prototype.getDefaultDisplayRoot; -/** @override */ MockVolumeManager.prototype.findByDevicePath = VolumeManagerImpl.prototype.findByDevicePath; -/** @override */ MockVolumeManager.prototype.whenVolumeInfoReady = VolumeManagerImpl.prototype.whenVolumeInfoReady;
diff --git a/ui/file_manager/file_manager/background/js/volume_info_list_impl.js b/ui/file_manager/file_manager/background/js/volume_info_list_impl.js index 60a5a63..9f3d3841 100644 --- a/ui/file_manager/file_manager/background/js/volume_info_list_impl.js +++ b/ui/file_manager/file_manager/background/js/volume_info_list_impl.js
@@ -26,17 +26,14 @@ return this.model_.length; } - /** @override */ addEventListener(type, handler) { this.model_.addEventListener(type, handler); } - /** @override */ removeEventListener(type, handler) { this.model_.removeEventListener(type, handler); } - /** @override */ add(volumeInfo) { const index = this.findIndex(volumeInfo.volumeId); if (index !== -1) { @@ -46,7 +43,6 @@ } } - /** @override */ remove(volumeId) { const index = this.findIndex(volumeId); if (index !== -1) { @@ -54,7 +50,6 @@ } } - /** @override */ item(index) { return /** @type {!VolumeInfo} */ (this.model_.item(index)); }
diff --git a/ui/file_manager/file_manager/common/js/BUILD.gn b/ui/file_manager/file_manager/common/js/BUILD.gn index 1d2fb05e..01f7e685 100644 --- a/ui/file_manager/file_manager/common/js/BUILD.gn +++ b/ui/file_manager/file_manager/common/js/BUILD.gn
@@ -84,6 +84,7 @@ ] closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=./gen/ui", "js_module_root=../../ui", "hide_warnings_for=third_party/", @@ -101,6 +102,7 @@ closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=./gen/ui", "js_module_root=../../ui", "browser_resolver_prefix_replacements=\"chrome://webui-test/=./\"", @@ -417,6 +419,7 @@ closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=./gen/ui", "js_module_root=../../ui", "browser_resolver_prefix_replacements=\"chrome://webui-test/=./\"",
diff --git a/ui/file_manager/file_manager/common/js/mock_entry.js b/ui/file_manager/file_manager/common/js/mock_entry.js index 63f6482..4e0e11b1 100644 --- a/ui/file_manager/file_manager/common/js/mock_entry.js +++ b/ui/file_manager/file_manager/common/js/mock_entry.js
@@ -156,7 +156,8 @@ if (this.filesystem.entries[this.fullPath]) { onSuccess(this.metadata); } else { - onError(/** @type {!FileError} */ ({name: util.FileError.NOT_FOUND_ERR})); + onError( + /** @type {!FileError} */ ({name: util.FileError.NOT_FOUND_ERR})); } } @@ -187,7 +188,8 @@ if (this.filesystem.entries[path]) { onSuccess(this.filesystem.entries[path]); } else { - onError(/** @type {!FileError} */ ({name: util.FileError.NOT_FOUND_ERR})); + onError( + /** @type {!FileError} */ ({name: util.FileError.NOT_FOUND_ERR})); } } @@ -198,8 +200,8 @@ * @param {string=} opt_newName New name. * @param {function(!Entry)=} opt_successCallback Callback invoked with the * moved entry. - * @param {function(!FileError)=} opt_errorCallback Callback invoked with an - * error object. + * @param {function(!FileError)=} opt_errorCallback Callback invoked with + * an error object. */ moveTo(parent, opt_newName, opt_successCallback, opt_errorCallback) { Promise.resolve() @@ -281,7 +283,11 @@ } } - /** @override */ + /** + * @param {string} fullpath New fullpath. + * @param {FileSystem=} opt_filesystem New file system + * @return {Entry} Cloned entry. + */ clone(fullpath, opt_filesystem) { throw new Error('Not implemented.'); }
diff --git a/ui/file_manager/file_manager/definitions/file_error.d.ts b/ui/file_manager/file_manager/definitions/file_error.d.ts new file mode 100644 index 0000000..1f1fe798 --- /dev/null +++ b/ui/file_manager/file_manager/definitions/file_error.d.ts
@@ -0,0 +1,27 @@ +// Copyright 2022 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. + + +/** + * @fileoverview Definitions for FileError. + * This is for compatibility with Closure definition for File API [1]. + * + * [1] + * https://github.com/google/closure-compiler/blob/master/externs/browser/nonstandard_fileapi.js#L197 + */ + +interface FileError extends DOMException { + NOT_FOUND_ERR: number; + SECURITY_ERR: number; + ABORT_ERR: number; + NOT_READABLE_ERR: number; + ENCODING_ERR: number; + NO_MODIFICATION_ALLOWED_ERR: number; + INVALID_STATE_ERR: number; + SYNTAX_ERR: number; + INVALID_MODIFICATION_ERR: number; + QUOTA_EXCEEDED_ERR: number; + TYPE_MISMATCH_ERR: number; + PATH_EXISTS_ERR: number; +}
diff --git a/ui/file_manager/file_manager/definitions/file_manager_private.d.ts b/ui/file_manager/file_manager/definitions/file_manager_private.d.ts new file mode 100644 index 0000000..ef68384 --- /dev/null +++ b/ui/file_manager/file_manager/definitions/file_manager_private.d.ts
@@ -0,0 +1,58 @@ +// Copyright 2022 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. + +/** @fileoverview Definitions for chrome.fileManagerPrivate API */ +// TODO(crbug.com/1203307)= Auto-generate this file. + +export {}; + +declare global { + export namespace chrome { + export namespace fileManagerPrivate { + export enum SourceRestriction { + ANY_SOURCE = 'any_source', + NATIVE_SOURCE = 'native_source', + } + + export enum RecentFileType { + ALL = 'all', + AUDIO = 'audio', + IMAGE = 'image', + VIDEO = 'video', + DOCUMENT = 'document', + } + + export enum DriveConnectionStateType { + OFFLINE = 'OFFLINE', + METERED = 'METERED', + ONLINE = 'ONLINE', + } + export enum DriveOfflineReason { + NOT_READY = 'NOT_READY', + NO_NETWORK = 'NO_NETWORK', + NO_SERVICE = 'NO_SERVICE', + } + + export enum VmType { + TERMINA = 'termina', + PLUGIN_VM = 'plugin_vm', + BOREALIS = 'borealis', + BRUSCHETTA = 'bruschetta', + ARCVM = 'arcvm', + } + + export interface IconSet { + icon16x16Url?: string; + icon32x32Url?: string; + } + + export interface DriveConnectionState { + type: chrome.fileManagerPrivate.DriveConnectionStateType; + reason?: chrome.fileManagerPrivate.DriveOfflineReason; + hasCellularNetworkAccess: boolean; + canPinHostedFiles: boolean; + } + } + } +}
diff --git a/ui/file_manager/file_manager/externs/volume_manager.js b/ui/file_manager/file_manager/externs/volume_manager.js index 3c320905..eccfd95 100644 --- a/ui/file_manager/file_manager/externs/volume_manager.js +++ b/ui/file_manager/file_manager/externs/volume_manager.js
@@ -135,7 +135,7 @@ * Searches the information of the volume that exists on the given device * path. * @param {string} devicePath Path of the device to search. - * @return {VolumeInfo} The volume's information, or null if not found. + * @return {?VolumeInfo} The volume's information, or null if not found. */ findByDevicePath(devicePath) {}
diff --git a/ui/file_manager/file_manager/foreground/elements/BUILD.gn b/ui/file_manager/file_manager/foreground/elements/BUILD.gn index ff8f8a1..00efd2a 100644 --- a/ui/file_manager/file_manager/foreground/elements/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/elements/BUILD.gn
@@ -27,6 +27,7 @@ js_type_check("closure_compile_jsmodules") { is_polymer3 = true closure_flags = default_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=gen/ui/file_manager/", "js_module_root=../../ui/file_manager/", ] @@ -242,6 +243,7 @@ closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "generate_exports=false", "js_module_root=./gen/ui", "js_module_root=../../ui",
diff --git a/ui/file_manager/file_manager/foreground/elements/files_tooltip.html b/ui/file_manager/file_manager/foreground/elements/files_tooltip.html index 6b2d996..feba0eb 100644 --- a/ui/file_manager/file_manager/foreground/elements/files_tooltip.html +++ b/ui/file_manager/file_manager/foreground/elements/files_tooltip.html
@@ -9,7 +9,6 @@ display: flex; height: 24px; opacity: 0; - pointer-events: none; position: absolute; transition: opacity 300ms; z-index: 1000; @@ -38,6 +37,11 @@ padding: 12px 16px; } + #label.link-label { + align-items: flex-start; + flex-direction: column; + } + #label.card-label { line-height: 18px; margin: 0;
diff --git a/ui/file_manager/file_manager/foreground/elements/files_tooltip.js b/ui/file_manager/file_manager/foreground/elements/files_tooltip.js index c17acabc..d288a80 100644 --- a/ui/file_manager/file_manager/foreground/elements/files_tooltip.js +++ b/ui/file_manager/file_manager/foreground/elements/files_tooltip.js
@@ -34,7 +34,7 @@ */ hideTimeout: { type: Number, - value: 250, // ms + value: 500, // ms readOnly: true, }, }, @@ -75,9 +75,13 @@ attached: function() { const closeTooltipHandler = this.onDocumentMouseDown_.bind(this); const cleanupTooltipHandler = this.onTransitionEnd_.bind(this); + const mouseoverHandler = this.onMouseOver_.bind(this, null); + const mouseoutHandler = this.onMouseOut_.bind(this, null); document.body.addEventListener('mousedown', closeTooltipHandler); this.addEventListener('transitionend', cleanupTooltipHandler); window.addEventListener('resize', closeTooltipHandler); + this.addEventListener('mouseover', mouseoverHandler); + this.addEventListener('mouseout', mouseoutHandler); }, /** @@ -140,6 +144,7 @@ // check if the label is different from the existing tooltip text, because // if label text changes, we need to show the tooltip. if (this.visibleTooltipTarget_ === target && + target.hasAttribute('aria-label') && this.$.label.textContent === target.getAttribute('aria-label')) { return; } @@ -191,11 +196,19 @@ const windowEdgePadding = 6; const label = target.getAttribute('aria-label'); + const showLinkTooltip = target.hasAttribute('show-link-tooltip'); if (!label) { return; } - this.$.label.textContent = label; + if (showLinkTooltip) { + // Use innerHTML since link tooltip contains a <a href> in the label. + this.$.label.innerHTML = label; + this.$.label.classList.add('link-label'); + } else { + this.$.label.textContent = label; + } + const invert = 'invert-tooltip'; this.$.label.toggleAttribute('invert', target.hasAttribute(invert)); @@ -216,7 +229,7 @@ if (useCardTooltip) { this.className = 'card-tooltip'; - this.$.label.className = 'card-label'; + this.$.label.classList.add('card-label'); // Push left to the body's left when tooltip is longer than viewport. if (this.offsetWidth > document.body.offsetWidth) { @@ -278,7 +291,8 @@ * @private */ onMouseOver_: function(target, event) { - this.initShowingTooltip_(target); + const actualTarget = target || this.visibleTooltipTarget_; + this.initShowingTooltip_(actualTarget); }, /** @@ -286,7 +300,8 @@ * @private */ onMouseOut_: function(target, event) { - this.initHidingTooltip_(target); + const actualTarget = target || this.visibleTooltipTarget_; + this.initHidingTooltip_(actualTarget); }, /**
diff --git a/ui/file_manager/file_manager/foreground/js/BUILD.gn b/ui/file_manager/file_manager/foreground/js/BUILD.gn index 59c6508..b9d7659 100644 --- a/ui/file_manager/file_manager/foreground/js/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/BUILD.gn
@@ -94,6 +94,7 @@ js_type_check("closure_compile_jsmodules") { is_polymer3 = true closure_flags = default_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=gen/ui/file_manager/tsc/", "js_module_root=gen/ui/file_manager/", "js_module_root=../../ui/file_manager/", @@ -1408,6 +1409,7 @@ ] closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "generate_exports=false", "js_module_root=gen/ui/file_manager/tsc/", "js_module_root=./gen/ui",
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js index 9e4b435..2c281dc 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
@@ -2016,6 +2016,59 @@ })(); /** + * Displays the Data Leak Prevention (DLP) Restriction details. + */ +CommandHandler.COMMANDS_['dlp-restriction-details'] = + new (class extends FilesCommand { + execute(event, fileManager) { + const entries = fileManager.getSelection().entries; + + const metadata = + fileManager.metadataModel.getCache(entries, ['sourceUrl']); + if (!metadata || metadata.length !== 1) { + return; + } + const sourceUrl = metadata[0].sourceUrl; + if (sourceUrl) { + try { + chrome.fileManagerPrivate.showDlpRestrictionDetails(sourceUrl); + } catch (error) { + console.warn('Error showing DlpRestrictionDetails ', error); + } + } + } + + /** @override */ + canExecute(event, fileManager) { + if (!util.isDlpEnabled()) { + event.canExecute = false; + event.command.setHidden(true); + return; + } + + const entries = fileManager.getSelection().entries; + + // Show this item only when one file is selected. + if (entries.length !== 1) { + event.canExecute = false; + event.command.setHidden(true); + return; + } + + const metadata = + fileManager.metadataModel.getCache(entries, ['isDlpRestricted']); + if (!metadata || metadata.length !== 1) { + event.canExecute = false; + event.command.setHidden(true); + } + + const isDlpRestricted = metadata[0].isDlpRestricted; + event.canExecute = isDlpRestricted; + event.command.setHidden(!isDlpRestricted); + } + })(); + +/** * Focuses search input box. */ CommandHandler.COMMANDS_['search'] = new (class extends FilesCommand {
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn b/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn index e0d31a96..1d1a5719 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/metadata/BUILD.gn
@@ -49,6 +49,7 @@ js_type_check("closure_compile_jsmodules") { closure_flags = default_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=gen/ui/file_manager/", "js_module_root=../../ui/file_manager/", "browser_resolver_prefix_replacements=\"chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/=./file_manager/\"", @@ -374,6 +375,7 @@ ] closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=./gen/ui", "js_module_root=../../ui/file_manager/", "js_module_root=./gen/ui/file_manager/",
diff --git a/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn b/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn index 3ea442a..57e7c9a 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn
@@ -413,6 +413,7 @@ "//ui/file_manager/file_manager/externs:files_app_entry_interfaces", "//ui/file_manager/file_manager/externs:volume_manager", "//ui/file_manager/file_manager/externs/background:import_history", + "//ui/file_manager/file_manager/foreground/elements:files_tooltip", "//ui/file_manager/file_manager/foreground/js:file_list_model", "//ui/file_manager/file_manager/foreground/js:list_thumbnail_loader", "//ui/file_manager/file_manager/foreground/js/metadata:metadata_model",
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_table.js b/ui/file_manager/file_manager/foreground/js/ui/file_table.js index b33466f..483af670 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_table.js +++ b/ui/file_manager/file_manager/foreground/js/ui/file_table.js
@@ -16,6 +16,7 @@ import {EntryLocation} from '../../../externs/entry_location.js'; import {FilesAppEntry} from '../../../externs/files_app_entry_interfaces.js'; import {VolumeManager} from '../../../externs/volume_manager.js'; +import {FilesTooltip} from '../../elements/files_tooltip.js'; import {FileListModel} from '../file_list_model.js'; import {ListThumbnailLoader} from '../list_thumbnail_loader.js'; import {MetadataModel} from '../metadata/metadata_model.js'; @@ -1149,11 +1150,20 @@ const nameId = item.id + '-entry-name'; const sizeId = item.id + '-size'; const dateId = item.id + '-date'; + const dlpId = item.id + '-dlp-managed-icon'; filelist.decorateListItem(item, entry, assert(this.metadataModel_)); item.setAttribute('file-name', entry.name); item.querySelector('.detail-name').setAttribute('id', nameId); item.querySelector('.size').setAttribute('id', sizeId); item.querySelector('.date').setAttribute('id', dateId); + const dlpManagedIcon = item.querySelector('.dlp-managed-icon'); + if (dlpManagedIcon) { + dlpManagedIcon.setAttribute('id', dlpId); + /** @type {!FilesTooltip} */ ( + this.ownerDocument.querySelector('files-tooltip')) + .addTargets(item.querySelectorAll('.dlp-managed-icon')); + } + item.setAttribute('aria-labelledby', nameId); return item; } @@ -1235,6 +1245,14 @@ const icon = /** @type {!HTMLDivElement} */ (this.ownerDocument.createElement('div')); icon.className = 'dlp-managed-icon'; + icon.toggleAttribute('has-tooltip'); + icon.setAttribute( + 'aria-label', + strf( + 'DLP_MANAGED_ICON_TOOLTIP', + 'https://support.google.com/chrome/a/?p=chromeos_datacontrols')); + icon.toggleAttribute('show-link-tooltip'); + icon.toggleAttribute('show-card-tooltip'); return icon; }
diff --git a/ui/file_manager/file_manager/lib/base_store.ts b/ui/file_manager/file_manager/lib/base_store.ts index c432937..bc5221b 100644 --- a/ui/file_manager/file_manager/lib/base_store.ts +++ b/ui/file_manager/file_manager/lib/base_store.ts
@@ -89,8 +89,7 @@ * @param observer Callback called whenever the Store is updated. * @returns callback to unsusbscribe the observer. */ - subscribe(observer: StoreObserver<StateType>): - (observer: StoreObserver<StateType>) => void { + subscribe(observer: StoreObserver<StateType>): () => void { this.observers_.push(observer); return this.unsubscribe.bind(this, observer); } @@ -122,6 +121,11 @@ this.notifyObservers_(this.data_); } + /** @returns the current state of the store. */ + getState(): StateType { + return this.data_; + } + /** * TODO(lucmult): Update this doc. * @@ -172,8 +176,14 @@ /** Notify observers with the current state. */ private notifyObservers_(state: StateType) { - // TODO(lucmult): Should we try/catch each observer, so an error in observer - // doesn't stop other parts from rendering. - this.observers_.forEach(o => o.onStateChanged(state)); + this.observers_.forEach(o => { + try { + o.onStateChanged(state); + } catch (error) { + // Subscribers shouldn't fail, here we only log and continue to all + // other subscribers. + console.error(error); + } + }); } }
diff --git a/ui/file_manager/file_manager/lib/base_store_unittest.ts b/ui/file_manager/file_manager/lib/base_store_unittest.ts new file mode 100644 index 0000000..3fcbc36 --- /dev/null +++ b/ui/file_manager/file_manager/lib/base_store_unittest.ts
@@ -0,0 +1,225 @@ +// Copyright 2022 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. + +import {assertEquals} from 'chrome://webui-test/chai_assert.js'; + +import {BaseAction, BaseStore} from './base_store.js'; + +/** Store state used across all unittests in this file. */ +interface TestState { + // Just an incremental counter. + numVisitors?: number; + + // The latest string sent in the Action. + latestPayload?: string; +} + +/** Test action used across all unittests in this file. */ +interface TestAction extends BaseAction { + payload?: string; +} + +type TestStore = BaseStore<TestState, any>; + +/** Returns the current numVisitors from the Store. */ +function getNumVisitors(store: TestStore): number|undefined { + return store.getState().numVisitors; +} + +/** Counts how many times `onStateChanged()` was called. */ +class TestSubscriber { + calledCounter: number = 0; + + onStateChanged(_state: TestState) { + this.calledCounter += 1; + } +} + +/** + * Creates new Storee, subscriber and dispatchedActions. + * These can be called multiple times for each test, which create new + * independent instances of those. + */ +function setupStore() { + // All actions dispatched via the store and processed by the reducer. + const dispatchedActions = Array<TestAction>(0); + + /** Test reducer. It's the root and only reducer in these tests. */ + function testReducer(state: TestState, action: TestAction): TestState { + dispatchedActions.push(action); + return { + numVisitors: (state.numVisitors || 0) + 1, + latestPayload: action.payload, + }; + } + + const store = new BaseStore({}, testReducer); + const subscriber = new TestSubscriber(); + + return { + store, + subscriber, + dispatchedActions, + }; +} + +/** + * Checks that the subscribers receive the initial state when the store is + * initialized. + */ +export function testStoreInitEmptyState() { + const {store, subscriber} = setupStore(); + store.subscribe(subscriber); + // It starts un-initialized. + assertEquals(false, store.isInitialized(), 'shouldnt be initialized yet'); + store.init({numVisitors: 2}); + + assertEquals(true, store.isInitialized(), 'initialized'); + assertEquals(2, getNumVisitors(store), 'numVisitors should be 2'); + assertEquals(1, subscriber.calledCounter, 'subscriber only called once'); +} + +/** + * Checks that the subscribers are only called after the store has been + * initialized. + */ +export function testStoreInitBatched() { + const {store, subscriber} = setupStore(); + store.subscribe(subscriber); + + // It starts un-initialized. + assertEquals(false, store.isInitialized(), 'shouldnt be initialized yet'); + + // Nothing happened yet, so counter is still null. + assertEquals(undefined, getNumVisitors(store), 'should start undefined'); + assertEquals(0, subscriber.calledCounter, 'no subscriber called yet'); + + // The action here doesn't matter, since the reducer always increment by 1. + store.dispatch({type: 'test'}); + store.dispatch({type: 'test'}); + + // Since the Store is still un-initialized, the subscriber isn't called. + assertEquals(undefined, getNumVisitors(store), 'should still be undefined'); + assertEquals(0, subscriber.calledCounter, 'no subscriber called yet'); + + store.init({numVisitors: 2}); + + assertEquals(true, store.isInitialized(), 'initialized'); + assertEquals(4, getNumVisitors(store), 'numVisitors should be init+2 calls'); + assertEquals( + 1, subscriber.calledCounter, + 'subscriber should be called only once for both actions'); +} + +/** + * Checks that the store can be updated in batch mode. As in, multiple calls to + * dispatch() is only propagated to the subscribers at the end of the batch. + */ +export function testBatchDispatch() { + const {store, subscriber} = setupStore(); + store.subscribe(subscriber); + + store.init({numVisitors: 2}); + store.beginBatchUpdate(); + + // The action here doesn't matter, since the reducer always increment by 1. + store.dispatch({type: 'test'}); + store.dispatch({type: 'test'}); + store.dispatch({type: 'test'}); + + // The subscriber isn't called for the 3 dispatches. + assertEquals( + 1, subscriber.calledCounter, 'subscriber only called once from init()'); + + // However the State in the Store is updated. + assertEquals(5, getNumVisitors(store), 'should increment to 5'); + + store.endBatchUpdate(); + assertEquals(5, getNumVisitors(store), 'numVisitors should be init+3 calls'); + assertEquals( + 2, subscriber.calledCounter, + 'subscriber should be called only once more for all actions'); +} + +/** + * Checks that the reducer is called for every action. + */ +export function testDispatch() { + const {store, subscriber, dispatchedActions} = setupStore(); + assertEquals(0, dispatchedActions.length, 'starts with 0 actions'); + store.subscribe(subscriber); + + // Add some actions before the init(). + store.dispatch({type: 'test', payload: 'msg 1'}); + store.dispatch({type: 'test', payload: 'msg 2'}); + + // Dispatches don't happen before the init(). + assertEquals(0, dispatchedActions.length, '0 before the init'); + + store.init({numVisitors: 2}); + + // Both actions are processed after the init. + assertEquals( + 2, dispatchedActions.length, + 'all queued actions are processed after the init()'); + // In the same order. + assertEquals( + 'msg 1, msg 2', dispatchedActions.map(a => a.payload!).join(', ')); + + store.dispatch({type: 'test', payload: 'msg 3'}); + + // Both actions are processed after the init. + assertEquals( + 3, dispatchedActions.length, + 'Actions after init() are processed directly'); + assertEquals( + 'msg 1, msg 2, msg 3', dispatchedActions.map(a => a.payload!).join(', ')); +} + +/** Checks that subscriber can unsubscribe and stops receiving updates. */ +export function testObserverUnsubscribe() { + const {store, subscriber} = setupStore(); + const unsubscribe = store.subscribe(subscriber); + store.init({numVisitors: 2}); + + assertEquals(1, subscriber.calledCounter, 'subscriber called by init()'); + + store.dispatch({type: 'test', payload: 'msg 1'}); + assertEquals(2, subscriber.calledCounter, 'subscriber called by dispatch()'); + + unsubscribe(); + store.dispatch({type: 'test', payload: 'msg 2'}); + assertEquals(2, subscriber.calledCounter, 'subscriber not called anymore'); +} + +/** + * Checks that an exception in one subscriber doesn't stop pushing to other + * subscribers. + */ +export function testObserverException() { + const {store, subscriber: successSubscriber} = setupStore(); + store.init({numVisitors: 2}); + + // NOTE: Subscribers are called in the order of subscription. + // So adding the failing subscriber first. + let errorCounter = 0; + store.subscribe({ + onStateChanged(_state: TestState) { + errorCounter += 1; + throw new Error('always fail subscriber'); + }, + }); + // Add the successful subscriber. + store.subscribe(successSubscriber); + + assertEquals( + 0, successSubscriber.calledCounter, 'successSubscriber not called yet'); + assertEquals(0, errorCounter, 'errorSubscriber not called yet'); + + store.dispatch({type: 'test', payload: 'msg 1'}); + assertEquals( + 1, successSubscriber.calledCounter, + 'successSubscriber called by dispatch()'); + assertEquals(1, errorCounter, 'errorSubscriber called by dispatch()'); +}
diff --git a/ui/file_manager/file_manager/main.html b/ui/file_manager/file_manager/main.html index 685961e..c260b59 100644 --- a/ui/file_manager/file_manager/main.html +++ b/ui/file_manager/file_manager/main.html
@@ -56,6 +56,7 @@ label="$i18n{PASTE_INTO_FOLDER_BUTTON_LABEL}"> <command id="get-info" label="$i18n{GET_INFO_BUTTON_LABEL}" shortcut="Space"> + <command id="dlp-restriction-details" label="$i18n{DLP_RESTRICTION_DETAILS}"> <command id="rename" label="$i18n{RENAME_BUTTON_LABEL}" shortcut="Enter|Ctrl"> <command id="move-to-trash" shortcut="Backspace|Alt Delete" label="$i18n{MOVE_TO_TRASH_BUTTON_LABEL}"> @@ -189,6 +190,7 @@ <cr-menu-item command="#paste-into-folder" visibleif="full-page"></cr-menu-item> <hr visibleif="full-page"> <cr-menu-item command="#get-info"></cr-menu-item> + <cr-menu-item command="#dlp-restriction-details"></cr-menu-item> <cr-menu-item command="#rename"></cr-menu-item> <cr-menu-item command="#pin-folder"></cr-menu-item> <cr-menu-item command="#move-to-trash"></cr-menu-item>
diff --git a/ui/file_manager/file_manager/state/actions.ts b/ui/file_manager/file_manager/state/actions.ts index 575ffc1..80625ea 100644 --- a/ui/file_manager/file_manager/state/actions.ts +++ b/ui/file_manager/file_manager/state/actions.ts
@@ -19,6 +19,7 @@ /** Enum to identify every Action in Files app. */ export const enum Actions { CHANGE_DIRECTORY = 'change-directory', + CLEAR_STALE_CACHED_ENTRIES = 'clear-stale-cached-entries', } /** Action to request to change the Current Directory. */
diff --git a/ui/file_manager/file_manager/state/reducers/all_entries.ts b/ui/file_manager/file_manager/state/reducers/all_entries.ts index dc521dae..63edabd 100644 --- a/ui/file_manager/file_manager/state/reducers/all_entries.ts +++ b/ui/file_manager/file_manager/state/reducers/all_entries.ts
@@ -5,7 +5,60 @@ import {FilesAppEntry} from '../../externs/files_app_entry_interfaces.js'; import {State} from '../../externs/ts/state.js'; import {Action, Actions, ChangeDirectoryAction} from '../actions.js'; +import {getStore} from '../store.js'; +/** + * Schedules the routine to remove stale entries from `allEntries`. + */ +function scheduleClearCachedEntries() { + if (clearCachedEntriesRequestId === 0) { + clearCachedEntriesRequestId = requestIdleCallback(startClearCache); + } +} + +/** ID for the current scheduled `clearCachedEntries`. */ +let clearCachedEntriesRequestId = 0; + +/** Starts the action CLEAR_STALE_CACHED_ENTRIES. */ +function startClearCache() { + const store = getStore(); + store.dispatch({type: Actions.CLEAR_STALE_CACHED_ENTRIES}); + clearCachedEntriesRequestId = 0; +} + +/** + * Scans the current state for entries still in use to be able to remove the + * stale entries from the `allEntries`. + */ +export function clearCachedEntries(state: State, _action: Action): State { + const entries = state.allEntries; + const currentDirectoryKey = + state.currentDirectory ? state.currentDirectory.key : null; + const entriesToKeep = new Set<string>(); + + if (currentDirectoryKey) { + entriesToKeep.add(currentDirectoryKey); + + for (const component of state.currentDirectory!.pathComponents) { + entriesToKeep.add(component.key); + } + } + + for (const key of Object.keys(entries)) { + if (entriesToKeep.has(key)) { + continue; + } + + delete entries[key]; + } + + return state; +} + +/** + * @param action Action being currently processed. + * @returns The entry instance from the allEntries, if it exists in the cache. + */ function getEntry(state: State, action: ChangeDirectoryAction): Entry| FilesAppEntry|null { const {newDirectory, key} = action; @@ -22,6 +75,9 @@ /** Caches the Action's entry in the `allEntries` attribute. */ export function cacheEntries(currentState: State, action: Action): State { + // Schedule to clear the cached entries from the state. + scheduleClearCachedEntries(); + if (action.type === Actions.CHANGE_DIRECTORY) { const {key} = (action as ChangeDirectoryAction); const allEntries = currentState.allEntries || {};
diff --git a/ui/file_manager/file_manager/state/reducers/all_entries_unittest.ts b/ui/file_manager/file_manager/state/reducers/all_entries_unittest.ts new file mode 100644 index 0000000..1e535e6 --- /dev/null +++ b/ui/file_manager/file_manager/state/reducers/all_entries_unittest.ts
@@ -0,0 +1,98 @@ +// Copyright 2022 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. + +import {assertDeepEquals, assertEquals} from 'chrome://webui-test/chai_assert.js'; + +import {MockVolumeManager} from '../../background/js/mock_volume_manager.js'; +import {MockFileSystem} from '../../common/js/mock_entry.js'; +import {waitUntil} from '../../common/js/test_error_reporting.js'; +import {Actions, changeDirectory} from '../actions.js'; +import {getStore, Store} from '../store.js'; + +import {clearCachedEntries} from './all_entries.js'; + +let store: Store; +let fileSystem: MockFileSystem; + +export function setUp() { + store = getStore(); + + // changeDirectory() reducer uses the VolumeManager. + const volumeManager = new MockVolumeManager(); + window.fileManager = { + volumeManager: volumeManager, + }; + + store.init({ + allEntries: {}, + currentDirectory: undefined, + }); + + fileSystem = volumeManager.getCurrentProfileVolumeInfo( + 'downloads')!.fileSystem as MockFileSystem; + fileSystem.populate([ + '/dir-1/', + '/dir-2/sub-dir/', + '/dir-3/', + ]); +} + +function allEntriesSize(): number { + return Object.keys(store.getState().allEntries).length; +} + +function cd(directory: DirectoryEntry) { + store.dispatch(changeDirectory({to: directory, toKey: directory.toURL()})); +} + +/** Tests that entries get cached in the allEntries. */ +export function testAllEntries() { + assertEquals(0, allEntriesSize(), 'allEntries should start empty'); + + const dir1 = fileSystem.entries['/dir-1']; + const dir2 = fileSystem.entries['/dir-2']; + const dir2SubDir = fileSystem.entries['/dir-2/sub-dir']; + cd(dir1); + assertEquals(1, allEntriesSize(), 'dir-1 should be cached'); + + cd(dir2); + assertEquals(2, allEntriesSize(), 'dir-2 should be cached'); + + cd(dir2SubDir); + assertEquals(3, allEntriesSize(), 'dir-2/sub-dir/ should be cached'); +} + +export async function testClearStaleEntries(done: () => void) { + const dir1 = fileSystem.entries['/dir-1']; + const dir2 = fileSystem.entries['/dir-2']; + const dir3 = fileSystem.entries['/dir-3']; + const dir2SubDir = fileSystem.entries['/dir-2/sub-dir']; + + cd(dir1); + cd(dir2); + cd(dir3); + cd(dir2SubDir); + + assertEquals(4, allEntriesSize(), 'all entries should be cached'); + + // Wait for the async clear to be called. + await waitUntil(() => allEntriesSize() < 4); + + // It should keep the current directory and all its parents that were + // previously cached. + assertEquals( + 2, allEntriesSize(), 'only dir-2 and dir-2/sub-dir should be cached'); + assertDeepEquals( + Object.keys(store.getState().allEntries).sort(), + ['filesystem:downloads/dir-2', 'filesystem:downloads/dir-2/sub-dir']); + + // Running the clear multiple times should not change: + const action = {type: Actions.CLEAR_STALE_CACHED_ENTRIES}; + clearCachedEntries(store.getState(), action); + clearCachedEntries(store.getState(), action); + assertEquals( + 2, allEntriesSize(), 'only dir-2 and dir-2/sub-dir should be cached'); + + done(); +}
diff --git a/ui/file_manager/file_manager/state/reducers/current_directory.ts b/ui/file_manager/file_manager/state/reducers/current_directory.ts index 73b3289e..82c8553 100644 --- a/ui/file_manager/file_manager/state/reducers/current_directory.ts +++ b/ui/file_manager/file_manager/state/reducers/current_directory.ts
@@ -8,22 +8,27 @@ /** Reducer that updates the `currentDirectory` attributes. */ export function changeDirectory( - currentState: State, action: ChangeDirectoryAction): CurrentDirectory|null { + currentState: State, action: ChangeDirectoryAction): CurrentDirectory { const fileData = currentState.allEntries[action.key]; + const emptyDir = { + key: action.key, + status: action.status, + pathComponents: [], + }; + if (!fileData) { - // The new directory might not be in the allEntries yet. - return { - key: action.key, - status: action.status, - pathComponents: [], - }; + // The new directory might not be in the allEntries yet, this might happen + // when starting to change the directory for a entry that isn't cached. + // At the end of the change directory, DirectoryContents will send an Action + // with the Entry to be cached. + return emptyDir; } // TODO(lucmult): Find a correct way to grab the VolumeManager. const volumeManager = window.fileManager.volumeManager; if (!volumeManager) { console.debug(`VolumeManager not available yet.`); - return currentState.currentDirectory || null; + return currentState.currentDirectory || emptyDir; } const components =
diff --git a/ui/file_manager/file_manager/state/reducers/root.ts b/ui/file_manager/file_manager/state/reducers/root.ts index 29fad96..5bb428c 100644 --- a/ui/file_manager/file_manager/state/reducers/root.ts +++ b/ui/file_manager/file_manager/state/reducers/root.ts
@@ -5,7 +5,7 @@ import {State} from '../../externs/ts/state.js'; import {Action, Actions, ChangeDirectoryAction} from '../actions.js'; -import {cacheEntries} from './all_entries.js'; +import {cacheEntries, clearCachedEntries} from './all_entries.js'; import {changeDirectory} from './current_directory.js'; /** @@ -24,6 +24,9 @@ changeDirectory(state, action as ChangeDirectoryAction), }); + case Actions.CLEAR_STALE_CACHED_ENTRIES: + return clearCachedEntries(state, action); + default: console.error(`invalid action: ${action.type}`); return state;
diff --git a/ui/file_manager/file_names.gni b/ui/file_manager/file_names.gni index 0f92576..fb5dfbf 100644 --- a/ui/file_manager/file_names.gni +++ b/ui/file_manager/file_names.gni
@@ -269,7 +269,16 @@ # HTML template files that are used to generate the ".html.ts" ts_templates = [ "file_manager/widgets/xf_breadcrumb.html" ] -ts_test_files = [ "file_manager/widgets/xf_breadcrumb_unittest.ts" ] +ts_test_files = [ + # Lib: + "file_manager/lib/base_store_unittest.ts", + + # Reducers: + "file_manager/state/reducers/all_entries_unittest.ts", + + # Widgets: + "file_manager/widgets/xf_breadcrumb_unittest.ts", +] ts_generated_templates = [] foreach(_t, ts_templates) { @@ -326,6 +335,7 @@ # Test files: unittest_files = [ + # Common: "file_manager/common/js/async_util_unittest.js", "file_manager/common/js/util_unittest.js", "file_manager/common/js/filtered_volume_manager_unittest.js", @@ -336,6 +346,8 @@ "file_manager/common/js/recent_date_bucket_unittest.js", "file_manager/common/js/storage_adapter_unittest.js", "file_manager/common/js/volume_manager_types_unittest.js", + + # Background: "file_manager/background/js/mount_metrics_unittest.js", "file_manager/background/js/drive_sync_handler_unittest.js", "file_manager/background/js/media_import_handler_unittest.js", @@ -350,6 +362,8 @@ "file_manager/background/js/metadata_proxy_unittest.js", "file_manager/background/js/crostini_unittest.js", "file_manager/background/js/device_handler_unittest.js", + + # Foreground: "file_manager/foreground/elements/files_password_dialog_unittest.js", "file_manager/foreground/elements/files_xf_elements_unittest.js", "file_manager/foreground/elements/files_toast_unittest.js", @@ -398,6 +412,8 @@ "file_manager/foreground/js/file_tasks_unittest.js", "file_manager/foreground/js/file_transfer_controller_unittest.js", "file_manager/foreground/js/import_controller_unittest.js", + + # Image Loader: "image_loader/scheduler_unittest.js", "image_loader/image_loader_unittest.js", "image_loader/cache_unittest.js",
diff --git a/ui/file_manager/integration_tests/BUILD.gn b/ui/file_manager/integration_tests/BUILD.gn index 28ae6ac..a10edea 100644 --- a/ui/file_manager/integration_tests/BUILD.gn +++ b/ui/file_manager/integration_tests/BUILD.gn
@@ -19,6 +19,7 @@ ] closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=./gen/ui", "js_module_root=../../ui", "browser_resolver_prefix_replacements=\"chrome://webui-test/=./\"",
diff --git a/ui/file_manager/integration_tests/file_manager/BUILD.gn b/ui/file_manager/integration_tests/file_manager/BUILD.gn index bf096a6..b3060fc 100644 --- a/ui/file_manager/integration_tests/file_manager/BUILD.gn +++ b/ui/file_manager/integration_tests/file_manager/BUILD.gn
@@ -59,6 +59,7 @@ closure_flags = strict_error_checking_closure_args + [ + "language_in=ECMASCRIPT_2020", "js_module_root=gen/ui/file_manager/", "js_module_root=../../ui/file_manager/", "browser_resolver_prefix_replacements=\"chrome://webui-test/=./\"",
diff --git a/ui/file_manager/integration_tests/file_manager/context_menu.js b/ui/file_manager/integration_tests/file_manager/context_menu.js index 33dc0d4..d4108bd 100644 --- a/ui/file_manager/integration_tests/file_manager/context_menu.js +++ b/ui/file_manager/integration_tests/file_manager/context_menu.js
@@ -68,9 +68,13 @@ * @param {string} commandId ID of the command in the context menu to check. * @param {string} path Path to the file to open the context menu for. * @param {boolean} expectedEnabledState True if the command should be enabled - * in the context menu, false if not. + * in the context menu, false if not. Only checked if the command isn't + * hidden. + * @param {boolean} expectedHiddenState True if the command should be hidden + * in the context menu, false if not. Defaults to false. */ -async function checkContextMenu(commandId, path, expectedEnabledState) { +async function checkContextMenu( + commandId, path, expectedEnabledState, expectedHiddenState = false) { // Open Files App on Drive. const appId = await setupAndWaitUntilReady(RootPath.DRIVE, [], COMPLEX_DRIVE_ENTRY_SET); @@ -93,11 +97,16 @@ // Wait for the command option to appear. let query = '#file-context-menu:not([hidden])'; - if (expectedEnabledState) { - query += ` [command="#${commandId}"]:not([hidden]):not([disabled])`; + if (expectedHiddenState) { + query += ` [command="#${commandId}"][hidden]`; } else { - query += ` [command="#${commandId}"][disabled]:not([hidden])`; + if (expectedEnabledState) { + query += ` [command="#${commandId}"]:not([hidden]):not([disabled])`; + } else { + query += ` [command="#${commandId}"][disabled]:not([hidden])`; + } } + await remoteCall.waitForElement(appId, query); } @@ -260,6 +269,15 @@ }; /** + * Tests that the Restriction details menu item is hidden if DLP is disabled. + */ +testcase.checkDlpRestrictionDetailsDisabledForNonDlpFiles = () => { + return checkContextMenu( + 'dlp-restriction-details', 'hello.txt', /*expectedEnabledState=*/ false, + /*expectedHiddenState=*/ true); +}; + +/** * Tests that the Cut menu item is disabled if a read-only folder is * selected. */
diff --git a/ui/file_manager/integration_tests/file_manager/create_new_folder.js b/ui/file_manager/integration_tests/file_manager/create_new_folder.js index 5b3f27e..2ec73b2 100644 --- a/ui/file_manager/integration_tests/file_manager/create_new_folder.js +++ b/ui/file_manager/integration_tests/file_manager/create_new_folder.js
@@ -63,13 +63,14 @@ chrome.test.assertTrue( await remoteCall.callRemoteTestUtil('fakeKeyDown', appId, key)); + let newFolderName = 'New folder'; // Check: a new folder should be shown in the file list. - let files = [['New folder', '--', 'Folder', '']].concat( + let files = [[newFolderName, '--', 'Folder', '']].concat( TestEntryInfo.getExpectedRows(initialEntrySet)); // Check: a new folder should be present in the directory tree. const newSubtreeChildItem = - selector + ' .tree-children .tree-item[entry-label="New folder"]'; + `${selector} .tree-children .tree-item[entry-label="${newFolderName}"]`; await remoteCall.waitForElement(appId, newSubtreeChildItem); // Check: the text input should be shown in the file list. @@ -82,7 +83,7 @@ // Check: the new folder only should be 'renaming'. chrome.test.assertEq(1, elements.length); - chrome.test.assertEq(0, elements[0].text.indexOf('New folder--')); + chrome.test.assertEq(0, elements[0].text.indexOf(`${newFolderName}--`)); chrome.test.assertTrue('selected' in elements[0].attributes); // Get all file list rows that have attribute 'selected'. @@ -92,11 +93,12 @@ // Check: the new folder only should be 'selected'. chrome.test.assertEq(1, elements.length); - chrome.test.assertEq(0, elements[0].text.indexOf('New folder--')); + chrome.test.assertEq(0, elements[0].text.indexOf(`${newFolderName}--`)); chrome.test.assertTrue('renaming' in elements[0].attributes); // Type the test folder name. - await remoteCall.inputText(appId, textInput, 'Test Folder Name'); + newFolderName = 'Test Folder Name'; + await remoteCall.inputText(appId, textInput, newFolderName); // Press the Enter key. key = [textInput, 'Enter', false, false, false]; @@ -108,23 +110,17 @@ await remoteCall.waitForElementLost(appId, renamingItem); // Check: the test folder should be shown in the file list. - files = [['Test Folder Name', '--', 'Folder', '']].concat( + files = [[newFolderName, '--', 'Folder', '']].concat( TestEntryInfo.getExpectedRows(initialEntrySet)); // Check: the test folder should be present in the directory tree. const testSubtreeChildItem = - selector + ' .tree-children .tree-item[entry-label="Test Folder Name"]'; + `${selector} .tree-children .tree-item[entry-label="${newFolderName}"]`; await remoteCall.waitForElement(appId, testSubtreeChildItem); - // Get all file list rows that have attribute 'selected'. - elements = await remoteCall.callRemoteTestUtil( - 'queryAllElements', appId, selectedFileListRows); - - // Check: the test folder only should be 'selected'. - chrome.test.assertEq(1, elements.length); - chrome.test.assertEq( - 0, elements[0].text.indexOf('Test Folder Name--'), - 'Actual text was: ' + elements[0].text); + // Wait for the new folder to become selected in the file list. + await remoteCall.waitForElement( + appId, [`#file-list .table-row[file-name="${newFolderName}"][selected]`]); } testcase.selectCreateFolderDownloads = async () => {
diff --git a/ui/file_manager/integration_tests/file_manager/dlp.js b/ui/file_manager/integration_tests/file_manager/dlp.js index 0f59b21..4066e96f 100644 --- a/ui/file_manager/integration_tests/file_manager/dlp.js +++ b/ui/file_manager/integration_tests/file_manager/dlp.js
@@ -48,17 +48,65 @@ /** * Tests that if the file is restricted by DLP, a managed icon is shown in the - * detail list . + * detail list and a tooltip is displayed when hovering over that icon. */ testcase.dlpShowManagedIcon = async () => { // Setup the restrictions. await sendTestMessage({name: 'setIsRestrictedByAnyRuleRestrictions'}); + // Open Files app. const appId = await setupAndWaitUntilReady( RootPath.DOWNLOADS, BASIC_LOCAL_ENTRY_SET, []); + const dlpManagedIcon = '#file-list .dlp-managed-icon'; // Check: only three of the five files should have the 'dlp-managed-icon' // class, which means that the icon is displayed. + await remoteCall.waitForElementsCount(appId, [dlpManagedIcon], 3); + + // Hover over an icon: a tooltip should appear. + chrome.test.assertTrue(await remoteCall.callRemoteTestUtil( + 'fakeMouseOver', appId, [dlpManagedIcon])); + + // Check: the DLP managed icon tooltip should be visible. The full text + // contains a placeholder for the link so here we only check the first part. + const labelTextPrefix = 'This file is confidential and subject ' + + 'to restrictions by administrator policy.'; + const label = await remoteCall.waitForElement( + appId, ['files-tooltip[visible=true]', '#label']); + chrome.test.assertTrue(label.text.startsWith(labelTextPrefix)); +}; + +/** + * Tests that if the file is restricted by DLP, the Restriction details context + * menu item appears and is enabled. + */ +testcase.dlpContextMenuRestrictionDetails = async () => { + // Setup the restrictions. + await sendTestMessage({name: 'setIsRestrictedByAnyRuleBlocked'}); + + const entry = ENTRIES.hello; + + // Open Files app. + const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS, [entry], []); + + // Wait for the DLP managed icon to be shown - this also means metadata has + // been cached and can be used to show the context menu command. await remoteCall.waitForElementsCount( - appId, ['#file-list .dlp-managed-icon'], 3); + appId, ['#file-list .dlp-managed-icon'], 1); + + // Select the file. + await remoteCall.waitUntilSelected(appId, entry.nameText); + + // Right-click on the file. + await remoteCall.waitAndRightClick(appId, ['.table-row[selected]']); + + // Wait for the context menu to appear. + await remoteCall.waitForElement(appId, '#file-context-menu:not([hidden])'); + + // Wait for the context menu command option to appear. + await remoteCall.waitForElement( + appId, + '#file-context-menu:not([hidden])' + + ' [command="#dlp-restriction-details"]' + + ':not([hidden]):not([disabled])'); };
diff --git a/ui/file_manager/integration_tests/file_manager/files_tooltip.js b/ui/file_manager/integration_tests/file_manager/files_tooltip.js index 76f92c7..19ab957 100644 --- a/ui/file_manager/integration_tests/file_manager/files_tooltip.js +++ b/ui/file_manager/integration_tests/file_manager/files_tooltip.js
@@ -7,6 +7,7 @@ import {remoteCall, setupAndWaitUntilReady} from './background.js'; +const tooltipQuery = 'files-tooltip'; const tooltipQueryHidden = 'files-tooltip:not([visible])'; const tooltipQueryVisible = 'files-tooltip[visible=true]'; const searchButton = '#search-button[has-tooltip]'; @@ -189,6 +190,43 @@ }; /** + * Tests that tooltips stay open when hovering over the tooltip. + */ +testcase.filesTooltipMouseOverStaysOpen = async () => { + const appId = + await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.beautiful], []); + + // Check: initially the tooltip should be hidden. + await remoteCall.waitForElement(appId, tooltipQueryHidden); + + // Mouse hover over a button that has a tooltip: the search button. + chrome.test.assertTrue(await remoteCall.callRemoteTestUtil( + 'fakeMouseOver', appId, [searchButton])); + + // Check: the search button tooltip should be visible. + const expectedLabelText = await getExpectedLabelText('SEARCH_TEXT_LABEL'); + const firstElement = + await remoteCall.waitForElement(appId, [tooltipQueryVisible, '#label']); + chrome.test.assertEq(expectedLabelText, firstElement.text); + + // Move the mouse away from the search button, but on the tooltip. + chrome.test.assertTrue(await remoteCall.callRemoteTestUtil( + 'fakeMouseOut', appId, [searchButton])); + chrome.test.assertTrue(await remoteCall.callRemoteTestUtil( + 'fakeMouseOver', appId, [tooltipQuery])); + + // Check: the tooltip should still be visible. + await remoteCall.waitForElement(appId, tooltipQueryVisible); + + // Move the mouse away from the tooltip. + chrome.test.assertTrue(await remoteCall.callRemoteTestUtil( + 'fakeMouseOut', appId, [tooltipQuery])); + + // Check: the tooltip should hide. + await remoteCall.waitForElement(appId, tooltipQueryHidden); +}; + +/** * Tests that tooltip is hidden when clicking on body (or anything else). */ testcase.filesTooltipClickHides = async () => {
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn index 6655b0d2..a32cc34 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn
@@ -894,11 +894,10 @@ } if (is_fuchsia) { - # TODO(https://crbug.com/1287051): fuchsia.sys.Launcher is used to launch - # fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx with specific test - # args. - use_cfv2 = false - deps += [ "//skia:test_fonts" ] + use_cfv1 = false + deps += [ "//skia:test_fonts_cfv2" ] + additional_manifest_fragments = + [ "//build/config/fuchsia/test/test_fonts.shard.test-cml" ] } }
diff --git a/ui/views/accessibility/accessibility_paint_checks.cc b/ui/views/accessibility/accessibility_paint_checks.cc index 190a080c..dba0008 100644 --- a/ui/views/accessibility/accessibility_paint_checks.cc +++ b/ui/views/accessibility/accessibility_paint_checks.cc
@@ -51,6 +51,17 @@ << GetViewDebugInfo(view); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) + // ViewAccessibility::GetAccessibleNodeData currently returns early, after + // setting the role to kUnknown, the NameFrom to kAttributeExplicitlyEmpty, + // and adding the kDisabled restriction, if the Widget is closed. + if (node_data.GetRestriction() != ax::mojom::Restriction::kDisabled) { + // Focusable views should have a valid role. + DCHECK(node_data.role != ax::mojom::Role::kNone && + node_data.role != ax::mojom::Role::kUnknown) + << "View is focusable but lacks a valid role.\n" + << GetViewDebugInfo(view); + } + // Focusable nodes must have an accessible name, otherwise screen reader users // will not know what they landed on. For example, the reload button should // have an accessible name of "Reload". @@ -74,7 +85,9 @@ DCHECK_EQ(node_data.GetNameFrom(), ax::mojom::NameFrom::kAttributeExplicitlyEmpty) << "View is focusable but has no accessible name or placeholder, and is " - "not explicitly marked as empty.\n" + "not explicitly marked as empty. The accessible name is spoken by " + "screen readers to end users. Thus if this is production code, the " + "accessible name should be localized.\n" << GetViewDebugInfo(view); }
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index 3e49d8a..e4f8abde 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc
@@ -1742,6 +1742,8 @@ class ContentsView : public View { void GetAccessibleNodeData(ui::AXNodeData* node_data) override { node_data->SetNameExplicitlyEmpty(); + // Focusable Views need a valid role. + node_data->role = ax::mojom::Role::kDialog; } };
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index d7f4815..cba9074 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -169,7 +169,6 @@ "cr_elements/cr_container_shadow_behavior.m.d.ts", "cr_elements/cr_dialog/cr_dialog.m.d.ts", "cr_elements/cr_expand_button/cr_expand_button.m.d.ts", - "cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.d.ts", "cr_elements/cr_icon_button/cr_icon_button.m.d.ts", "cr_elements/cr_input/cr_input.m.d.ts", "cr_elements/cr_lottie/cr_lottie.m.d.ts", @@ -267,7 +266,6 @@ if (include_polymer) { generate_definitions_js_files += [ "cr_elements/action_link_css.m.js", - "cr_elements/cr_fingerprint/cr_fingerprint_icon.js", "cr_elements/cr_actionable_row_style.m.js", "cr_elements/cr_icons_css.m.js", "cr_elements/cr_input/cr_input_style_css.m.js",
diff --git a/ui/webui/resources/cr_elements/BUILD.gn b/ui/webui/resources/cr_elements/BUILD.gn index 7e73565..9cdcc1a5 100644 --- a/ui/webui/resources/cr_elements/BUILD.gn +++ b/ui/webui/resources/cr_elements/BUILD.gn
@@ -147,8 +147,6 @@ "cr_container_shadow_behavior.m.js", "cr_dialog/cr_dialog.m.js", "cr_expand_button/cr_expand_button.m.js", - "cr_fingerprint/cr_fingerprint_icon.js", - "cr_fingerprint/cr_fingerprint_progress_arc.js", "cr_icon_button/cr_icon_button.m.js", "cr_icons_css.m.js", "cr_input/cr_input.m.js", @@ -197,7 +195,6 @@ "cr_checkbox:closure_compile_module", "cr_dialog:closure_compile_module", "cr_expand_button:closure_compile_module", - "cr_fingerprint:closure_compile_module", "cr_icon_button:closure_compile_module", "cr_input:closure_compile_module", "cr_lottie:closure_compile_module", @@ -307,7 +304,6 @@ "cr_checkbox:cr_checkbox_module", "cr_dialog:cr_dialog_module", "cr_expand_button:cr_expand_button_module", - "cr_fingerprint:web_components", "cr_icon_button:cr_icon_button_module", "cr_input:polymer3_elements", "cr_lottie:cr_lottie_module",
diff --git a/ui/webui/resources/cr_elements/cr_elements.gni b/ui/webui/resources/cr_elements/cr_elements.gni index 6fdfd3f..eeab93d 100644 --- a/ui/webui/resources/cr_elements/cr_elements.gni +++ b/ui/webui/resources/cr_elements/cr_elements.gni
@@ -31,6 +31,7 @@ "cr_a11y_announcer/cr_a11y_announcer.ts", "cr_action_menu/cr_action_menu.ts", "cr_drawer/cr_drawer.ts", + "cr_fingerprint/cr_fingerprint_progress_arc.ts", "cr_grid/cr_grid.ts", "cr_link_row/cr_link_row.ts", "cr_profile_avatar_selector/cr_profile_avatar_selector_grid.ts", @@ -51,7 +52,10 @@ [ "cr_searchable_drop_down/cr_searchable_drop_down.ts" ] } - icons_html_files = [ "mwb_shared_icons.html" ] + icons_html_files = [ + "mwb_shared_icons.html", + "cr_fingerprint/cr_fingerprint_icon.html", + ] # Polymer HTML files that are passed as input to html_to_wrapper(). polymer_html_files = []
diff --git a/ui/webui/resources/cr_elements/cr_fingerprint/BUILD.gn b/ui/webui/resources/cr_elements/cr_fingerprint/BUILD.gn deleted file mode 100644 index d39f1d9..0000000 --- a/ui/webui/resources/cr_elements/cr_fingerprint/BUILD.gn +++ /dev/null
@@ -1,26 +0,0 @@ -# Copyright 2018 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. - -import("//third_party/closure_compiler/compile_js.gni") -import("//tools/polymer/html_to_js.gni") - -html_to_js("web_components") { - js_files = [ - "cr_fingerprint_progress_arc.js", - "cr_fingerprint_icon.js", - ] -} - -js_type_check("closure_compile_module") { - is_polymer3 = true - deps = [ ":cr_fingerprint_progress_arc" ] -} - -js_library("cr_fingerprint_progress_arc") { - deps = [ - "../cr_lottie:cr_lottie.m", - "//third_party/polymer/v3_0/components-chromium/iron-icon:iron-icon", - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - ] -}
diff --git a/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_icon.js b/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_icon.js deleted file mode 100644 index 5df0d68..0000000 --- a/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_icon.js +++ /dev/null
@@ -1,10 +0,0 @@ -// Copyright 2022 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. - -import '//resources/polymer/v3_0/iron-iconset-svg/iron-iconset-svg.js'; - -import {html} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - -const template = html`{__html_template__}`; -document.head.appendChild(template.content);
diff --git a/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.d.ts b/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.d.ts deleted file mode 100644 index 5d1bd058..0000000 --- a/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.d.ts +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2021 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. - -import {CrLottieElement} from 'chrome://resources/cr_elements/cr_lottie/cr_lottie.m.js'; -import {IronIconElement} from 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; - -export const FINGERPRINT_SCANNED_ICON_DARK: string; -export const FINGERPRINT_SCANNED_ICON_LIGHT: string; -export const FINGERPRINT_CHECK_DARK_URL: string; -export const FINGERPRINT_CHECK_LIGHT_URL: string; -export const PROGRESS_CIRCLE_BACKGROUND_COLOR_DARK: string; -export const PROGRESS_CIRCLE_BACKGROUND_COLOR_LIGHT: string; -export const PROGRESS_CIRCLE_FILL_COLOR_DARK: string; -export const PROGRESS_CIRCLE_FILL_COLOR_LIGHT: string; - -interface CrFingerprintProgressArcElement extends HTMLElement { - circleRadius: number; - - reset(): void; - setProgress( - prevPercentComplete: number, currPercentComplete: number, - isComplete: boolean): void; - setPlay(shouldPlay: boolean): void; - isComplete(): boolean; - $: { - canvas: HTMLCanvasElement, - fingerprintScanned: IronIconElement, - scanningAnimation: CrLottieElement, - }; -} - -export {CrFingerprintProgressArcElement}; - -declare global { - interface HTMLElementTagNameMap { - 'cr-fingerprint-progress-arc': CrFingerprintProgressArcElement; - } -}
diff --git a/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.js b/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.ts similarity index 72% rename from ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.js rename to ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.ts index 61803514..6734527 100644 --- a/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.js +++ b/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc.ts
@@ -4,128 +4,127 @@ import '//resources/polymer/v3_0/iron-icon/iron-icon.js'; import '//resources/polymer/v3_0/iron-media-query/iron-media-query.js'; -import './cr_fingerprint_icon.js'; +import './cr_fingerprint_icon.html.js'; import '../cr_lottie/cr_lottie.m.js'; -import {html, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {assert} from '//resources/js/assert_ts.js'; +import {IronIconElement} from '//resources/polymer/v3_0/iron-icon/iron-icon.js'; +import {PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {CrLottieElement} from '../cr_lottie/cr_lottie.m.js'; + +import {getTemplate} from './cr_fingerprint_progress_arc.html.js'; /** * The dark-mode fingerprint icon displayed temporarily each time a user scans * their fingerprint and persistently once the enrollment process is complete. - * @type {string} */ -export const FINGERPRINT_SCANNED_ICON_DARK = +export const FINGERPRINT_SCANNED_ICON_DARK: string = 'cr-fingerprint-icon:fingerprint-scanned-dark'; /** * The light-mode fingerprint icon displayed temporarily each time a user scans * their fingerprint and persistently once the enrollment process is complete. - * @type {string} */ -export const FINGERPRINT_SCANNED_ICON_LIGHT = +export const FINGERPRINT_SCANNED_ICON_LIGHT: string = 'cr-fingerprint-icon:fingerprint-scanned-light'; -/** @type {string} */ -export const FINGERPRINT_CHECK_DARK_URL = +export const FINGERPRINT_CHECK_DARK_URL: string = 'chrome://theme/IDR_FINGERPRINT_COMPLETE_CHECK_DARK'; -/** @type {string} */ -export const FINGERPRINT_CHECK_LIGHT_URL = +export const FINGERPRINT_CHECK_LIGHT_URL: string = 'chrome://theme/IDR_FINGERPRINT_COMPLETE_CHECK_LIGHT'; /** * The dark-mode color of the progress circle background: Google Grey 700. - * @type {string} */ -export const PROGRESS_CIRCLE_BACKGROUND_COLOR_DARK = 'rgba(95, 99, 104, 1.0)'; +export const PROGRESS_CIRCLE_BACKGROUND_COLOR_DARK: string = + 'rgba(95, 99, 104, 1.0)'; /** * The light-mode color of the progress circle background: Google Grey 200. - * @type {string} */ -export const PROGRESS_CIRCLE_BACKGROUND_COLOR_LIGHT = +export const PROGRESS_CIRCLE_BACKGROUND_COLOR_LIGHT: string = 'rgba(232, 234, 237, 1.0)'; /** * The dark-mode color of the setup progress arc: Google Blue 400. - * @type {string} */ -export const PROGRESS_CIRCLE_FILL_COLOR_DARK = 'rgba(102, 157, 246, 1.0)'; +export const PROGRESS_CIRCLE_FILL_COLOR_DARK: string = + 'rgba(102, 157, 246, 1.0)'; /** * The light-mode color of the setup progress arc: Google Blue 500. - * @type {string} */ -export const PROGRESS_CIRCLE_FILL_COLOR_LIGHT = 'rgba(66, 133, 244, 1.0)'; +export const PROGRESS_CIRCLE_FILL_COLOR_LIGHT: string = + 'rgba(66, 133, 244, 1.0)'; /** * The time in milliseconds of the animation updates. - * @type {number} */ -const ANIMATE_TICKS_MS = 20; +const ANIMATE_TICKS_MS: number = 20; /** * The duration in milliseconds of the animation of the progress circle when the * user is touching the scanner. - * @type {number} */ -const ANIMATE_DURATION_MS = 200; +const ANIMATE_DURATION_MS: number = 200; /** * The radius of the add fingerprint progress circle. - * @type {number} */ -const DEFAULT_PROGRESS_CIRCLE_RADIUS = 114; +const DEFAULT_PROGRESS_CIRCLE_RADIUS: number = 114; /** * The default height of the icon located in the center of the fingerprint * progress circle. - * @type {number} */ -const ICON_HEIGHT = 118; +const ICON_HEIGHT: number = 118; /** * The default width of the icon located in the center of the fingerprint * progress circle. - * @type {number} */ -const ICON_WIDTH = 106; +const ICON_WIDTH: number = 106; /** * The default size of the check mark located in the bottom-right corner of the * fingerprint progress circle. - * @type {number} */ -const CHECK_MARK_SIZE = 53; +const CHECK_MARK_SIZE: number = 53; /** * The time in milliseconds of the fingerprint scan success timeout. - * @type {number} */ -const FINGERPRINT_SCAN_SUCCESS_MS = 500; +const FINGERPRINT_SCAN_SUCCESS_MS: number = 500; /** * The thickness of the fingerprint progress circle. - * @type {number} */ -const PROGRESS_CIRCLE_STROKE_WIDTH = 4; +const PROGRESS_CIRCLE_STROKE_WIDTH: number = 4; -/** @polymer */ +export interface CrFingerprintProgressArcElement { + $: { + canvas: HTMLCanvasElement, + fingerprintScanned: IronIconElement, + scanningAnimation: CrLottieElement, + }; +} + export class CrFingerprintProgressArcElement extends PolymerElement { static get is() { return 'cr-fingerprint-progress-arc'; } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() { return { /** * Radius of the fingerprint progress circle being displayed. - * @type {number} */ circleRadius: { type: Number, @@ -134,7 +133,6 @@ /** * Whether lottie animation should be autoplayed. - * @type {boolean} */ autoplay: { type: Boolean, @@ -145,8 +143,6 @@ * Scale factor based the configured radius (circleRadius) vs the default * radius (DEFAULT_PROGRESS_CIRCLE_RADIUS). * This will affect the size of icons and check mark. - * @type {number} - * @private */ scale_: { type: Number, @@ -155,15 +151,11 @@ /** * Whether fingerprint enrollment is complete. - * @type {boolean} - * @private */ isComplete_: Boolean, /** * Whether the fingerprint progress page is being rendered in dark mode. - * @type {boolean} - * @private */ isDarkModeActive_: { type: Boolean, @@ -173,41 +165,32 @@ }; } - constructor() { - super(); + circleRadius: number; + autoplay: boolean; + private scale_: number; + private isComplete_: boolean; + private isDarkModeActive_: boolean; - /** - * Animation ID for the fingerprint progress circle. - * @private {number|undefined} - */ - this.progressAnimationIntervalId_ = undefined; + // Animation ID for the fingerprint progress circle. + private progressAnimationIntervalId_: number|undefined = undefined; - /** - * Percentage of the enrollment process completed as of the last update. - * @private {number} - */ - this.progressPercentDrawn_ = 0; + // Percentage of the enrollment process completed as of the last update. + private progressPercentDrawn_: number = 0; - /** - * Timer ID for fingerprint scan success update. - * @private {number|undefined} - */ - this.updateTimerId_ = undefined; - } + // Timer ID for fingerprint scan success update. + private updateTimerId_: number|undefined = undefined; /** * Updates the current state to account for whether dark mode is enabled. - * @private */ - onDarkModeChanged_() { + private onDarkModeChanged_() { this.clearCanvas_(); this.drawProgressCircle_(this.progressPercentDrawn_); this.updateAnimationAsset_(); this.updateIconAsset_(); } - /** @override */ - connectedCallback() { + override connectedCallback() { super.connectedCallback(); this.scale_ = this.circleRadius / DEFAULT_PROGRESS_CIRCLE_RADIUS; @@ -217,7 +200,6 @@ /** * Reset the element to initial state, when the enrollment just starts. - * @public */ reset() { this.cancelAnimations_(); @@ -227,8 +209,7 @@ this.drawProgressCircle_(/** currentPercent = */ 0); this.$.fingerprintScanned.hidden = true; - const scanningAnimation = - /** @type {CrLottieElement|HTMLElement} */ (this.$.scanningAnimation); + const scanningAnimation = this.$.scanningAnimation; scanningAnimation.singleLoop = false; scanningAnimation.classList.add('translucent'); this.updateAnimationAsset_(); @@ -240,14 +221,15 @@ * Animates the progress circle. Animates an arc that starts at the top of * the circle to prevPercentComplete, to an arc that starts at the top of the * circle to currPercentComplete. - * @param {number} prevPercentComplete The previous progress indicates the - * start angle of the arc we want to draw. - * @param {number} currPercentComplete The current progress indicates the end - * angle of the arc we want to draw. - * @param {boolean} isComplete Indicate whether enrollment is complete. - * @public + * @param prevPercentComplete The previous progress indicates the start angle + * of the arc we want to draw. + * @param currPercentComplete The current progress indicates the end angle of + * the arc we want to draw. + * @param isComplete Indicate whether enrollment is complete. */ - setProgress(prevPercentComplete, currPercentComplete, isComplete) { + setProgress( + prevPercentComplete: number, currPercentComplete: number, + isComplete: boolean) { if (this.isComplete_) { return; } @@ -294,33 +276,29 @@ /** * Controls the animation based on the value of |shouldPlay|. - * @param {boolean} shouldPlay Will play the animation if true else pauses it. - * @public + * @param shouldPlay Will play the animation if true else pauses it. */ - setPlay(shouldPlay) { - const scanningAnimation = - /** @type {CrLottieElement|HTMLElement} */ (this.$.scanningAnimation); - scanningAnimation.setPlay(shouldPlay); + setPlay(shouldPlay: boolean) { + this.$.scanningAnimation.setPlay(shouldPlay); } - /** @public */ - isComplete() { + isComplete(): boolean { return this.isComplete_; } /** * Draws an arc on the canvas element around the center with radius * |circleRadius|. - * @param {number} startAngle The start angle of the arc we want to draw. - * @param {number} endAngle The end angle of the arc we want to draw. - * @param {string} color The color of the arc we want to draw. The string is + * @param startAngle The start angle of the arc we want to draw. + * @param endAngle The end angle of the arc we want to draw. + * @param color The color of the arc we want to draw. The string is * in the format rgba(r',g',b',a'). r', g', b' are values from [0-255] * and a' is a value from [0-1]. - * @private */ - drawArc_(startAngle, endAngle, color) { + private drawArc_(startAngle: number, endAngle: number, color: string) { const c = this.$.canvas; const ctx = c.getContext('2d'); + assert(!!ctx); ctx.beginPath(); ctx.arc(c.width / 2, c.height / 2, this.circleRadius, startAngle, endAngle); @@ -334,11 +312,10 @@ * |circleRadius|. The first |currentPercent| of the circle, starting at the * top, is drawn with |PROGRESS_CIRCLE_FILL_COLOR|; the remainder of the * circle is drawn |PROGRESS_CIRCLE_BACKGROUND_COLOR|. - * @param {number} currentPercent A value from [0-100] indicating the + * @param currentPercent A value from [0-100] indicating the * percentage of progress to display. - * @private */ - drawProgressCircle_(currentPercent) { + private drawProgressCircle_(currentPercent: number) { // Angles on HTML canvases start at 0 radians on the positive x-axis and // increase in the clockwise direction. We want to start at the top of the // circle, which is 3pi/2. @@ -364,11 +341,9 @@ /** * Updates the lottie animation taking into account the current state and * whether dark mode is enabled. - * @private */ - updateAnimationAsset_() { - const scanningAnimation = - /** @type {CrLottieElement} */ (this.$.scanningAnimation); + private updateAnimationAsset_() { + const scanningAnimation = this.$.scanningAnimation; if (this.isComplete_) { scanningAnimation.animationUrl = this.isDarkModeActive_ ? FINGERPRINT_CHECK_DARK_URL : @@ -382,21 +357,17 @@ /** * Updates the fingerprint-scanned icon based on whether dark mode is enabled. - * @private */ - updateIconAsset_() { - const fingerprintScanned = - /** @type {IronIconElement} */ (this.$.fingerprintScanned); - fingerprintScanned.icon = this.isDarkModeActive_ ? + private updateIconAsset_() { + this.$.fingerprintScanned.icon = this.isDarkModeActive_ ? FINGERPRINT_SCANNED_ICON_DARK : FINGERPRINT_SCANNED_ICON_LIGHT; } /* * Cleans up any pending animation update created by setInterval(). - * @private */ - cancelAnimations_() { + private cancelAnimations_() { this.progressPercentDrawn_ = 0; if (this.progressAnimationIntervalId_) { clearInterval(this.progressAnimationIntervalId_); @@ -410,11 +381,9 @@ /** * Show animation for enrollment completion. - * @private */ - animateScanComplete_() { - const scanningAnimation = - /** @type {CrLottieElement|HTMLElement} */ (this.$.scanningAnimation); + private animateScanComplete_() { + const scanningAnimation = this.$.scanningAnimation; scanningAnimation.singleLoop = true; scanningAnimation.autoplay = true; scanningAnimation.classList.remove('translucent'); @@ -425,9 +394,8 @@ /** * Show animation for enrollment in progress. - * @private */ - animateScanProgress_() { + private animateScanProgress_() { this.$.fingerprintScanned.hidden = false; this.$.scanningAnimation.hidden = true; this.updateTimerId_ = window.setTimeout(() => { @@ -438,32 +406,27 @@ /** * Clear the canvas of any renderings. - * @private */ - clearCanvas_() { + private clearCanvas_() { const c = this.$.canvas; const ctx = c.getContext('2d'); + assert(!!ctx); ctx.clearRect(0, 0, c.width, c.height); } /** * Update the size and position of the animation images. - * @private */ - updateImages_() { - this.resizeAndCenterIcon_( - /** @type {!HTMLElement} */ (this.$.scanningAnimation)); - this.resizeAndCenterIcon_( - /** @type {!HTMLElement} */ (this.$.fingerprintScanned)); + private updateImages_() { + this.resizeAndCenterIcon_(this.$.scanningAnimation); + this.resizeAndCenterIcon_(this.$.fingerprintScanned); } /** * Resize the icon based on the scale and place it in the center of the * fingerprint progress circle. - * @param {!HTMLElement} target - * @private */ - resizeAndCenterIcon_(target) { + private resizeAndCenterIcon_(target: HTMLElement) { // Resize icon based on the default width/height and scale. target.style.width = ICON_WIDTH * this.scale_ + 'px'; target.style.height = ICON_HEIGHT * this.scale_ + 'px'; @@ -478,10 +441,8 @@ /** * Resize the check mark based on the scale and place it in the bottom-right * corner of the fingerprint progress circle. - * @param {!HTMLElement} target - * @private */ - resizeCheckMark_(target) { + private resizeCheckMark_(target: HTMLElement) { // Resize check mark based on the default size and scale. target.style.width = CHECK_MARK_SIZE * this.scale_ + 'px'; target.style.height = CHECK_MARK_SIZE * this.scale_ + 'px'; @@ -496,5 +457,11 @@ } } +declare global { + interface HTMLElementTagNameMap { + 'cr-fingerprint-progress-arc': CrFingerprintProgressArcElement; + } +} + customElements.define( CrFingerprintProgressArcElement.is, CrFingerprintProgressArcElement);
diff --git a/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc_externs.js b/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc_externs.js new file mode 100644 index 0000000..9beb0cb --- /dev/null +++ b/ui/webui/resources/cr_elements/cr_fingerprint/cr_fingerprint_progress_arc_externs.js
@@ -0,0 +1,22 @@ +// Copyright 2022 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. + +/* Minimal externs file provided for places in the code that + * still use JavaScript instead of TypeScript. + * @externs + */ + +/** + * @constructor + * @extends {HTMLElement} + */ +function CrFingerprintProgressArcElement() {} + +/** + * @param {number} prevPercentComplete + * @param {number} currPercentComplete + * @param {boolean} isComplete + */ +CrFingerprintProgressArcElement.prototype.setProgress = function( + prevPercentComplete, currPercentComplete, isComplete) {};
diff --git a/ui/webui/resources/cr_elements/cr_lottie/cr_lottie.m.d.ts b/ui/webui/resources/cr_elements/cr_lottie/cr_lottie.m.d.ts index b71df126d..6f8ede8 100644 --- a/ui/webui/resources/cr_elements/cr_lottie/cr_lottie.m.d.ts +++ b/ui/webui/resources/cr_elements/cr_lottie/cr_lottie.m.d.ts
@@ -9,10 +9,12 @@ interface CrLottieElement extends LegacyElementMixin, HTMLElement { animationUrl: string; autoplay: boolean; + setPlay(shouldPlay: boolean): void; + singleLoop: boolean; + $: { canvas: HTMLCanvasElement, }; - setPlay(shouldPlay: boolean): void; } export {CrLottieElement};
diff --git a/weblayer/browser/content_browser_client_impl.cc b/weblayer/browser/content_browser_client_impl.cc index 82b9b3f..636dd9c 100644 --- a/weblayer/browser/content_browser_client_impl.cc +++ b/weblayer/browser/content_browser_client_impl.cc
@@ -875,23 +875,26 @@ // TODO(https://crbug.com/1265864): Move the registry logic below to a // dedicated file to ensure security review coverage. // TODO(lingqi): Swap the parameters so that lambda functions are not needed. - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> - receiver) { - autofill::ContentAutofillDriverFactory::BindAutofillDriver( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver<autofill::mojom::PasswordManagerDriver> - receiver) { - PasswordManagerDriverFactory::BindPasswordManagerDriver( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface<autofill::mojom::AutofillDriver>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> + receiver) { + autofill::ContentAutofillDriverFactory::BindAutofillDriver( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface<autofill::mojom::PasswordManagerDriver>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + autofill::mojom::PasswordManagerDriver> receiver) { + PasswordManagerDriverFactory::BindPasswordManagerDriver( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface< + content_capture::mojom::ContentCaptureReceiver>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver< content_capture::mojom::ContentCaptureReceiver> receiver) { @@ -899,15 +902,17 @@ std::move(receiver), render_frame_host); }, &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( - [](content::RenderFrameHost* render_frame_host, - mojo::PendingAssociatedReceiver< - page_load_metrics::mojom::PageLoadMetrics> receiver) { - page_load_metrics::MetricsWebContentsObserver::BindPageLoadMetrics( - std::move(receiver), render_frame_host); - }, - &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface<page_load_metrics::mojom::PageLoadMetrics>( + base::BindRepeating( + [](content::RenderFrameHost* render_frame_host, + mojo::PendingAssociatedReceiver< + page_load_metrics::mojom::PageLoadMetrics> receiver) { + page_load_metrics::MetricsWebContentsObserver::BindPageLoadMetrics( + std::move(receiver), render_frame_host); + }, + &render_frame_host)); + associated_registry.AddInterface< + security_interstitials::mojom::InterstitialCommands>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver< security_interstitials::mojom::InterstitialCommands> receiver) { @@ -915,7 +920,8 @@ BindInterstitialCommands(std::move(receiver), render_frame_host); }, &render_frame_host)); - associated_registry.AddInterface(base::BindRepeating( + associated_registry.AddInterface< + subresource_filter::mojom::SubresourceFilterHost>(base::BindRepeating( [](content::RenderFrameHost* render_frame_host, mojo::PendingAssociatedReceiver< subresource_filter::mojom::SubresourceFilterHost> receiver) { @@ -938,8 +944,9 @@ mojo::MakeSelfOwnedReceiver(std::make_unique<SpellCheckHostImpl>(), std::move(receiver)); }; - registry->AddInterface(base::BindRepeating(create_spellcheck_host), - content::GetUIThreadTaskRunner({})); + registry->AddInterface<spellcheck::mojom::SpellCheckHost>( + base::BindRepeating(create_spellcheck_host), + content::GetUIThreadTaskRunner({})); if (base::FeatureList::IsEnabled(features::kWebLayerSafeBrowsing) && IsSafebrowsingSupported()) {
diff --git a/weblayer/renderer/error_page_helper.cc b/weblayer/renderer/error_page_helper.cc index 6eb924d..dc8b945 100644 --- a/weblayer/renderer/error_page_helper.cc +++ b/weblayer/renderer/error_page_helper.cc
@@ -57,9 +57,9 @@ ErrorPageHelper::ErrorPageHelper(content::RenderFrame* render_frame) : RenderFrameObserver(render_frame), RenderFrameObserverTracker<ErrorPageHelper>(render_frame) { - render_frame->GetAssociatedInterfaceRegistry()->AddInterface( - base::BindRepeating(&ErrorPageHelper::BindErrorPageHelper, - weak_factory_.GetWeakPtr())); + render_frame->GetAssociatedInterfaceRegistry() + ->AddInterface<mojom::ErrorPageHelper>(base::BindRepeating( + &ErrorPageHelper::BindErrorPageHelper, weak_factory_.GetWeakPtr())); } ErrorPageHelper::~ErrorPageHelper() = default;
diff --git a/weblayer/renderer/weblayer_render_thread_observer.cc b/weblayer/renderer/weblayer_render_thread_observer.cc index 913c304b..3d8a589d 100644 --- a/weblayer/renderer/weblayer_render_thread_observer.cc +++ b/weblayer/renderer/weblayer_render_thread_observer.cc
@@ -14,7 +14,8 @@ void WebLayerRenderThreadObserver::RegisterMojoInterfaces( blink::AssociatedInterfaceRegistry* associated_interfaces) { - associated_interfaces->AddInterface(base::BindRepeating( + associated_interfaces->AddInterface< + mojom::RendererConfiguration>(base::BindRepeating( &WebLayerRenderThreadObserver::OnRendererConfigurationAssociatedRequest, base::Unretained(this))); }