diff --git a/AUTHORS b/AUTHORS index 6fb28c31..8e2fcc7 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -557,6 +557,7 @@ Jaehyun Lee <j-hyun.lee@samsung.com> Jaekyeom Kim <btapiz@gmail.com> Jaemin Seo <jaemin86.seo@samsung.com> +Jaemo Koo <jaemok@amazon.com> Jaeseok Yoon <yjaeseok@gmail.com> Jaewon Choi <jaewon.james.choi@gmail.com> Jaewon Jung <jw.jung@navercorp.com>
diff --git a/DEPS b/DEPS index c0f7738..1de4016 100644 --- a/DEPS +++ b/DEPS
@@ -305,19 +305,19 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'src_internal_revision': 'c7418cbf4981c8cb53efffc321eb95d7bb648108', + 'src_internal_revision': '48b0109464d269d64245a7527afeca3f3a9fed8b', # 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': 'a4cce5236dcf5af8b3b8725559df76877802f209', + 'skia_revision': 'b6ce84dc3e53eb5850206d5b567c8a2b6e4b211d', # 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': 'd8629e1b3fd3f577927bc834b67b7b67daddd471', + 'v8_revision': 'fbf289b1de521d0d07e777cd3c8355c8d8480767', # 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': '9a7e8b7bb17fdd3c88c3b1f26f0c605135654ee0', + 'angle_revision': '1bb2c5ece1de58658c5f2e5f26d0b309d95924f7', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -380,7 +380,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': '84fb1a2dd0db549933ae487a763ce77d6bcb171a', + 'catapult_revision': '5a57691454ee8bae85c8b856ed9d03db951ede14', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling chromium_variations # and whatever else without interference from each other. @@ -400,7 +400,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': 'fd66b840a076b7c161543dc94828ee2ce0bcc4c1', + 'devtools_frontend_revision': 'c4b83319a573ccd35afe6ab9993ecef075eb2150', # 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. @@ -424,7 +424,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': 'cb10a354ea6d051457c2912563f0da4288f3351f', + 'dawn_revision': '691b30570104591a5a4870bffb1e40a7e0c133fa', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -824,7 +824,7 @@ 'src/clank': { 'url': Var('chrome_git') + '/clank/internal/apps.git' + '@' + - '20d5912ad65aa985382a75f6883945a2bb40c79a', + 'b108590d728e5b8403a3e3c4c6957f037c13fdad', 'condition': 'checkout_android and checkout_src_internal', }, @@ -833,7 +833,7 @@ }, 'src/ios/third_party/earl_grey2/src': { - 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + '2afe6d25f15c122be700d7e693cd095f46495a69', + 'url': Var('chromium_git') + '/external/github.com/google/EarlGrey.git' + '@' + 'ed56cf15bef0ebd3ffb726897df2ec55d33bdf61', 'condition': 'checkout_ios', }, @@ -986,7 +986,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': 'sOzm2XsTsUBghbrM6e-K3ddbbSNOM4mBodH6N59L07AC', + 'version': 'm2hxzTFLmNn2t0TKpyN-rl_aK18w-9_aSmernX02SpMC', }, ], 'condition': 'checkout_android', @@ -1183,7 +1183,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'eacd3aac0c2cd69a4040c450f09a6d8133b38791', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '598bf5a6d5e4b97107e8d4528dec0c3c011bf038', 'condition': 'checkout_chromeos', }, @@ -1218,13 +1218,13 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'a83e6906622848185f5eb4e974ec35586dfe5043', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '3a66263cd2e68e3085d4563fb61fa53a51caee21', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), 'src/third_party/devtools-frontend-internal': { - 'url': Var('chrome_git') + '/devtools/devtools-internal.git' + '@' + '108ae7ce925d5b6a4691eee6f6e5bafe9e41b8bc', + 'url': Var('chrome_git') + '/devtools/devtools-internal.git' + '@' + 'f86b29c9164948f7084ad112ff18c81597da2dd1', 'condition': 'checkout_src_internal', }, @@ -1557,7 +1557,7 @@ }, 'src/third_party/libvpx/source/libvpx': - Var('chromium_git') + '/webm/libvpx.git' + '@' + '424723dc025ce451dab9568239a46b18d0919b4d', + Var('chromium_git') + '/webm/libvpx.git' + '@' + '0d3ef6ffd22bda0ba1ec1bf9c7a24852e4a1d111', 'src/third_party/libwebm/source': Var('chromium_git') + '/webm/libwebm.git' + '@' + 'e4fbea0c9751ae8aa86629b197a28d8276a2b0da', @@ -1689,7 +1689,7 @@ Var('pdfium_git') + '/pdfium.git' + '@' + Var('pdfium_revision'), 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'ed90e2735442263d54f02f2aa7410762f653d9c8', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '978c4586ae203718174455aa228b39d1f07defe3', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1841,7 +1841,7 @@ # Display server protocol for Linux. 'src/third_party/wayland/src': { - 'url': Var('chromium_git') + '/external/anongit.freedesktop.org/git/wayland/wayland.git' + '@' + '3fda2fbf51db54398c0155facee82cc9533958a2', + 'url': Var('chromium_git') + '/external/anongit.freedesktop.org/git/wayland/wayland.git' + '@' + 'af7f44122127b86a8c74cb7432909180f4899eaa', 'condition': 'checkout_linux', }, @@ -1871,10 +1871,10 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'f4bf599a8b575df685c31d9c4729a70a04e377ed', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'f413d3474963ae2e63a7ba9580709b3c7180f9e8', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '5a6983265a19816f74953c3d51efbbaa246ff190', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'bd396fdffae452216e1984dec3cea73937192479', + Var('webrtc_git') + '/src.git' + '@' + 'd3414d96888391774677736f25e9ed3865d5db23', # Wuffs' canonical repository is at github.com/google/wuffs, but we use # Skia's mirror of Wuffs, the same as in upstream Skia's DEPS file. @@ -1997,7 +1997,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'F-smYN5msMHerDO0Fa3nHPPil7dyou5VUBAsBjUs-BYC', + 'version': '3I7STNsUR3aF6SfnyryXew_OTp__jgaCFlt_JNnU-nkC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -2008,7 +2008,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'S8cXaSjIZIQtLXX2xxhn5Q4iKPVYqc1waan-Z-WUHMUC', + 'version': 'Gv8OGXt1JjdLWQ3L13-DzxxYLmx25j7xSXoQZM1G_v4C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -2664,7 +2664,7 @@ 'packages': [ { 'package': 'chromium/third_party/android_deps/libs/com_google_android_material_material', - 'version': 'version:2@1.7.0-alpha02.cr1', + 'version': 'version:2@1.11.0-beta01.cr1', }, ], 'condition': 'checkout_android', @@ -4031,7 +4031,7 @@ 'src/ios_internal': { 'url': Var('chrome_git') + '/chrome/ios_internal.git' + '@' + - '44710d02e1e10d2013b2e30325cf482aa82afee1', + 'c6eeaf49b25eceebf916e331e8a243e3f2455ab2', 'condition': 'checkout_ios and checkout_src_internal', },
diff --git a/ash/accessibility/accessibility_controller_impl.cc b/ash/accessibility/accessibility_controller_impl.cc index 053c26a8..68ee1f8 100644 --- a/ash/accessibility/accessibility_controller_impl.cc +++ b/ash/accessibility/accessibility_controller_impl.cc
@@ -22,6 +22,7 @@ #include "ash/accessibility/ui/accessibility_panel_layout_manager.h" #include "ash/color_enhancement/color_enhancement_controller.h" #include "ash/constants/ash_constants.h" +#include "ash/constants/ash_features.h" #include "ash/constants/ash_pref_names.h" #include "ash/constants/notifier_catalogs.h" #include "ash/events/accessibility_event_rewriter.h" @@ -35,6 +36,8 @@ #include "ash/public/cpp/notification_utils.h" #include "ash/public/cpp/session/session_observer.h" #include "ash/public/cpp/shell_window_ids.h" +#include "ash/public/cpp/system/anchored_nudge_data.h" +#include "ash/public/cpp/system/anchored_nudge_manager.h" #include "ash/public/cpp/system_tray_client.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/root_window_controller.h" @@ -175,6 +178,8 @@ constexpr char kNotificationId[] = "chrome://settings/accessibility"; constexpr char kNotifierAccessibility[] = "ash.accessibility"; +constexpr char kDictationLanguageUpgradedNudgeId[] = + "dictation_language_upgraded.nudge_id"; // TODO(warx): Signin screen has more controllable accessibility prefs. We may // want to expand this to a complete list. If so, merge this with @@ -1914,6 +1919,19 @@ void AccessibilityControllerImpl::ShowDictationLanguageUpgradedNudge( const std::string& dictation_locale, const std::string& application_locale) { + if (features::IsSystemNudgeMigrationEnabled()) { + const std::u16string language_name = l10n_util::GetDisplayNameForLocale( + dictation_locale, application_locale, /*is_for_ui=*/true); + const std::u16string body_text = l10n_util::GetStringFUTF16( + IDS_ASH_DICTATION_LANGUAGE_SUPPORTED_OFFLINE_NUDGE, language_name); + + AnchoredNudgeData nudge_data(kDictationLanguageUpgradedNudgeId, + NudgeCatalogName::kDictation, body_text); + + AnchoredNudgeManager::Get()->Show(nudge_data); + return; + } + // TODO(b:259352600): Move dictation_nudge_controller_ into // accessibility_notification_controller. dictation_nudge_controller_ = std::make_unique<DictationNudgeController>(
diff --git a/ash/accessibility/dictation_nudge_controller_unittest.cc b/ash/accessibility/dictation_nudge_controller_unittest.cc index 83e398da..b692e78 100644 --- a/ash/accessibility/dictation_nudge_controller_unittest.cc +++ b/ash/accessibility/dictation_nudge_controller_unittest.cc
@@ -7,11 +7,14 @@ #include "ash/accessibility/accessibility_controller_impl.h" #include "ash/accessibility/dictation_nudge.h" #include "ash/accessibility/dictation_nudge_controller.h" +#include "ash/constants/ash_features.h" #include "ash/shell.h" +#include "ash/system/toast/anchored_nudge_manager_impl.h" #include "ash/system/tray/system_nudge_label.h" #include "ash/test/ash_test_base.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" #include "testing/gmock/include/gmock/gmock.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" @@ -24,8 +27,16 @@ namespace ash { +namespace { + +constexpr char kDictationLanguageUpgradedNudgeId[] = + "dictation_language_upgraded.nudge_id"; + +} // namespace + // Tests for showing the Dictation Nudge from AccessibilityControllerImpl. -class DictationNudgeControllerTest : public AshTestBase { +class DictationNudgeControllerTest : public AshTestBase, + public testing::WithParamInterface<bool> { public: DictationNudgeControllerTest() = default; DictationNudgeControllerTest(const DictationNudgeControllerTest&) = delete; @@ -35,6 +46,8 @@ // AshTestBase: void SetUp() override { + scoped_feature_list_.InitWithFeatureState(features::kSystemNudgeMigration, + IsSystemNudgeMigrationEnabled()); AshTestBase::SetUp(); Shell::Get()->accessibility_controller()->dictation().SetEnabled(true); } @@ -76,9 +89,30 @@ widget_destroyed_waiter.Wait(); } + + bool IsSystemNudgeMigrationEnabled() { return GetParam(); } + + private: + base::test::ScopedFeatureList scoped_feature_list_; }; -TEST_F(DictationNudgeControllerTest, ShowsAndHidesNudge) { +INSTANTIATE_TEST_SUITE_P(All, + DictationNudgeControllerTest, + /*enable_system_nudge_migration=*/testing::Bool()); + +TEST_P(DictationNudgeControllerTest, ShowsAndHidesNudge) { + if (IsSystemNudgeMigrationEnabled()) { + EXPECT_FALSE(AnchoredNudgeManager::Get()->IsNudgeShown( + kDictationLanguageUpgradedNudgeId)); + ShowDictationLanguageUpgradedNudge("en-US", "en-US"); + EXPECT_TRUE(AnchoredNudgeManager::Get()->IsNudgeShown( + kDictationLanguageUpgradedNudgeId)); + + // Manager handled nudge's destruction is tested in + // anchored_nudge_manager_impl_unittest.cc. + return; + } + EXPECT_FALSE(GetDictationNudgeController()); ShowDictationLanguageUpgradedNudge("en-US", "en-US"); @@ -92,7 +126,7 @@ WaitForWidgetDestruction(controller, nudge); } -TEST_F(DictationNudgeControllerTest, SetsLabelBasedOnApplicationLocale) { +TEST_P(DictationNudgeControllerTest, SetsLabelBasedOnApplicationLocale) { struct { std::string locale; std::string application_locale; @@ -106,19 +140,28 @@ for (const auto& testcase : kTestCases) { ShowDictationLanguageUpgradedNudge(testcase.locale, testcase.application_locale); + if (IsSystemNudgeMigrationEnabled()) { + ASSERT_TRUE(AnchoredNudgeManager::Get()->IsNudgeShown( + kDictationLanguageUpgradedNudgeId)); - DictationNudgeController* controller = GetDictationNudgeController(); - ASSERT_TRUE(controller); + const std::string body_text = base::UTF16ToUTF8( + Shell::Get()->anchored_nudge_manager()->GetNudgeBodyTextForTest( + kDictationLanguageUpgradedNudgeId)); + EXPECT_THAT(body_text, HasSubstr(testcase.label)); + } else { + DictationNudgeController* controller = GetDictationNudgeController(); + ASSERT_TRUE(controller); - DictationNudge* nudge = - static_cast<DictationNudge*>(controller->GetSystemNudgeForTesting()); - ASSERT_TRUE(nudge); + DictationNudge* nudge = + static_cast<DictationNudge*>(controller->GetSystemNudgeForTesting()); + ASSERT_TRUE(nudge); - std::unique_ptr<SystemNudgeLabel> label = GetDictationNudgeLabel(nudge); - std::string text = base::UTF16ToUTF8(label->GetText()); - EXPECT_THAT(text, HasSubstr(testcase.label)); + std::unique_ptr<SystemNudgeLabel> label = GetDictationNudgeLabel(nudge); + std::string text = base::UTF16ToUTF8(label->GetText()); + EXPECT_THAT(text, HasSubstr(testcase.label)); - WaitForWidgetDestruction(controller, nudge); + WaitForWidgetDestruction(controller, nudge); + } } }
diff --git a/ash/app_list/views/assistant/assistant_main_stage.cc b/ash/app_list/views/assistant/assistant_main_stage.cc index 4760887..7b447cf 100644 --- a/ash/app_list/views/assistant/assistant_main_stage.cc +++ b/ash/app_list/views/assistant/assistant_main_stage.cc
@@ -467,10 +467,6 @@ } query_view_->SetQuery(AssistantNullQuery()); - - footer_->SetVisible(true); - footer_->layer()->SetOpacity(1.f); - footer_->SetCanProcessEventsWithinSubtree(true); } void AppListAssistantMainStage::InitializeUIForBubbleView() {
diff --git a/ash/capture_mode/capture_audio_mixing_unittests.cc b/ash/capture_mode/capture_audio_mixing_unittests.cc index cfd4a41..998e311 100644 --- a/ash/capture_mode/capture_audio_mixing_unittests.cc +++ b/ash/capture_mode/capture_audio_mixing_unittests.cc
@@ -14,6 +14,7 @@ #include "ash/public/cpp/capture_mode/capture_mode_test_api.h" #include "ash/style/icon_button.h" #include "ash/test/ash_test_base.h" +#include "ash/test/ash_test_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h"
diff --git a/ash/capture_mode/capture_mode_camera_unittests.cc b/ash/capture_mode/capture_mode_camera_unittests.cc index 87b4d64d..72bf65df 100644 --- a/ash/capture_mode/capture_mode_camera_unittests.cc +++ b/ash/capture_mode/capture_mode_camera_unittests.cc
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/accessibility/a11y_feature_type.h" #include "ash/accessibility/accessibility_controller_impl.h" #include "ash/accessibility/autoclick/autoclick_controller.h" #include "ash/capture_mode/capture_mode_bar_view.h" @@ -49,6 +48,7 @@ #include "ash/system/status_area_widget.h" #include "ash/system/unified/unified_system_tray.h" #include "ash/test/ash_test_base.h" +#include "ash/test/ash_test_util.h" #include "ash/wm/window_state.h" #include "base/ranges/algorithm.h" #include "base/strings/stringprintf.h"
diff --git a/ash/capture_mode/capture_mode_demo_tools_unittests.cc b/ash/capture_mode/capture_mode_demo_tools_unittests.cc index 2e9b399..02c3bd8 100644 --- a/ash/capture_mode/capture_mode_demo_tools_unittests.cc +++ b/ash/capture_mode/capture_mode_demo_tools_unittests.cc
@@ -39,6 +39,7 @@ #include "ash/shell.h" #include "ash/style/icon_button.h" #include "ash/test/ash_test_base.h" +#include "ash/test/ash_test_util.h" #include "ash/wm/splitview/split_view_controller.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h"
diff --git a/ash/capture_mode/capture_mode_game_dashboard_unittests.cc b/ash/capture_mode/capture_mode_game_dashboard_unittests.cc index 92aff58..b25154a 100644 --- a/ash/capture_mode/capture_mode_game_dashboard_unittests.cc +++ b/ash/capture_mode/capture_mode_game_dashboard_unittests.cc
@@ -25,9 +25,9 @@ #include "ash/screen_util.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" -#include "ash/style/icon_button.h" #include "ash/style/pill_button.h" #include "ash/test/ash_test_base.h" +#include "ash/test/ash_test_util.h" #include "ash/wm/desks/desks_test_util.h" #include "base/system/sys_info.h" #include "base/test/metrics/histogram_tester.h"
diff --git a/ash/capture_mode/capture_mode_test_util.cc b/ash/capture_mode/capture_mode_test_util.cc index aa388705..e0388dae 100644 --- a/ash/capture_mode/capture_mode_test_util.cc +++ b/ash/capture_mode/capture_mode_test_util.cc
@@ -148,14 +148,6 @@ return folder_on_drive_fs; } -void SendKey(ui::KeyboardCode key_code, - ui::test::EventGenerator* event_generator, - int flags, - int count) { - for (int i = 0; i < count; ++i) - event_generator->PressAndReleaseKey(key_code, flags); -} - void WaitForSeconds(int seconds) { base::RunLoop loop; base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
diff --git a/ash/capture_mode/capture_mode_test_util.h b/ash/capture_mode/capture_mode_test_util.h index 754ec6e..2902dc2 100644 --- a/ash/capture_mode/capture_mode_test_util.h +++ b/ash/capture_mode/capture_mode_test_util.h
@@ -84,12 +84,6 @@ // created in the root folder with given `custom_folder_name`. base::FilePath CreateFolderOnDriveFS(const std::string& custom_folder_name); -// Sends a press release key combo `count` times. -void SendKey(ui::KeyboardCode key_code, - ui::test::EventGenerator* event_generator, - int flags = ui::EF_NONE, - int count = 1); - // Wait for a specific `seconds`. void WaitForSeconds(int seconds);
diff --git a/ash/capture_mode/capture_mode_unittests.cc b/ash/capture_mode/capture_mode_unittests.cc index d5dd3e5..69fbe5c 100644 --- a/ash/capture_mode/capture_mode_unittests.cc +++ b/ash/capture_mode/capture_mode_unittests.cc
@@ -53,6 +53,7 @@ #include "ash/style/tab_slider_button.h" #include "ash/system/status_area_widget.h" #include "ash/test/ash_test_base.h" +#include "ash/test/ash_test_util.h" #include "ash/test/test_widget_builder.h" #include "ash/wm/desks/desk.h" #include "ash/wm/desks/desks_controller.h"
diff --git a/ash/capture_mode/gif_recording_unittests.cc b/ash/capture_mode/gif_recording_unittests.cc index 74190516..e0c45489 100644 --- a/ash/capture_mode/gif_recording_unittests.cc +++ b/ash/capture_mode/gif_recording_unittests.cc
@@ -16,6 +16,7 @@ #include "ash/public/cpp/capture_mode/capture_mode_test_api.h" #include "ash/style/icon_button.h" #include "ash/test/ash_test_base.h" +#include "ash/test/ash_test_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "ui/events/keycodes/keyboard_codes_posix.h"
diff --git a/ash/components/arc/chrome_feature_flags/arc_chrome_feature_flags_bridge.cc b/ash/components/arc/chrome_feature_flags/arc_chrome_feature_flags_bridge.cc index df4d177..b49d7b075 100644 --- a/ash/components/arc/chrome_feature_flags/arc_chrome_feature_flags_bridge.cc +++ b/ash/components/arc/chrome_feature_flags/arc_chrome_feature_flags_bridge.cc
@@ -90,6 +90,8 @@ flags->rounded_window_radius = chromeos::features::RoundedWindowsRadius(); flags->xdg_mode = base::FeatureList::IsEnabled(kXdgMode); flags->enable_pip_double_tap = ash::features::IsPipDoubleTapToResizeEnabled(); + flags->render_arc_notifications_by_chrome = + ash::features::IsRenderArcNotificationsByChromeEnabled(); chrome_feature_flags_instance->NotifyFeatureFlags(std::move(flags)); }
diff --git a/ash/components/arc/mojom/chrome_feature_flags.mojom b/ash/components/arc/mojom/chrome_feature_flags.mojom index 16fed69..419f7ea 100644 --- a/ash/components/arc/mojom/chrome_feature_flags.mojom +++ b/ash/components/arc/mojom/chrome_feature_flags.mojom
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Next MinVersion: 6 +// Next MinVersion: 7 module arc.mojom; @@ -33,6 +33,8 @@ [MinVersion=4] bool xdg_mode; // chrome://flags#enable-pip-double-tap-to-resize; [MinVersion=5] bool enable_pip_double_tap; + // chrome://flags#render-arc-notifications-by-chrome; + [MinVersion=6] bool render_arc_notifications_by_chrome; }; // This interface provides methods to propagate the feature flag status to
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index 8bd8b2c..4d75ec2 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -1324,7 +1324,7 @@ // Enables a Files banner about Google One offer. BASE_FEATURE(kGoogleOneOfferFilesBanner, "GoogleOneOfferFilesBanner", - base::FEATURE_ENABLED_BY_DEFAULT); + base::FEATURE_DISABLED_BY_DEFAULT); // Enables editing with handwriting gestures within the virtual keyboard. BASE_FEATURE(kHandwritingGestureEditing, @@ -1347,6 +1347,11 @@ "HelpAppAutoTriggerInstallDialog", base::FEATURE_ENABLED_BY_DEFAULT); +// If enabled, the Help app will render with Cros components. +BASE_FEATURE(kHelpAppCrosComponents, + "HelpAppCrosComponents", + base::FEATURE_DISABLED_BY_DEFAULT); + // Enables or disables the Help App Discover tab notifications on non-stable // ChromeOS channels. Used for testing. BASE_FEATURE(kHelpAppDiscoverTabNotificationAllChannels, @@ -2605,6 +2610,12 @@ // Enables the UI to show tab cluster info. BASE_FEATURE(kTabClusterUI, "TabClusterUI", base::FEATURE_DISABLED_BY_DEFAULT); +// Enables the UI to allow Chromebook hotspot functionality for experimental +// carriers, modem and modem FW. +BASE_FEATURE(kTetheringExperimentalFunctionality, + "TetheringExperimentalFunctionality", + base::FEATURE_DISABLED_BY_DEFAULT); + // Enables ChromeOS Telemetry Extension. BASE_FEATURE(kTelemetryExtension, "TelemetryExtension", @@ -4200,6 +4211,10 @@ return base::FeatureList::IsEnabled(kStylusBatteryStatus); } +bool IsTetheringExperimentalFunctionalityEnabled() { + return base::FeatureList::IsEnabled(kTetheringExperimentalFunctionality); +} + bool IsTimeOfDayScreenSaverEnabled() { return base::FeatureList::IsEnabled(kTimeOfDayScreenSaver) && base::FeatureList::IsEnabled(kFeatureManagementTimeOfDayScreenSaver) &&
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 709b856..3f8060f 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h
@@ -436,6 +436,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kHelpAppAutoTriggerInstallDialog); COMPONENT_EXPORT(ASH_CONSTANTS) +BASE_DECLARE_FEATURE(kHelpAppCrosComponents); +COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kHelpAppDiscoverTabNotificationAllChannels); COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kHelpAppHomePageAppArticles); @@ -798,6 +800,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kTabClusterUI); COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kTelemetryExtension); COMPONENT_EXPORT(ASH_CONSTANTS) +BASE_DECLARE_FEATURE(kTetheringExperimentalFunctionality); +COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kTerminalAlternativeEmulator); COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kTerminalDev); COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kTimeOfDayScreenSaver); @@ -1210,6 +1214,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSystemNudgeMigrationEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSystemTrayShadowEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsStylusBatteryStatusEnabled(); +COMPONENT_EXPORT(ASH_CONSTANTS) +bool IsTetheringExperimentalFunctionalityEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsTimeOfDayScreenSaverEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsTimeOfDayWallpaperEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS)
diff --git a/ash/constants/ash_pref_names.h b/ash/constants/ash_pref_names.h index 832544b1..24f6a86 100644 --- a/ash/constants/ash_pref_names.h +++ b/ash/constants/ash_pref_names.h
@@ -652,6 +652,12 @@ // for the primary user on first sign-in. The guids are stored as lowercase // strings. inline constexpr char kDesksGuidsList[] = "ash.desks.desks_guids_list"; +// A list containing the lacros profile ID associations for desks in the same +// order of the desks in the overview desks bar. This is used so that desk <-> +// profile associations can be restored. The profile IDs are logically unsigned +// integers, but stored as strings since they can (and will) be 64-bits large. +inline constexpr char kDesksLacrosProfileIdList[] = + "ash.desks.desks_lacros_profile_id_list"; // This list stores the metrics of virtual desks. Like |kDesksNamesList|, this // list stores entries in the same order of the desks in the overview desks bar. // Values are stored as dictionaries.
diff --git a/ash/in_session_auth/auth_dialog_contents_view.cc b/ash/in_session_auth/auth_dialog_contents_view.cc index d0fc5bb..ce24598 100644 --- a/ash/in_session_auth/auth_dialog_contents_view.cc +++ b/ash/in_session_auth/auth_dialog_contents_view.cc
@@ -26,8 +26,6 @@ #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/compositor/layer.h" @@ -106,14 +104,10 @@ // Consists of fingerprint icon view and a label. class AuthDialogContentsView::FingerprintView : public views::View { - METADATA_HEADER(FingerprintView, views::View) - public: // Use a subclass that inherit views::Label so that GetAccessibleNodeData // override is respected. class FingerprintLabel : public views::Label { - METADATA_HEADER(FingerprintLabel, views::Label) - public: // views::View void GetAccessibleNodeData(ui::AXNodeData* node_data) override { @@ -298,17 +292,7 @@ base::OneShotTimer reset_state_; }; -BEGIN_METADATA(AuthDialogContentsView, FingerprintView, views::View) -END_METADATA - -BEGIN_METADATA(AuthDialogContentsView::FingerprintView, - FingerprintLabel, - views::Label) -END_METADATA - class AuthDialogContentsView::TitleLabel : public views::Label { - METADATA_HEADER(TitleLabel, views::Label) - public: TitleLabel() { SetSubpixelRenderingEnabled(false); @@ -358,9 +342,6 @@ bool is_showing_error_ = false; }; -BEGIN_METADATA(AuthDialogContentsView, TitleLabel, views::Label) -END_METADATA - AuthDialogContentsView::AuthDialogContentsView( uint32_t auth_methods, const std::string& origin_name, @@ -730,7 +711,4 @@ WebAuthNDialogController::Get()->OpenInSessionAuthHelpPage(); } -BEGIN_METADATA(AuthDialogContentsView) -END_METADATA - } // namespace ash
diff --git a/ash/in_session_auth/auth_dialog_contents_view.h b/ash/in_session_auth/auth_dialog_contents_view.h index 5b26eea..eb1b68b 100644 --- a/ash/in_session_auth/auth_dialog_contents_view.h +++ b/ash/in_session_auth/auth_dialog_contents_view.h
@@ -10,7 +10,6 @@ #include "ash/ash_export.h" #include "ash/public/cpp/login_types.h" #include "base/memory/raw_ptr.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace views { @@ -30,8 +29,6 @@ // Contains the debug views that allows the developer to interact with the // AuthDialogController. class AuthDialogContentsView : public views::View { - METADATA_HEADER(AuthDialogContentsView, views::View) - public: // Flags which describe the set of currently visible auth methods. enum AuthMethods {
diff --git a/ash/login/ui/access_code_input.cc b/ash/login/ui/access_code_input.cc index 618cdb88..64bd7e66 100644 --- a/ash/login/ui/access_code_input.cc +++ b/ash/login/ui/access_code_input.cc
@@ -15,7 +15,6 @@ #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/color/color_id.h" #include "ui/compositor/layer.h" @@ -43,9 +42,6 @@ constexpr int kAccessCodeBetweenInputFieldsGapDp = 8; } // namespace -BEGIN_METADATA(AccessCodeInput) -END_METADATA - FlexCodeInput::FlexCodeInput(OnInputChange on_input_change, OnEnter on_enter, OnEscape on_escape, @@ -191,9 +187,6 @@ return false; } -BEGIN_METADATA(FlexCodeInput) -END_METADATA - AccessibleInputField::AccessibleInputField() : SystemTextfield(SystemTextfield::Type::kMedium) {} @@ -226,9 +219,6 @@ node_data->SetNameFrom(ax::mojom::NameFrom::kAttributeExplicitlyEmpty); } -BEGIN_METADATA(AccessibleInputField) -END_METADATA - FixedLengthCodeInput::FixedLengthCodeInput(int length, OnInputChange on_input_change, OnEnter on_enter, @@ -615,7 +605,4 @@ return ActiveField()->GetText(); } -BEGIN_METADATA(FixedLengthCodeInput) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/access_code_input.h b/ash/login/ui/access_code_input.h index 364bb7b03..bc1a7c1 100644 --- a/ash/login/ui/access_code_input.h +++ b/ash/login/ui/access_code_input.h
@@ -10,7 +10,6 @@ #include "ash/style/system_textfield.h" #include "base/memory/raw_ptr.h" #include "third_party/abseil-cpp/absl/types/optional.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/color/color_id.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/controls/textfield/textfield_controller.h" @@ -22,8 +21,6 @@ namespace ash { class AccessCodeInput : public views::View, public views::TextfieldController { - METADATA_HEADER(AccessCodeInput, views::View) - public: static constexpr int kAccessCodeInputFieldUnderlineThicknessDp = 2; static constexpr int kAccessCodeInputFieldHeightDp = @@ -57,8 +54,6 @@ }; class FlexCodeInput : public AccessCodeInput { - METADATA_HEADER(FlexCodeInput, AccessCodeInput) - public: using OnInputChange = base::RepeatingCallback<void(bool enable_submit)>; using OnEnter = base::RepeatingClosure; @@ -128,8 +123,6 @@ // Accessible input field for a single digit in fixed length codes. // Customizes field description and focus behavior. class AccessibleInputField : public SystemTextfield { - METADATA_HEADER(AccessibleInputField, SystemTextfield) - public: AccessibleInputField(); @@ -148,8 +141,6 @@ // Digital access code input view for variable length of input codes. // Displays a separate underscored field for every input code digit. class FixedLengthCodeInput : public AccessCodeInput { - METADATA_HEADER(FixedLengthCodeInput, AccessCodeInput) - public: using OnInputChange = base::RepeatingCallback<void(bool last_field_active, bool complete)>;
diff --git a/ash/login/ui/animated_auth_factors_label_wrapper.cc b/ash/login/ui/animated_auth_factors_label_wrapper.cc index 975cd43..bb674cd 100644 --- a/ash/login/ui/animated_auth_factors_label_wrapper.cc +++ b/ash/login/ui/animated_auth_factors_label_wrapper.cc
@@ -10,8 +10,6 @@ #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_sequence.h" #include "ui/compositor/layer_animator.h" @@ -41,8 +39,6 @@ constexpr int kLabelWrapperHeightDp = kLabelMaxLines * kLabelLineHeightDp; class AuthFactorsLabel : public views::Label { - METADATA_HEADER(AuthFactorsLabel, views::Label) - public: AuthFactorsLabel(bool visible_to_screen_reader) : visible_to_screen_reader_(visible_to_screen_reader) { @@ -81,9 +77,6 @@ bool visible_to_screen_reader_ = true; }; -BEGIN_METADATA(AuthFactorsLabel) -END_METADATA - } // namespace AnimatedAuthFactorsLabelWrapper::AnimatedAuthFactorsLabelWrapper() { @@ -205,7 +198,4 @@ return gfx::Size(kAuthFactorsViewWidthDp, kLabelWrapperHeightDp); } -BEGIN_METADATA(AnimatedAuthFactorsLabelWrapper) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/animated_auth_factors_label_wrapper.h b/ash/login/ui/animated_auth_factors_label_wrapper.h index 2dc6593..8457cfd 100644 --- a/ash/login/ui/animated_auth_factors_label_wrapper.h +++ b/ash/login/ui/animated_auth_factors_label_wrapper.h
@@ -10,7 +10,6 @@ #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/timer/timer.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace views { @@ -21,8 +20,6 @@ // TODO(b/216696664): Add unit tests for this class. class ASH_EXPORT AnimatedAuthFactorsLabelWrapper : public views::View { - METADATA_HEADER(AnimatedAuthFactorsLabelWrapper, views::View) - public: AnimatedAuthFactorsLabelWrapper(); AnimatedAuthFactorsLabelWrapper(const AnimatedAuthFactorsLabelWrapper&) =
diff --git a/ash/login/ui/animated_rounded_image_view.cc b/ash/login/ui/animated_rounded_image_view.cc index e5d2daf..dea96b50 100644 --- a/ash/login/ui/animated_rounded_image_view.cc +++ b/ash/login/ui/animated_rounded_image_view.cc
@@ -10,7 +10,6 @@ #include "base/numerics/ranges.h" #include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkPath.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/skia_conversions.h" #include "ui/gfx/image/image_skia_operations.h" @@ -151,7 +150,4 @@ } } -BEGIN_METADATA(AnimatedRoundedImageView) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/animated_rounded_image_view.h b/ash/login/ui/animated_rounded_image_view.h index 630d05ad..8f87fdd 100644 --- a/ash/login/ui/animated_rounded_image_view.h +++ b/ash/login/ui/animated_rounded_image_view.h
@@ -11,7 +11,6 @@ #include "ash/ash_export.h" #include "ash/login/ui/animation_frame.h" #include "base/timer/timer.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/image/image_skia.h" #include "ui/views/view.h" @@ -20,8 +19,6 @@ // A custom image view with rounded edges. class ASH_EXPORT AnimatedRoundedImageView : public views::View { - METADATA_HEADER(AnimatedRoundedImageView, views::View) - public: enum class Playback { kFirstFrameOnly, // Only the first frame in the animation will be shown.
diff --git a/ash/login/ui/login_base_bubble_view.cc b/ash/login/ui/login_base_bubble_view.cc index e4315c7..f86d5ff 100644 --- a/ash/login/ui/login_base_bubble_view.cc +++ b/ash/login/ui/login_base_bubble_view.cc
@@ -19,7 +19,6 @@ #include "ui/accessibility/ax_enums.mojom.h" #include "ui/aura/client/focus_change_observer.h" #include "ui/aura/client/focus_client.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" @@ -393,7 +392,4 @@ } } -BEGIN_METADATA(LoginBaseBubbleView) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/login_base_bubble_view.h b/ash/login/ui/login_base_bubble_view.h index b3a2dd30..abee7d8d 100644 --- a/ash/login/ui/login_base_bubble_view.h +++ b/ash/login/ui/login_base_bubble_view.h
@@ -9,7 +9,6 @@ #include "ash/login/ui/login_button.h" #include "ash/style/system_shadow.h" #include "base/memory/weak_ptr.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/view.h" @@ -22,8 +21,6 @@ // Base bubble view for login screen bubbles. class ASH_EXPORT LoginBaseBubbleView : public views::View, public ui::LayerAnimationObserver { - METADATA_HEADER(LoginBaseBubbleView, views::View) - public: enum class PositioningStrategy { // Try to show the bubble after the anchor (on the right side in LTR), if
diff --git a/ash/login/ui/login_password_view.cc b/ash/login/ui/login_password_view.cc index 72db0cb..871f1a3 100644 --- a/ash/login/ui/login_password_view.cc +++ b/ash/login/ui/login_password_view.cc
@@ -29,7 +29,6 @@ #include "chromeos/constants/chromeos_features.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" @@ -145,8 +144,6 @@ // The login password row contains the password textfield and different buttons // and indicators (display password, caps lock enabled). class LoginPasswordView::LoginPasswordRow : public views::View { - METADATA_HEADER(LoginPasswordRow, views::View) - public: explicit LoginPasswordRow() { const bool is_jelly = chromeos::features::IsJellyEnabled(); @@ -166,14 +163,9 @@ LoginPasswordRow& operator=(const LoginPasswordRow&) = delete; }; -BEGIN_METADATA(LoginPasswordView, LoginPasswordRow, views::View) -END_METADATA - // A textfield that selects all text on focus and allows to switch between // show/hide password modes. class LoginPasswordView::LoginTextfield : public views::Textfield { - METADATA_HEADER(LoginTextfield, views::Textfield) - public: LoginTextfield(base::RepeatingClosure on_focus_closure, base::RepeatingClosure on_blur_closure) @@ -254,13 +246,8 @@ base::RepeatingClosure on_tab_focus_closure_; }; -BEGIN_METADATA(LoginPasswordView, LoginTextfield, views::Textfield) -END_METADATA - class LoginPasswordView::DisplayPasswordButton : public views::ToggleImageButton { - METADATA_HEADER(DisplayPasswordButton, views::ToggleImageButton) - public: explicit DisplayPasswordButton(views::Button::PressedCallback callback) : ToggleImageButton(std::move(callback)) { @@ -298,11 +285,6 @@ ~DisplayPasswordButton() override = default; }; -BEGIN_METADATA(LoginPasswordView, - DisplayPasswordButton, - views::ToggleImageButton) -END_METADATA - LoginPasswordView::TestApi::TestApi(LoginPasswordView* view) : view_(view) {} LoginPasswordView::TestApi::~TestApi() = default;
diff --git a/ash/login/ui/login_pin_input_view.cc b/ash/login/ui/login_pin_input_view.cc index 4601d0e..bff3e06 100644 --- a/ash/login/ui/login_pin_input_view.cc +++ b/ash/login/ui/login_pin_input_view.cc
@@ -19,8 +19,6 @@ #include "ui/accessibility/ax_enums.mojom-shared.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_type.h" #include "ui/gfx/geometry/size.h" @@ -44,8 +42,6 @@ // A FixedLengthCodeInput that is always obscured and // has some special focus handling. class LoginPinInput : public FixedLengthCodeInput { - METADATA_HEADER(LoginPinInput, FixedLengthCodeInput) - public: LoginPinInput(int length, LoginPinInputView::OnPinSubmit on_submit, @@ -150,9 +146,6 @@ IDS_ASH_LOGIN_POD_PASSWORD_PIN_INPUT_ACCESSIBLE_NAME)); } -BEGIN_METADATA(LoginPinInput) -END_METADATA - const int LoginPinInputView::kDefaultLength = 6; LoginPinInputView::TestApi::TestApi(LoginPinInputView* view) : view_(view) { @@ -312,7 +305,4 @@ } } -BEGIN_METADATA(LoginPinInputView) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/login_pin_input_view.h b/ash/login/ui/login_pin_input_view.h index 0973df0..2927b2e3 100644 --- a/ash/login/ui/login_pin_input_view.h +++ b/ash/login/ui/login_pin_input_view.h
@@ -10,7 +10,6 @@ #include "ash/login/ui/non_accessible_view.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/views/view.h" @@ -35,8 +34,6 @@ // class ASH_EXPORT LoginPinInputView : public views::View, public ui::ImplicitAnimationObserver { - METADATA_HEADER(LoginPinInputView, views::View) - public: using OnPinSubmit = base::RepeatingCallback<void(const std::u16string& pin)>; using OnPinChanged = base::RepeatingCallback<void(bool is_empty)>;
diff --git a/ash/login/ui/login_pin_view.cc b/ash/login/ui/login_pin_view.cc index 3343952f..09d2180d 100644 --- a/ash/login/ui/login_pin_view.cc +++ b/ash/login/ui/login_pin_view.cc
@@ -22,8 +22,6 @@ #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/events/base_event_utils.h" #include "ui/events/keycodes/dom/dom_code.h" @@ -90,8 +88,6 @@ // A base class for pin button in the pin keyboard. class BasePinButton : public views::View { - METADATA_HEADER(BasePinButton, views::View) - public: BasePinButton(const gfx::Size& size, const std::u16string& accessible_name, @@ -209,15 +205,10 @@ base::RepeatingClosure on_press_; }; -BEGIN_METADATA(BasePinButton) -END_METADATA - } // namespace // A PIN button that displays a digit number and corresponding letter mapping. class LoginPinView::DigitPinButton : public BasePinButton { - METADATA_HEADER(DigitPinButton, BasePinButton) - public: DigitPinButton(int value, bool show_sub_label, @@ -261,13 +252,8 @@ raw_ptr<views::Label, ExperimentalAsh> sub_label_ = nullptr; }; -BEGIN_METADATA(LoginPinView, DigitPinButton, BasePinButton) -END_METADATA - // A PIN button that displays backspace icon. class LoginPinView::BackspacePinButton : public BasePinButton { - METADATA_HEADER(BackspacePinButton, BasePinButton) - public: BackspacePinButton(const gfx::Size& size, const base::RepeatingClosure& on_press) @@ -407,13 +393,8 @@ base::Unretained(this))); }; -BEGIN_METADATA(LoginPinView, BackspacePinButton, BasePinButton) -END_METADATA - // A PIN button to press to submit the PIN / password. class LoginPinView::SubmitPinButton : public BasePinButton { - METADATA_HEADER(SubmitPinButton, BasePinButton) - public: SubmitPinButton(const gfx::Size& size, const base::RepeatingClosure& on_press) : BasePinButton(size, @@ -443,9 +424,6 @@ base::Unretained(this))); }; -BEGIN_METADATA(LoginPinView, SubmitPinButton, BasePinButton) -END_METADATA - // static gfx::Size LoginPinView::TestApi::GetButtonSize(Style style) { return gfx::Size(kButtonWidthDp, kButtonHeightDp); @@ -559,7 +537,4 @@ return row; } -BEGIN_METADATA(LoginPinView) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/login_pin_view.h b/ash/login/ui/login_pin_view.h index 528a278a..b1299b6 100644 --- a/ash/login/ui/login_pin_view.h +++ b/ash/login/ui/login_pin_view.h
@@ -13,7 +13,6 @@ #include "base/functional/callback.h" #include "base/functional/callback_helpers.h" #include "base/memory/raw_ptr.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace base { @@ -51,8 +50,6 @@ // The submit button is optional. // class ASH_EXPORT LoginPinView : public NonAccessibleView { - METADATA_HEADER(LoginPinView, NonAccessibleView) - public: // Visual style of PIN keyboard. enum class Style {
diff --git a/ash/login/ui/login_remove_account_dialog.cc b/ash/login/ui/login_remove_account_dialog.cc index b3ecf4c..b919ff3 100644 --- a/ash/login/ui/login_remove_account_dialog.cc +++ b/ash/login/ui/login_remove_account_dialog.cc
@@ -18,8 +18,6 @@ #include "chromeos/strings/grit/chromeos_strings.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/display/display.h" #include "ui/display/screen.h" @@ -77,8 +75,6 @@ // A system label button that dismisses its bubble dialog parent on key event. class RemoveUserButton : public PillButton { - METADATA_HEADER(RemoveUserButton, PillButton) - public: RemoveUserButton(PressedCallback callback, LoginRemoveAccountDialog* bubble) : PillButton(std::move(callback), @@ -117,9 +113,6 @@ raw_ptr<LoginRemoveAccountDialog, ExperimentalAsh> bubble_; }; -BEGIN_METADATA(RemoveUserButton) -END_METADATA - LoginRemoveAccountDialog::TestApi::TestApi(LoginRemoveAccountDialog* bubble) : bubble_(bubble) {} @@ -335,7 +328,4 @@ } } -BEGIN_METADATA(LoginRemoveAccountDialog) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/login_remove_account_dialog.h b/ash/login/ui/login_remove_account_dialog.h index fb1749b..6951553 100644 --- a/ash/login/ui/login_remove_account_dialog.h +++ b/ash/login/ui/login_remove_account_dialog.h
@@ -12,7 +12,6 @@ #include "ash/login/ui/login_button.h" #include "base/memory/raw_ptr.h" #include "components/user_manager/user_type.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/label.h" #include "ui/views/focus/focus_search.h" #include "ui/views/view.h" @@ -24,8 +23,6 @@ class ASH_EXPORT LoginRemoveAccountDialog : public LoginBaseBubbleView, public views::FocusTraversable { - METADATA_HEADER(LoginRemoveAccountDialog, LoginBaseBubbleView) - public: class TestApi { public:
diff --git a/ash/login/ui/non_accessible_view.cc b/ash/login/ui/non_accessible_view.cc index b18eb488..7b6ecea 100644 --- a/ash/login/ui/non_accessible_view.cc +++ b/ash/login/ui/non_accessible_view.cc
@@ -6,7 +6,6 @@ #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" -#include "ui/base/metadata/metadata_impl_macros.h" namespace ash { @@ -20,15 +19,12 @@ NonAccessibleView::~NonAccessibleView() = default; -std::string NonAccessibleView::GetObjectName() const { - return name_; +const char* NonAccessibleView::GetClassName() const { + return name_.c_str(); } void NonAccessibleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { node_data->AddState(ax::mojom::State::kInvisible); } -BEGIN_METADATA(NonAccessibleView) -END_METADATA - } // namespace ash \ No newline at end of file
diff --git a/ash/login/ui/non_accessible_view.h b/ash/login/ui/non_accessible_view.h index 3e688b4..e6bfa18 100644 --- a/ash/login/ui/non_accessible_view.h +++ b/ash/login/ui/non_accessible_view.h
@@ -8,15 +8,12 @@ #include <string> #include "ash/ash_export.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { // A views::View instance that is not shown in the accessibility hierarchy. class ASH_EXPORT NonAccessibleView : public views::View { - METADATA_HEADER(NonAccessibleView, views::View) - public: NonAccessibleView(); explicit NonAccessibleView(const std::string& name); @@ -27,7 +24,7 @@ ~NonAccessibleView() override; // views::View: - std::string GetObjectName() const override; + const char* GetClassName() const override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; private:
diff --git a/ash/login/ui/note_action_launch_button.cc b/ash/login/ui/note_action_launch_button.cc index ef27a89..0c88ecc1 100644 --- a/ash/login/ui/note_action_launch_button.cc +++ b/ash/login/ui/note_action_launch_button.cc
@@ -16,8 +16,6 @@ #include "base/i18n/rtl.h" #include "base/memory/raw_ptr.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" @@ -103,8 +101,6 @@ // The (background) view that paints and animates the note action bubble. class NoteActionLaunchButton::BackgroundView : public NonAccessibleView { - METADATA_HEADER(BackgroundView, NonAccessibleView) - public: // NOTE: the background layer is set to the large bubble bounds and scaled // down when needed. @@ -165,9 +161,6 @@ BubbleLayerDelegate background_layer_delegate_; }; -BEGIN_METADATA(NoteActionLaunchButton, BackgroundView, NonAccessibleView) -END_METADATA - // The event target delegate used for the note action view. It matches the // shape of the bubble with the provided radius. class BubbleTargeterDelegate : public views::MaskedTargeterDelegate { @@ -196,8 +189,6 @@ // the (small) bubble shape centered in the top right corner of the action // button bounds. class NoteActionLaunchButton::ActionButton : public views::ImageButton { - METADATA_HEADER(ActionButton, views::ImageButton) - public: explicit ActionButton(NoteActionLaunchButton::BackgroundView* background) : views::ImageButton(base::BindRepeating(&ActionButton::ButtonPressed, @@ -352,9 +343,6 @@ bool tracking_activation_gesture_ = false; }; -BEGIN_METADATA(NoteActionLaunchButton, ActionButton, views::ImageButton) -END_METADATA - NoteActionLaunchButton::TestApi::TestApi(NoteActionLaunchButton* launch_button) : launch_button_(launch_button) {} @@ -388,7 +376,4 @@ SetVisible(action_state == mojom::TrayActionState::kAvailable); } -BEGIN_METADATA(NoteActionLaunchButton) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/note_action_launch_button.h b/ash/login/ui/note_action_launch_button.h index fc6e7c92..c8f92497 100644 --- a/ash/login/ui/note_action_launch_button.h +++ b/ash/login/ui/note_action_launch_button.h
@@ -11,7 +11,6 @@ #include "ash/tray_action/tray_action.h" #include "ash/tray_action/tray_action_observer.h" #include "base/memory/raw_ptr.h" -#include "ui/base/metadata/metadata_header_macros.h" namespace ash { @@ -28,8 +27,6 @@ // (the view observes the action availability using login data dispatcher, and // updates itself accordingly). class ASH_EXPORT NoteActionLaunchButton : public NonAccessibleView { - METADATA_HEADER(NoteActionLaunchButton, NonAccessibleView) - public: // Used by tests to get internal implementation details. class ASH_EXPORT TestApi {
diff --git a/ash/login/ui/public_account_monitoring_info_dialog.cc b/ash/login/ui/public_account_monitoring_info_dialog.cc index 9ff511ee..1ed96466 100644 --- a/ash/login/ui/public_account_monitoring_info_dialog.cc +++ b/ash/login/ui/public_account_monitoring_info_dialog.cc
@@ -7,8 +7,6 @@ #include "ash/login/ui/login_expanded_public_account_view.h" #include "ash/strings/grit/ash_strings.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/canvas.h" #include "ui/views/border.h" #include "ui/views/bubble/bubble_frame_view.h" @@ -30,8 +28,6 @@ kDialogWidthDp - kBulletContainerSizeDp - 2 * kDialogContentMarginDp; class BulletView : public views::View { - METADATA_HEADER(BulletView, views::View) - public: explicit BulletView(SkColor color, int radius) : color_(color), radius_(radius) {} @@ -59,9 +55,6 @@ int radius_; }; -BEGIN_METADATA(BulletView) -END_METADATA - } // namespace PublicAccountMonitoringInfoDialog::PublicAccountMonitoringInfoDialog( @@ -143,7 +136,4 @@ return {kDialogWidthDp, GetHeightForWidth(kDialogWidthDp)}; } -BEGIN_METADATA(PublicAccountMonitoringInfoDialog) -END_METADATA - } // namespace ash
diff --git a/ash/login/ui/public_account_monitoring_info_dialog.h b/ash/login/ui/public_account_monitoring_info_dialog.h index 3c79cae9..4a29869 100644 --- a/ash/login/ui/public_account_monitoring_info_dialog.h +++ b/ash/login/ui/public_account_monitoring_info_dialog.h
@@ -7,7 +7,6 @@ #include "ash/ash_export.h" #include "base/memory/weak_ptr.h" -#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/window/dialog_delegate.h" namespace ash { @@ -18,8 +17,6 @@ // present on the public account expanded view. class ASH_EXPORT PublicAccountMonitoringInfoDialog : public views::DialogDelegateView { - METADATA_HEADER(PublicAccountMonitoringInfoDialog, views::DialogDelegateView) - public: explicit PublicAccountMonitoringInfoDialog( base::WeakPtr<LoginExpandedPublicAccountView> controller);
diff --git a/ash/login/ui/views_utils.cc b/ash/login/ui/views_utils.cc index 03fdc186..dcbc736 100644 --- a/ash/login/ui/views_utils.cc +++ b/ash/login/ui/views_utils.cc
@@ -10,8 +10,6 @@ #include "ash/public/cpp/shelf_config.h" #include "ash/style/ash_color_provider.h" #include "base/ranges/algorithm.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_id.h" #include "ui/display/display.h" #include "ui/display/screen.h" @@ -30,8 +28,6 @@ class ContainerView : public NonAccessibleView, public views::ViewTargeterDelegate { - METADATA_HEADER(ContainerView, NonAccessibleView) - public: ContainerView() { SetEventTargeter(std::make_unique<views::ViewTargeter>(this)); @@ -56,9 +52,6 @@ } }; -BEGIN_METADATA(ContainerView) -END_METADATA - } // namespace namespace login_views_utils {
diff --git a/ash/public/cpp/BUILD.gn b/ash/public/cpp/BUILD.gn index 83675bf..179fc88 100644 --- a/ash/public/cpp/BUILD.gn +++ b/ash/public/cpp/BUILD.gn
@@ -508,6 +508,7 @@ "app_list/app_list_config_provider_unittest.cc", "file_preview/file_preview_factory_unittest.cc", "file_preview/file_preview_unittest.cc", + "holding_space/holding_space_controller_unittest.cc", "holding_space/holding_space_image_unittest.cc", "holding_space/holding_space_item_unittest.cc", "holding_space/holding_space_model_unittest.cc",
diff --git a/ash/public/cpp/ash_view_ids.h b/ash/public/cpp/ash_view_ids.h index 5f58144..7b1c3d4 100644 --- a/ash/public/cpp/ash_view_ids.h +++ b/ash/public/cpp/ash_view_ids.h
@@ -101,9 +101,6 @@ VIEW_ID_SA_NOTIFICATION_TRAY, VIEW_ID_SA_MAX = VIEW_ID_SA_NOTIFICATION_TRAY, - // Sticky header rows in a scroll view. - VIEW_ID_STICKY_HEADER, - // System dialog delegate view: VIEW_ID_STYLE_SYSTEM_DIALOG_DELEGATE_ACCEPT_BUTTON, VIEW_ID_STYLE_SYSTEM_DIALOG_DELEGATE_CANCEL_BUTTON,
diff --git a/ash/public/cpp/holding_space/BUILD.gn b/ash/public/cpp/holding_space/BUILD.gn index 944a6af..edd3572 100644 --- a/ash/public/cpp/holding_space/BUILD.gn +++ b/ash/public/cpp/holding_space/BUILD.gn
@@ -12,6 +12,8 @@ sources = [ "mock_holding_space_client.cc", "mock_holding_space_client.h", + "mock_holding_space_controller_observer.cc", + "mock_holding_space_controller_observer.h", "mock_holding_space_model_observer.cc", "mock_holding_space_model_observer.h", ]
diff --git a/ash/public/cpp/holding_space/holding_space_controller.cc b/ash/public/cpp/holding_space/holding_space_controller.cc index 63e0a0b..3cf76c4a 100644 --- a/ash/public/cpp/holding_space/holding_space_controller.cc +++ b/ash/public/cpp/holding_space/holding_space_controller.cc
@@ -7,6 +7,7 @@ #include "ash/public/cpp/holding_space/holding_space_controller_observer.h" #include "ash/public/cpp/session/session_controller.h" #include "base/check.h" +#include "base/check_is_test.h" namespace ash { @@ -47,17 +48,31 @@ CHECK(!g_instance); g_instance = this; - SessionController::Get()->AddObserver(this); + // `SessionController` may not exist during tests. + if (auto* session_controller = SessionController::Get()) { + session_controller->AddObserver(this); + } else { + CHECK_IS_TEST(); + } } HoldingSpaceController::~HoldingSpaceController() { CHECK_EQ(g_instance, this); + for (auto& observer : observers_) { + observer.OnHoldingSpaceControllerDestroying(); + } + SetClient(nullptr); SetModel(nullptr); g_instance = nullptr; - SessionController::Get()->RemoveObserver(this); + // `SessionController` may not exist during tests. + if (auto* session_controller = SessionController::Get()) { + session_controller->RemoveObserver(this); + } else { + CHECK_IS_TEST(); + } } // static
diff --git a/ash/public/cpp/holding_space/holding_space_controller_observer.h b/ash/public/cpp/holding_space/holding_space_controller_observer.h index a6b40bcf..eb2e25a 100644 --- a/ash/public/cpp/holding_space/holding_space_controller_observer.h +++ b/ash/public/cpp/holding_space/holding_space_controller_observer.h
@@ -16,6 +16,9 @@ class ASH_PUBLIC_EXPORT HoldingSpaceControllerObserver : public base::CheckedObserver { public: + // Called when `HoldingSpaceController` is being destroyed. + virtual void OnHoldingSpaceControllerDestroying() {} + // Called when a model gets attached to the HoldingSpaceController. virtual void OnHoldingSpaceModelAttached(HoldingSpaceModel* model) {}
diff --git a/ash/public/cpp/holding_space/holding_space_controller_unittest.cc b/ash/public/cpp/holding_space/holding_space_controller_unittest.cc new file mode 100644 index 0000000..ca1fd93d --- /dev/null +++ b/ash/public/cpp/holding_space/holding_space_controller_unittest.cc
@@ -0,0 +1,30 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/public/cpp/holding_space/holding_space_controller.h" + +#include "ash/public/cpp/holding_space/mock_holding_space_controller_observer.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ash { + +// HoldingSpaceControllerObserverTest ------------------------------------------ + +// Base class for tests of the `HoldingSpaceController` that make sure it fires +// all observer methods as appropriate. +// TODO(http://b/260612195): Add all `HoldingSpaceControllerObserver` methods to +// this test suite. +using HoldingSpaceControllerObserverTest = testing::Test; + +// Tests ----------------------------------------------------------------------- + +TEST_F(HoldingSpaceControllerObserverTest, Destruction) { + auto controller = std::make_unique<HoldingSpaceController>(); + MockHoldingSpaceControllerObserver observer; + controller->AddObserver(&observer); + EXPECT_CALL(observer, OnHoldingSpaceControllerDestroying()); + controller.reset(); +} + +} // namespace ash
diff --git a/ash/public/cpp/holding_space/mock_holding_space_controller_observer.cc b/ash/public/cpp/holding_space/mock_holding_space_controller_observer.cc new file mode 100644 index 0000000..f895cd4 --- /dev/null +++ b/ash/public/cpp/holding_space/mock_holding_space_controller_observer.cc
@@ -0,0 +1,17 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/public/cpp/holding_space/mock_holding_space_controller_observer.h" + +#include "ash/public/cpp/holding_space/holding_space_controller.h" + +namespace ash { + +MockHoldingSpaceControllerObserver::MockHoldingSpaceControllerObserver() = + default; + +MockHoldingSpaceControllerObserver::~MockHoldingSpaceControllerObserver() = + default; + +} // namespace ash
diff --git a/ash/public/cpp/holding_space/mock_holding_space_controller_observer.h b/ash/public/cpp/holding_space/mock_holding_space_controller_observer.h new file mode 100644 index 0000000..d06a219 --- /dev/null +++ b/ash/public/cpp/holding_space/mock_holding_space_controller_observer.h
@@ -0,0 +1,31 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_PUBLIC_CPP_HOLDING_SPACE_MOCK_HOLDING_SPACE_CONTROLLER_OBSERVER_H_ +#define ASH_PUBLIC_CPP_HOLDING_SPACE_MOCK_HOLDING_SPACE_CONTROLLER_OBSERVER_H_ + +#include "ash/public/cpp/holding_space/holding_space_controller_observer.h" + +#include "testing/gmock/include/gmock/gmock.h" + +namespace ash { + +// An implementation of `HoldingSpaceControllerObserver` that enables its +// methods to be mocked. +class MockHoldingSpaceControllerObserver + : public HoldingSpaceControllerObserver { + public: + MockHoldingSpaceControllerObserver(); + ~MockHoldingSpaceControllerObserver() override; + + // HoldingSpaceControllerObserver: + MOCK_METHOD(void, OnHoldingSpaceControllerDestroying, (), (override)); + MOCK_METHOD(void, + OnHoldingSpaceTrayBubbleVisibilityChanged, + (const HoldingSpaceTray*, bool), + (override)); +}; +} // namespace ash + +#endif // ASH_PUBLIC_CPP_HOLDING_SPACE_MOCK_HOLDING_SPACE_CONTROLLER_OBSERVER_H_
diff --git a/ash/public/cpp/shelf_item.h b/ash/public/cpp/shelf_item.h index 2b62097..9acd659 100644 --- a/ash/public/cpp/shelf_item.h +++ b/ash/public/cpp/shelf_item.h
@@ -28,7 +28,7 @@ // Image to display in the shelf. gfx::ImageSkia image; // Whether the image for this shelf item is a placeholder image. - bool has_placeholder_icon; + bool has_placeholder_icon = false; // If set, an image to be displayed as a badge on the main shelf image. gfx::ImageSkia badge_image;
diff --git a/ash/shelf/shelf_app_button.cc b/ash/shelf/shelf_app_button.cc index 5f41176..86a2ac79 100644 --- a/ash/shelf/shelf_app_button.cc +++ b/ash/shelf/shelf_app_button.cc
@@ -10,6 +10,7 @@ #include "ash/constants/ash_features.h" #include "ash/public/cpp/shelf_config.h" #include "ash/public/cpp/shelf_model.h" +#include "ash/resources/vector_icons/vector_icons.h" #include "ash/shelf/scrollable_shelf_view.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_button_delegate.h" @@ -526,33 +527,13 @@ image, icon_shadows_)); } -void ShelfAppButton::SetImage(const gfx::ImageSkia& image) { - if (image.isNull()) { - // TODO: need an empty image. - icon_view_->SetImage(image); - icon_image_ = gfx::ImageSkia(); - return; - } - icon_image_ = image; - - gfx::Size preferred_size = GetPreferredIconSize(); - +void ShelfAppButton::UpdateIconImage() { if (has_host_badge_) { - if (image.size() == preferred_size) { - icon_view_->SetImage(image); - return; - } - icon_view_->SetImage(gfx::ImageSkiaOperations::CreateResizedImage( - image, skia::ImageOperations::RESIZE_BEST, preferred_size)); + icon_view_->SetImage(GetIconImage()); return; } - if (image.size() == preferred_size) { - SetShadowedImage(image); - return; - } - SetShadowedImage(gfx::ImageSkiaOperations::CreateResizedImage( - image, skia::ImageOperations::RESIZE_BEST, preferred_size)); + SetShadowedImage(GetIconImage()); } gfx::ImageSkia ShelfAppButton::GetImage() const { @@ -560,12 +541,24 @@ } gfx::ImageSkia ShelfAppButton::GetIconImage() const { - const gfx::Size preferred_size = GetPreferredSize(); - if (icon_image_.size() == preferred_size) - return icon_image_; + gfx::ImageSkia icon_image; + if (icon_image_model_.IsImage()) { + icon_image = icon_image_model_.GetImage().AsImageSkia(); + } else if (icon_image_model_.IsVectorIcon()) { + auto* color_provider = GetColorProvider(); + if (!color_provider) { + color_provider = shelf_view_->GetColorProvider(); + } + icon_image = ui::ThemedVectorIcon(icon_image_model_.GetVectorIcon()) + .GetImageSkia(color_provider); + } + const gfx::Size preferred_size = GetPreferredIconSize(); + if (icon_image.size() == preferred_size) { + return icon_image; + } return gfx::ImageSkiaOperations::CreateResizedImage( - icon_image_, skia::ImageOperations::RESIZE_BEST, GetPreferredIconSize()); + icon_image, skia::ImageOperations::RESIZE_BEST, preferred_size); } void ShelfAppButton::SetHostBadgeImage(const gfx::ImageSkia& host_badge_image) { @@ -584,13 +577,21 @@ } void ShelfAppButton::SetMainAndMaybeHostBadgeImage( - const gfx::ImageSkia& image, + const gfx::ImageSkia& main_image, + bool has_placeholder_icon, const gfx::ImageSkia& host_badge_image) { // `has_host_badge_` needs to be set before SetImage(), since image size is // set depending on the boolean logic. has_host_badge_ = !host_badge_image.isNull(); - SetImage(image); + if (is_promise_app_ && has_placeholder_icon) { + icon_image_model_ = ui::ImageModel(ui::ImageModel::FromVectorIcon( + ash::kPlaceholderAppIcon, cros_tokens::kCrosSysPrimary)); + } else { + icon_image_model_ = + ui::ImageModel(ui::ImageModel::FromImageSkia(main_image)); + } SetHostBadgeImage(host_badge_image); + UpdateIconImage(); } void ShelfAppButton::AddState(State state) { @@ -721,16 +722,15 @@ else ClearState(ShelfAppButton::STATE_NOTIFICATION); - app_status_ = item.app_status; - is_promise_app_ = item.is_promise_app; package_id_ = item.package_id; // Progress is incremental always by server side implementation. Do not use // equal for comparing progress as float point errors may surface. - if (progress_ < item.progress) { + if (progress_ < item.progress || app_status_ != item.app_status) { progress_ = item.progress; + app_status_ = item.app_status; UpdateProgressRingBounds(); } @@ -1222,9 +1222,11 @@ : shelf_view_->GetButtonIconSize() * GetAdjustedIconScaleForProgressRing(); + const gfx::Size current_icon_size = icon_image_model_.Size(); + // Resize the image maintaining our aspect ratio. - float aspect_ratio = static_cast<float>(icon_image_.width()) / - static_cast<float>(icon_image_.height()); + float aspect_ratio = static_cast<float>(current_icon_size.width()) / + static_cast<float>(current_icon_size.height()); int height = icon_size; int width = static_cast<int>(aspect_ratio * height); if (width > icon_size) { @@ -1240,7 +1242,7 @@ if (scale_up) { icon_scale_ = kAppIconScale; - SetImage(icon_image_); + UpdateIconImage(); icon_view_->layer()->SetTransform(GetScaleTransform(kAppIconScale)); } ui::ScopedLayerAnimationSettings settings(icon_view_->layer()->GetAnimator()); @@ -1276,7 +1278,7 @@ void ShelfAppButton::OnImplicitAnimationsCompleted() { icon_scale_ = 1.0f; - SetImage(icon_image_); + UpdateIconImage(); icon_view_->layer()->SetTransform(gfx::Transform()); if (notification_indicator_) notification_indicator_->layer()->SetTransform(gfx::Transform());
diff --git a/ash/shelf/shelf_app_button.h b/ash/shelf/shelf_app_button.h index 28d2876..449f4db 100644 --- a/ash/shelf/shelf_app_button.h +++ b/ash/shelf/shelf_app_button.h
@@ -12,14 +12,12 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" +#include "ui/base/models/image_model.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/gfx/shadow_value.h" #include "ui/views/animation/ink_drop_observer.h" #include "ui/views/animation/ink_drop_state.h" - -namespace views { -class ImageView; -} // namespace views +#include "ui/views/controls/image_view.h" namespace ash { struct ShelfItem; @@ -70,17 +68,22 @@ ~ShelfAppButton() override; - // Sets the image to display for this entry. - void SetImage(const gfx::ImageSkia& image); + // Updates the icon image to display for this entry. + void UpdateIconImage(); // Retrieve the image to show proxy operations. gfx::ImageSkia GetImage() const; - // Gets the resized `icon_image_` without the shadow. + // Gets the resized icon image represented by `icon_image_model_` without the + // shadow. gfx::ImageSkia GetIconImage() const; - // Calls SetImage(), and SetHostBadgeImage() depending on `has_host_badge`. - void SetMainAndMaybeHostBadgeImage(const gfx::ImageSkia& image, + // Sets the `icon_image_model_` for this entry. If |is_placeholder_icon| is + // true, the |main_image| will be ignored and this entry will be assigned a + // placeholder vector icon. This method also SetHostBadgeImage() depending on + // `has_host_badge` and then calls into UpdateIconImage(). + void SetMainAndMaybeHostBadgeImage(const gfx::ImageSkia& main_image, + bool is_placeholder_icon, const gfx::ImageSkia& host_badge_image); // |state| is or'd into the current state. @@ -256,8 +259,8 @@ gfx::ShadowValues icon_shadows_; - // The bitmap image for this app button. - gfx::ImageSkia icon_image_; + // The model image for this app button. + ui::ImageModel icon_image_model_; // The bitmap image for the host badge icon if this is an App Shortcut. gfx::ImageSkia host_badge_image_;
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index 4136112..e939ce03 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc
@@ -1062,7 +1062,8 @@ void ShelfView::UpdateButton(ShelfAppButton* button, const ShelfItem& item) { button->ReflectItemStatus(item); - button->SetMainAndMaybeHostBadgeImage(item.image, item.badge_image); + button->SetMainAndMaybeHostBadgeImage(item.image, item.has_placeholder_icon, + item.badge_image); button->SetNotificationBadgeColor(item.notification_badge_color); button->SetAccessibleName(item.accessible_name); button->SchedulePaint();
diff --git a/ash/system/accessibility/switch_access/switch_access_menu_view.cc b/ash/system/accessibility/switch_access/switch_access_menu_view.cc index c8388ecd..e08c7267 100644 --- a/ash/system/accessibility/switch_access/switch_access_menu_view.cc +++ b/ash/system/accessibility/switch_access/switch_access_menu_view.cc
@@ -17,6 +17,7 @@ #include "ui/accessibility/accessibility_features.h" #include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/mojom/ax_node_data.mojom-shared.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/events/event.h" #include "ui/views/layout/table_layout.h" @@ -160,4 +161,7 @@ return "SwitchAccessMenuView"; } +BEGIN_METADATA(SwitchAccessMenuView) +END_METADATA + } // namespace ash
diff --git a/ash/system/accessibility/switch_access/switch_access_menu_view.h b/ash/system/accessibility/switch_access/switch_access_menu_view.h index 221dc7b..db7c071 100644 --- a/ash/system/accessibility/switch_access/switch_access_menu_view.h +++ b/ash/system/accessibility/switch_access/switch_access_menu_view.h
@@ -7,12 +7,15 @@ #include <vector> +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { // View for the Switch Access menu. class SwitchAccessMenuView : public views::View { + METADATA_HEADER(SwitchAccessMenuView, views::View) + public: SwitchAccessMenuView(); ~SwitchAccessMenuView() override;
diff --git a/ash/system/cast/cast_detailed_view.cc b/ash/system/cast/cast_detailed_view.cc index 2aa3bed0..927c7b4 100644 --- a/ash/system/cast/cast_detailed_view.cc +++ b/ash/system/cast/cast_detailed_view.cc
@@ -104,11 +104,9 @@ void CastDetailedView::OnDevicesUpdated( const std::vector<SinkAndRoute>& sinks_routes) { sinks_and_routes_.clear(); - // Add/update existing. - for (const auto& device : sinks_routes) { - sinks_and_routes_.insert(std::make_pair(device.sink.id, device)); + for (const auto& sink_and_route : sinks_routes) { + sinks_and_routes_.push_back(sink_and_route); } - // Update UI. UpdateReceiverListFromCachedData(); Layout(); @@ -130,8 +128,8 @@ // Add a view for each receiver. for (auto& it : sinks_and_routes_) { - const CastSink& sink = it.second.sink; - const CastRoute& route = it.second.route; + const CastSink& sink = it.sink; + const CastRoute& route = it.route; HoverHighlightView* container = AddScrollListItem( item_container, SinkIconTypeToIcon(sink.sink_icon_type), base::UTF8ToUTF16(sink.name));
diff --git a/ash/system/cast/cast_detailed_view.h b/ash/system/cast/cast_detailed_view.h index 19a6217..0c52716f 100644 --- a/ash/system/cast/cast_detailed_view.h +++ b/ash/system/cast/cast_detailed_view.h
@@ -85,8 +85,8 @@ // associated `route`. std::unique_ptr<PillButton> CreateFreezeButton(const CastRoute& route); - // A mapping from the sink id to the receiver/activity data. - std::map<std::string, SinkAndRoute> sinks_and_routes_; + // A list of the receiver/activity data. + std::vector<SinkAndRoute> sinks_and_routes_; // A mapping from the view pointer to the associated activity sink id. std::map<views::View*, std::string> view_to_sink_map_;
diff --git a/ash/system/cast/cast_zero_state_view.cc b/ash/system/cast/cast_zero_state_view.cc index 2b31f585..2a0b44c 100644 --- a/ash/system/cast/cast_zero_state_view.cc +++ b/ash/system/cast/cast_zero_state_view.cc
@@ -13,6 +13,7 @@ #include "ash/style/rounded_container.h" #include "ash/style/typography.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/views/border.h" @@ -68,4 +69,7 @@ subtitle->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); } +BEGIN_METADATA(CastZeroStateView) +END_METADATA + } // namespace ash
diff --git a/ash/system/cast/cast_zero_state_view.h b/ash/system/cast/cast_zero_state_view.h index caa4d9b..ce22b8c 100644 --- a/ash/system/cast/cast_zero_state_view.h +++ b/ash/system/cast/cast_zero_state_view.h
@@ -5,12 +5,15 @@ #ifndef ASH_SYSTEM_CAST_CAST_ZERO_STATE_VIEW_H_ #define ASH_SYSTEM_CAST_CAST_ZERO_STATE_VIEW_H_ +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { // The view shown in the system tray when there are no cast targets available. class CastZeroStateView : public views::View { + METADATA_HEADER(CastZeroStateView, views::View) + public: CastZeroStateView(); CastZeroStateView(const CastZeroStateView&) = delete;
diff --git a/ash/system/focus_mode/focus_mode_countdown_view.cc b/ash/system/focus_mode/focus_mode_countdown_view.cc index 44ed517..ee453a1 100644 --- a/ash/system/focus_mode/focus_mode_countdown_view.cc +++ b/ash/system/focus_mode/focus_mode_countdown_view.cc
@@ -10,6 +10,7 @@ #include "ash/system/focus_mode/focus_mode_controller.h" #include "ash/system/focus_mode/focus_mode_util.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/size.h" @@ -164,4 +165,7 @@ session_duration < focus_mode_util::kMaximumDuration); } +BEGIN_METADATA(FocusModeCountdownView) +END_METADATA + } // namespace ash
diff --git a/ash/system/focus_mode/focus_mode_countdown_view.h b/ash/system/focus_mode/focus_mode_countdown_view.h index 3940fad..ea9bd21 100644 --- a/ash/system/focus_mode/focus_mode_countdown_view.h +++ b/ash/system/focus_mode/focus_mode_countdown_view.h
@@ -6,6 +6,7 @@ #define ASH_SYSTEM_FOCUS_MODE_FOCUS_MODE_COUNTDOWN_VIEW_H_ #include "ash/system/focus_mode/focus_mode_controller.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/layout/flex_layout_view.h" namespace views { @@ -25,6 +26,8 @@ // is included. This view's parent needs to call `UpdateUI()` to first populate // the UI before it is shown for the first time, and on timer tick. class ASH_EXPORT FocusModeCountdownView : public views::FlexLayoutView { + METADATA_HEADER(FocusModeCountdownView, views::FlexLayoutView) + public: FocusModeCountdownView(bool include_end_button); FocusModeCountdownView(const FocusModeCountdownView&) = delete;
diff --git a/ash/system/focus_mode/focus_mode_feature_pod_controller.cc b/ash/system/focus_mode/focus_mode_feature_pod_controller.cc index c1f31c9a..c79bc1e6 100644 --- a/ash/system/focus_mode/focus_mode_feature_pod_controller.cc +++ b/ash/system/focus_mode/focus_mode_feature_pod_controller.cc
@@ -25,7 +25,6 @@ FocusModeFeaturePodController::FocusModeFeaturePodController( UnifiedSystemTrayController* tray_controller) : tray_controller_(tray_controller) { - CHECK(features::IsQsRevampEnabled()); CHECK(features::IsFocusModeEnabled()); FocusModeController::Get()->AddObserver(this); }
diff --git a/ash/system/focus_mode/focus_mode_feature_pod_controller_unittest.cc b/ash/system/focus_mode/focus_mode_feature_pod_controller_unittest.cc index 08afe18..e048abf 100644 --- a/ash/system/focus_mode/focus_mode_feature_pod_controller_unittest.cc +++ b/ash/system/focus_mode/focus_mode_feature_pod_controller_unittest.cc
@@ -23,7 +23,7 @@ public: FocusModeFeaturePodControllerTest() { feature_list_.InitWithFeatures( - /*enabled_features=*/{features::kFocusMode, features::kQsRevamp}, + /*enabled_features=*/{features::kFocusMode}, /*disabled_features=*/{}); } ~FocusModeFeaturePodControllerTest() override = default;
diff --git a/ash/system/focus_mode/focus_mode_tray.cc b/ash/system/focus_mode/focus_mode_tray.cc index 1e0fd1a..7639e13 100644 --- a/ash/system/focus_mode/focus_mode_tray.cc +++ b/ash/system/focus_mode/focus_mode_tray.cc
@@ -15,6 +15,7 @@ #include "ash/system/tray/tray_utils.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" namespace ash { @@ -147,4 +148,7 @@ ShowBubble(); } +BEGIN_METADATA(FocusModeTray) +END_METADATA + } // namespace ash
diff --git a/ash/system/focus_mode/focus_mode_tray.h b/ash/system/focus_mode/focus_mode_tray.h index e7df73c..99d9578 100644 --- a/ash/system/focus_mode/focus_mode_tray.h +++ b/ash/system/focus_mode/focus_mode_tray.h
@@ -8,6 +8,7 @@ #include "ash/system/focus_mode/focus_mode_controller.h" #include "ash/system/tray/tray_background_view.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash { @@ -20,6 +21,8 @@ // button is clicked. class FocusModeTray : public TrayBackgroundView, public FocusModeController::Observer { + METADATA_HEADER(FocusModeTray, TrayBackgroundView) + public: explicit FocusModeTray(Shelf* shelf); FocusModeTray(const FocusModeTray&) = delete;
diff --git a/ash/system/holding_space/downloads_section.cc b/ash/system/holding_space/downloads_section.cc index d541859..3c0bc30 100644 --- a/ash/system/holding_space/downloads_section.cc +++ b/ash/system/holding_space/downloads_section.cc
@@ -22,6 +22,8 @@ #include "base/i18n/rtl.h" #include "base/memory/raw_ptr.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/color/color_id.h" #include "ui/compositor/layer.h" @@ -52,6 +54,8 @@ // Header ---------------------------------------------------------------------- class Header : public views::Button { + METADATA_HEADER(Header, views::Button) + public: Header() { // Layout/Properties. @@ -111,6 +115,9 @@ raw_ptr<views::ImageView, ExperimentalAsh> chevron_ = nullptr; }; +BEGIN_METADATA(Header) +END_METADATA + } // namespace // DownloadsSection ------------------------------------------------------------ @@ -146,4 +153,7 @@ return std::make_unique<HoldingSpaceItemChipView>(delegate(), item); } +BEGIN_METADATA(DownloadsSection) +END_METADATA + } // namespace ash
diff --git a/ash/system/holding_space/downloads_section.h b/ash/system/holding_space/downloads_section.h index 797e2e7..d73a718 100644 --- a/ash/system/holding_space/downloads_section.h +++ b/ash/system/holding_space/downloads_section.h
@@ -8,11 +8,14 @@ #include <memory> #include "ash/system/holding_space/holding_space_item_views_section.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash { // Section for downloads in the `RecentFilesBubble`. class DownloadsSection : public HoldingSpaceItemViewsSection { + METADATA_HEADER(DownloadsSection, HoldingSpaceItemViewsSection) + public: explicit DownloadsSection(HoldingSpaceViewDelegate* delegate); DownloadsSection(const DownloadsSection& other) = delete;
diff --git a/ash/system/holding_space/holding_space_drag_util.cc b/ash/system/holding_space/holding_space_drag_util.cc index 7b62f66f..d832a24 100644 --- a/ash/system/holding_space/holding_space_drag_util.cc +++ b/ash/system/holding_space/holding_space_drag_util.cc
@@ -19,6 +19,8 @@ #include "base/i18n/rtl.h" #include "base/memory/raw_ptr.h" #include "base/ranges/algorithm.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_provider.h" #include "ui/compositor/canvas_painter.h" #include "ui/compositor/compositor.h" @@ -143,6 +145,8 @@ // this view is to implement the shadow which is intentionally done without use // of `ui::Layer`s to accommodate painting to an `SkBitmap`. class DragImageItemView : public views::View { + METADATA_HEADER(DragImageItemView, views::View) + public: DragImageItemView(const DragImageItemView&) = delete; DragImageItemView& operator=(const DragImageItemView&) = delete; @@ -184,11 +188,16 @@ const raw_ptr<const ui::ColorProvider, ExperimentalAsh> color_provider_; }; +BEGIN_METADATA(DragImageItemView) +END_METADATA + // DragImageItemChipView ------------------------------------------------------- // A `DragImageItemView` which represents a single holding space `item` as a // chip in the drag image for a collection of holding space item views. class DragImageItemChipView : public DragImageItemView { + METADATA_HEADER(DragImageItemChipView, DragImageItemView) + public: DragImageItemChipView(const HoldingSpaceItem* item, const ui::ColorProvider* color_provider) @@ -245,11 +254,16 @@ } }; +BEGIN_METADATA(DragImageItemChipView) +END_METADATA + // DragImageItemScreenCaptureView ---------------------------------------------- // A `DragImageItemView` which represents a single holding space screen capture // `item` in the drag image for a collection of holding space item views. class DragImageItemScreenCaptureView : public DragImageItemView { + METADATA_HEADER(DragImageItemScreenCaptureView, DragImageItemView) + public: DragImageItemScreenCaptureView(const HoldingSpaceItem* item, const ui::ColorProvider* color_provider) @@ -282,12 +296,17 @@ } }; +BEGIN_METADATA(DragImageItemScreenCaptureView) +END_METADATA + // DragImageOverflowBadge ------------------------------------------------------ // A `views::View` which indicates the number of items being dragged in the // drag image for a collection of holding space items. This view is only created // if the number of dragged items is > `kDragImageViewMaxItemsToPaint`. class DragImageOverflowBadge : public views::View { + METADATA_HEADER(DragImageOverflowBadge, views::View) + public: DragImageOverflowBadge(size_t count, const ui::ColorProvider* color_provider) : color_provider_(color_provider) { @@ -337,11 +356,16 @@ const raw_ptr<const ui::ColorProvider, ExperimentalAsh> color_provider_; }; +BEGIN_METADATA(DragImageOverflowBadge) +END_METADATA + // DragImageView --------------------------------------------------------------- // A `views::View` for use as a drag image for a collection of holding space // item `views`. This view expects to be painted to an `SkBitmap`. class DragImageView : public views::View { + METADATA_HEADER(DragImageView, views::View) + public: DragImageView(const std::vector<const HoldingSpaceItem*>& items, const ui::ColorProvider* color_provider) @@ -483,6 +507,9 @@ raw_ptr<views::View, ExperimentalAsh> drag_image_overflow_badge_ = nullptr; }; +BEGIN_METADATA(DragImageView) +END_METADATA + } // namespace // Utilities -------------------------------------------------------------------
diff --git a/ash/system/holding_space/holding_space_item_views_section.cc b/ash/system/holding_space/holding_space_item_views_section.cc index 93618dd..dfacc95 100644 --- a/ash/system/holding_space/holding_space_item_views_section.cc +++ b/ash/system/holding_space/holding_space_item_views_section.cc
@@ -15,6 +15,8 @@ #include "base/functional/bind.h" #include "base/functional/callback_helpers.h" #include "base/ranges/algorithm.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/callback_layer_animation_observer.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_observer.h" @@ -65,6 +67,8 @@ class HoldingSpaceScrollView : public views::ScrollView, public views::ViewObserver { + METADATA_HEADER(HoldingSpaceScrollView, views::ScrollView) + public: HoldingSpaceScrollView() { // `HoldingSpaceItemView`s draw a focus ring outside of their view bounds. @@ -115,6 +119,9 @@ this}; }; +BEGIN_METADATA(HoldingSpaceScrollView) +END_METADATA + } // namespace // HoldingSpaceItemViewsSection ------------------------------------------------ @@ -533,4 +540,7 @@ MaybeAnimateIn(); } +BEGIN_METADATA(HoldingSpaceItemViewsSection) +END_METADATA + } // namespace ash
diff --git a/ash/system/holding_space/holding_space_item_views_section.h b/ash/system/holding_space/holding_space_item_views_section.h index c618ea80..148198c 100644 --- a/ash/system/holding_space/holding_space_item_views_section.h +++ b/ash/system/holding_space/holding_space_item_views_section.h
@@ -15,6 +15,7 @@ #include "ash/public/cpp/holding_space/holding_space_section.h" #include "base/memory/raw_ptr.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ui { @@ -33,6 +34,8 @@ // A section of holding space item views in a `HoldingSpaceTrayChildBubble`. class ASH_EXPORT HoldingSpaceItemViewsSection : public views::View { + METADATA_HEADER(HoldingSpaceItemViewsSection, views::View) + public: HoldingSpaceItemViewsSection(HoldingSpaceViewDelegate* delegate, HoldingSpaceSectionId section_id);
diff --git a/ash/system/holding_space/holding_space_tray_child_bubble.cc b/ash/system/holding_space/holding_space_tray_child_bubble.cc index a1750deb..108e226 100644 --- a/ash/system/holding_space/holding_space_tray_child_bubble.cc +++ b/ash/system/holding_space/holding_space_tray_child_bubble.cc
@@ -17,6 +17,7 @@ #include "base/functional/bind.h" #include "base/ranges/algorithm.h" #include "chromeos/constants/chromeos_features.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/callback_layer_animation_observer.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_observer.h" @@ -504,4 +505,7 @@ } } +BEGIN_METADATA(HoldingSpaceTrayChildBubble) +END_METADATA + } // namespace ash
diff --git a/ash/system/holding_space/holding_space_tray_child_bubble.h b/ash/system/holding_space/holding_space_tray_child_bubble.h index b892047..19dc076 100644 --- a/ash/system/holding_space/holding_space_tray_child_bubble.h +++ b/ash/system/holding_space/holding_space_tray_child_bubble.h
@@ -15,6 +15,7 @@ #include "ash/public/cpp/holding_space/holding_space_model_observer.h" #include "base/memory/raw_ptr.h" #include "base/scoped_observation.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ui { @@ -32,6 +33,8 @@ : public views::View, public HoldingSpaceControllerObserver, public HoldingSpaceModelObserver { + METADATA_HEADER(HoldingSpaceTrayChildBubble, views::View) + public: explicit HoldingSpaceTrayChildBubble(HoldingSpaceViewDelegate* delegate); HoldingSpaceTrayChildBubble(const HoldingSpaceTrayChildBubble& other) =
diff --git a/ash/system/holding_space/holding_space_tray_unittest.cc b/ash/system/holding_space/holding_space_tray_unittest.cc index d461dafe..0e1b265 100644 --- a/ash/system/holding_space/holding_space_tray_unittest.cc +++ b/ash/system/holding_space/holding_space_tray_unittest.cc
@@ -23,6 +23,7 @@ #include "ash/public/cpp/holding_space/holding_space_test_api.h" #include "ash/public/cpp/holding_space/holding_space_util.h" #include "ash/public/cpp/holding_space/mock_holding_space_client.h" +#include "ash/public/cpp/holding_space/mock_holding_space_controller_observer.h" #include "ash/public/cpp/test/shell_test_api.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/session/session_controller_impl.h" @@ -264,30 +265,6 @@ return nullptr; } -// ScopedMockHoldingSpaceControllerObserver ------------------------------------ - -// An implementation of `HoldingSpaceControllerObserver` that enables its -// methods to be mocked. -class ScopedMockHoldingSpaceControllerObserver - : public HoldingSpaceControllerObserver { - public: - explicit ScopedMockHoldingSpaceControllerObserver( - HoldingSpaceController* controller) { - observation_.Observe(controller); - } - - // HoldingSpaceControllerObserver: - MOCK_METHOD(void, - OnHoldingSpaceTrayBubbleVisibilityChanged, - (const HoldingSpaceTray*, bool), - (override)); - - private: - base::ScopedObservation<HoldingSpaceController, - HoldingSpaceControllerObserver> - observation_{this}; -}; - // ViewVisibilityChangedWaiter ------------------------------------------------- // A class capable of waiting until a view's visibility is changed. @@ -2140,8 +2117,12 @@ StartSession(); ASSERT_TRUE(test_api()->IsShowingInShelf()); - ScopedMockHoldingSpaceControllerObserver observer( - HoldingSpaceController::Get()); + MockHoldingSpaceControllerObserver observer; + base::ScopedObservation<HoldingSpaceController, + HoldingSpaceControllerObserver> + observation(&observer); + observation.Observe(HoldingSpaceController::Get()); + EXPECT_CALL(observer, OnHoldingSpaceTrayBubbleVisibilityChanged( GetTray(), /*visible*/ true)); test_api()->Show();
diff --git a/ash/system/holding_space/screen_captures_section.cc b/ash/system/holding_space/screen_captures_section.cc index add9800..8328cad 100644 --- a/ash/system/holding_space/screen_captures_section.cc +++ b/ash/system/holding_space/screen_captures_section.cc
@@ -13,6 +13,7 @@ #include "ash/system/holding_space/holding_space_item_screen_capture_view.h" #include "ash/system/holding_space/holding_space_ui.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/label.h" @@ -57,4 +58,7 @@ return std::make_unique<HoldingSpaceItemScreenCaptureView>(delegate(), item); } +BEGIN_METADATA(ScreenCapturesSection) +END_METADATA + } // namespace ash
diff --git a/ash/system/holding_space/screen_captures_section.h b/ash/system/holding_space/screen_captures_section.h index 9038efd88..bff29ac6 100644 --- a/ash/system/holding_space/screen_captures_section.h +++ b/ash/system/holding_space/screen_captures_section.h
@@ -9,11 +9,14 @@ #include "ash/public/cpp/holding_space/holding_space_item.h" #include "ash/system/holding_space/holding_space_item_views_section.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash { // Section for screen captures in the `RecentFilesBubble`. class ScreenCapturesSection : public HoldingSpaceItemViewsSection { + METADATA_HEADER(ScreenCapturesSection, HoldingSpaceItemViewsSection) + public: explicit ScreenCapturesSection(HoldingSpaceViewDelegate* delegate); ScreenCapturesSection(const ScreenCapturesSection& other) = delete;
diff --git a/ash/system/hotspot/hotspot_detailed_view_controller_unittest.cc b/ash/system/hotspot/hotspot_detailed_view_controller_unittest.cc index c1c79c47..0e993902 100644 --- a/ash/system/hotspot/hotspot_detailed_view_controller_unittest.cc +++ b/ash/system/hotspot/hotspot_detailed_view_controller_unittest.cc
@@ -32,8 +32,7 @@ ~HotspotDetailedViewControllerTest() override = default; void SetUp() override { - scoped_feature_list_.InitWithFeatures( - {features::kHotspot, features::kQsRevamp}, {}); + scoped_feature_list_.InitWithFeatures({features::kHotspot}, {}); cros_hotspot_config_test_helper_ = std::make_unique<hotspot_config::CrosHotspotConfigTestHelper>( /*use_fake_implementation=*/true);
diff --git a/ash/system/hotspot/hotspot_detailed_view_unittest.cc b/ash/system/hotspot/hotspot_detailed_view_unittest.cc index c76e76d..7877dc7 100644 --- a/ash/system/hotspot/hotspot_detailed_view_unittest.cc +++ b/ash/system/hotspot/hotspot_detailed_view_unittest.cc
@@ -59,8 +59,7 @@ ~HotspotDetailedViewTest() override = default; void SetUp() override { - scoped_feature_list_.InitWithFeatures( - {features::kHotspot, features::kQsRevamp}, {}); + scoped_feature_list_.InitWithFeatures({features::kHotspot}, {}); cros_hotspot_config_test_helper_ = std::make_unique<hotspot_config::CrosHotspotConfigTestHelper>( /*use_fake_implementation=*/true);
diff --git a/ash/system/hotspot/hotspot_feature_pod_controller_unittest.cc b/ash/system/hotspot/hotspot_feature_pod_controller_unittest.cc index 055c8e9..cf658d26 100644 --- a/ash/system/hotspot/hotspot_feature_pod_controller_unittest.cc +++ b/ash/system/hotspot/hotspot_feature_pod_controller_unittest.cc
@@ -47,8 +47,7 @@ ~HotspotFeaturePodControllerTest() override = default; void SetUp() override { - scoped_feature_list_.InitWithFeatures( - {features::kHotspot, features::kQsRevamp}, {}); + scoped_feature_list_.InitWithFeatures({features::kHotspot}, {}); cros_hotspot_config_test_helper_ = std::make_unique<hotspot_config::CrosHotspotConfigTestHelper>( /*use_fake_implementation=*/true);
diff --git a/ash/system/input_device_settings/input_device_settings_metrics_manager.cc b/ash/system/input_device_settings/input_device_settings_metrics_manager.cc index ccb6837..ce86dbf0 100644 --- a/ash/system/input_device_settings/input_device_settings_metrics_manager.cc +++ b/ash/system/input_device_settings/input_device_settings_metrics_manager.cc
@@ -359,9 +359,10 @@ std::move(updated_settings_update_info_dict)); } -void RecordCurrentButtonRemappingAction( +void RecordButtonRemappingAction( const mojom::ButtonRemappingPtr& button_remapping, - const char* peripheral_kind) { + const char* peripheral_kind, + const char* metric_name_suffix) { if (!button_remapping->remapping_action) { // TOOD(dpad): Add metric for recording default button remapping. return; @@ -372,17 +373,19 @@ switch (button_remapping->remapping_action->which()) { case mojom::RemappingAction::Tag::kAcceleratorAction: base::UmaHistogramSparse( - base::StrCat({metric_name_prefix, "AcceleratorAction.Initial"}), + base::StrCat( + {metric_name_prefix, "AcceleratorAction.", metric_name_suffix}), button_remapping->remapping_action->get_accelerator_action()); break; case mojom::RemappingAction::Tag::kStaticShortcutAction: base::UmaHistogramEnumeration( - base::StrCat({metric_name_prefix, "StaticShortcutAction.Initial"}), + base::StrCat({metric_name_prefix, "StaticShortcutAction.", + metric_name_suffix}), button_remapping->remapping_action->get_static_shortcut_action()); break; case mojom::RemappingAction::Tag::kKeyEvent: base::UmaHistogramSparse( - base::StrCat({metric_name_prefix, "KeyEvent.Initial"}), + base::StrCat({metric_name_prefix, "KeyEvent.", metric_name_suffix}), GetEncodedShortcut( button_remapping->remapping_action->get_key_event()->modifiers, button_remapping->remapping_action->get_key_event()->vkey)); @@ -390,6 +393,21 @@ } } +void RecordButtonRemappingActionIfChanged( + const mojom::ButtonRemappingPtr& original_remapping, + const mojom::ButtonRemappingPtr& new_remapping, + const char* peripheral_kind) { + if (original_remapping->remapping_action != new_remapping->remapping_action) { + RecordButtonRemappingAction(new_remapping, peripheral_kind, "Changed"); + } +} + +void RecordCurrentButtonRemappingAction( + const mojom::ButtonRemappingPtr& button_remapping, + const char* peripheral_kind) { + RecordButtonRemappingAction(button_remapping, peripheral_kind, "Initial"); +} + } // namespace InputDeviceSettingsMetricsManager::InputDeviceSettingsMetricsManager() = @@ -654,6 +672,9 @@ RecordButtonRemappingNameIfChanged(original_remapping, new_remapping, /*peripheral_kind=*/ "Mouse"); + RecordButtonRemappingActionIfChanged(original_remapping, new_remapping, + /*peripheral_kind=*/ + "Mouse"); } } } @@ -877,6 +898,9 @@ RecordButtonRemappingNameIfChanged(original_remapping, new_remapping, /*peripheral_kind=*/ "GraphicsTabletPen"); + RecordButtonRemappingActionIfChanged(original_remapping, new_remapping, + /*peripheral_kind=*/ + "GraphicsTabletPen"); } } } @@ -888,6 +912,9 @@ RecordButtonRemappingNameIfChanged(original_remapping, new_remapping, /*peripheral_kind=*/ "GraphicsTablet"); + RecordButtonRemappingActionIfChanged(original_remapping, new_remapping, + /*peripheral_kind=*/ + "GraphicsTablet"); } } }
diff --git a/ash/system/input_device_settings/input_device_settings_metrics_manager_unittest.cc b/ash/system/input_device_settings/input_device_settings_metrics_manager_unittest.cc index 18a4f1a..eb380ed 100644 --- a/ash/system/input_device_settings/input_device_settings_metrics_manager_unittest.cc +++ b/ash/system/input_device_settings/input_device_settings_metrics_manager_unittest.cc
@@ -417,12 +417,27 @@ /*expected_count=*/2u); // Call record changed settings metrics. - const auto old_setting = mouse.settings->Clone(); + auto old_setting = mouse.settings->Clone(); mouse.settings->sensitivity = kSampleMinSensitivity; mouse.settings->reverse_scrolling = !mouse.settings->reverse_scrolling; mouse.settings->button_remappings.at(0)->name = "renamed vkey"; mouse.settings->button_remappings.at(1)->name = "renamed customizable button"; + mouse.settings->button_remappings.at(0) + ->remapping_action->set_accelerator_action( + ash::AcceleratorAction::kBrightnessDown); manager_.get()->RecordMouseChangedMetrics(mouse, *old_setting); + + old_setting = mouse.settings->Clone(); + mouse.settings->button_remappings.at(0)->remapping_action->set_key_event( + key_event_for_mouse->get_key_event()->Clone()); + manager_.get()->RecordMouseChangedMetrics(mouse, *old_setting); + + old_setting = mouse.settings->Clone(); + mouse.settings->button_remappings.at(0) + ->remapping_action->set_static_shortcut_action( + mojom::StaticShortcutAction::kCopy); + manager_.get()->RecordMouseChangedMetrics(mouse, *old_setting); + histogram_tester.ExpectTotalCount( "ChromeOS.Settings.Device.Mouse.SwapPrimaryButtons.Changed", /*expected_count=*/0); @@ -453,6 +468,35 @@ "CustomizableButton", /*sample=*/mojom::CustomizableButton::kLeft, /*expected_count=*/0u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.Mouse.ButtonRemapping.AcceleratorAction." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.Mouse.ButtonRemapping.AcceleratorAction." + "Changed", + /*sample=*/AcceleratorAction::kBrightnessDown, + /*expected_count=*/1u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.Mouse.ButtonRemapping.KeyEvent." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.Mouse.ButtonRemapping.KeyEvent." + "Changed", + /*sample=*/ + GetEncodedShortcut(key_event_for_mouse->get_key_event()->modifiers, + key_event_for_mouse->get_key_event()->vkey), + /*expected_count=*/1u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.Mouse.ButtonRemapping.StaticShortcutAction." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.Mouse.ButtonRemapping.StaticShortcutAction." + "Changed", + /*sample=*/mojom::StaticShortcutAction::kCopy, + /*expected_count=*/1u); } TEST_F(InputDeviceSettingsMetricsManagerTest, RecordPointingStickSettings) { @@ -710,13 +754,31 @@ /*expected_count=*/2u); // Call record changed settings metrics. - const auto old_setting = graphics_tablet.settings->Clone(); + auto old_setting = graphics_tablet.settings->Clone(); graphics_tablet.settings->tablet_button_remappings.at(0)->name = "renamed vkey"; graphics_tablet.settings->tablet_button_remappings.at(1)->name = "renamed customizable button"; + graphics_tablet.settings->tablet_button_remappings.at(0) + ->remapping_action->set_accelerator_action( + ash::AcceleratorAction::kBrightnessDown); manager_.get()->RecordGraphicsTabletChangedMetrics(graphics_tablet, *old_setting); + + old_setting = graphics_tablet.settings->Clone(); + graphics_tablet.settings->tablet_button_remappings.at(0) + ->remapping_action->set_key_event( + key_event_for_tablet->get_key_event()->Clone()); + manager_.get()->RecordGraphicsTabletChangedMetrics(graphics_tablet, + *old_setting); + + old_setting = graphics_tablet.settings->Clone(); + graphics_tablet.settings->tablet_button_remappings.at(0) + ->remapping_action->set_static_shortcut_action( + mojom::StaticShortcutAction::kCopy); + manager_.get()->RecordGraphicsTabletChangedMetrics(graphics_tablet, + *old_setting); + // Test tablet button remappings. histogram_tester.ExpectUniqueSample( "ChromeOS.Settings.Device.GraphicsTablet.ButtonRemapping.Name.Changed." @@ -733,6 +795,39 @@ "CustomizableButton", /*sample=*/mojom::CustomizableButton::kMiddle, /*expected_count=*/0u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.GraphicsTablet.ButtonRemapping." + "AcceleratorAction." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.GraphicsTablet.ButtonRemapping." + "AcceleratorAction." + "Changed", + /*sample=*/AcceleratorAction::kBrightnessDown, + /*expected_count=*/1u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.GraphicsTablet.ButtonRemapping.KeyEvent." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.GraphicsTablet.ButtonRemapping.KeyEvent." + "Changed", + /*sample=*/ + GetEncodedShortcut(key_event_for_tablet->get_key_event()->modifiers, + key_event_for_tablet->get_key_event()->vkey), + /*expected_count=*/1u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.GraphicsTablet.ButtonRemapping." + "StaticShortcutAction." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.GraphicsTablet.ButtonRemapping." + "StaticShortcutAction." + "Changed", + /*sample=*/mojom::StaticShortcutAction::kCopy, + /*expected_count=*/1u); } TEST_F(InputDeviceSettingsMetricsManagerTest, RecordGraphicsTabletPenSettings) { @@ -840,12 +935,30 @@ /*expected_count=*/2u); // Call record changed settings metrics. - const auto old_setting = graphics_tablet.settings->Clone(); + auto old_setting = graphics_tablet.settings->Clone(); graphics_tablet.settings->pen_button_remappings.at(0)->name = "renamed vkey"; graphics_tablet.settings->pen_button_remappings.at(1)->name = "renamed customizable button"; + graphics_tablet.settings->pen_button_remappings.at(0) + ->remapping_action->set_accelerator_action( + ash::AcceleratorAction::kLaunchApp7); manager_.get()->RecordGraphicsTabletChangedMetrics(graphics_tablet, *old_setting); + + old_setting = graphics_tablet.settings->Clone(); + graphics_tablet.settings->pen_button_remappings.at(0) + ->remapping_action->set_key_event( + key_event_for_pen->get_key_event()->Clone()); + manager_.get()->RecordGraphicsTabletChangedMetrics(graphics_tablet, + *old_setting); + + old_setting = graphics_tablet.settings->Clone(); + graphics_tablet.settings->pen_button_remappings.at(0) + ->remapping_action->set_static_shortcut_action( + mojom::StaticShortcutAction::kCopy); + manager_.get()->RecordGraphicsTabletChangedMetrics(graphics_tablet, + *old_setting); + histogram_tester.ExpectUniqueSample( "ChromeOS.Settings.Device.GraphicsTabletPen.ButtonRemapping.Name." "Changed.Vkey", @@ -861,6 +974,39 @@ "Changed.CustomizableButton", /*sample=*/mojom::CustomizableButton::kRight, /*expected_count=*/0u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.GraphicsTabletPen.ButtonRemapping." + "AcceleratorAction." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.GraphicsTabletPen.ButtonRemapping." + "AcceleratorAction." + "Changed", + /*sample=*/AcceleratorAction::kLaunchApp7, + /*expected_count=*/1u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.GraphicsTabletPen.ButtonRemapping.KeyEvent." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.GraphicsTabletPen.ButtonRemapping.KeyEvent." + "Changed", + /*sample=*/ + GetEncodedShortcut(key_event_for_pen->get_key_event()->modifiers, + key_event_for_pen->get_key_event()->vkey), + /*expected_count=*/1u); + histogram_tester.ExpectTotalCount( + "ChromeOS.Settings.Device.GraphicsTabletPen.ButtonRemapping." + "StaticShortcutAction." + "Changed", + /*expected_count=*/1); + histogram_tester.ExpectBucketCount( + "ChromeOS.Settings.Device.GraphicsTabletPen.ButtonRemapping." + "StaticShortcutAction." + "Changed", + /*sample=*/mojom::StaticShortcutAction::kCopy, + /*expected_count=*/1u); } TEST_F(InputDeviceSettingsMetricsManagerTest, RecordModifierRemappingMetrics) {
diff --git a/ash/system/media/media_tray.cc b/ash/system/media/media_tray.cc index 65e92450..e85da3e 100644 --- a/ash/system/media/media_tray.cc +++ b/ash/system/media/media_tray.cc
@@ -33,6 +33,8 @@ #include "components/prefs/pref_service.h" #include "media/base/media_switches.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/compositor/layer.h" #include "ui/display/manager/display_manager.h" @@ -88,6 +90,8 @@ // View that contains global media controls' title. class GlobalMediaControlsTitleView : public views::View { + METADATA_HEADER(GlobalMediaControlsTitleView, views::View) + public: GlobalMediaControlsTitleView() { auto* box_layout = SetLayoutManager(std::make_unique<views::BoxLayout>( @@ -146,6 +150,9 @@ raw_ptr<views::Label, ExperimentalAsh> title_label_ = nullptr; }; +BEGIN_METADATA(GlobalMediaControlsTitleView) +END_METADATA + } // namespace // static @@ -211,6 +218,9 @@ : IDS_ASH_GLOBAL_MEDIA_CONTROLS_UNPINNED_BUTTON_TOOLTIP_TEXT)); } +BEGIN_METADATA(MediaTray, PinButton, IconButton) +END_METADATA + MediaTray::MediaTray(Shelf* shelf) : TrayBackgroundView(shelf, TrayBackgroundViewCatalogName::kMediaPlayer) { SetCallback(base::BindRepeating(&MediaTray::OnTrayButtonPressed, @@ -484,4 +494,7 @@ shelf()->GetStatusAreaWidget()->GetMediaTrayAnchorRect()); } +BEGIN_METADATA(MediaTray) +END_METADATA + } // namespace ash
diff --git a/ash/system/media/media_tray.h b/ash/system/media/media_tray.h index 5c0bdd1..d1232a4 100644 --- a/ash/system/media/media_tray.h +++ b/ash/system/media/media_tray.h
@@ -11,6 +11,7 @@ #include "ash/system/media/media_notification_provider_observer.h" #include "ash/system/tray/tray_background_view.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" class PrefChangeRegistrar; class PrefRegistrySimple; @@ -31,6 +32,8 @@ class ASH_EXPORT MediaTray : public MediaNotificationProviderObserver, public TrayBackgroundView, public SessionObserver { + METADATA_HEADER(MediaTray, TrayBackgroundView) + public: // Register `prefs::kGlobalMediaControlsPinned`. static void RegisterProfilePrefs(PrefRegistrySimple* registry); @@ -44,6 +47,8 @@ // Pin button shown in `GlobalMediaControlsTitleView` and // `UnifiedMediaControlsDetailedView`. class PinButton : public IconButton { + METADATA_HEADER(PinButton, IconButton) + public: PinButton(); PinButton(const PinButton&) = delete;
diff --git a/ash/system/media/quick_settings_media_view.cc b/ash/system/media/quick_settings_media_view.cc index 5e33fba..59d0c4ad 100644 --- a/ash/system/media/quick_settings_media_view.cc +++ b/ash/system/media/quick_settings_media_view.cc
@@ -11,6 +11,8 @@ #include "ash/system/media/quick_settings_media_view_controller.h" #include "components/global_media_controls/public/views/media_item_ui_view.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/views/controls/scroll_view.h" #include "ui/views/layout/box_layout_view.h" @@ -35,6 +37,8 @@ // is shown on the screen by setting the x position of the scroll content. class MediaScrollView : public views::ScrollView, public PaginationModelObserver { + METADATA_HEADER(MediaScrollView, views::ScrollView) + public: MediaScrollView(QuickSettingsMediaView* media_view, PaginationModel* model) : views::ScrollView(ScrollView::ScrollWithLayers::kEnabled), @@ -99,6 +103,9 @@ this}; }; +BEGIN_METADATA(MediaScrollView) +END_METADATA + } // namespace QuickSettingsMediaView::QuickSettingsMediaView( @@ -217,4 +224,7 @@ : global_media_controls::kCrOSMediaItemUpdatedUISize.height(); } +BEGIN_METADATA(QuickSettingsMediaView) +END_METADATA + } // namespace ash
diff --git a/ash/system/media/quick_settings_media_view.h b/ash/system/media/quick_settings_media_view.h index 9284f39c..c7cea81 100644 --- a/ash/system/media/quick_settings_media_view.h +++ b/ash/system/media/quick_settings_media_view.h
@@ -10,6 +10,7 @@ #include "ash/ash_export.h" #include "ash/public/cpp/pagination/pagination_model.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace global_media_controls { @@ -28,6 +29,8 @@ // Media view displayed in the quick settings view. class ASH_EXPORT QuickSettingsMediaView : public views::View { + METADATA_HEADER(QuickSettingsMediaView, views::View) + public: explicit QuickSettingsMediaView(QuickSettingsMediaViewController* controller); QuickSettingsMediaView(const QuickSettingsMediaView&) = delete;
diff --git a/ash/system/media/quick_settings_media_view_container.cc b/ash/system/media/quick_settings_media_view_container.cc index ef246c26..c1d6d51 100644 --- a/ash/system/media/quick_settings_media_view_container.cc +++ b/ash/system/media/quick_settings_media_view_container.cc
@@ -8,6 +8,7 @@ #include "ash/system/tray/tray_constants.h" #include "ash/system/unified/unified_system_tray_controller.h" #include "components/global_media_controls/public/constants.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/layout/fill_layout.h" namespace ash { @@ -42,4 +43,7 @@ return gfx::Size(kTrayMenuWidth, GetExpandedHeight()); } +BEGIN_METADATA(QuickSettingsMediaViewContainer) +END_METADATA + } // namespace ash \ No newline at end of file
diff --git a/ash/system/media/quick_settings_media_view_container.h b/ash/system/media/quick_settings_media_view_container.h index f06e1d7..fc9d19b 100644 --- a/ash/system/media/quick_settings_media_view_container.h +++ b/ash/system/media/quick_settings_media_view_container.h
@@ -6,6 +6,7 @@ #define ASH_SYSTEM_MEDIA_QUICK_SETTINGS_MEDIA_VIEW_CONTAINER_H_ #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { @@ -15,6 +16,8 @@ // Container view of QuickSettingsMediaView which manages the visibility of the // entire quick settings media view. class QuickSettingsMediaViewContainer : public views::View { + METADATA_HEADER(QuickSettingsMediaViewContainer, views::View) + public: explicit QuickSettingsMediaViewContainer( UnifiedSystemTrayController* controller);
diff --git a/ash/system/media/unified_media_controls_container.cc b/ash/system/media/unified_media_controls_container.cc index a3a35639..0dd282b 100644 --- a/ash/system/media/unified_media_controls_container.cc +++ b/ash/system/media/unified_media_controls_container.cc
@@ -5,6 +5,7 @@ #include "ash/system/media/unified_media_controls_container.h" #include "ash/system/tray/tray_constants.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/views/border.h" @@ -56,4 +57,7 @@ return gfx::Size(kTrayMenuWidth, GetExpandedHeight() * expanded_amount_); } +BEGIN_METADATA(UnifiedMediaControlsContainer) +END_METADATA + } // namespace ash
diff --git a/ash/system/media/unified_media_controls_container.h b/ash/system/media/unified_media_controls_container.h index 8ec9a44..f76dda7 100644 --- a/ash/system/media/unified_media_controls_container.h +++ b/ash/system/media/unified_media_controls_container.h
@@ -5,6 +5,7 @@ #ifndef ASH_SYSTEM_MEDIA_UNIFIED_MEDIA_CONTROLS_CONTAINER_H_ #define ASH_SYSTEM_MEDIA_UNIFIED_MEDIA_CONTROLS_CONTAINER_H_ +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { @@ -12,6 +13,8 @@ // Container view of UnifiedMediaControlsView. This manages the // visibility and expanded amount of the entire media controls view. class UnifiedMediaControlsContainer : public views::View { + METADATA_HEADER(UnifiedMediaControlsContainer, views::View) + public: UnifiedMediaControlsContainer(); ~UnifiedMediaControlsContainer() override = default;
diff --git a/ash/system/media/unified_media_controls_view.cc b/ash/system/media/unified_media_controls_view.cc index 1d0039b0..a67d7e1 100644 --- a/ash/system/media/unified_media_controls_view.cc +++ b/ash/system/media/unified_media_controls_view.cc
@@ -15,6 +15,8 @@ #include "components/media_message_center/media_notification_util.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_id.h" #include "ui/gfx/geometry/skia_conversions.h" #include "ui/gfx/paint_vector_icon.h" @@ -138,6 +140,9 @@ SetVectorIcon(GetVectorIconForMediaAction(action)); } +BEGIN_METADATA(UnifiedMediaControlsView, MediaActionButton, IconButton) +END_METADATA + UnifiedMediaControlsView::UnifiedMediaControlsView( UnifiedMediaControlsController* controller) : views::Button(base::BindRepeating( @@ -370,4 +375,7 @@ return path; } +BEGIN_METADATA(UnifiedMediaControlsView) +END_METADATA + } // namespace ash
diff --git a/ash/system/media/unified_media_controls_view.h b/ash/system/media/unified_media_controls_view.h index d62723a7..57fd87d 100644 --- a/ash/system/media/unified_media_controls_view.h +++ b/ash/system/media/unified_media_controls_view.h
@@ -11,6 +11,7 @@ #include "base/memory/raw_ptr.h" #include "services/media_session/public/mojom/media_session.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/button/button.h" namespace gfx { @@ -28,6 +29,8 @@ // Media controls view displayed in quick settings. class ASH_EXPORT UnifiedMediaControlsView : public views::Button { + METADATA_HEADER(UnifiedMediaControlsView, views::Button) + public: explicit UnifiedMediaControlsView(UnifiedMediaControlsController* controller); ~UnifiedMediaControlsView() override = default; @@ -56,6 +59,8 @@ friend class UnifiedMediaControlsControllerTest; class MediaActionButton : public IconButton { + METADATA_HEADER(MediaActionButton, IconButton) + public: MediaActionButton(UnifiedMediaControlsController* controller, media_session::mojom::MediaSessionAction action,
diff --git a/ash/system/message_center/ash_notification_view.cc b/ash/system/message_center/ash_notification_view.cc index a708cf66..5f45e9d4 100644 --- a/ash/system/message_center/ash_notification_view.cc +++ b/ash/system/message_center/ash_notification_view.cc
@@ -141,8 +141,8 @@ constexpr auto kHeaderRowExpandedPadding = gfx::Insets::TLBR(6, 0, 8, 0); constexpr auto kHeaderRowCollapsedPadding = gfx::Insets::TLBR(0, 0, 8, 0); -constexpr auto kRightContentCollapsedPadding = gfx::Insets::TLBR(12, 0, 0, 16); -constexpr auto kRightContentExpandedPadding = gfx::Insets::TLBR(20, 0, 0, 16); +constexpr auto kRightContentCollapsedPadding = gfx::Insets::TLBR(12, 16, 0, 0); +constexpr auto kRightContentExpandedPadding = gfx::Insets::TLBR(20, 16, 0, 0); constexpr auto kTimeStampInCollapsedStatePadding = gfx::Insets::TLBR(0, 0, 0, 16); @@ -547,6 +547,8 @@ views::Builder<views::FlexLayoutView>() .SetOrientation(views::LayoutOrientation::kVertical) .SetCrossAxisAlignment(views::LayoutAlignment::kEnd) + .SetMinimumCrossAxisSize( + kExpandAndControlButtonsContainerMinimumWidth) .AddChild( views::Builder<views::BoxLayoutView>() .SetMainAxisAlignment(MainAxisAlignment::kEnd)
diff --git a/ash/system/message_center/ash_notification_view_pixeltest.cc b/ash/system/message_center/ash_notification_view_pixeltest.cc index a2dbe295..f977cfec 100644 --- a/ash/system/message_center/ash_notification_view_pixeltest.cc +++ b/ash/system/message_center/ash_notification_view_pixeltest.cc
@@ -16,6 +16,8 @@ #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "ui/base/models/image_model.h" +#include "ui/message_center/public/cpp/notification.h" +#include "ui/message_center/public/cpp/notifier_id.h" #include "ui/message_center/views/message_popup_view.h" #include "ui/message_center/views/message_view.h" #include "ui/message_center/views/notification_control_buttons_view.h" @@ -32,12 +34,20 @@ "Test Notification's Very Very Very Very Very Very Very Very Very Very " "Very Very Very Very Very Very Very Very Very Very Very Very Very Very " "Very Very Very Very Long Multiline Title"; +constexpr char kLongMessageString[] = + "Test Notification's Very Very Very Very Very Very Very Very Very Very " + "Very Very Very Very Very Very Very Very Very Very Very Very Very Very " + "Very Very Very Very Long Message"; constexpr char kShortTitleScreenshot[] = "ash_notification_short_title"; constexpr char kMediumTitleScreenshot[] = "ash_notification_multiline_medium_title"; constexpr char kLongTitleScreenshot[] = "ash_notification_multiline_long_title"; +const ui::ImageModel test_green_icon = ui::ImageModel::FromImageSkia( + CreateSolidColorTestImage(gfx::Size(/*width=*/48, /*height=*/48), + SK_ColorGREEN)); + // The types of the primary display size. enum class DisplayType { // The display size is the default one. @@ -123,9 +133,7 @@ // Create a notification with no message, and open the notification center // bubble to view it. const std::string id = test_api()->AddCustomNotification( - u"Notification title", u"", - ui::ImageModel::FromImageSkia(CreateSolidColorTestImage( - gfx::Size(/*width=*/45, /*height=*/45), SK_ColorGREEN))); + u"Notification title", u"", test_green_icon); test_api()->ToggleBubble(); // Make sure the notification is collapsed. @@ -137,7 +145,7 @@ // Verify with a pixel test that the notification's title is vertically // centered. EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen( - "collapsed_no_message", /*revision_number=*/2, notification_view)); + "collapsed_no_message", /*revision_number=*/4, notification_view)); } // Tests that a progress notification does not have its title vertically @@ -158,7 +166,7 @@ // Verify with a pixel test that the notification's title is not vertically // centered. EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen( - "progress_collapsed", /*revision_number=*/1, notification_view)); + "progress_collapsed", /*revision_number=*/3, notification_view)); } // Tests the control buttons UI for the case of a notification with just the @@ -234,9 +242,7 @@ const std::string title = GetTitle(); const std::string id = test_api()->AddCustomNotification( - base::UTF8ToUTF16(title), u"Notification Content", - ui::ImageModel::FromImageSkia(CreateSolidColorTestImage( - gfx::Size(/*width=*/45, /*height=*/45), SK_ColorGREEN))); + base::UTF8ToUTF16(title), u"Notification Content", test_green_icon); test_api()->ToggleBubble(); @@ -249,7 +255,58 @@ // Compare pixels. const std::string screenshot_name = GetScreenshotName(); EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen( - screenshot_name, /*revision_number=*/6, notification_view)); + screenshot_name, /*revision_number=*/8, notification_view)); +} + +class AshNotificationViewCollapsedLongTextPixelTest + : public AshNotificationViewPixelTest, + public testing::WithParamInterface< + std::tuple<bool /*whether there is an icon*/, + bool /*whether there is a settings control button*/>> { + public: + bool HasIcon() { return std::get<0>(GetParam()); } + bool HasSettingsControlButton() { return std::get<1>(GetParam()); } +}; + +INSTANTIATE_TEST_SUITE_P(All, + AshNotificationViewCollapsedLongTextPixelTest, + testing::Combine(testing::Bool(), testing::Bool())); + +// Tests the spacing between long, elided title/message text content and the +// next element of the notification (either icon or expand/collapse button). +// Also parameterized by the presence/absence of the settings control button. +TEST_P(AshNotificationViewCollapsedLongTextPixelTest, ElidedTextSpacing) { + // Generate a notification with a long title and message, and view it in the + // notification center. Also add a second notification so that the main + // notification is automatically in its collapsed state when the bubble is + // toggled. + message_center::RichNotificationData optional_fields; + if (HasSettingsControlButton()) { + optional_fields.settings_button_handler = + message_center::SettingsButtonHandler::DELEGATE; + } + const std::string id = test_api()->AddCustomNotification( + base::UTF8ToUTF16(std::string(kLongTitleString)), + base::UTF8ToUTF16(std::string(kLongMessageString)), + /*icon=*/HasIcon() ? test_green_icon : ui::ImageModel(), + /*display_source=*/u"", /*url=*/GURL(), + /*notifier_id=*/message_center::NotifierId(), optional_fields); + test_api()->AddNotification(); + test_api()->ToggleBubble(); + + // Verify that the notification is collapsed. + auto* notification_view = static_cast<AshNotificationView*>( + test_api()->GetNotificationViewForId(id)); + ASSERT_FALSE(notification_view->IsExpanded()); + + // Hover the mouse over the notification so that the control buttons are + // visible when taking a screenshot. + GetEventGenerator()->MoveMouseTo( + notification_view->GetBoundsInScreen().CenterPoint(), /*count=*/10); + + // Verify the spacing with a pixel test. + EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen( + "elided_text_spacing", /*revision_number=*/0, notification_view)); } class ScreenCaptureNotificationPixelTest
diff --git a/ash/system/message_center/message_center_constants.h b/ash/system/message_center/message_center_constants.h index fe55949..907b590 100644 --- a/ash/system/message_center/message_center_constants.h +++ b/ash/system/message_center/message_center_constants.h
@@ -70,6 +70,14 @@ inline constexpr auto kControlButtonsContainerCollapsedPadding = gfx::Insets::TLBR(2, 0, 0, 0); +// The minimum width necessary for the container that holds the expand/collapse +// button and the control buttons. This is calculated to ensure that there is +// 16dp of space between the expand/collapse button and the notification icon if +// there is one, or else 16dp between the expand/collapse button and the end of +// the notification title and/or message, if the title and/or message are long +// and are elided. See http://b/267195370 for details. +inline constexpr int kExpandAndControlButtonsContainerMinimumWidth = 52; + inline constexpr char kGoogleSansFont[] = "Google Sans"; inline constexpr int kHeaderViewLabelSize = 12; inline constexpr char kNotificationBodyFontWeight = 13;
diff --git a/ash/system/message_center/notification_swipe_control_view.cc b/ash/system/message_center/notification_swipe_control_view.cc index 14e6078..3fa376f0 100644 --- a/ash/system/message_center/notification_swipe_control_view.cc +++ b/ash/system/message_center/notification_swipe_control_view.cc
@@ -14,6 +14,7 @@ #include "base/i18n/rtl.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/events/event.h" #include "ui/message_center/views/message_view.h" @@ -23,9 +24,6 @@ namespace ash { -const char NotificationSwipeControlView::kViewClassName[] = - "NotificationSwipeControlView"; - NotificationSwipeControlView::NotificationSwipeControlView( message_center::MessageView* message_view) : message_view_(message_view) { @@ -127,10 +125,6 @@ } } -const char* NotificationSwipeControlView::GetClassName() const { - return kViewClassName; -} - void NotificationSwipeControlView::ButtonPressed(const ui::Event& event) { auto weak_this = weak_factory_.GetWeakPtr(); @@ -152,4 +146,7 @@ message_view_->CloseSwipeControl(); } +BEGIN_METADATA(NotificationSwipeControlView) +END_METADATA + } // namespace ash
diff --git a/ash/system/message_center/notification_swipe_control_view.h b/ash/system/message_center/notification_swipe_control_view.h index ec6242e..a3b30448 100644 --- a/ash/system/message_center/notification_swipe_control_view.h +++ b/ash/system/message_center/notification_swipe_control_view.h
@@ -10,6 +10,7 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/animation/animation_delegate.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/view.h" @@ -23,15 +24,14 @@ // View containing the settings button that appears behind notification by // swiping. class ASH_EXPORT NotificationSwipeControlView : public views::View { + METADATA_HEADER(NotificationSwipeControlView, views::View) + public: // Physical positions to show buttons in the swipe control. This is invariant // across RTL/LTR languages because buttons should be shown on one side which // is made uncovered by the overlapping view after user's swipe action. enum class ButtonPosition { RIGHT, LEFT }; - // String to be returned by GetClassName() method. - static const char kViewClassName[]; - explicit NotificationSwipeControlView( message_center::MessageView* message_view); NotificationSwipeControlView(const NotificationSwipeControlView&) = delete; @@ -39,9 +39,6 @@ delete; ~NotificationSwipeControlView() override; - // views::View - const char* GetClassName() const override; - // Update the visibility of control buttons. void UpdateButtonsVisibility();
diff --git a/ash/system/message_center/notifier_settings_view.cc b/ash/system/message_center/notifier_settings_view.cc index bd416c1..a357c6a 100644 --- a/ash/system/message_center/notifier_settings_view.cc +++ b/ash/system/message_center/notifier_settings_view.cc
@@ -34,6 +34,8 @@ #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/color/color_id.h" #include "ui/compositor/layer.h" #include "ui/compositor/paint_recorder.h" @@ -112,6 +114,8 @@ // (NotifierMetadata.enforced), it also applies filter to make the color of the // button dim. class NotifierButtonWrapperView : public views::View { + METADATA_HEADER(NotifierButtonWrapperView, views::View) + public: explicit NotifierButtonWrapperView(views::View* contents); @@ -132,7 +136,6 @@ void OnMouseReleased(const ui::MouseEvent& event) override; void OnPaint(gfx::Canvas* canvas) override; void OnBlur() override; - const char* GetClassName() const override; private: std::unique_ptr<views::Painter> focus_painter_; @@ -141,6 +144,9 @@ raw_ptr<views::View, ExperimentalAsh> contents_; }; +BEGIN_METADATA(NotifierButtonWrapperView) +END_METADATA + NotifierButtonWrapperView::NotifierButtonWrapperView(views::View* contents) : focus_painter_(TrayPopupUtils::CreateFocusPainter()), contents_(contents) { @@ -202,22 +208,17 @@ SchedulePaint(); } -const char* NotifierButtonWrapperView::GetClassName() const { - return "NotifierButtonWrapperView"; -} - // ScrollContentsView ---------------------------------------------------------- class ScrollContentsView : public views::View { + METADATA_HEADER(ScrollContentsView, views::View) + public: ScrollContentsView() = default; ScrollContentsView(const ScrollContentsView&) = delete; ScrollContentsView& operator=(const ScrollContentsView&) = delete; - // views::View: - const char* GetClassName() const override { return "ScrollContentsView"; } - private: void PaintChildren(const views::PaintInfo& paint_info) override { views::View::PaintChildren(paint_info); @@ -245,9 +246,14 @@ } }; +BEGIN_METADATA(ScrollContentsView) +END_METADATA + // EmptyNotifierView ----------------------------------------------------------- class EmptyNotifierView : public views::View { + METADATA_HEADER(EmptyNotifierView, views::View) + public: EmptyNotifierView() { const SkColor text_color = AshColorProvider::Get()->GetContentLayerColor( @@ -282,9 +288,6 @@ EmptyNotifierView(const EmptyNotifierView&) = delete; EmptyNotifierView& operator=(const EmptyNotifierView&) = delete; - // views::View: - const char* GetClassName() const override { return "EmptyNotifierView"; } - private: void OnThemeChanged() override { views::View::OnThemeChanged(); @@ -295,7 +298,12 @@ raw_ptr<views::Label, ExperimentalAsh> label_; }; +BEGIN_METADATA(EmptyNotifierView) +END_METADATA + class NotifierViewCheckbox : public views::Checkbox { + METADATA_HEADER(NotifierViewCheckbox, views::Checkbox) + public: using views::Checkbox::Checkbox; @@ -310,7 +318,12 @@ } }; +BEGIN_METADATA(NotifierViewCheckbox) +END_METADATA + class NotifierButtonNameView : public views::Label { + METADATA_HEADER(NotifierButtonNameView, views::Label) + public: explicit NotifierButtonNameView(const std::u16string& text) : views::Label(text) {} @@ -339,8 +352,13 @@ bool cached_notifier_enforced_ = false; }; +BEGIN_METADATA(NotifierButtonNameView) +END_METADATA + // PrimaryTextColorLabel should use kTextColorPrimary instead of system colors. class PrimaryTextColorLabel : public ::views::Label { + METADATA_HEADER(PrimaryTextColorLabel, views::Label) + public: explicit PrimaryTextColorLabel(const std::u16string& text) : views::Label(text) {} @@ -356,8 +374,13 @@ } }; +BEGIN_METADATA(PrimaryTextColorLabel) +END_METADATA + // App badging icon should use kIconColorPrimary instead of system colors. class AdaptiveBadgingIcon : public ::views::ImageView { + METADATA_HEADER(AdaptiveBadgingIcon, views::ImageView) + public: AdaptiveBadgingIcon() = default; AdaptiveBadgingIcon(const AdaptiveBadgingIcon&) = delete; @@ -374,6 +397,9 @@ } }; +BEGIN_METADATA(AdaptiveBadgingIcon) +END_METADATA + } // namespace // NotifierSettingsView::NotifierButton --------------------------------------- @@ -455,10 +481,6 @@ return checkbox_->GetChecked(); } -const char* NotifierSettingsView::NotifierButton::GetClassName() const { - return "NotifierButton"; -} - void NotifierSettingsView::NotifierButton::GetAccessibleNodeData( ui::AXNodeData* node_data) { static_cast<views::View*>(checkbox_)->GetAccessibleNodeData(node_data); @@ -519,6 +541,9 @@ Layout(); } +BEGIN_METADATA(NotifierSettingsView, NotifierButton, views::Button) +END_METADATA + // NotifierSettingsView ------------------------------------------------------- NotifierSettingsView::NotifierSettingsView() { @@ -673,10 +698,6 @@ IDS_ASH_MESSAGE_CENTER_SETTINGS_DIALOG_DESCRIPTION)); } -const char* NotifierSettingsView::GetClassName() const { - return "NotifierSettingsView"; -} - void NotifierSettingsView::OnNotifiersUpdated( const std::vector<NotifierMetadata>& notifiers) { // We do not show notifier metadata when notifications settings are @@ -873,4 +894,7 @@ NotifierSettingsController::Get()->GetNotifiers(); } +BEGIN_METADATA(NotifierSettingsView) +END_METADATA + } // namespace ash
diff --git a/ash/system/message_center/notifier_settings_view.h b/ash/system/message_center/notifier_settings_view.h index cd80fc5..093bfc4 100644 --- a/ash/system/message_center/notifier_settings_view.h +++ b/ash/system/message_center/notifier_settings_view.h
@@ -12,6 +12,7 @@ #include "ash/public/cpp/notifier_settings_observer.h" #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/message_center/public/cpp/notifier_id.h" #include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/button/image_button.h" @@ -30,6 +31,8 @@ // users to customize the settings. class ASH_EXPORT NotifierSettingsView : public views::View, public NotifierSettingsObserver { + METADATA_HEADER(NotifierSettingsView, views::View) + public: NotifierSettingsView(); @@ -50,7 +53,6 @@ // views::View: void GetAccessibleNodeData(ui::AXNodeData* node_data) override; - const char* GetClassName() const override; views::ScrollView* get_scroller_view_for_test() { return scroller_; } views::Label* get_notification_settings_lable_for_test() { @@ -68,6 +70,8 @@ FRIEND_TEST_ALL_PREFIXES(NotifierSettingsViewTest, TestEmptyNotifierView); class ASH_EXPORT NotifierButton : public views::Button { + METADATA_HEADER(NotifierButton, views::Button) + public: explicit NotifierButton(const NotifierMetadata& notifier); @@ -83,9 +87,6 @@ return notifier_id_; } - // views::Button: - const char* GetClassName() const override; - private: // views::Button: void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
diff --git a/ash/system/network/fake_network_detailed_network_view.cc b/ash/system/network/fake_network_detailed_network_view.cc index e68469cf..e78831f 100644 --- a/ash/system/network/fake_network_detailed_network_view.cc +++ b/ash/system/network/fake_network_detailed_network_view.cc
@@ -13,6 +13,7 @@ #include "ash/system/network/network_list_network_item_view.h" #include "ash/system/network/network_list_view_controller_impl.h" #include "ash/system/network/network_list_wifi_header_view_impl.h" +#include "ui/base/metadata/metadata_impl_macros.h" namespace ash { @@ -93,4 +94,7 @@ last_scan_bar_visibility_ = visible; } +BEGIN_METADATA(FakeNetworkDetailedNetworkView) +END_METADATA + } // namespace ash
diff --git a/ash/system/network/fake_network_detailed_network_view.h b/ash/system/network/fake_network_detailed_network_view.h index 6471b51..b99cc89e 100644 --- a/ash/system/network/fake_network_detailed_network_view.h +++ b/ash/system/network/fake_network_detailed_network_view.h
@@ -12,6 +12,7 @@ #include "ash/system/network/network_list_network_item_view.h" #include "ash/system/network/network_list_wifi_header_view_impl.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { @@ -21,6 +22,8 @@ : public NetworkDetailedNetworkView, public views::View, public ViewClickListener { + METADATA_HEADER(FakeNetworkDetailedNetworkView, views::View) + public: explicit FakeNetworkDetailedNetworkView(Delegate* delegate); FakeNetworkDetailedNetworkView(const FakeNetworkDetailedNetworkView&) =
diff --git a/ash/system/network/fake_network_list_mobile_header_view.cc b/ash/system/network/fake_network_list_mobile_header_view.cc index f8ca3405..9c73acf 100644 --- a/ash/system/network/fake_network_list_mobile_header_view.cc +++ b/ash/system/network/fake_network_list_mobile_header_view.cc
@@ -6,6 +6,7 @@ #include "ash/system/network/network_list_mobile_header_view.h" #include "ash/system/network/network_list_network_header_view.h" +#include "ui/base/metadata/metadata_impl_macros.h" namespace ash { @@ -23,4 +24,7 @@ set_toggle_state_count_++; } +BEGIN_METADATA(FakeNetworkListMobileHeaderView) +END_METADATA + } // namespace ash
diff --git a/ash/system/network/fake_network_list_mobile_header_view.h b/ash/system/network/fake_network_list_mobile_header_view.h index 584f49a..218cc7a 100644 --- a/ash/system/network/fake_network_list_mobile_header_view.h +++ b/ash/system/network/fake_network_list_mobile_header_view.h
@@ -8,12 +8,15 @@ #include "ash/ash_export.h" #include "ash/system/network/network_list_mobile_header_view.h" #include "ash/system/network/network_list_network_header_view.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash { // Fake implementation of NetworkListMobileHeaderView class ASH_EXPORT FakeNetworkListMobileHeaderView : public NetworkListMobileHeaderView { + METADATA_HEADER(FakeNetworkListMobileHeaderView, NetworkListMobileHeaderView) + public: explicit FakeNetworkListMobileHeaderView( NetworkListNetworkHeaderView::Delegate* delegate);
diff --git a/ash/system/network/fake_network_list_tether_hosts_header_view.cc b/ash/system/network/fake_network_list_tether_hosts_header_view.cc index 782a768..ffdcd2d 100644 --- a/ash/system/network/fake_network_list_tether_hosts_header_view.cc +++ b/ash/system/network/fake_network_list_tether_hosts_header_view.cc
@@ -8,6 +8,7 @@ #include "ash/system/network/network_list_network_header_view.h" #include "ash/system/network/network_list_tether_hosts_header_view.h" #include "base/feature_list.h" +#include "ui/base/metadata/metadata_impl_macros.h" namespace ash { @@ -20,4 +21,7 @@ FakeNetworkListTetherHostsHeaderView::~FakeNetworkListTetherHostsHeaderView() = default; +BEGIN_METADATA(FakeNetworkListTetherHostsHeaderView) +END_METADATA + } // namespace ash
diff --git a/ash/system/network/fake_network_list_tether_hosts_header_view.h b/ash/system/network/fake_network_list_tether_hosts_header_view.h index 63e5f1f..861eeba7 100644 --- a/ash/system/network/fake_network_list_tether_hosts_header_view.h +++ b/ash/system/network/fake_network_list_tether_hosts_header_view.h
@@ -8,12 +8,16 @@ #include "ash/ash_export.h" #include "ash/system/network/network_list_network_header_view.h" #include "ash/system/network/network_list_tether_hosts_header_view.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash { // Fake implementation of NetworkListTetherHostsHeaderView class ASH_EXPORT FakeNetworkListTetherHostsHeaderView : public NetworkListTetherHostsHeaderView { + METADATA_HEADER(FakeNetworkListTetherHostsHeaderView, + NetworkListTetherHostsHeaderView) + public: explicit FakeNetworkListTetherHostsHeaderView( NetworkListNetworkHeaderView::Delegate* delegate);
diff --git a/ash/system/network/fake_network_list_wifi_header_view.cc b/ash/system/network/fake_network_list_wifi_header_view.cc index d641e44a..da9e0a40 100644 --- a/ash/system/network/fake_network_list_wifi_header_view.cc +++ b/ash/system/network/fake_network_list_wifi_header_view.cc
@@ -6,6 +6,7 @@ #include "ash/system/network/network_list_network_header_view.h" #include "ash/system/network/network_list_wifi_header_view.h" +#include "ui/base/metadata/metadata_impl_macros.h" namespace ash { @@ -23,4 +24,7 @@ set_toggle_state_count_++; } +BEGIN_METADATA(FakeNetworkListWifiHeaderView) +END_METADATA + } // namespace ash
diff --git a/ash/system/network/fake_network_list_wifi_header_view.h b/ash/system/network/fake_network_list_wifi_header_view.h index c94009f..d6c32a7d 100644 --- a/ash/system/network/fake_network_list_wifi_header_view.h +++ b/ash/system/network/fake_network_list_wifi_header_view.h
@@ -8,12 +8,15 @@ #include "ash/ash_export.h" #include "ash/system/network/network_list_network_header_view.h" #include "ash/system/network/network_list_wifi_header_view.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash { // Fake implementation of NetworkListWifiHeaderView class ASH_EXPORT FakeNetworkListWifiHeaderView : public NetworkListWifiHeaderView { + METADATA_HEADER(FakeNetworkListWifiHeaderView, NetworkListWifiHeaderView) + public: explicit FakeNetworkListWifiHeaderView( NetworkListNetworkHeaderView::Delegate* delegate);
diff --git a/ash/system/network/network_feature_tile_pixeltest.cc b/ash/system/network/network_feature_tile_pixeltest.cc index 0f600a16..80e01ac 100644 --- a/ash/system/network/network_feature_tile_pixeltest.cc +++ b/ash/system/network/network_feature_tile_pixeltest.cc
@@ -2,14 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/constants/ash_features.h" #include "ash/system/network/network_feature_pod_controller.h" #include "ash/system/unified/unified_system_tray.h" #include "ash/system/unified/unified_system_tray_bubble.h" #include "ash/test/ash_test_base.h" #include "ash/test/pixel/ash_pixel_differ.h" #include "ash/test/pixel/ash_pixel_test_init_params.h" -#include "base/test/scoped_feature_list.h" #include "chromeos/ash/components/network/network_state_test_helper.h" #include "chromeos/ash/services/network_config/public/cpp/cros_network_config_test_helper.h" #include "chromeos/constants/chromeos_features.h" @@ -42,10 +40,7 @@ // Pixel test for the quick settings network feature tile view. class NetworkFeatureTilePixelTest : public AshTestBase { public: - NetworkFeatureTilePixelTest() { - feature_list_.InitWithFeatures( - {features::kQsRevamp, chromeos::features::kJelly}, {}); - } + NetworkFeatureTilePixelTest() = default; void SetUp() override { AshTestBase::SetUp(); @@ -130,7 +125,6 @@ return network_state_helper()->ConfigureService(shill_json_string); } - base::test::ScopedFeatureList feature_list_; std::string cellular_path_; std::string ethernet_path_; std::string wifi_path_;
diff --git a/ash/system/network/network_list_header_view.cc b/ash/system/network/network_list_header_view.cc index abf17c9..8ce01b7 100644 --- a/ash/system/network/network_list_header_view.cc +++ b/ash/system/network/network_list_header_view.cc
@@ -10,14 +10,14 @@ #include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tri_view.h" #include "ash/system/tray/view_click_listener.h" -#include "ui/views/layout/fill_layout.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/view.h" namespace ash { NetworkListHeaderView::NetworkListHeaderView() { TrayPopupUtils::ConfigureAsStickyHeader(this); - SetLayoutManager(std::make_unique<views::FillLayout>()); + SetUseDefaultFillLayout(true); entry_row_ = AddChildView(std::make_unique<HoverHighlightView>(/*listener=*/this)); entry_row_->SetFocusBehavior(FocusBehavior::NEVER); @@ -31,4 +31,7 @@ } } +BEGIN_METADATA(NetworkListHeaderView) +END_METADATA + } // namespace ash
diff --git a/ash/system/network/network_list_header_view.h b/ash/system/network/network_list_header_view.h index 48a1de2a..a68956e 100644 --- a/ash/system/network/network_list_header_view.h +++ b/ash/system/network/network_list_header_view.h
@@ -9,6 +9,7 @@ #include "ash/system/tray/tri_view.h" #include "ash/system/tray/view_click_listener.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { @@ -19,6 +20,8 @@ // responsible for initializing the core views for a header. class ASH_EXPORT NetworkListHeaderView : public views::View, public ViewClickListener { + METADATA_HEADER(NetworkListHeaderView, views::View) + public: NetworkListHeaderView(const NetworkListHeaderView&) = delete; NetworkListHeaderView& operator=(const NetworkListHeaderView&) = delete;
diff --git a/ash/system/network/network_list_network_header_view.cc b/ash/system/network/network_list_network_header_view.cc index a92d9636..497cb3d 100644 --- a/ash/system/network/network_list_network_header_view.cc +++ b/ash/system/network/network_list_network_header_view.cc
@@ -18,6 +18,7 @@ #include "base/memory/weak_ptr.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/image_view.h" @@ -97,4 +98,7 @@ OnToggleToggled(has_new_state ? toggle_->GetIsOn() : !toggle_->GetIsOn()); } +BEGIN_METADATA(NetworkListNetworkHeaderView) +END_METADATA + } // namespace ash
diff --git a/ash/system/network/network_list_network_header_view.h b/ash/system/network/network_list_network_header_view.h index 8a8af90..6537c89 100644 --- a/ash/system/network/network_list_network_header_view.h +++ b/ash/system/network/network_list_network_header_view.h
@@ -12,6 +12,7 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "chromeos/ui/vector_icons/vector_icons.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { @@ -22,6 +23,8 @@ // implements the functionality shared between the headers of Mobile and Wifi // network headers. class ASH_EXPORT NetworkListNetworkHeaderView : public NetworkListHeaderView { + METADATA_HEADER(NetworkListNetworkHeaderView, NetworkListHeaderView) + public: class Delegate { public:
diff --git a/ash/system/network/network_list_tether_hosts_header_view.cc b/ash/system/network/network_list_tether_hosts_header_view.cc index fde79b4..4932232d 100644 --- a/ash/system/network/network_list_tether_hosts_header_view.cc +++ b/ash/system/network/network_list_tether_hosts_header_view.cc
@@ -8,6 +8,7 @@ #include "ash/resources/vector_icons/vector_icons.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/network/network_list_network_header_view.h" +#include "ui/base/metadata/metadata_impl_macros.h" namespace ash { @@ -22,4 +23,7 @@ NetworkListTetherHostsHeaderView::~NetworkListTetherHostsHeaderView() = default; +BEGIN_METADATA(NetworkListTetherHostsHeaderView) +END_METADATA + } // namespace ash
diff --git a/ash/system/network/network_list_tether_hosts_header_view.h b/ash/system/network/network_list_tether_hosts_header_view.h index 4001439..01c34f0 100644 --- a/ash/system/network/network_list_tether_hosts_header_view.h +++ b/ash/system/network/network_list_tether_hosts_header_view.h
@@ -7,6 +7,7 @@ #include "ash/ash_export.h" #include "ash/system/network/network_list_network_header_view.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash { @@ -14,6 +15,9 @@ // section of Quick Settings. class ASH_EXPORT NetworkListTetherHostsHeaderView : public NetworkListNetworkHeaderView { + METADATA_HEADER(NetworkListTetherHostsHeaderView, + NetworkListNetworkHeaderView) + public: explicit NetworkListTetherHostsHeaderView( NetworkListNetworkHeaderView::Delegate* delegate);
diff --git a/ash/system/network/network_list_wifi_header_view.h b/ash/system/network/network_list_wifi_header_view.h index 387a61f7..207d89d7 100644 --- a/ash/system/network/network_list_wifi_header_view.h +++ b/ash/system/network/network_list_wifi_header_view.h
@@ -7,7 +7,7 @@ #include "ash/ash_export.h" #include "ash/system/network/network_list_network_header_view.h" -#include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash {
diff --git a/ash/system/notification_center/notification_list_view.cc b/ash/system/notification_center/notification_list_view.cc index ee4419d..67616fd 100644 --- a/ash/system/notification_center/notification_list_view.cc +++ b/ash/system/notification_center/notification_list_view.cc
@@ -23,6 +23,7 @@ #include "base/metrics/histogram_macros.h" #include "base/ranges/algorithm.h" #include "base/time/time.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/compositor.h" #include "ui/gfx/animation/linear_animation.h" @@ -86,6 +87,8 @@ // All children of NotificationListView should be MessageViewContainer. class NotificationListView::MessageViewContainer : public MessageView::Observer, public views::View { + METADATA_HEADER(MessageViewContainer, views::View) + public: MessageViewContainer(MessageView* message_view, NotificationListView* list_view) @@ -378,6 +381,9 @@ const raw_ptr<NotificationSwipeControlView, ExperimentalAsh> control_view_; }; +BEGIN_METADATA(NotificationListView, MessageViewContainer, views::View) +END_METADATA + NotificationListView::NotificationListView( NotificationCenterView* message_center_view) : views::AnimationDelegateViews(this),
diff --git a/ash/system/notification_center/stacked_notification_bar.cc b/ash/system/notification_center/stacked_notification_bar.cc index 080b9a9..5469034 100644 --- a/ash/system/notification_center/stacked_notification_bar.cc +++ b/ash/system/notification_center/stacked_notification_bar.cc
@@ -16,6 +16,7 @@ #include "base/memory/raw_ptr.h" #include "base/ranges/algorithm.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/color/color_provider.h" @@ -66,6 +67,8 @@ class StackedNotificationBar::StackedNotificationBarIcon : public views::ImageView, public ui::LayerAnimationObserver { + METADATA_HEADER(StackedNotificationBarIcon, views::ImageView) + public: explicit StackedNotificationBarIcon(const std::string& id) : id_(id) { SetPaintToLayer(); @@ -206,6 +209,11 @@ AnimationCompleteCallback animation_complete_callback_; }; +BEGIN_METADATA(StackedNotificationBar, + StackedNotificationBarIcon, + views::ImageView) +END_METADATA + StackedNotificationBar::StackedNotificationBar( NotificationCenterView* notification_center_view) : notification_center_view_(notification_center_view), @@ -430,10 +438,6 @@ } } -const char* StackedNotificationBar::GetClassName() const { - return "StackedNotificationBar"; -} - void StackedNotificationBar::OnNotificationAdded(const std::string& id) { // Reset the stacked icons bar if a notification is added since we don't // know the position where it may have been added. @@ -454,4 +458,7 @@ void StackedNotificationBar::OnNotificationUpdated(const std::string& id) {} +BEGIN_METADATA(StackedNotificationBar) +END_METADATA + } // namespace ash
diff --git a/ash/system/notification_center/stacked_notification_bar.h b/ash/system/notification_center/stacked_notification_bar.h index f612362..4798e37 100644 --- a/ash/system/notification_center/stacked_notification_bar.h +++ b/ash/system/notification_center/stacked_notification_bar.h
@@ -7,6 +7,7 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/message_center/message_center_observer.h" #include "ui/views/view.h" @@ -29,6 +30,8 @@ // are scrolled. class StackedNotificationBar : public views::View, public message_center::MessageCenterObserver { + METADATA_HEADER(StackedNotificationBar, views::View) + public: explicit StackedNotificationBar( NotificationCenterView* notification_center_view); @@ -45,9 +48,6 @@ int pinned_notification_count, std::vector<message_center::Notification*> stacked_notifications); - // views::View: - const char* GetClassName() const override; - // message_center::MessageCenterObserver: void OnNotificationAdded(const std::string& id) override; void OnNotificationRemoved(const std::string& id, bool by_user) override;
diff --git a/ash/system/phonehub/app_stream_launcher_item.cc b/ash/system/phonehub/app_stream_launcher_item.cc index 74f6def..9ebeb1ee 100644 --- a/ash/system/phonehub/app_stream_launcher_item.cc +++ b/ash/system/phonehub/app_stream_launcher_item.cc
@@ -9,6 +9,8 @@ #include "base/strings/string_piece.h" #include "base/strings/utf_string_conversions.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia_operations.h" @@ -43,6 +45,8 @@ } class AppNameLabel : public views::LabelButton { + METADATA_HEADER(AppNameLabel, views::LabelButton) + public: explicit AppNameLabel(PressedCallback callback = PressedCallback(), const std::u16string& text = std::u16string()) @@ -58,6 +62,9 @@ AppNameLabel operator=(AppNameLabel&) = delete; }; +BEGIN_METADATA(AppNameLabel) +END_METADATA + } // namespace AppStreamLauncherItem::AppStreamLauncherItem( @@ -128,4 +135,7 @@ return recent_app_button_; } +BEGIN_METADATA(AppStreamLauncherItem) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/app_stream_launcher_item.h b/ash/system/phonehub/app_stream_launcher_item.h index 5486786..791c82a5 100644 --- a/ash/system/phonehub/app_stream_launcher_item.h +++ b/ash/system/phonehub/app_stream_launcher_item.h
@@ -9,7 +9,9 @@ #include "ash/system/phonehub/phone_hub_recent_app_button.h" #include "base/memory/raw_ptr.h" #include "chromeos/ash/components/phonehub/notification.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/button/image_button.h" +#include "ui/views/view.h" namespace views { class LabelButton; @@ -19,6 +21,8 @@ // A view contains a PhoneHubRecentAppButton and a label with app name. class ASH_EXPORT AppStreamLauncherItem : public views::View { + METADATA_HEADER(AppStreamLauncherItem, views::View) + public: AppStreamLauncherItem( views::ImageButton::PressedCallback callback,
diff --git a/ash/system/phonehub/camera_roll_view.cc b/ash/system/phonehub/camera_roll_view.cc index 2a8657b..2d6eba2 100644 --- a/ash/system/phonehub/camera_roll_view.cc +++ b/ash/system/phonehub/camera_roll_view.cc
@@ -17,6 +17,8 @@ #include "base/strings/string_number_conversions.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/gfx/text_constants.h" #include "ui/views/animation/animation_builder.h" @@ -48,6 +50,8 @@ } class HeaderView : public views::Label { + METADATA_HEADER(HeaderView, views::Label) + public: HeaderView() { SetText(l10n_util::GetStringUTF16(IDS_ASH_PHONE_HUB_CAMERA_ROLL_TITLE)); @@ -81,6 +85,9 @@ const char* GetClassName() const override { return "HeaderView"; } }; +BEGIN_METADATA(HeaderView) +END_METADATA + } // namespace CameraRollView::CameraRollView( @@ -110,10 +117,6 @@ Update(); } -const char* CameraRollView::GetClassName() const { - return "CameraRollView"; -} - CameraRollView::CameraRollItemsView::CameraRollItemsView() = default; CameraRollView::CameraRollItemsView::~CameraRollItemsView() = default; @@ -153,10 +156,6 @@ } } -const char* CameraRollView::CameraRollItemsView::GetClassName() const { - return "CameraRollItemsView"; -} - gfx::Point CameraRollView::CameraRollItemsView::GetCameraRollItemPosition( int index) { auto item_size = GetCameraRollItemSize(); @@ -177,6 +176,9 @@ } } +BEGIN_METADATA(CameraRollView, CameraRollItemsView, views::View) +END_METADATA + void CameraRollView::Update() { items_view_->Reset(); phonehub::CameraRollManager::CameraRollUiState current_ui_state = @@ -215,4 +217,7 @@ PreferredSizeChanged(); } +BEGIN_METADATA(CameraRollView) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/camera_roll_view.h b/ash/system/phonehub/camera_roll_view.h index 4bbb1b8..8ca5e0d 100644 --- a/ash/system/phonehub/camera_roll_view.h +++ b/ash/system/phonehub/camera_roll_view.h
@@ -9,6 +9,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "chromeos/ash/components/phonehub/camera_roll_manager.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" #include "ui/views/view_model.h" @@ -24,6 +25,8 @@ // This view will automatically hide if no Camera Roll items are available. class ASH_EXPORT CameraRollView : public views::View, public phonehub::CameraRollManager::Observer { + METADATA_HEADER(CameraRollView, views::View) + public: CameraRollView(phonehub::CameraRollManager* camera_roll_manager, phonehub::UserActionRecorder* user_action_recorder); @@ -34,9 +37,6 @@ // phonehub::CameraRollManager::Observer: void OnCameraRollViewUiStateUpdated() override; - // views::View: - const char* GetClassName() const override; - private: friend class CameraRollViewTest; FRIEND_TEST_ALL_PREFIXES(CameraRollViewTest, OptInAlready); @@ -45,6 +45,8 @@ FRIEND_TEST_ALL_PREFIXES(CameraRollViewTest, VideoThumbnail); class CameraRollItemsView : public views::View { + METADATA_HEADER(CameraRollItemsView, views::View) + public: CameraRollItemsView(); ~CameraRollItemsView() override; @@ -57,7 +59,6 @@ // views::View: gfx::Size CalculatePreferredSize() const override; void Layout() override; - const char* GetClassName() const override; private: FRIEND_TEST_ALL_PREFIXES(CameraRollViewTest, ViewLayout);
diff --git a/ash/system/phonehub/phone_connected_view.cc b/ash/system/phonehub/phone_connected_view.cc index af9adc4..c80cd65 100644 --- a/ash/system/phonehub/phone_connected_view.cc +++ b/ash/system/phonehub/phone_connected_view.cc
@@ -24,6 +24,7 @@ #include "chromeos/ash/components/phonehub/phone_hub_manager.h" #include "chromeos/ash/components/phonehub/ping_manager.h" #include "chromeos/ash/components/phonehub/user_action_recorder.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/resource/resource_bundle.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/insets.h" @@ -153,4 +154,7 @@ enable_hotspot->icon_button()->NotifyClick(event); } +BEGIN_METADATA(PhoneConnectedView) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/phone_connected_view.h b/ash/system/phonehub/phone_connected_view.h index cc4c0d4..8022e395 100644 --- a/ash/system/phonehub/phone_connected_view.h +++ b/ash/system/phonehub/phone_connected_view.h
@@ -10,6 +10,7 @@ #include "ash/system/phonehub/phone_hub_content_view.h" #include "base/memory/raw_ptr.h" #include "chromeos/ash/components/phonehub/phone_hub_manager.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/events/event.h" #include "ui/views/view.h" @@ -24,6 +25,8 @@ // A view of the Phone Hub panel, displaying phone status and utility actions // such as phone status, task continuation, etc. class PhoneConnectedView : public PhoneHubContentView { + METADATA_HEADER(PhoneConnectedView, PhoneHubContentView) + public: explicit PhoneConnectedView(phonehub::PhoneHubManager* phone_hub_manager); ~PhoneConnectedView() override;
diff --git a/ash/system/phonehub/phone_hub_app_count_icon.cc b/ash/system/phonehub/phone_hub_app_count_icon.cc index c9c40ad..fd39f4f 100644 --- a/ash/system/phonehub/phone_hub_app_count_icon.cc +++ b/ash/system/phonehub/phone_hub_app_count_icon.cc
@@ -6,6 +6,7 @@ #include "ash/style/ash_color_provider.h" #include "base/i18n/number_formatting.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" #include "ui/gfx/font_list.h" @@ -60,4 +61,8 @@ count, AppIcon::kSizeSmall)), AppIcon::kSizeSmall) {} + +BEGIN_METADATA(AppCountIcon) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/phone_hub_app_count_icon.h b/ash/system/phonehub/phone_hub_app_count_icon.h index 0b9d3987..54fc7b5 100644 --- a/ash/system/phonehub/phone_hub_app_count_icon.h +++ b/ash/system/phonehub/phone_hub_app_count_icon.h
@@ -4,15 +4,20 @@ #ifndef ASH_SYSTEM_PHONEHUB_PHONE_HUB_APP_COUNT_ICON_H_ #define ASH_SYSTEM_PHONEHUB_PHONE_HUB_APP_COUNT_ICON_H_ + #include "ash/ash_export.h" #include "ash/system/phonehub/phone_hub_app_icon.h" +#include "ui/base/metadata/metadata_header_macros.h" namespace ash { class ASH_EXPORT AppCountIcon : public AppIcon { + METADATA_HEADER(AppCountIcon, AppIcon) + public: explicit AppCountIcon(const int count); }; + } // namespace ash #endif // ASH_SYSTEM_PHONEHUB_PHONE_HUB_APP_COUNT_ICON_H_
diff --git a/ash/system/phonehub/phone_hub_app_icon.cc b/ash/system/phonehub/phone_hub_app_icon.cc index 5abbdba..41aa3a0 100644 --- a/ash/system/phonehub/phone_hub_app_icon.cc +++ b/ash/system/phonehub/phone_hub_app_icon.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "ash/system/phonehub/phone_hub_app_icon.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia_operations.h" @@ -14,9 +15,7 @@ gfx::Size(size, size))); } -// views::View: -const char* AppIcon::GetClassName() const { - return "AppIcon"; -} +BEGIN_METADATA(AppIcon) +END_METADATA } // namespace ash
diff --git a/ash/system/phonehub/phone_hub_app_icon.h b/ash/system/phonehub/phone_hub_app_icon.h index c2d379e..44427b2 100644 --- a/ash/system/phonehub/phone_hub_app_icon.h +++ b/ash/system/phonehub/phone_hub_app_icon.h
@@ -6,11 +6,14 @@ #define ASH_SYSTEM_PHONEHUB_PHONE_HUB_APP_ICON_H_ #include "ash/ash_export.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/image_view.h" namespace ash { class ASH_EXPORT AppIcon : public views::ImageView { + METADATA_HEADER(AppIcon, views::ImageView) + public: // Measured in DIPs. static constexpr int kSizeSmall = 20; @@ -28,10 +31,8 @@ AppIcon(const AppIcon&) = delete; AppIcon& operator=(const AppIcon&) = delete; ~AppIcon() override = default; - - // views::View: - const char* GetClassName() const override; }; + } // namespace ash #endif // ASH_SYSTEM_PHONEHUB_PHONE_HUB_APP_ICON_H_
diff --git a/ash/system/phonehub/phone_hub_app_loading_icon.cc b/ash/system/phonehub/phone_hub_app_loading_icon.cc index dc96e83..7c1970c 100644 --- a/ash/system/phonehub/phone_hub_app_loading_icon.cc +++ b/ash/system/phonehub/phone_hub_app_loading_icon.cc
@@ -5,6 +5,7 @@ #include "ash/system/phonehub/phone_hub_app_loading_icon.h" #include "ash/style/ash_color_provider.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/canvas_image_source.h" @@ -78,4 +79,7 @@ animation_initial_delay_timer_.Stop(); } +BEGIN_METADATA(AppLoadingIcon) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/phone_hub_app_loading_icon.h b/ash/system/phonehub/phone_hub_app_loading_icon.h index adb466ab..ea7b41c 100644 --- a/ash/system/phonehub/phone_hub_app_loading_icon.h +++ b/ash/system/phonehub/phone_hub_app_loading_icon.h
@@ -9,11 +9,14 @@ #include "ash/system/phonehub/phone_hub_app_icon.h" #include "base/timer/timer.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/animation/animation_abort_handle.h" namespace ash { class ASH_EXPORT AppLoadingIcon : public AppIcon { + METADATA_HEADER(AppLoadingIcon, AppIcon) + public: explicit AppLoadingIcon(int size); AppLoadingIcon(const AppLoadingIcon&) = delete;
diff --git a/ash/system/phonehub/phone_hub_content_view.cc b/ash/system/phonehub/phone_hub_content_view.cc index ee38790..71197eef 100644 --- a/ash/system/phonehub/phone_hub_content_view.cc +++ b/ash/system/phonehub/phone_hub_content_view.cc
@@ -4,6 +4,8 @@ #include "ash/system/phonehub/phone_hub_content_view.h" +#include "ui/base/metadata/metadata_impl_macros.h" + namespace ash { PhoneHubContentView::PhoneHubContentView() = default; @@ -22,4 +24,7 @@ phone_hub_metrics::LogInterstitialScreenEvent(GetScreenForMetrics(), event); } +BEGIN_METADATA(PhoneHubContentView) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/phone_hub_content_view.h b/ash/system/phonehub/phone_hub_content_view.h index 5dcd221..3f476d0 100644 --- a/ash/system/phonehub/phone_hub_content_view.h +++ b/ash/system/phonehub/phone_hub_content_view.h
@@ -7,12 +7,15 @@ #include "ash/ash_export.h" #include "ash/system/phonehub/phone_hub_metrics.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { // A base class for Phone Hub content views. class ASH_EXPORT PhoneHubContentView : public views::View { + METADATA_HEADER(PhoneHubContentView, views::View) + public: ~PhoneHubContentView() override;
diff --git a/ash/system/phonehub/phone_hub_recent_apps_view.cc b/ash/system/phonehub/phone_hub_recent_apps_view.cc index eb73099..51e820f6 100644 --- a/ash/system/phonehub/phone_hub_recent_apps_view.cc +++ b/ash/system/phonehub/phone_hub_recent_apps_view.cc
@@ -29,6 +29,7 @@ #include "chromeos/ash/components/phonehub/phone_hub_manager.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/insets.h" @@ -172,10 +173,6 @@ } } -const char* PhoneHubRecentAppsView::HeaderView::GetClassName() const { - return "HeaderView"; -} - void PhoneHubRecentAppsView::HeaderView::SetErrorButtonVisible( bool is_visible) { if (error_button_) { @@ -183,7 +180,12 @@ } } +BEGIN_METADATA(PhoneHubRecentAppsView, HeaderView, views::View) +END_METADATA + class PhoneHubRecentAppsView::PlaceholderView : public views::Label { + METADATA_HEADER(PlaceholderView, views::Label) + public: PlaceholderView() { SetText( @@ -205,11 +207,11 @@ ~PlaceholderView() override = default; PlaceholderView(PlaceholderView&) = delete; PlaceholderView operator=(PlaceholderView&) = delete; - - // views::View: - const char* GetClassName() const override { return "ContentView"; } }; +BEGIN_METADATA(PhoneHubRecentAppsView, PlaceholderView, views::Label) +END_METADATA + PhoneHubRecentAppsView::PhoneHubRecentAppsView( phonehub::RecentAppsInteractionHandler* recent_apps_interaction_handler, phonehub::PhoneHubManager* phone_hub_manager, @@ -253,10 +255,6 @@ recent_apps_interaction_handler_->RemoveObserver(this); } -const char* PhoneHubRecentAppsView::GetClassName() const { - return "PhoneHubRecentAppsView"; -} - PhoneHubRecentAppsView::RecentAppButtonsView::RecentAppButtonsView() { SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); @@ -307,10 +305,6 @@ LayoutAppButtonsView(this); } -const char* PhoneHubRecentAppsView::RecentAppButtonsView::GetClassName() const { - return "RecentAppButtonView"; -} - void PhoneHubRecentAppsView::RecentAppButtonsView::Reset() { RemoveAllChildViews(); } @@ -320,6 +314,9 @@ return weak_ptr_factory_.GetWeakPtr(); } +BEGIN_METADATA(PhoneHubRecentAppsView, RecentAppButtonsView, views::View) +END_METADATA + PhoneHubRecentAppsView::LoadingView::LoadingView() { SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); @@ -356,10 +353,6 @@ LayoutAppButtonsView(this); } -const char* PhoneHubRecentAppsView::LoadingView::GetClassName() const { - return "RecentAppLoadingView"; -} - base::WeakPtr<PhoneHubRecentAppsView::LoadingView> PhoneHubRecentAppsView::LoadingView::GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); @@ -382,6 +375,9 @@ more_apps_button_->StopLoadingAnimation(); } +BEGIN_METADATA(PhoneHubRecentAppsView, LoadingView, views::BoxLayoutView) +END_METADATA + void PhoneHubRecentAppsView::Update() { recent_app_buttons_view_->Reset(); recent_app_button_list_.clear(); @@ -583,4 +579,7 @@ return more_apps_button; } +BEGIN_METADATA(PhoneHubRecentAppsView) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/phone_hub_recent_apps_view.h b/ash/system/phonehub/phone_hub_recent_apps_view.h index 43766f3..c19be7eb 100644 --- a/ash/system/phonehub/phone_hub_recent_apps_view.h +++ b/ash/system/phonehub/phone_hub_recent_apps_view.h
@@ -14,6 +14,7 @@ #include "base/timer/timer.h" #include "chromeos/ash/components/phonehub/recent_apps_interaction_handler.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/layout/box_layout_view.h" #include "ui/views/view.h" @@ -33,6 +34,8 @@ class ASH_EXPORT PhoneHubRecentAppsView : public views::View, public phonehub::RecentAppsInteractionHandler::Observer { + METADATA_HEADER(PhoneHubRecentAppsView, views::View) + public: explicit PhoneHubRecentAppsView( phonehub::RecentAppsInteractionHandler* recent_apps_interaction_handler, @@ -45,9 +48,6 @@ // phonehub::RecentAppsInteractionHandler::Observer: void OnRecentAppsUiStateUpdated() override; - // views::View: - const char* GetClassName() const override; - protected: friend class RecentAppButtonsViewTest; @@ -72,15 +72,14 @@ class PlaceholderView; class HeaderView : public views::View { + METADATA_HEADER(HeaderView, views::View) + public: explicit HeaderView(views::ImageButton::PressedCallback callback); ~HeaderView() override = default; HeaderView(HeaderView&) = delete; HeaderView operator=(HeaderView&) = delete; - // views::View: - const char* GetClassName() const override; - void SetErrorButtonVisible(bool is_visible); views::ImageButton* get_error_button_for_test() { return error_button_; } @@ -90,6 +89,8 @@ }; class RecentAppButtonsView : public views::View { + METADATA_HEADER(RecentAppButtonsView, views::View) + public: RecentAppButtonsView(); ~RecentAppButtonsView() override; @@ -99,7 +100,6 @@ // views::View: gfx::Size CalculatePreferredSize() const override; void Layout() override; - const char* GetClassName() const override; views::View* AddRecentAppButton( std::unique_ptr<views::View> recent_app_button); @@ -112,6 +112,8 @@ }; class LoadingView : public views::BoxLayoutView { + METADATA_HEADER(LoadingView, views::BoxLayoutView) + public: LoadingView(); ~LoadingView() override; @@ -121,7 +123,6 @@ // views::View: gfx::Size CalculatePreferredSize() const override; void Layout() override; - const char* GetClassName() const override; void StartLoadingAnimation(); void StopLoadingAnimation();
diff --git a/ash/system/phonehub/phone_hub_tray.h b/ash/system/phonehub/phone_hub_tray.h index 8ee218c..c8a4b8b 100644 --- a/ash/system/phonehub/phone_hub_tray.h +++ b/ash/system/phonehub/phone_hub_tray.h
@@ -125,6 +125,7 @@ private: FRIEND_TEST_ALL_PREFIXES(PhoneHubTrayTest, SafeAccessToHeaderView); + FRIEND_TEST_ALL_PREFIXES(PhoneHubTrayTest, EcheIconActivatesCallback); // TrayBubbleView::Delegate: std::u16string GetAccessibleNameForBubble() override;
diff --git a/ash/system/phonehub/phone_hub_tray_unittest.cc b/ash/system/phonehub/phone_hub_tray_unittest.cc index 21dd4fd..b1ca72e 100644 --- a/ash/system/phonehub/phone_hub_tray_unittest.cc +++ b/ash/system/phonehub/phone_hub_tray_unittest.cc
@@ -18,10 +18,12 @@ #include "ash/system/toast/anchored_nudge_manager_impl.h" #include "ash/test/ash_test_base.h" #include "base/memory/raw_ptr.h" +#include "base/test/bind.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/time/time.h" #include "chromeos/ash/components/phonehub/fake_connection_scheduler.h" +#include "chromeos/ash/components/phonehub/fake_icon_decoder.h" #include "chromeos/ash/components/phonehub/fake_multidevice_feature_access_manager.h" #include "chromeos/ash/components/phonehub/fake_phone_hub_manager.h" #include "chromeos/ash/components/phonehub/phone_model_test_util.h" @@ -851,4 +853,16 @@ Shell::Get()->anchored_nudge_manager()->IsNudgeShown(kPhoneHubNudgeId)); } +TEST_F(PhoneHubTrayTest, EcheIconActivatesCallback) { + bool launched_app_window = false; + phone_hub_tray_->SetEcheIconActivationCallback( + base::BindLambdaForTesting([&]() { launched_app_window = true; })); + phone_hub_tray_->OnAppStreamUpdate(phonehub::proto::AppStreamUpdate()); + phone_hub_manager_.fake_icon_decoder()->FinishLastCall(); + + LeftClickOn(phone_hub_tray_->eche_icon_); + + EXPECT_TRUE(launched_app_window); +} + } // namespace ash
diff --git a/ash/system/phonehub/quick_action_item.cc b/ash/system/phonehub/quick_action_item.cc index 54bdaec..46d5850 100644 --- a/ash/system/phonehub/quick_action_item.cc +++ b/ash/system/phonehub/quick_action_item.cc
@@ -12,6 +12,7 @@ #include "base/functional/bind.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/insets.h" @@ -176,4 +177,7 @@ return "QuickActionItem"; } +BEGIN_METADATA(QuickActionItem) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/quick_action_item.h b/ash/system/phonehub/quick_action_item.h index dbc70f4..918fc833 100644 --- a/ash/system/phonehub/quick_action_item.h +++ b/ash/system/phonehub/quick_action_item.h
@@ -8,6 +8,8 @@ #include "ash/ash_export.h" #include "ash/system/unified/feature_pod_button.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/views/view.h" namespace views { class Label; @@ -17,6 +19,8 @@ // A toggle button with labels used in the quick action view. class ASH_EXPORT QuickActionItem : public views::View { + METADATA_HEADER(QuickActionItem, views::View) + public: class Delegate { public:
diff --git a/ash/system/phonehub/quick_actions_view.cc b/ash/system/phonehub/quick_actions_view.cc index 362c66b3..3251d58 100644 --- a/ash/system/phonehub/quick_actions_view.cc +++ b/ash/system/phonehub/quick_actions_view.cc
@@ -10,6 +10,7 @@ #include "ash/system/phonehub/quick_action_item.h" #include "ash/system/phonehub/silence_phone_quick_action_controller.h" #include "chromeos/constants/chromeos_features.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/layout/box_layout.h" namespace ash { @@ -66,4 +67,7 @@ } } +BEGIN_METADATA(QuickActionsView) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/quick_actions_view.h b/ash/system/phonehub/quick_actions_view.h index 03b0f284..9b9750ea 100644 --- a/ash/system/phonehub/quick_actions_view.h +++ b/ash/system/phonehub/quick_actions_view.h
@@ -8,6 +8,7 @@ #include "ash/ash_export.h" #include "base/memory/raw_ptr.h" #include "chromeos/ash/components/phonehub/phone_hub_manager.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" namespace ash { @@ -18,6 +19,8 @@ // A view in Phone Hub bubble that contains toggle button for quick actions such // as enable hotspot, silence phone and locate phone. class ASH_EXPORT QuickActionsView : public views::View { + METADATA_HEADER(QuickActionsView, views::View) + public: explicit QuickActionsView(phonehub::PhoneHubManager* phone_hub_manager); ~QuickActionsView() override;
diff --git a/ash/system/phonehub/task_continuation_view.cc b/ash/system/phonehub/task_continuation_view.cc index 7314c3a7..8984d6f 100644 --- a/ash/system/phonehub/task_continuation_view.cc +++ b/ash/system/phonehub/task_continuation_view.cc
@@ -13,6 +13,8 @@ #include "ash/system/tray/tray_constants.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/text_constants.h" #include "ui/views/controls/label.h" @@ -43,6 +45,8 @@ } class HeaderView : public views::Label { + METADATA_HEADER(HeaderView, views::Label) + public: HeaderView() { SetText( @@ -69,11 +73,11 @@ ~HeaderView() override = default; HeaderView(HeaderView&) = delete; HeaderView operator=(HeaderView&) = delete; - - // views::View: - const char* GetClassName() const override { return "HeaderView"; } }; +BEGIN_METADATA(HeaderView) +END_METADATA + } // namespace TaskContinuationView::TaskContinuationView( @@ -103,10 +107,6 @@ Update(); } -const char* TaskContinuationView::GetClassName() const { - return "TaskContinuationView"; -} - TaskContinuationView::TaskChipsView::TaskChipsView() = default; TaskContinuationView::TaskChipsView::~TaskChipsView() = default; @@ -169,6 +169,9 @@ } } +BEGIN_METADATA(TaskContinuationView, TaskChipsView, views::View) +END_METADATA + void TaskContinuationView::Update() { chips_view_->Reset(); @@ -199,4 +202,7 @@ SetVisible(true); } +BEGIN_METADATA(TaskContinuationView) +END_METADATA + } // namespace ash
diff --git a/ash/system/phonehub/task_continuation_view.h b/ash/system/phonehub/task_continuation_view.h index 16a5369..4f53f74 100644 --- a/ash/system/phonehub/task_continuation_view.h +++ b/ash/system/phonehub/task_continuation_view.h
@@ -9,6 +9,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "chromeos/ash/components/phonehub/phone_model.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" #include "ui/views/view_model.h" @@ -22,6 +23,8 @@ // off from their phone, currently only support web browsing. class ASH_EXPORT TaskContinuationView : public views::View, public phonehub::PhoneModel::Observer { + METADATA_HEADER(TaskContinuationView, views::View) + public: TaskContinuationView(phonehub::PhoneModel* phone_model, phonehub::UserActionRecorder* user_action_recorder); @@ -32,13 +35,12 @@ // phonehub::PhoneHubModel::Observer: void OnModelChanged() override; - // views::View: - const char* GetClassName() const override; - private: FRIEND_TEST_ALL_PREFIXES(TaskContinuationViewTest, TaskChipsView); class TaskChipsView : public views::View { + METADATA_HEADER(TaskChipsView, views::View) + public: TaskChipsView(); ~TaskChipsView() override;
diff --git a/ash/system/power/power_button_menu_screen_view.cc b/ash/system/power/power_button_menu_screen_view.cc index 1ee2816..332349c 100644 --- a/ash/system/power/power_button_menu_screen_view.cc +++ b/ash/system/power/power_button_menu_screen_view.cc
@@ -15,6 +15,7 @@ #include "ash/system/power/power_button_menu_view.h" #include "ash/system/power/power_button_menu_view_util.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/scoped_layer_animation_settings.h" @@ -405,4 +406,7 @@ } } +BEGIN_METADATA(PowerButtonMenuScreenView) +END_METADATA + } // namespace ash
diff --git a/ash/system/power/power_button_menu_screen_view.h b/ash/system/power/power_button_menu_screen_view.h index 550dfc6..6eaf6aa 100644 --- a/ash/system/power/power_button_menu_screen_view.h +++ b/ash/system/power/power_button_menu_screen_view.h
@@ -11,6 +11,7 @@ #include "ash/display/screen_orientation_controller.h" #include "ash/system/power/power_button_controller.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/display/display_observer.h" #include "ui/views/view.h" @@ -24,6 +25,8 @@ // and a PowerButtonMenuView to display the menu. class ASH_EXPORT PowerButtonMenuScreenView : public views::View, public display::DisplayObserver { + METADATA_HEADER(PowerButtonMenuScreenView, views::View) + public: // |show_animation_done| is a callback for when the animation that shows the // power menu has finished.
diff --git a/ash/system/power/power_button_menu_view.cc b/ash/system/power/power_button_menu_view.cc index 800e189..64f3eb18 100644 --- a/ash/system/power/power_button_menu_view.cc +++ b/ash/system/power/power_button_menu_view.cc
@@ -27,6 +27,7 @@ #include "base/time/time.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" #include "ui/compositor/scoped_layer_animation_settings.h" @@ -330,4 +331,7 @@ Shell::Get()->power_button_controller()->DismissMenu(); } +BEGIN_METADATA(PowerButtonMenuView) +END_METADATA + } // namespace ash
diff --git a/ash/system/power/power_button_menu_view.h b/ash/system/power/power_button_menu_view.h index f88170b..01fe477 100644 --- a/ash/system/power/power_button_menu_view.h +++ b/ash/system/power/power_button_menu_view.h
@@ -9,6 +9,7 @@ #include "ash/shutdown_reason.h" #include "ash/system/power/power_button_controller.h" #include "base/memory/raw_ptr_exclusion.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/views/view.h" @@ -21,6 +22,8 @@ // includes power off and sign out items currently. class ASH_EXPORT PowerButtonMenuView : public views::View, public ui::ImplicitAnimationObserver { + METADATA_HEADER(PowerButtonMenuView, views::View) + public: // Direction of the animation transform. X means to translate from // x-coordinate. Y means to translate from y-coordinate.
diff --git a/ash/system/privacy/privacy_indicators_tray_item_view.cc b/ash/system/privacy/privacy_indicators_tray_item_view.cc index 00e98e3..1372dd64 100644 --- a/ash/system/privacy/privacy_indicators_tray_item_view.cc +++ b/ash/system/privacy/privacy_indicators_tray_item_view.cc
@@ -23,6 +23,7 @@ #include "base/timer/timer.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/color/color_id.h" @@ -624,4 +625,7 @@ count_repeated_shows_ = 0; } +BEGIN_METADATA(PrivacyIndicatorsTrayItemView) +END_METADATA + } // namespace ash
diff --git a/ash/system/privacy/privacy_indicators_tray_item_view.h b/ash/system/privacy/privacy_indicators_tray_item_view.h index 80afc72..0e7e6f4 100644 --- a/ash/system/privacy/privacy_indicators_tray_item_view.h +++ b/ash/system/privacy/privacy_indicators_tray_item_view.h
@@ -11,6 +11,7 @@ #include "base/memory/raw_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/compositor/throughput_tracker.h" namespace gfx { @@ -28,6 +29,8 @@ // is currently accessing camera/microphone. class ASH_EXPORT PrivacyIndicatorsTrayItemView : public TrayItemView, public SessionObserver { + METADATA_HEADER(PrivacyIndicatorsTrayItemView, TrayItemView) + public: enum AnimationState { // No animation is running.
diff --git a/ash/system/privacy_screen/privacy_screen_toast_view.cc b/ash/system/privacy_screen/privacy_screen_toast_view.cc index 8cb8df8..8d01daa 100644 --- a/ash/system/privacy_screen/privacy_screen_toast_view.cc +++ b/ash/system/privacy_screen/privacy_screen_toast_view.cc
@@ -12,6 +12,8 @@ #include "ash/system/unified/feature_pod_button.h" #include "base/memory/raw_ptr.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/views/controls/button/button.h" @@ -40,6 +42,8 @@ // View shown if the privacy screen setting is enterprise managed. class PrivacyScreenToastManagedView : public views::View { + METADATA_HEADER(PrivacyScreenToastManagedView, views::View) + public: PrivacyScreenToastManagedView() { SetLayoutManager(std::make_unique<views::BoxLayout>( @@ -71,8 +75,13 @@ ~PrivacyScreenToastManagedView() override = default; }; +BEGIN_METADATA(PrivacyScreenToastManagedView) +END_METADATA + // View containing the various labels in the toast. class PrivacyScreenToastLabelView : public views::View { + METADATA_HEADER(PrivacyScreenToastLabelView, views::View) + public: PrivacyScreenToastLabelView() { auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( @@ -112,6 +121,9 @@ raw_ptr<PrivacyScreenToastManagedView, ExperimentalAsh> managed_view_; }; +BEGIN_METADATA(PrivacyScreenToastLabelView) +END_METADATA + PrivacyScreenToastView::PrivacyScreenToastView( PrivacyScreenToastController* controller, views::Button::PressedCallback callback) @@ -175,4 +187,7 @@ controller_->StartAutoCloseTimer(); } +BEGIN_METADATA(PrivacyScreenToastView) +END_METADATA + } // namespace ash
diff --git a/ash/system/privacy_screen/privacy_screen_toast_view.h b/ash/system/privacy_screen/privacy_screen_toast_view.h index 8f37734..fb10587 100644 --- a/ash/system/privacy_screen/privacy_screen_toast_view.h +++ b/ash/system/privacy_screen/privacy_screen_toast_view.h
@@ -7,6 +7,7 @@ #include "ash/ash_export.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/button/button.h" #include "ui/views/view.h" #include "ui/views/view_observer.h" @@ -20,6 +21,8 @@ // The view shown inside the privacy screen toast bubble. class ASH_EXPORT PrivacyScreenToastView : public views::View, public views::ViewObserver { + METADATA_HEADER(PrivacyScreenToastView, views::View) + public: PrivacyScreenToastView(PrivacyScreenToastController* controller, views::Button::PressedCallback callback);
diff --git a/ash/system/rotation/rotation_lock_feature_pod_controller_unittest.cc b/ash/system/rotation/rotation_lock_feature_pod_controller_unittest.cc index a0d04c3..9c1d181 100644 --- a/ash/system/rotation/rotation_lock_feature_pod_controller_unittest.cc +++ b/ash/system/rotation/rotation_lock_feature_pod_controller_unittest.cc
@@ -15,9 +15,9 @@ namespace ash { -class RotationLockFeaturePodControllerQsRevampTest : public AshTestBase { +class RotationLockFeaturePodControllerTest : public AshTestBase { public: - RotationLockFeaturePodControllerQsRevampTest() = default; + RotationLockFeaturePodControllerTest() = default; // AshTestBase: void SetUp() override { // The Display used for testing is not an internal display. This flag @@ -44,20 +44,20 @@ }; // Tests that when the tile is initially created it is not visible. -TEST_F(RotationLockFeaturePodControllerQsRevampTest, CreateTile) { +TEST_F(RotationLockFeaturePodControllerTest, CreateTile) { SetUpController(); EXPECT_FALSE(feature_tile_->GetVisible()); } // Tests that the button is created visible when tablet mode is enabled. -TEST_F(RotationLockFeaturePodControllerQsRevampTest, CreateTileInTabletMode) { +TEST_F(RotationLockFeaturePodControllerTest, CreateTileInTabletMode) { Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); SetUpController(); EXPECT_TRUE(feature_tile_->GetVisible()); } // Tests that enabling tablet mode changes the tile visibility. -TEST_F(RotationLockFeaturePodControllerQsRevampTest, +TEST_F(RotationLockFeaturePodControllerTest, TileVisibilityChangesDuringTabletMode) { SetUpController(); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); @@ -74,7 +74,7 @@ EXPECT_TRUE(feature_tile_->GetVisible()); } -TEST_F(RotationLockFeaturePodControllerQsRevampTest, OnIconPressed) { +TEST_F(RotationLockFeaturePodControllerTest, OnIconPressed) { SetUpController(); TabletModeController* tablet_mode_controller = Shell::Get()->tablet_mode_controller(); @@ -100,7 +100,7 @@ tablet_mode_controller->SetEnabledForTest(false); } -TEST_F(RotationLockFeaturePodControllerQsRevampTest, IconUMATracking) { +TEST_F(RotationLockFeaturePodControllerTest, IconUMATracking) { SetUpController(); // No metrics logged before clicking on any views.
diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc index 84d2d835..3894d70f 100644 --- a/ash/system/status_area_widget.cc +++ b/ash/system/status_area_widget.cc
@@ -126,14 +126,11 @@ AddTrayButton(std::make_unique<WmModeButtonTray>(shelf_)); } - if (features::IsQsRevampEnabled()) { notification_center_tray_ = AddTrayButton(std::make_unique<NotificationCenterTray>(shelf_)); notification_center_tray_->AddObserver(this); animation_controller_ = std::make_unique<StatusAreaAnimationController>( notification_center_tray()); - } - auto unified_system_tray = std::make_unique<UnifiedSystemTray>(shelf_); unified_system_tray_ = unified_system_tray.get(); date_tray_ = @@ -172,11 +169,9 @@ StatusAreaWidget::~StatusAreaWidget() { Shell::Get()->session_controller()->RemoveObserver(this); - // If QsRevamp flag is enabled, reset `animation_controller_` before - // destroying `notification_center_tray_` so that we don't run into a UaF. - if (features::IsQsRevampEnabled()) { - animation_controller_.reset(nullptr); - } + // Resets `animation_controller_` before destroying + // `notification_center_tray_` so that we don't run into a UaF. + animation_controller_.reset(nullptr); // `TrayBubbleView` might be deleted after `StatusAreaWidget`, so we reset the // pointer here to avoid dangling pointer. @@ -204,10 +199,7 @@ void StatusAreaWidget::SetSystemTrayVisibility(bool visible) { unified_system_tray_->SetVisiblePreferred(visible); date_tray_->SetVisiblePreferred(visible); - - if (features::IsQsRevampEnabled()) { - notification_center_tray_->OnSystemTrayVisibilityChanged(visible); - } + notification_center_tray_->OnSystemTrayVisibilityChanged(visible); if (visible) { Show(); @@ -793,7 +785,7 @@ } void StatusAreaWidget::UpdateDateTrayRoundedCorners() { - if (!features::IsQsRevampEnabled() || !date_tray_) { + if (!date_tray_) { return; }
diff --git a/ash/system/status_area_widget_unittest.cc b/ash/system/status_area_widget_unittest.cc index 911f4d7..2d3dfc6 100644 --- a/ash/system/status_area_widget_unittest.cc +++ b/ash/system/status_area_widget_unittest.cc
@@ -61,7 +61,13 @@ namespace ash { -using StatusAreaWidgetTest = AshTestBase; +class StatusAreaWidgetTest : public AshTestBase { + protected: + TrayBackgroundView::RoundedCornerBehavior GetTrayCornerBehavior( + TrayBackgroundView* tray) { + return tray->corner_behavior_; + } +}; // Tests that status area trays are constructed. TEST_F(StatusAreaWidgetTest, Basics) { @@ -201,6 +207,28 @@ system_tray->bubble()->GetBubbleView()); } +// The corner radius of the date tray changes based on the visibility of the +// `NotificationCenterTray`. The date tray should have rounded corners on the +// left if the `NotificationCenterTray` is not visible and no rounded corners +// otherwise. +TEST_F(StatusAreaWidgetTest, DateTrayRoundedCornerBehavior) { + StatusAreaWidget* status_area = + StatusAreaWidgetTestHelper::GetStatusAreaWidget(); + EXPECT_FALSE(status_area->notification_center_tray()->GetVisible()); + EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), + TrayBackgroundView::RoundedCornerBehavior::kStartRounded); + + status_area->notification_center_tray()->SetVisiblePreferred(true); + + EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), + TrayBackgroundView::RoundedCornerBehavior::kNotRounded); + + status_area->notification_center_tray()->SetVisiblePreferred(false); + + EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), + TrayBackgroundView::RoundedCornerBehavior::kStartRounded); +} + class SystemTrayFocusTestObserver : public SystemTrayObserver { public: SystemTrayFocusTestObserver() = default; @@ -750,47 +778,6 @@ EXPECT_TRUE(!drag_handle_widget || drag_handle_widget->IsClosed()); } -class StatusAreaWidgetQSRevampTest : public AshTestBase { - protected: - void SetUp() override { - scoped_feature_list_.InitAndEnableFeature(features::kQsRevamp); - AshTestBase::SetUp(); - } - - TrayBackgroundView::RoundedCornerBehavior GetTrayCornerBehavior( - TrayBackgroundView* tray) { - return tray->corner_behavior_; - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -// The corner radius of the date tray changes based on the visibility of the -// `NotificationCenterTray`. The date tray should have rounded corners on the -// left if the `NotificationCenterTray` is not visible and no rounded corners -// otherwise. -TEST_F(StatusAreaWidgetQSRevampTest, DateTrayRoundedCornerBehavior) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(features::kQsRevamp); - - StatusAreaWidget* status_area = - StatusAreaWidgetTestHelper::GetStatusAreaWidget(); - EXPECT_FALSE(status_area->notification_center_tray()->GetVisible()); - EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), - TrayBackgroundView::RoundedCornerBehavior::kStartRounded); - - status_area->notification_center_tray()->SetVisiblePreferred(true); - - EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), - TrayBackgroundView::RoundedCornerBehavior::kNotRounded); - - status_area->notification_center_tray()->SetVisiblePreferred(false); - - EXPECT_EQ(GetTrayCornerBehavior(status_area->date_tray()), - TrayBackgroundView::RoundedCornerBehavior::kStartRounded); -} - class StatusAreaWidgetEcheTest : public AshTestBase { protected: void SetUp() override {
diff --git a/ash/system/time/calendar_event_list_item_view.cc b/ash/system/time/calendar_event_list_item_view.cc index 1529b694..3824f167 100644 --- a/ash/system/time/calendar_event_list_item_view.cc +++ b/ash/system/time/calendar_event_list_item_view.cc
@@ -22,6 +22,7 @@ #include "base/strings/utf_string_conversions.h" #include "google_apis/calendar/calendar_api_response_types.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/compositor/layer.h" @@ -73,6 +74,8 @@ // Renders an Event color dot. class CalendarEventListItemDot : public views::View { + METADATA_HEADER(CalendarEventListItemDot, views::View) + public: explicit CalendarEventListItemDot(std::string color_id) { DCHECK(color_id.empty() || kEventHexColorCodes.count(color_id)); @@ -111,6 +114,9 @@ int color_; }; +BEGIN_METADATA(CalendarEventListItemDot) +END_METADATA + // Creates and returns a label containing the event summary. views::Builder<views::Label> CreateSummaryLabel( const std::string& event_summary,
diff --git a/ash/system/time/calendar_event_list_view.cc b/ash/system/time/calendar_event_list_view.cc index d14fee92c..a433fe6 100644 --- a/ash/system/time/calendar_event_list_view.cc +++ b/ash/system/time/calendar_event_list_view.cc
@@ -22,6 +22,7 @@ #include "chromeos/constants/chromeos_features.h" #include "google_apis/calendar/calendar_api_response_types.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/compositor/layer.h" @@ -65,6 +66,8 @@ // A view that's displayed when the user selects a day cell from the calendar // month view that has no events. Clicking on it opens Google calendar. class CalendarEmptyEventListView : public PillButton { + METADATA_HEADER(CalendarEmptyEventListView, PillButton) + public: explicit CalendarEmptyEventListView(CalendarViewController* controller) : PillButton(views::Button::PressedCallback(base::BindRepeating( @@ -113,6 +116,9 @@ const raw_ptr<CalendarViewController, ExperimentalAsh> controller_; }; +BEGIN_METADATA(CalendarEmptyEventListView) +END_METADATA + CalendarEventListView::CalendarEventListView( CalendarViewController* calendar_view_controller) : calendar_view_controller_(calendar_view_controller),
diff --git a/ash/system/time/calendar_view.cc b/ash/system/time/calendar_view.cc index 3b2490c..d9947231 100644 --- a/ash/system/time/calendar_view.cc +++ b/ash/system/time/calendar_view.cc
@@ -436,10 +436,6 @@ GetViewAccessibility().OverrideRole(ax::mojom::Role::kPane); GetViewAccessibility().OverrideName(GetClassName()); - // Since there's no separator in the `CalendarView`, first sets - // `has_separator` in `TrayDetailedView` to false. - IgnoreSeparator(); - CreateTitleRow(IDS_ASH_CALENDAR_TITLE, /*create_back_button=*/false); // Adds the progress bar to layout when initialization to avoid changing the
diff --git a/ash/system/time/time_view.cc b/ash/system/time/time_view.cc index 39a09ba..daa7d69 100644 --- a/ash/system/time/time_view.cc +++ b/ash/system/time/time_view.cc
@@ -149,6 +149,9 @@ ui::ImageModel::FromVectorIcon(kCalendarBackgroundIcon, color_id)); } +BEGIN_METADATA(VerticalDateView) +END_METADATA + TimeView::TimeView(ClockLayout clock_layout, ClockModel* model, Type type) : model_(model), type_(type) { SetTimer(GetTimeToShow());
diff --git a/ash/system/time/time_view.h b/ash/system/time/time_view.h index 1f451f64..fa2df29c 100644 --- a/ash/system/time/time_view.h +++ b/ash/system/time/time_view.h
@@ -32,6 +32,8 @@ // The Date view, which is a date in a calendar icon, for vertical time view. // For horizontal time view, there's no Date Icon View and it shows a text date. class VerticalDateView : public views::View { + METADATA_HEADER(VerticalDateView, views::View) + public: VerticalDateView(); VerticalDateView(const VerticalDateView& other) = delete;
diff --git a/ash/system/tray/detailed_view_delegate.cc b/ash/system/tray/detailed_view_delegate.cc index d32027f..abe2a4482 100644 --- a/ash/system/tray/detailed_view_delegate.cc +++ b/ash/system/tray/detailed_view_delegate.cc
@@ -4,7 +4,6 @@ #include "ash/system/tray/detailed_view_delegate.h" -#include "ash/constants/ash_features.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/strings/grit/ash_strings.h" #include "ash/style/icon_button.h" @@ -50,11 +49,9 @@ // unique pointers. views::Button* DetailedViewDelegate::CreateBackButton( views::Button::PressedCallback callback) { - return new IconButton( - std::move(callback), - features::IsQsRevampEnabled() ? IconButton::Type::kMedium - : IconButton::Type::kMediumFloating, - &kQuickSettingsLeftArrowIcon, IDS_ASH_STATUS_TRAY_PREVIOUS_MENU); + return new IconButton(std::move(callback), IconButton::Type::kMedium, + &kQuickSettingsLeftArrowIcon, + IDS_ASH_STATUS_TRAY_PREVIOUS_MENU); } views::Button* DetailedViewDelegate::CreateInfoButton(
diff --git a/ash/system/tray/detailed_view_delegate.h b/ash/system/tray/detailed_view_delegate.h index 39a6d94..fb9806ab 100644 --- a/ash/system/tray/detailed_view_delegate.h +++ b/ash/system/tray/detailed_view_delegate.h
@@ -34,7 +34,7 @@ // Returns the margin around the scroll view. Most detailed views should use // the default implementation. Shelf pods that reuse detailed views may need - // custom margins. Only used with feature QsRevamp. + // custom margins. virtual gfx::Insets GetScrollViewMargin() const; // Return the back button used in the title row. Caller takes ownership of the
diff --git a/ash/system/tray/status_area_overflow_button_tray.cc b/ash/system/tray/status_area_overflow_button_tray.cc index c8d04d0..b1f7331 100644 --- a/ash/system/tray/status_area_overflow_button_tray.cc +++ b/ash/system/tray/status_area_overflow_button_tray.cc
@@ -99,6 +99,9 @@ SetTransform(transform); } +BEGIN_METADATA(StatusAreaOverflowButtonTray, IconView, views::ImageView) +END_METADATA + StatusAreaOverflowButtonTray::StatusAreaOverflowButtonTray(Shelf* shelf) : TrayBackgroundView( shelf,
diff --git a/ash/system/tray/status_area_overflow_button_tray.h b/ash/system/tray/status_area_overflow_button_tray.h index 5e53d2a..d3ad8362 100644 --- a/ash/system/tray/status_area_overflow_button_tray.h +++ b/ash/system/tray/status_area_overflow_button_tray.h
@@ -64,6 +64,8 @@ private: // The button icon of an animating arrow based on the collapse/expand state. class IconView : public views::ImageView, public gfx::AnimationDelegate { + METADATA_HEADER(IconView, views::ImageView) + public: IconView(); ~IconView() override;
diff --git a/ash/system/tray/system_nudge_label.cc b/ash/system/tray/system_nudge_label.cc index 9f361c0..a87bfc6 100644 --- a/ash/system/tray/system_nudge_label.cc +++ b/ash/system/tray/system_nudge_label.cc
@@ -7,6 +7,7 @@ #include <memory> #include "ash/style/ash_color_provider.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/controls/styled_label.h" #include "ui/views/layout/box_layout.h" @@ -68,4 +69,7 @@ } } +BEGIN_METADATA(SystemNudgeLabel) +END_METADATA + } // namespace ash
diff --git a/ash/system/tray/system_nudge_label.h b/ash/system/tray/system_nudge_label.h index 6c11fd0..0746c52 100644 --- a/ash/system/tray/system_nudge_label.h +++ b/ash/system/tray/system_nudge_label.h
@@ -8,6 +8,7 @@ #include "ash/ash_export.h" #include "base/containers/flat_map.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/range/range.h" #include "ui/views/controls/styled_label.h" #include "ui/views/view.h" @@ -17,6 +18,8 @@ // A label for system nudges which automatically updates text color on theme // changes and supports inline embedding of custom views. class ASH_EXPORT SystemNudgeLabel : public views::View { + METADATA_HEADER(SystemNudgeLabel, views::View) + public: SystemNudgeLabel(std::u16string text, int fixed_width);
diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h index d42ee52..b1945fc 100644 --- a/ash/system/tray/tray_background_view.h +++ b/ash/system/tray/tray_background_view.h
@@ -269,7 +269,7 @@ private: class TrayWidgetObserver; class TrayBackgroundViewSessionChangeHandler; - friend class StatusAreaWidgetQSRevampTest; + friend class StatusAreaWidgetTest; void StartVisibilityAnimation(bool visible);
diff --git a/ash/system/tray/tray_detailed_view.cc b/ash/system/tray/tray_detailed_view.cc index 44538d3..2016b00 100644 --- a/ash/system/tray/tray_detailed_view.cc +++ b/ash/system/tray/tray_detailed_view.cc
@@ -8,12 +8,9 @@ #include <string> #include <utility> -#include "base/containers/cxx20_erase.h" -#include "ash/constants/ash_features.h" #include "ash/controls/rounded_scroll_bar.h" #include "ash/public/cpp/ash_view_ids.h" #include "ash/strings/grit/ash_strings.h" -#include "ash/style/ash_color_id.h" #include "ash/style/ash_color_provider.h" #include "ash/style/typography.h" #include "ash/system/tray/detailed_view_delegate.h" @@ -23,21 +20,15 @@ #include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tri_view.h" #include "base/check.h" -#include "base/containers/adapters.h" #include "base/functional/bind.h" #include "base/memory/raw_ptr.h" -#include "chromeos/constants/chromeos_features.h" -#include "third_party/skia/include/core/SkDrawLooper.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" -#include "ui/compositor/clip_recorder.h" #include "ui/compositor/layer.h" -#include "ui/compositor/paint_context.h" -#include "ui/compositor/paint_recorder.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rounded_corners_f.h" @@ -50,12 +41,11 @@ #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/controls/highlight_path_generator.h" -#include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/controls/progress_bar.h" #include "ui/views/controls/scroll_view.h" -#include "ui/views/controls/separator.h" #include "ui/views/layout/box_layout.h" +#include "ui/views/layout/box_layout_view.h" #include "ui/views/view_class_properties.h" #include "ui/views/view_targeter.h" #include "ui/views/view_targeter_delegate.h" @@ -65,13 +55,11 @@ namespace { // The index of the horizontal rule below the title row. -const int kTitleRowSeparatorIndex = 1; +const int kTitleRowProgressBarIndex = 1; -constexpr int kQsItemBetweenSpacing = 8; - -constexpr int kQsScrollViewCornerRadius = 16; - -constexpr int kQsTriViewRightPadding = 16; +constexpr int kItemBetweenSpacing = 8; +constexpr int kScrollViewCornerRadius = 16; +constexpr int kTriViewRightPadding = 16; // If there's no back button then less padding is required. // TODO(b/285280977): Remove when CalendarView is out of TrayDetailedView as @@ -79,8 +67,7 @@ constexpr int kNoBackButtonLeftPadding = 8; // Inset the scroll bar to avoid the rounded corners at top and bottom. -constexpr auto kQsScrollBarInsets = - gfx::Insets::VH(kQsScrollViewCornerRadius, 0); +constexpr auto kScrollBarInsets = gfx::Insets::VH(kScrollViewCornerRadius, 0); // Configures the TriView used for the title in a detailed view. void ConfigureTitleTriView(TriView* tri_view, @@ -97,12 +84,11 @@ : kNoBackButtonLeftPadding : 0; const int right_padding = - container == TriView::Container::END ? kQsTriViewRightPadding : 0; + container == TriView::Container::END ? kTriViewRightPadding : 0; layout = std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal, gfx::Insets::TLBR(0, left_padding, 0, right_padding), - features::IsQsRevampEnabled() ? kQsItemBetweenSpacing - : kUnifiedTopShortcutSpacing); + kItemBetweenSpacing); layout->set_main_axis_alignment( views::BoxLayout::MainAxisAlignment::kCenter); layout->set_cross_axis_alignment( @@ -116,7 +102,7 @@ views::BoxLayout::Orientation::kVertical); layout->set_main_axis_alignment( views::BoxLayout::MainAxisAlignment::kCenter); - if (features::IsQsRevampEnabled() && create_back_button) { + if (create_back_button) { layout->set_cross_axis_alignment( views::BoxLayout::CrossAxisAlignment::kCenter); break; @@ -131,259 +117,6 @@ gfx::Size(0, kUnifiedDetailedViewTitleRowHeight)); } -// A view that is used as ScrollView contents. It supports designating some of -// the children as sticky header rows. The sticky header rows are not scrolled -// above the top of the visible viewport until the next one "pushes" it up and -// are painted above other children. To indicate that a child is a sticky header -// row use SetID(VIEW_ID_STICKY_HEADER). -class ScrollContentsView : public views::View { - public: - ScrollContentsView() { - box_layout_ = SetLayoutManager(std::make_unique<views::BoxLayout>( - views::BoxLayout::Orientation::kVertical)); - // NOTE: Pre-QsRevamp, insets are added in ViewHierarchyChanged(). - } - - ScrollContentsView(const ScrollContentsView&) = delete; - ScrollContentsView& operator=(const ScrollContentsView&) = delete; - - ~ScrollContentsView() override = default; - - protected: - // views::View: - void OnBoundsChanged(const gfx::Rect& previous_bounds) override { - PositionHeaderRows(); - } - - void PaintChildren(const views::PaintInfo& paint_info) override { - // No sticky header and no shadow for the revamped view. - if (features::IsQsRevampEnabled()) { - views::View::PaintChildren(paint_info); - return; - } - - int sticky_header_height = 0; - for (const auto& header : headers_) { - // Sticky header is at the top. - if (header.view->y() != header.natural_offset) { - sticky_header_height = header.view->bounds().height(); - DCHECK_EQ(VIEW_ID_STICKY_HEADER, header.view->GetID()); - break; - } - } - // Paint contents other than sticky headers. If sticky header is at the top, - // it clips the header's height so that nothing is shown behind the header. - { - ui::ClipRecorder clip_recorder(paint_info.context()); - gfx::Rect clip_rect = gfx::Rect(paint_info.paint_recording_size()) - - paint_info.offset_from_parent(); - auto clip_insets = gfx::Insets::TLBR(sticky_header_height, 0, 0, 0); - clip_rect.Inset(gfx::ScaleToFlooredInsets( - clip_insets, paint_info.paint_recording_scale_x(), - paint_info.paint_recording_scale_y())); - clip_recorder.ClipRect(clip_rect); - for (auto* child : children()) { - if (child->GetID() != VIEW_ID_STICKY_HEADER && !child->layer()) { - child->Paint(paint_info); - } - } - } - // Paint sticky headers. - for (auto* child : children()) { - if (child->GetID() == VIEW_ID_STICKY_HEADER && !child->layer()) { - child->Paint(paint_info); - } - } - - bool did_draw_shadow = false; - // Paint header row separators. - for (auto& header : headers_) { - did_draw_shadow = - PaintDelineation(header, paint_info.context()) || did_draw_shadow; - } - - // Draw a shadow at the top of the viewport when scrolled, but only if a - // header didn't already draw one. Overlap the shadow with the separator - // that's below the header view so we don't get both a separator and a full - // shadow. - if (y() != 0 && !did_draw_shadow) { - DrawShadow(paint_info.context(), - gfx::Rect(0, 0, width(), -y() - kTraySeparatorWidth)); - } - } - - void Layout() override { - views::View::Layout(); - - // No sticky headers for the revamped view. - if (features::IsQsRevampEnabled()) { - return; - } - - headers_.clear(); - for (auto* child : children()) { - if (child->GetID() == VIEW_ID_STICKY_HEADER) { - headers_.emplace_back(child); - } - } - PositionHeaderRows(); - } - - const char* GetClassName() const override { return "ScrollContentsView"; } - - View::Views GetChildrenInZOrder() override { - // Place sticky headers last in the child order so that they wind up on top - // in Z order. - View::Views children_in_z_order = children(); - std::stable_partition(children_in_z_order.begin(), - children_in_z_order.end(), [](const View* child) { - return child->GetID() != VIEW_ID_STICKY_HEADER; - }); - return children_in_z_order; - } - - void ViewHierarchyChanged( - const views::ViewHierarchyChangedDetails& details) override { - // No sticky headers or border insets in the revamped view. - if (features::IsQsRevampEnabled()) { - return; - } - - if (!details.is_add && details.parent == this) { - base::EraseIf(headers_, [details](const Header& header) { - return header.view.get() == details.child; - }); - } else if (details.is_add && details.parent == this && - details.child == children().front()) { - // We always want padding on the bottom of the scroll contents. - // We only want padding on the top of the scroll contents if the first - // child is not a header (in that case, the padding is built into the - // header). - DCHECK_EQ(box_layout_, GetLayoutManager()); - box_layout_->set_inside_border_insets( - gfx::Insets::TLBR(details.child->GetID() == VIEW_ID_STICKY_HEADER - ? 0 - : kMenuSeparatorVerticalPadding, - 0, kMenuSeparatorVerticalPadding, 0)); - } - } - - private: - const int kShadowOffsetY = 2; - const int kShadowBlur = 2; - - // A structure that keeps the original offset of each header between the - // calls to Layout() to allow keeping track of which view should be sticky. - struct Header { - explicit Header(views::View* view) - : view(view), natural_offset(view->y()), draw_separator_below(false) {} - - // A header View that can be decorated as sticky. - raw_ptr<views::View, ExperimentalAsh> view; - - // Offset from the top of ScrollContentsView to |view|'s original vertical - // position. - int natural_offset; - - // True when a separator needs to be painted below the header when another - // header is pushing |this| header up. - bool draw_separator_below; - }; - - // Adjusts y-position of header rows allowing one or two rows to stick to the - // top of the visible viewport. - void PositionHeaderRows() { - const int scroll_offset = -y(); - Header* previous_header = nullptr; - for (auto& header : base::Reversed(headers_)) { - views::View* header_view = header.view; - bool draw_separator_below = false; - if (header.natural_offset >= scroll_offset) { - previous_header = &header; - header_view->SetY(header.natural_offset); - } else { - if (previous_header && previous_header->view->y() <= - scroll_offset + header_view->height()) { - // Lower header displacing the header above. - draw_separator_below = true; - header_view->SetY(previous_header->view->y() - header_view->height()); - } else { - // A header becomes sticky. - header_view->SetY(scroll_offset); - header_view->Layout(); - header_view->SchedulePaint(); - } - } - if (header.draw_separator_below != draw_separator_below) { - header.draw_separator_below = draw_separator_below; - ShowStickyHeaderSeparator(header_view, draw_separator_below); - } - if (header.natural_offset < scroll_offset) { - break; - } - } - } - - // Configures `view` to have a visible separator below. - void ShowStickyHeaderSeparator(views::View* view, bool show_separator) { - if (show_separator) { - view->SetBorder(views::CreatePaddedBorder( - views::CreateSolidSidedBorder( - gfx::Insets::TLBR(0, 0, kTraySeparatorWidth, 0), - AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kSeparatorColor)), - gfx::Insets::TLBR(kMenuSeparatorVerticalPadding, 0, - kMenuSeparatorVerticalPadding - kTraySeparatorWidth, - 0))); - } else { - view->SetBorder(views::CreateEmptyBorder( - gfx::Insets::VH(kMenuSeparatorVerticalPadding, 0))); - } - view->SchedulePaint(); - } - - // Paints a separator for a header view. The separator can be a horizontal - // rule or a horizontal shadow, depending on whether the header is sticking to - // the top of the scroll viewport. The return value indicates whether a shadow - // was drawn. - bool PaintDelineation(const Header& header, const ui::PaintContext& context) { - const View* view = header.view; - - // If the header is where it normally belongs or If the header is pushed by - // a header directly below it, draw nothing. - if (view->y() == header.natural_offset || header.draw_separator_below) { - return false; - } - - // Otherwise, draw a shadow below. - DrawShadow(context, - gfx::Rect(0, 0, view->width(), view->bounds().bottom())); - return true; - } - - // Draws a drop shadow below |shadowed_area|. - void DrawShadow(const ui::PaintContext& context, - const gfx::Rect& shadowed_area) { - ui::PaintRecorder recorder(context, size()); - gfx::Canvas* canvas = recorder.canvas(); - cc::PaintFlags flags; - gfx::ShadowValues shadow; - shadow.emplace_back( - gfx::Vector2d(0, kShadowOffsetY), kShadowBlur, - AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kSeparatorColor)); - flags.setLooper(gfx::CreateShadowDrawLooper(shadow)); - flags.setAntiAlias(true); - canvas->ClipRect(shadowed_area, SkClipOp::kDifference); - canvas->DrawRect(shadowed_area, flags); - } - - raw_ptr<views::BoxLayout, ExperimentalAsh> box_layout_ = nullptr; - - // Header child views that stick to the top of visible viewport when scrolled. - std::vector<Header> headers_; -}; - } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -393,10 +126,6 @@ : delegate_(delegate) { box_layout_ = SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kVertical)); - - if (features::IsQsRevampEnabled()) { - IgnoreSeparator(); - } } TrayDetailedView::~TrayDetailedView() = default; @@ -423,20 +152,14 @@ tri_view_->AddView(TriView::Container::START, back_button_); } - // If this view doesn't have a separator, adds an empty view as a placeholder - // so that the views below won't move up when the `progress_bar_` becomes - // invisible. - if (!has_separator_) { - auto buffer_view = std::make_unique<views::View>(); - buffer_view->SetPreferredSize(gfx::Size(1, kTitleRowProgressBarHeight)); - AddChildViewAt(std::move(buffer_view), kTitleRowSeparatorIndex); - } else { - AddChildViewAt(CreateTitleSeparator(), kTitleRowSeparatorIndex); - } - + // Adds an empty view as a placeholder so that the views below won't move up + // when the `progress_bar_` becomes invisible. + auto buffer_view = std::make_unique<views::View>(); + buffer_view->SetPreferredSize(gfx::Size(1, kTitleRowProgressBarHeight)); + AddChildViewAt(std::move(buffer_view), kTitleRowProgressBarIndex); CreateExtraTitleRowButtons(); - if (!features::IsQsRevampEnabled() || !create_back_button) { + if (!create_back_button) { Layout(); return; } @@ -465,24 +188,21 @@ void TrayDetailedView::CreateScrollableList() { DCHECK(!scroller_); - auto scroll_content = std::make_unique<ScrollContentsView>(); + auto scroll_content = std::make_unique<views::BoxLayoutView>(); + scroll_content->SetOrientation(views::BoxLayout::Orientation::kVertical); scroller_ = AddChildView(std::make_unique<views::ScrollView>()); scroller_->SetDrawOverflowIndicator(false); scroll_content_ = scroller_->SetContents(std::move(scroll_content)); - // TODO(varkha): Make the sticky rows work with EnableViewPortLayer(). - if (features::IsQsRevampEnabled()) { - auto vertical_scroll = std::make_unique<RoundedScrollBar>( - /*horizontal=*/false); - vertical_scroll->SetInsets(kQsScrollBarInsets); - scroller_->SetVerticalScrollBar(std::move(vertical_scroll)); - scroller_->SetProperty(views::kMarginsKey, - delegate_->GetScrollViewMargin()); - scroller_->SetPaintToLayer(); - scroller_->layer()->SetFillsBoundsOpaquely(false); - scroller_->layer()->SetRoundedCornerRadius( - gfx::RoundedCornersF(kQsScrollViewCornerRadius)); - } + auto vertical_scroll = std::make_unique<RoundedScrollBar>( + /*horizontal=*/false); + vertical_scroll->SetInsets(kScrollBarInsets); + scroller_->SetVerticalScrollBar(std::move(vertical_scroll)); + scroller_->SetProperty(views::kMarginsKey, delegate_->GetScrollViewMargin()); + scroller_->SetPaintToLayer(); + scroller_->layer()->SetFillsBoundsOpaquely(false); + scroller_->layer()->SetRoundedCornerRadius( + gfx::RoundedCornersF(kScrollViewCornerRadius)); // Override the default theme-based color to remove the background. scroller_->SetBackgroundColor(absl::nullopt); @@ -499,27 +219,16 @@ if (icon.is_empty()) { item->AddLabelRow(text); } else { - if (chromeos::features::IsJellyEnabled()) { - item->AddIconAndLabel( - ui::ImageModel::FromVectorIcon(icon, cros_tokens::kCrosSysOnSurface), - text); - } else { - item->AddIconAndLabel( - gfx::CreateVectorIcon( - icon, AshColorProvider::Get()->GetContentLayerColor( - AshColorProvider::ContentLayerType::kIconColorPrimary)), - text); - } + item->AddIconAndLabel( + ui::ImageModel::FromVectorIcon(icon, cros_tokens::kCrosSysOnSurface), + text); } - - if (features::IsQsRevampEnabled()) { - views::FocusRing::Install(item); - views::InstallRoundRectHighlightPathGenerator(item, gfx::Insets(2), - /*corner_radius=*/0); - views::FocusRing::Get(item)->SetColorId(cros_tokens::kCrosSysFocusRing); - // Unset the focus painter set by `HoverHighlightView`. - item->SetFocusPainter(nullptr); - } + views::FocusRing::Install(item); + views::InstallRoundRectHighlightPathGenerator(item, gfx::Insets(2), + /*corner_radius=*/0); + views::FocusRing::Get(item)->SetColorId(cros_tokens::kCrosSysFocusRing); + // Unset the focus painter set by `HoverHighlightView`. + item->SetFocusPainter(nullptr); return item; } @@ -539,43 +248,6 @@ return item; } -TriView* TrayDetailedView::AddScrollListSubHeader(views::View* container, - const gfx::VectorIcon& icon, - int text_id) { - TriView* header = TrayPopupUtils::CreateSubHeaderRowView(true); - TrayPopupUtils::ConfigureAsStickyHeader(header); - - auto* sub_header_label = TrayPopupUtils::CreateDefaultLabel(); - sub_header_label->SetText(l10n_util::GetStringUTF16(text_id)); - - if (chromeos::features::IsJellyEnabled()) { - sub_header_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurfaceVariant); - ash::TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosBody2, - *sub_header_label); - } else { - sub_header_label->SetEnabledColorId(kColorAshTextColorPrimary); - TrayPopupUtils::SetLabelFontList(sub_header_label, - TrayPopupUtils::FontStyle::kSubHeader); - } - - header->AddView(TriView::Container::CENTER, sub_header_label); - - auto* sub_header_image_view = - TrayPopupUtils::CreateMainImageView(/*use_wide_layout=*/false); - if (chromeos::features::IsJellyEnabled()) { - sub_header_image_view->SetImage(ui::ImageModel::FromVectorIcon( - icon, cros_tokens::kCrosSysOnSurfaceVariant)); - } else { - sub_header_image_view->SetImage( - ui::ImageModel::FromVectorIcon(icon, kColorAshIconColorPrimary)); - } - - header->AddView(TriView::Container::START, sub_header_image_view); - - container->AddChildView(header); - return header; -} - void TrayDetailedView::Reset() { RemoveAllChildViews(); scroller_ = nullptr; @@ -590,7 +262,7 @@ if (!progress_bar_) { progress_bar_ = AddChildViewAt( std::make_unique<views::ProgressBar>(kTitleRowProgressBarHeight), - kTitleRowSeparatorIndex + 1); + kTitleRowProgressBarIndex + 1); progress_bar_->GetViewAccessibility().OverrideName( progress_bar_accessible_name_.value_or(l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_PROGRESS_BAR_ACCESSIBLE_NAME))); @@ -602,7 +274,7 @@ progress_bar_->SetValue(value); progress_bar_->SetVisible(visible); - children()[size_t{kTitleRowSeparatorIndex}]->SetVisible(!visible); + children()[size_t{kTitleRowProgressBarIndex}]->SetVisible(!visible); } views::Button* TrayDetailedView::CreateInfoButton( @@ -642,30 +314,15 @@ auto* title_label = TrayPopupUtils::CreateDefaultLabel(); title_label->SetText(l10n_util::GetStringUTF16(string_id)); - if (chromeos::features::IsJellyEnabled()) { - title_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface); - ash::TypographyProvider::Get()->StyleLabel( - ash::TypographyToken::kCrosTitle1, *title_label); - } else { - title_label->SetEnabledColorId(kColorAshTextColorPrimary); - TrayPopupUtils::SetLabelFontList(title_label, - TrayPopupUtils::FontStyle::kTitle); - } - + title_label->SetEnabledColorId(cros_tokens::kCrosSysOnSurface); + ash::TypographyProvider::Get()->StyleLabel(ash::TypographyToken::kCrosTitle1, + *title_label); tri_view->AddView(TriView::Container::CENTER, title_label); tri_view->SetContainerVisible(TriView::Container::END, false); return tri_view; } -std::unique_ptr<views::Separator> TrayDetailedView::CreateTitleSeparator() { - auto separator = std::make_unique<views::Separator>(); - separator->SetColorId(ui::kColorAshSystemUIMenuSeparator); - separator->SetBorder(views::CreateEmptyBorder(gfx::Insets::TLBR( - kTitleRowProgressBarHeight - views::Separator::kThickness, 0, 0, 0))); - return separator; -} - void TrayDetailedView::CreateExtraTitleRowButtons() {} void TrayDetailedView::TransitionToMainView() { @@ -685,10 +342,6 @@ delegate_->CloseBubble(); } -void TrayDetailedView::IgnoreSeparator() { - has_separator_ = false; -} - void TrayDetailedView::Layout() { views::View::Layout(); if (scroller_ && !scroller_->is_bounded()) {
diff --git a/ash/system/tray/tray_detailed_view.h b/ash/system/tray/tray_detailed_view.h index bba0926..6c1cde0 100644 --- a/ash/system/tray/tray_detailed_view.h +++ b/ash/system/tray/tray_detailed_view.h
@@ -24,7 +24,6 @@ class Button; class ProgressBar; class ScrollView; -class Separator; } // namespace views namespace ash { @@ -73,8 +72,7 @@ void CreateScrollableList(); // Adds a targetable row to `container` containing `icon` and `text`. - // Pre-QsRevamp the `container` should be scroll_content(). - // Post-QsRevamp the `container` may be a RoundedContainer. + // The `container` should be a RoundedContainer. HoverHighlightView* AddScrollListItem(views::View* container, const gfx::VectorIcon& icon, const std::u16string& text); @@ -83,8 +81,7 @@ // checkbox. `checked` determines whether the checkbox is checked or not. // `enterprise_managed` determines whether or not there will be an enterprise // managed icon for that item. - // Pre-QsRevamp the `container` should be scroll_content(). - // Post-QsRevamp the `container` may be a RoundedContainer. + // The `container` should be a RoundedContainer. HoverHighlightView* AddScrollListCheckableItem( views::View* container, const gfx::VectorIcon& icon, @@ -92,18 +89,12 @@ bool checked, bool enterprise_managed = false); - // Adds a sticky sub header to `container` containing `icon` and a text - // represented by `text_id` resource id. - TriView* AddScrollListSubHeader(views::View* container, - const gfx::VectorIcon& icon, - int text_id); - // Removes (and destroys) all child views. void Reset(); // Shows or hides the progress bar below the title row. It occupies the same - // space as the separator, so when shown the separator is hidden. If - // |progress_bar_| doesn't already exist it will be created. + // space as the created placeholder. If `progress_bar_` doesn't already exist + // it will be created. void ShowProgress(double value, bool visible); // Helper functions which create and return the settings and help buttons, @@ -124,11 +115,6 @@ views::ScrollView* scroller() const { return scroller_; } views::View* scroll_content() const { return scroll_content_; } - // Gets called in the constructor of the `CalendarView`, or any other views in - // the future that don't have a separator to modify the value of - // `has_separator` to false. - void IgnoreSeparator(); - private: friend class TrayDetailedViewTest; @@ -143,9 +129,6 @@ std::unique_ptr<TriView> CreateTitleTriView(int string_id, bool create_back_button); - // Returns the separator used between the title row and the contents. - std::unique_ptr<views::Separator> CreateTitleSeparator(); - // Creates and adds subclass-specific buttons to the title row. virtual void CreateExtraTitleRowButtons(); @@ -169,10 +152,6 @@ raw_ptr<views::Button, DanglingUntriaged | ExperimentalAsh> back_button_ = nullptr; - // Gets modified to false in the constructor of the view if it doesn't have a - // separator. - bool has_separator_ = true; - // The accessible name for the `progress_bar_`. absl::optional<std::u16string> progress_bar_accessible_name_; };
diff --git a/ash/system/tray/tray_event_filter.cc b/ash/system/tray/tray_event_filter.cc index f42359d..5efa030 100644 --- a/ash/system/tray/tray_event_filter.cc +++ b/ash/system/tray/tray_event_filter.cc
@@ -19,7 +19,6 @@ #include "ash/system/tray/tray_bubble_base.h" #include "ash/system/unified/date_tray.h" #include "ash/system/unified/unified_system_tray.h" -#include "ash/system/unified/unified_system_tray_bubble.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/functional/bind.h" #include "ui/aura/window.h" @@ -122,16 +121,6 @@ return; } - auto* unified_system_tray_bubble = - active_status_area_widget->unified_system_tray()->bubble(); - - // If `QsRevamp` is disabled, the event handling will happen in - // `UnifiedSystemTrayBubble`. - if (!features::IsQsRevampEnabled() && unified_system_tray_bubble && - open_shelf_pod_bubble == unified_system_tray_bubble->GetBubbleView()) { - return; - } - views::Widget* bubble_widget = open_shelf_pod_bubble->GetWidget(); auto* gained_active_widget = views::Widget::GetWidgetForNativeView(gained_active);
diff --git a/ash/system/tray/tray_item_view.cc b/ash/system/tray/tray_item_view.cc index f4236ec..90a79d5 100644 --- a/ash/system/tray/tray_item_view.cc +++ b/ash/system/tray/tray_item_view.cc
@@ -13,6 +13,7 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/compositor.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" @@ -71,6 +72,9 @@ node_data->SetNameChecked(custom_accessible_name_); } +BEGIN_METADATA(IconizedLabel) +END_METADATA + TrayItemView::TrayItemView(Shelf* shelf) : views::AnimationDelegateViews(this), shelf_(shelf) { DCHECK(shelf_); @@ -185,12 +189,10 @@ // animation is going to run, so don't hide the tray item here. // `StatusAreaAnimationController` will call `ImmediatelyUpdateVisibility()` // once the hide animation is over to ensure that all tray items are given a - // chance to properly update their visibilities. Only applicable when the - // QS revamp is enabled. - if (features::IsQsRevampEnabled() && !target_visible_ && - shelf_->status_area_widget() - ->animation_controller() - ->is_hide_animation_scheduled()) { + // chance to properly update their visibilities. + if (!target_visible_ && shelf_->status_area_widget() + ->animation_controller() + ->is_hide_animation_scheduled()) { return; } animation_->SetSlideDuration(base::TimeDelta()); @@ -357,4 +359,7 @@ (1 / (1 - kAnimatingOutEndValue)); } +BEGIN_METADATA(TrayItemView) +END_METADATA + } // namespace ash
diff --git a/ash/system/tray/tray_item_view.h b/ash/system/tray/tray_item_view.h index ab5ff6e..48b9f3b 100644 --- a/ash/system/tray/tray_item_view.h +++ b/ash/system/tray/tray_item_view.h
@@ -10,6 +10,7 @@ #include "ash/ash_export.h" #include "base/memory/raw_ptr.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/compositor/throughput_tracker.h" #include "ui/views/animation/animation_delegate_views.h" #include "ui/views/controls/label.h" @@ -31,6 +32,8 @@ // rendered as a label, but reading such text literally will not always be // understandable. class IconizedLabel : public views::Label { + METADATA_HEADER(IconizedLabel, views::Label) + public: void SetCustomAccessibleName(const std::u16string& name) { custom_accessible_name_ = name; @@ -63,6 +66,8 @@ // animated (for instance, when the `NotificationCenterTray` is hidden). class ASH_EXPORT TrayItemView : public views::View, public views::AnimationDelegateViews { + METADATA_HEADER(TrayItemView, views::View) + public: class Observer : public base::CheckedObserver { public:
diff --git a/ash/system/tray/tray_popup_utils.cc b/ash/system/tray/tray_popup_utils.cc index 475b162d..af885e72 100644 --- a/ash/system/tray/tray_popup_utils.cc +++ b/ash/system/tray/tray_popup_utils.cc
@@ -242,8 +242,8 @@ kFocusBorderThickness, gfx::InsetsF()); } +// TODO(b/309681875): Rename this method. void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { - view->SetID(VIEW_ID_STICKY_HEADER); view->SetBorder(views::CreateEmptyBorder( gfx::Insets::VH(kMenuSeparatorVerticalPadding, 0))); view->SetPaintToLayer(); @@ -296,7 +296,6 @@ } bool TrayPopupUtils::CanShowNightLightFeatureTile() { - CHECK(features::IsQsRevampEnabled()); return Shell::Get()->session_controller()->ShouldEnableSettings() || (Shell::Get()->session_controller()->GetSessionState() == session_manager::SessionState::LOCKED); @@ -356,36 +355,7 @@ // static void TrayPopupUtils::SetLabelFontList(views::Label* label, FontStyle style) { - // See function header comment. - DCHECK(!features::IsQsRevampEnabled() || - !chromeos::features::IsJellyEnabled()); - label->SetAutoColorReadabilityEnabled(false); - const gfx::FontList google_sans_font_list({"Google Sans"}, gfx::Font::NORMAL, - 16, gfx::Font::Weight::MEDIUM); - const gfx::FontList roboto_font_list({"Roboto"}, gfx::Font::NORMAL, 16, - gfx::Font::Weight::MEDIUM); - - switch (style) { - case FontStyle::kTitle: - label->SetFontList(google_sans_font_list); - break; - case FontStyle::kPodMenuHeader: - label->SetFontList(roboto_font_list); - break; - case FontStyle::kSubHeader: - label->SetFontList(roboto_font_list.Derive(-1, gfx::Font::NORMAL, - gfx::Font::Weight::MEDIUM)); - break; - case FontStyle::kSmallTitle: - label->SetFontList(roboto_font_list.Derive(-3, gfx::Font::NORMAL, - gfx::Font::Weight::MEDIUM)); - break; - case FontStyle::kDetailedViewLabel: - case FontStyle::kSystemInfo: - label->SetFontList(roboto_font_list.Derive(-4, gfx::Font::NORMAL, - gfx::Font::Weight::NORMAL)); - break; - } + // TODO(b/309681875): Remove this method. } } // namespace ash
diff --git a/ash/system/tray/tri_view.cc b/ash/system/tray/tri_view.cc index b8e2355..0bbdd12 100644 --- a/ash/system/tray/tri_view.cc +++ b/ash/system/tray/tri_view.cc
@@ -7,6 +7,8 @@ #include "ash/system/tray/size_range_layout.h" #include "base/check.h" #include "base/notreached.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/geometry/insets.h" #include "ui/views/border.h" #include "ui/views/layout/box_layout.h" @@ -31,6 +33,8 @@ // A View that will perform a layout if a child view's preferred size changes. class RelayoutView : public views::View { + METADATA_HEADER(RelayoutView, views::View) + public: RelayoutView() = default; @@ -41,6 +45,9 @@ void ChildPreferredSizeChanged(View* child) override { Layout(); } }; +BEGIN_METADATA(RelayoutView) +END_METADATA + } // namespace TriView::TriView() : TriView(0) {} @@ -195,4 +202,7 @@ return nullptr; } +BEGIN_METADATA(TriView) +END_METADATA + } // namespace ash
diff --git a/ash/system/tray/tri_view.h b/ash/system/tray/tri_view.h index 30dad2aa..fa48dc44 100644 --- a/ash/system/tray/tri_view.h +++ b/ash/system/tray/tri_view.h
@@ -10,6 +10,7 @@ #include "ash/ash_export.h" #include "base/memory/raw_ptr.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/size.h" #include "ui/views/view.h" @@ -39,6 +40,8 @@ // The default BoxLayout will use a center alignment for both the main axis and // cross axis alignment. class ASH_EXPORT TriView : public views::View { + METADATA_HEADER(TriView, views::View) + public: enum class Orientation { HORIZONTAL,
diff --git a/ash/system/unified/date_tray_pixeltest.cc b/ash/system/unified/date_tray_pixeltest.cc index 179fc6a..e90aeb0 100644 --- a/ash/system/unified/date_tray_pixeltest.cc +++ b/ash/system/unified/date_tray_pixeltest.cc
@@ -4,22 +4,16 @@ #include "ash/system/unified/date_tray.h" -#include "ash/constants/ash_features.h" #include "ash/shelf/shelf.h" #include "ash/test/ash_test_base.h" #include "ash/test/pixel/ash_pixel_differ.h" #include "ash/test/pixel/ash_pixel_test_init_params.h" -#include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" namespace ash { class DateTrayPixelTest : public AshTestBase { public: - DateTrayPixelTest() { - scoped_feature_list_.InitWithFeatures( - {features::kQsRevamp, chromeos::features::kJelly}, {}); - } + DateTrayPixelTest() = default; DateTrayPixelTest(const DateTrayPixelTest&) = delete; DateTrayPixelTest& operator=(const DateTrayPixelTest&) = delete; ~DateTrayPixelTest() override = default; @@ -34,9 +28,6 @@ DateTray* GetDateTray() { return GetPrimaryShelf()->GetStatusAreaWidget()->date_tray(); } - - private: - base::test::ScopedFeatureList scoped_feature_list_; }; // Tests the inactive date tray UI for bottom shelf alignment and side shelf
diff --git a/ash/system/unified/feature_tile_unittest.cc b/ash/system/unified/feature_tile_unittest.cc index 66e64af..73ff5d8 100644 --- a/ash/system/unified/feature_tile_unittest.cc +++ b/ash/system/unified/feature_tile_unittest.cc
@@ -4,7 +4,6 @@ #include "ash/system/unified/feature_tile.h" -#include "ash/constants/ash_features.h" #include "ash/constants/quick_settings_catalogs.h" #include "ash/shell.h" #include "ash/system/tray/tray_constants.h" @@ -15,7 +14,6 @@ #include "base/functional/callback_helpers.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" -#include "base/test/scoped_feature_list.h" #include "components/vector_icons/vector_icons.h" #include "ui/accessibility/ax_enums.mojom-shared.h" #include "ui/accessibility/ax_node_data.h" @@ -105,8 +103,7 @@ class FeatureTileTest : public AshTestBase { public: - FeatureTileTest() { feature_list_.InitAndEnableFeature(features::kQsRevamp); } - + FeatureTileTest() = default; FeatureTileTest(const FeatureTileTest&) = delete; FeatureTileTest& operator=(const FeatureTileTest&) = delete; ~FeatureTileTest() override = default; @@ -129,9 +126,6 @@ } std::unique_ptr<views::Widget> widget_; - - private: - base::test::ScopedFeatureList feature_list_; }; TEST_F(FeatureTileTest, PrimaryTile_LaunchSurface) {
diff --git a/ash/system/unified/feature_tiles_container_view_unittest.cc b/ash/system/unified/feature_tiles_container_view_unittest.cc index c2f6239..fc08d9af 100644 --- a/ash/system/unified/feature_tiles_container_view_unittest.cc +++ b/ash/system/unified/feature_tiles_container_view_unittest.cc
@@ -4,7 +4,6 @@ #include "ash/system/unified/feature_tiles_container_view.h" -#include "ash/constants/ash_features.h" #include "ash/constants/quick_settings_catalogs.h" #include "ash/public/cpp/pagination/pagination_model.h" #include "ash/shell.h" @@ -18,7 +17,6 @@ #include "ash/test/ash_test_base.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" -#include "base/test/scoped_feature_list.h" #include "components/vector_icons/vector_icons.h" #include "ui/events/test/event_generator.h" #include "ui/views/test/views_test_utils.h" @@ -63,10 +61,7 @@ class FeatureTilesContainerViewTest : public AshTestBase, public views::ViewObserver { public: - FeatureTilesContainerViewTest() { - feature_list_.InitAndEnableFeature(features::kQsRevamp); - } - + FeatureTilesContainerViewTest() = default; FeatureTilesContainerViewTest(const FeatureTilesContainerViewTest&) = delete; FeatureTilesContainerViewTest& operator=( const FeatureTilesContainerViewTest&) = delete; @@ -154,7 +149,6 @@ } private: - base::test::ScopedFeatureList feature_list_; std::unique_ptr<views::Widget> widget_; std::unique_ptr<UnifiedSystemTrayController> tray_controller_; scoped_refptr<UnifiedSystemTrayModel> tray_model_;
diff --git a/ash/system/unified/power_button_pixeltest.cc b/ash/system/unified/power_button_pixeltest.cc index 3ed06492..1d38e04 100644 --- a/ash/system/unified/power_button_pixeltest.cc +++ b/ash/system/unified/power_button_pixeltest.cc
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/constants/ash_features.h" #include "ash/system/unified/power_button.h" #include "ash/system/unified/quick_settings_footer.h" #include "ash/system/unified/unified_system_tray.h" @@ -10,8 +9,6 @@ #include "ash/test/ash_test_base.h" #include "ash/test/pixel/ash_pixel_differ.h" #include "ash/test/pixel/ash_pixel_test_init_params.h" -#include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" #include "ui/views/controls/menu/menu_item_view.h" #include "ui/views/controls/menu/submenu_view.h" #include "ui/views/view.h" @@ -21,10 +18,7 @@ // Pixel tests for the quick settings Power button and menu. class PowerButtonPixelTest : public NoSessionAshTestBase { public: - PowerButtonPixelTest() { - feature_list_.InitWithFeatures( - {features::kQsRevamp, chromeos::features::kJelly}, {}); - } + PowerButtonPixelTest() = default; // AshTestBase: absl::optional<pixel_test::InitParams> CreatePixelTestInitParams() @@ -53,8 +47,6 @@ void SimulatePowerButtonPress() { LeftClickOn(button_->button_content_); } private: - base::test::ScopedFeatureList feature_list_; - // Owned by view hierarchy. raw_ptr<PowerButton, ExperimentalAsh> button_ = nullptr; };
diff --git a/ash/system/unified/power_button_unittest.cc b/ash/system/unified/power_button_unittest.cc index 420e658d..ea1ad71 100644 --- a/ash/system/unified/power_button_unittest.cc +++ b/ash/system/unified/power_button_unittest.cc
@@ -4,7 +4,6 @@ #include "ash/system/unified/power_button.h" -#include "ash/constants/ash_features.h" #include "ash/constants/quick_settings_catalogs.h" #include "ash/public/cpp/ash_view_ids.h" #include "ash/shell.h" @@ -21,7 +20,6 @@ #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "base/test/metrics/histogram_tester.h" -#include "base/test/scoped_feature_list.h" #include "components/user_manager/user_type.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/compositor/layer.h" @@ -45,7 +43,6 @@ ~PowerButtonTest() override = default; void SetUp() override { - feature_list_.InitAndEnableFeature(features::kQsRevamp); NoSessionAshTestBase::SetUp(); // Test with the real system tray bubble so that the power button has a real @@ -145,7 +142,6 @@ // Owned by view hierarchy. raw_ptr<PowerButton, DanglingUntriaged | ExperimentalAsh> button_ = nullptr; - base::test::ScopedFeatureList feature_list_; base::HistogramTester histogram_tester_; };
diff --git a/ash/system/unified/quick_settings_slider.cc b/ash/system/unified/quick_settings_slider.cc index f96d6a5..af3e1bcc 100644 --- a/ash/system/unified/quick_settings_slider.cc +++ b/ash/system/unified/quick_settings_slider.cc
@@ -4,7 +4,6 @@ #include "ash/system/unified/quick_settings_slider.h" -#include "ash/constants/ash_features.h" #include "ash/style/ash_color_provider.h" #include "ash/style/color_util.h" #include "base/notreached.h" @@ -80,8 +79,6 @@ QuickSettingsSlider::QuickSettingsSlider(views::SliderListener* listener, Style slider_style) : views::Slider(listener), slider_style_(slider_style) { - if (!features::IsQsRevampEnabled()) - return; SetValueIndicatorRadius(kFullSliderRoundedRadius); SetFocusBehavior(FocusBehavior::ALWAYS); } @@ -114,15 +111,6 @@ } SkColor QuickSettingsSlider::GetThumbColor() const { - // TODO(b/256705775): Updates the color when QsRevamp is disabled but Jelly is - // enabled. - if (!features::IsQsRevampEnabled()) { - using Type = AshColorProvider::ContentLayerType; - return AshColorProvider::Get()->GetContentLayerColor( - (style() == RenderingStyle::kMinimalStyle) ? Type::kSliderColorInactive - : Type::kSliderColorActive); - } - switch (slider_style_) { case Style::kDefault: case Style::kRadioActive: @@ -141,11 +129,6 @@ } SkColor QuickSettingsSlider::GetTroughColor() const { - // TODO(b/256705775): Updates the color when QsRevamp is disabled but Jelly is - // enabled. - if (!features::IsQsRevampEnabled()) - return ColorUtil::GetSecondToneColor(GetThumbColor()); - switch (slider_style_) { case Style::kDefault: return GetColorProvider()->GetColor( @@ -164,13 +147,6 @@ } void QuickSettingsSlider::OnPaint(gfx::Canvas* canvas) { - // Paints the `QuickSettingsSlider`. If the feature is not enabled, use - // `Slider::OnPaint()`. - if (!ash::features::IsQsRevampEnabled()) { - views::Slider::OnPaint(canvas); - return; - } - const gfx::Rect content = GetContentsBounds(); const float slider_width = GetSliderWidth(slider_style_); const float slider_radius = GetSliderRoundedCornerRadius(slider_style_);
diff --git a/ash/system/unified/quick_settings_view.cc b/ash/system/unified/quick_settings_view.cc index 30d1320..42d81842 100644 --- a/ash/system/unified/quick_settings_view.cc +++ b/ash/system/unified/quick_settings_view.cc
@@ -24,6 +24,7 @@ #include "media/base/media_switches.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" +#include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/insets.h" @@ -45,6 +46,8 @@ constexpr auto kSlidersContainerMargin = gfx::Insets::TLBR(4, 0, 0, 0); class AccessibilityFocusHelperView : public views::View { + METADATA_HEADER(AccessibilityFocusHelperView, views::View) + public: explicit AccessibilityFocusHelperView(UnifiedSystemTrayController* controller) : controller_(controller) {} @@ -65,6 +68,9 @@ raw_ptr<UnifiedSystemTrayController, ExperimentalAsh> controller_; }; +BEGIN_METADATA(AccessibilityFocusHelperView) +END_METADATA + } // namespace // The container view for the system tray, i.e. the panel containing settings
diff --git a/ash/system/unified/quick_settings_view_unittest.cc b/ash/system/unified/quick_settings_view_unittest.cc index 87e3ccf..f2721bc 100644 --- a/ash/system/unified/quick_settings_view_unittest.cc +++ b/ash/system/unified/quick_settings_view_unittest.cc
@@ -4,7 +4,6 @@ #include "ash/system/unified/quick_settings_view.h" -#include "ash/constants/ash_features.h" #include "ash/public/cpp/ash_view_ids.h" #include "ash/public/cpp/test/test_cast_config_controller.h" #include "ash/shell.h" @@ -15,7 +14,6 @@ #include "ash/system/unified/unified_system_tray_bubble.h" #include "ash/test/ash_test_base.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" -#include "base/test/scoped_feature_list.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" @@ -30,7 +28,6 @@ ~QuickSettingsViewTest() override = default; void SetUp() override { - feature_list_.InitAndEnableFeature(features::kQsRevamp); AshTestBase::SetUp(); cast_config_ = std::make_unique<TestCastConfigController>(); } @@ -70,7 +67,6 @@ // This is required to make the cast tile visible in the // `CastAndAutoRotateCompactTiles` unit test. Cast features will not be used. std::unique_ptr<TestCastConfigController> cast_config_; - base::test::ScopedFeatureList feature_list_; }; // Tests that the cast and auto-rotate tiles are presented in their compact
diff --git a/ash/system/unified/system_tray_test_api.cc b/ash/system/unified/system_tray_test_api.cc index 26ec5f4..71f52fe0 100644 --- a/ash/system/unified/system_tray_test_api.cc +++ b/ash/system/unified/system_tray_test_api.cc
@@ -6,7 +6,6 @@ #include <string> -#include "ash/public/cpp/ash_view_ids.h" #include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/system/accessibility/select_to_speak/select_to_speak_tray.h" @@ -131,20 +130,17 @@ } std::u16string SystemTrayTestApi::GetShutdownButtonTooltip() { - // When the QS revamp is enabled the power button view that has ID - // `VIEW_ID_QS_POWER_BUTTON` is not the view that has the tooltip; what we're - // looking for is actually the child `ash::IconButton` view. - if (base::FeatureList::IsEnabled(features::kQsRevamp)) { - auto* icon_button = GetTray() - ->bubble() - ->quick_settings_view() - ->footer_for_testing() - ->power_button_for_testing() - ->button_content_for_testing(); - return icon_button ? icon_button->GetTooltipText(gfx::Point()) - : std::u16string(); - } - return GetBubbleViewTooltip(VIEW_ID_QS_POWER_BUTTON); + // The power button view that has ID `VIEW_ID_QS_POWER_BUTTON` is not the view + // that has the tooltip; what we're looking for is actually the child + // `ash::IconButton` view. + auto* icon_button = GetTray() + ->bubble() + ->quick_settings_view() + ->footer_for_testing() + ->power_button_for_testing() + ->button_content_for_testing(); + return icon_button ? icon_button->GetTooltipText(gfx::Point()) + : std::u16string(); } std::u16string SystemTrayTestApi::GetBubbleViewText(int view_id) {
diff --git a/ash/system/unified/user_chooser_detailed_view_controller_unittest.cc b/ash/system/unified/user_chooser_detailed_view_controller_unittest.cc index 390106a9..f36c32a7 100644 --- a/ash/system/unified/user_chooser_detailed_view_controller_unittest.cc +++ b/ash/system/unified/user_chooser_detailed_view_controller_unittest.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "ash/constants/ash_features.h" #include "ash/public/cpp/ash_view_ids.h" #include "ash/public/cpp/system_tray_test_api.h" #include "ash/root_window_controller.h" @@ -18,7 +17,6 @@ #include "ash/system/unified/unified_system_tray_bubble.h" #include "ash/test/ash_test_base.h" #include "ash/wm/overview/overview_controller.h" -#include "base/test/scoped_feature_list.h" #include "components/account_id/account_id.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" @@ -35,18 +33,9 @@ ->user_info.account_id; } -class UserChooserDetailedViewControllerTest - : public AshTestBase, - public testing::WithParamInterface<bool> { +class UserChooserDetailedViewControllerTest : public AshTestBase { public: - UserChooserDetailedViewControllerTest() { - if (IsQsRevampEnabled()) { - feature_list_.InitAndEnableFeature(features::kQsRevamp); - } else { - feature_list_.InitAndDisableFeature(features::kQsRevamp); - } - } - + UserChooserDetailedViewControllerTest() = default; UserChooserDetailedViewControllerTest( const UserChooserDetailedViewControllerTest&) = delete; UserChooserDetailedViewControllerTest& operator=( @@ -54,9 +43,6 @@ ~UserChooserDetailedViewControllerTest() override = default; - // TODO(b/305075031) clean up after the flag is removed. - bool IsQsRevampEnabled() const { return true; } - // AshTestBase void SetUp() override { AshTestBase::SetUp(); @@ -71,13 +57,6 @@ } void ShowUserChooserView() { - if (!IsQsRevampEnabled()) { - // Click the user avatar button. - ASSERT_TRUE(IsBubbleViewVisible(VIEW_ID_QS_USER_AVATAR_BUTTON)); - tray_test_api()->ClickBubbleView(VIEW_ID_QS_USER_AVATAR_BUTTON); - return; - } - // Click the power button to show the menu. ASSERT_TRUE(IsBubbleViewVisible(VIEW_ID_QS_POWER_BUTTON)); tray_test_api()->ClickBubbleView(VIEW_ID_QS_POWER_BUTTON); @@ -99,16 +78,11 @@ SystemTrayTestApi* tray_test_api() { return tray_test_api_.get(); } private: - base::test::ScopedFeatureList feature_list_; std::unique_ptr<ui::ScopedAnimationDurationScaleMode> disable_animations_; std::unique_ptr<SystemTrayTestApi> tray_test_api_; }; -INSTANTIATE_TEST_SUITE_P(QsRevamp, - UserChooserDetailedViewControllerTest, - testing::Bool()); - -TEST_P(UserChooserDetailedViewControllerTest, +TEST_F(UserChooserDetailedViewControllerTest, ShowMultiProfileLoginWithOverview) { // Enter overview mode. EnterOverview(); @@ -127,7 +101,7 @@ tray_test_api()->ClickBubbleView(VIEW_ID_ADD_USER_BUTTON); } -TEST_P(UserChooserDetailedViewControllerTest, SwitchUserWithOverview) { +TEST_F(UserChooserDetailedViewControllerTest, SwitchUserWithOverview) { // Add a secondary user. const AccountId secondary_user = AccountId::FromUserEmail("secondary@gmail.com"); @@ -157,7 +131,7 @@ EXPECT_EQ(GetActiveUser(), secondary_user); } -TEST_P(UserChooserDetailedViewControllerTest, +TEST_F(UserChooserDetailedViewControllerTest, MultiProfileLoginDisabledForFamilyLinkUsers) { EXPECT_TRUE(UserChooserDetailedViewController::IsUserChooserEnabled());
diff --git a/ash/test/ash_test_util.cc b/ash/test/ash_test_util.cc index 3f5fed0f9..8b2d24b 100644 --- a/ash/test/ash_test_util.cc +++ b/ash/test/ash_test_util.cc
@@ -27,6 +27,7 @@ #include "chromeos/ui/frame/multitask_menu/multitask_menu_metrics.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window_observer.h" +#include "ui/events/test/event_generator.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia.h" @@ -274,4 +275,13 @@ return multitask_menu; } +void SendKey(ui::KeyboardCode key_code, + ui::test::EventGenerator* event_generator, + int flags, + int count) { + for (int i = 0; i < count; ++i) { + event_generator->PressAndReleaseKey(key_code, flags); + } +} + } // namespace ash
diff --git a/ash/test/ash_test_util.h b/ash/test/ash_test_util.h index f59a3dd..3f6a333 100644 --- a/ash/test/ash_test_util.h +++ b/ash/test/ash_test_util.h
@@ -27,6 +27,10 @@ class Size; } // namespace gfx +namespace ui::test { +class EventGenerator; +} // namespace ui::test + namespace views { class MenuItemView; } // namespace views @@ -81,6 +85,12 @@ chromeos::MultitaskMenuEntryType entry_type = chromeos::MultitaskMenuEntryType::kFrameSizeButtonHover); +// Sends a press release key combo `count` times. +void SendKey(ui::KeyboardCode key_code, + ui::test::EventGenerator* event_generator = nullptr, + int flags = ui::EF_NONE, + int count = 1); + } // namespace ash #endif
diff --git a/ash/webui/firmware_update_ui/firmware_update_app_ui.cc b/ash/webui/firmware_update_ui/firmware_update_app_ui.cc index 009502f..a4fb5fb 100644 --- a/ash/webui/firmware_update_ui/firmware_update_app_ui.cc +++ b/ash/webui/firmware_update_ui/firmware_update_app_ui.cc
@@ -69,7 +69,8 @@ {"restartingTitleText", IDS_FIRMWARE_RESTARTING_TITLE_TEXT}, {"upToDate", IDS_FIRMWARE_UP_TO_DATE_TEXT}, {"versionText", IDS_FIRMWARE_VERSION_TEXT}, - {"proceedConfirmationText", IDS_FIRMWARE_PROCEED_UPDATE_CONFIRMATION}}; + {"proceedConfirmationText", IDS_FIRMWARE_PROCEED_UPDATE_CONFIRMATION}, + {"confirmationDisclaimer", IDS_FIRMWARE_CONFIRMATION_DISCLAIMER_TEXT}}; source->AddLocalizedStrings(kLocalizedStrings); source->UseStringsJs();
diff --git a/ash/webui/firmware_update_ui/resources/BUILD.gn b/ash/webui/firmware_update_ui/resources/BUILD.gn index be9008f..5e99be5 100644 --- a/ash/webui/firmware_update_ui/resources/BUILD.gn +++ b/ash/webui/firmware_update_ui/resources/BUILD.gn
@@ -26,6 +26,8 @@ "update_card.ts", ] + icons_html_files = [ "icons.html" ] + non_web_component_files = [ "fake_data.ts", "fake_update_controller.ts",
diff --git a/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.html b/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.html index 2f481e3..5335134 100644 --- a/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.html +++ b/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.html
@@ -1,11 +1,43 @@ <style include="firmware-shared-fonts firmware-shared"> :host { --cr-dialog-width: 416px; + --disclaimer-icon-size: 16px; } #proceedText { white-space: pre-line; } + + #disclaimer { + align-items: center; + display: flex; + flex-direction: row; + margin-bottom: 16px; + } + + #disclaimer-icon { + align-items: center; + background: var(--cros-sys-warning_container); + border-radius: 8px; + display: flex; + flex: 0 0 auto; + height: 24px; + justify-content: center; + margin-inline-end: 8px; + width: 24px; + } + + #disclaimer-icon iron-icon { + --iron-icon-fill-color: var(--cros-sys-on_warning_container); + --iron-icon-height: var(--disclaimer-icon-size); + --iron-icon-width: var(--disclaimer-icon-size); + } + + #disclaimer-text { + color: var(--cros-sys-on_warning_container); + font: var(--cros-annotation-2-font); + flex: 1; + } </style> <template is="dom-if" if="[[open]]" restamp> <cr-dialog id="confirmationDialog" on-close="closeDialog" show-on-attach> @@ -13,6 +45,14 @@ [[computeTitle(update.*)]] </div> <div slot="body" class="firmware-dialog-body-font"> + <template is="dom-if" if="[[shouldShowDisclaimer]]" restamp> + <div id="disclaimer"> + <div id="disclaimer-icon"> + <iron-icon icon="firmware-updates:warning"></iron-icon> + </div> + <div id="disclaimer-text">[[i18n('confirmationDisclaimer')]]</div> + </div> + </template> <div id="updateDialogBody"> [[i18n('updatingInfo')]] </div>
diff --git a/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.ts b/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.ts index 5761a06..28ce95c1 100644 --- a/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.ts +++ b/ash/webui/firmware_update_ui/resources/firmware_confirmation_dialog.ts
@@ -5,6 +5,7 @@ import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/big_buffer.mojom-webui.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/string16.mojom-webui.js'; +import './icons.html.js'; import './firmware_shared.css.js'; import './firmware_shared_fonts.css.js'; import './strings.m.js'; @@ -16,6 +17,7 @@ import {getTemplate} from './firmware_confirmation_dialog.html.js'; import {FirmwareUpdate} from './firmware_update.mojom-webui.js'; import {OpenConfirmationDialogEventDetail, OpenUpdateDialogEventDetail} from './firmware_update_types.js'; +import {isAppV2Enabled} from './firmware_update_utils.js'; /** * @fileoverview @@ -46,11 +48,17 @@ type: Boolean, value: false, }, + + shouldShowDisclaimer: { + type: Boolean, + value: false, + }, }; } update: FirmwareUpdate; open: boolean = false; + private shouldShowDisclaimer: boolean = false; override connectedCallback() { super.connectedCallback(); @@ -58,6 +66,8 @@ 'open-confirmation-dialog', (e) => this.onOpenConfirmationDialog( e as CustomEvent<OpenConfirmationDialogEventDetail>)); + + this.shouldShowDisclaimer = isAppV2Enabled(); } protected openUpdateDialog(): void {
diff --git a/ash/webui/firmware_update_ui/resources/icons.html b/ash/webui/firmware_update_ui/resources/icons.html new file mode 100644 index 0000000..43f251914 --- /dev/null +++ b/ash/webui/firmware_update_ui/resources/icons.html
@@ -0,0 +1,10 @@ +<iron-iconset-svg name="firmware-updates" size="16"> + <svg> + <defs> + <g id="warning" width="16" height="16" viewBox="0 0 16 16"> + <path + d="M1.46667 13.0458L8 2.12292L14.5333 13.0458H1.46667ZM3.75625 11.7333H12.2438L8 4.675L3.75625 11.7333ZM8 11.1208C8.15556 11.1208 8.28681 11.0674 8.39375 10.9604C8.51042 10.8437 8.56875 10.7125 8.56875 10.5667C8.56875 10.4111 8.51042 10.2799 8.39375 10.1729C8.28681 10.0562 8.15556 9.99792 8 9.99792C7.84444 9.99792 7.70833 10.0514 7.59167 10.1583C7.48472 10.2653 7.43125 10.3965 7.43125 10.5521C7.43125 10.7076 7.48472 10.8437 7.59167 10.9604C7.70833 11.0674 7.84444 11.1208 8 11.1208ZM7.475 9.4H8.525V6.6875H7.475V9.4Z"> + </g> + </defs> + </svg> +</iron-iconset-svg>
diff --git a/ash/wm/desks/desk.cc b/ash/wm/desks/desk.cc index 05093a5..3c97219 100644 --- a/ash/wm/desks/desk.cc +++ b/ash/wm/desks/desk.cc
@@ -497,6 +497,22 @@ } } +void Desk::SetLacrosProfileId(uint64_t lacros_profile_id, + bool skip_prefs_update) { + if (lacros_profile_id == lacros_profile_id_) { + return; + } + + lacros_profile_id_ = lacros_profile_id; + if (!skip_prefs_update) { + desks_restore_util::UpdatePrimaryUserDeskLacrosProfileIdPrefs(); + } + + for (auto& observer : observers_) { + observer.OnDeskProfileChanged(lacros_profile_id_); + } +} + void Desk::PrepareForActivationAnimation() { DCHECK(!is_active_);
diff --git a/ash/wm/desks/desk.h b/ash/wm/desks/desk.h index 2c170f8..b9548204 100644 --- a/ash/wm/desks/desk.h +++ b/ash/wm/desks/desk.h
@@ -47,6 +47,9 @@ // Called when the desk's name changes. virtual void OnDeskNameChanged(const std::u16string& new_name) = 0; + + // Called when the desk's associated profile has changed. + virtual void OnDeskProfileChanged(uint64_t new_lacros_profile_id) {} }; // Suspends notification of content updates within its scope. Note that the @@ -141,6 +144,10 @@ return all_desk_window_stacking_; } + // Returns the lacros profile ID that this desk is associated with. A value of + // 0 means that the desk is associated with the primary user (the default). + uint64_t lacros_profile_id() const { return lacros_profile_id_; } + void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); @@ -163,6 +170,12 @@ // restoring desks on sign-in. If `new_guid` is invalid no change happens. void SetGuid(base::Uuid new_guid); + // Sets the desk's lacros profile id to `lacros_profile_id`. The value 0 + // (which is the default value) indicates that the desk is associated with the + // primary user. When `skip_prefs_update` is true, prefs are not updated. + void SetLacrosProfileId(uint64_t lacros_profile_id, + bool skip_prefs_update = false); + // Prepares for the animation to activate this desk (i.e. this desk is not // active yet), by showing its containers on all root windows while setting // their opacities to 0. Calling Activate() during the animation will set the @@ -372,6 +385,10 @@ // A timer for marking |this| as interacted with only if the user remains on // |this| for a brief period of time. base::OneShotTimer active_desk_timer_; + + // The lacros profile ID that this desk has been associated with. Defaults to + // 0 which means the desk is associated with the primary user. + uint64_t lacros_profile_id_ = 0; }; } // namespace ash
diff --git a/ash/wm/desks/desks_controller.cc b/ash/wm/desks/desks_controller.cc index 3cee97b..bbbf4cd 100644 --- a/ash/wm/desks/desks_controller.cc +++ b/ash/wm/desks/desks_controller.cc
@@ -711,6 +711,7 @@ // right order. desks_restore_util::UpdatePrimaryUserDeskNamesPrefs(); desks_restore_util::UpdatePrimaryUserDeskGuidsPrefs(); + desks_restore_util::UpdatePrimaryUserDeskLacrosProfileIdPrefs(); desks_restore_util::UpdatePrimaryUserDeskMetricsPrefs(); // 2. For multi-profile switching, update all affected active desk index in @@ -1996,6 +1997,7 @@ desks_restore_util::UpdatePrimaryUserDeskNamesPrefs(); desks_restore_util::UpdatePrimaryUserDeskGuidsPrefs(); + desks_restore_util::UpdatePrimaryUserDeskLacrosProfileIdPrefs(); desks_restore_util::UpdatePrimaryUserDeskMetricsPrefs(); DCHECK_LE(available_container_ids_.size(), desks_util::GetMaxNumberOfDesks());
diff --git a/ash/wm/desks/desks_restore_util.cc b/ash/wm/desks/desks_restore_util.cc index 1e2e303..3daff7f 100644 --- a/ash/wm/desks/desks_restore_util.cc +++ b/ash/wm/desks/desks_restore_util.cc
@@ -14,6 +14,7 @@ #include "ash/wm/desks/desks_histogram_enums.h" #include "ash/wm/desks/desks_util.h" #include "base/auto_reset.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/time/clock.h" #include "base/time/time.h" @@ -88,6 +89,7 @@ constexpr int kDefaultActiveDeskIndex = 0; registry->RegisterListPref(prefs::kDesksNamesList); registry->RegisterListPref(prefs::kDesksGuidsList); + registry->RegisterListPref(prefs::kDesksLacrosProfileIdList); registry->RegisterListPref(prefs::kDesksMetricsList); registry->RegisterDictionaryPref(prefs::kDesksWeeklyActiveDesksMetrics); registry->RegisterIntegerPref(prefs::kDesksActiveDesk, @@ -107,6 +109,8 @@ primary_user_prefs->GetList(prefs::kDesksNamesList); const base::Value::List& desks_guids_list = primary_user_prefs->GetList(prefs::kDesksGuidsList); + const base::Value::List& desks_lacros_profile_ids_list = + primary_user_prefs->GetList(prefs::kDesksLacrosProfileIdList); const base::Value::List& desks_metrics_list = primary_user_prefs->GetList(prefs::kDesksMetricsList); @@ -144,6 +148,15 @@ index); } + if (index < desks_lacros_profile_ids_list.size()) { + uint64_t lacros_profile_id = 0; + if (base::StringToUint64(desks_lacros_profile_ids_list[index].GetString(), + &lacros_profile_id)) { + desks_controller->GetDeskAtIndex(index)->SetLacrosProfileId( + lacros_profile_id, /*skip_prefs_update=*/true); + } + } + // Only restore metrics if there is existing data. if (index >= desks_metrics_list_size) continue; @@ -265,6 +278,29 @@ DCHECK_EQ(guid_pref_data.size(), desks.size()); } +void UpdatePrimaryUserDeskLacrosProfileIdPrefs() { + if (g_pause_desks_prefs_updates) { + return; + } + + PrefService* primary_user_prefs = GetPrimaryUserPrefService(); + if (!primary_user_prefs) { + // Can be null in tests. + return; + } + + ScopedListPrefUpdate id_update(primary_user_prefs, + prefs::kDesksLacrosProfileIdList); + base::Value::List& id_pref_data = id_update.Get(); + id_pref_data.clear(); + + for (const auto& desk : DesksController::Get()->desks()) { + // Lacros profile IDs are 64-bit unsigned integers, which will fall outside + // of the range of `int`. We therefore store them as strings. + id_pref_data.Append(base::NumberToString(desk->lacros_profile_id())); + } +} + void UpdatePrimaryUserDeskMetricsPrefs() { if (g_pause_desks_prefs_updates) return;
diff --git a/ash/wm/desks/desks_restore_util.h b/ash/wm/desks/desks_restore_util.h index 94135b8..edffd9b7 100644 --- a/ash/wm/desks/desks_restore_util.h +++ b/ash/wm/desks/desks_restore_util.h
@@ -33,6 +33,10 @@ // a desk is created or destroyed. ASH_EXPORT void UpdatePrimaryUserDeskGuidsPrefs(); +// Called to update the desk lacros profile ID associations for the primary user +// whenever it changes. +ASH_EXPORT void UpdatePrimaryUserDeskLacrosProfileIdPrefs(); + // Called to update the desk metrics restore prefs for the primary user whenever // desks count changes, desks order changes or during // `DesksController::Shutdown()`.
diff --git a/ash/wm/desks/desks_unittests.cc b/ash/wm/desks/desks_unittests.cc index ffe962a..0b5763d 100644 --- a/ash/wm/desks/desks_unittests.cc +++ b/ash/wm/desks/desks_unittests.cc
@@ -342,13 +342,21 @@ int notify_counts() const { return notify_counts_; } + const std::vector<uint64_t>& lacros_profile_id_updates() const { + return lacros_profile_id_updates_; + } + // Desk::Observer: void OnContentChanged() override { ++notify_counts_; } void OnDeskDestroyed(const Desk* desk) override {} void OnDeskNameChanged(const std::u16string& new_name) override {} + void OnDeskProfileChanged(uint64_t lacros_profile_id) override { + lacros_profile_id_updates_.push_back(lacros_profile_id); + } private: int notify_counts_ = 0; + std::vector<uint64_t> lacros_profile_id_updates_; }; class FullScreenStateObserver : public ShellObserver { @@ -2467,6 +2475,31 @@ ASSERT_FALSE(win4->HasFocus()); } +// Tests that we can set a lacros profile ID on a desk and that observers get +// notified. +TEST_P(DesksTest, LacrosProfileId) { + auto* controller = DesksController::Get(); + Desk* desk = controller->GetDeskAtIndex(0); + + TestDeskObserver desk_observer; + desk->AddObserver(&desk_observer); + + desk->SetLacrosProfileId(1001); + EXPECT_THAT(desk_observer.lacros_profile_id_updates(), + testing::ElementsAre(1001)); + + // Setting the same ID does not result in observer notifications. + desk->SetLacrosProfileId(1001); + EXPECT_THAT(desk_observer.lacros_profile_id_updates(), + testing::ElementsAre(1001)); + + desk->SetLacrosProfileId(2001); + EXPECT_THAT(desk_observer.lacros_profile_id_updates(), + testing::ElementsAre(1001, 2001)); + + desk->RemoveObserver(&desk_observer); +} + class DesksWithMultiDisplayOverview : public AshTestBase { public: DesksWithMultiDisplayOverview() = default; @@ -2667,6 +2700,23 @@ return guids; } +// Returns the lacros profile IDs in the given `user_prefs`. +std::vector<uint64_t> GetDeskRestoreLacrosProfileIds(PrefService* user_prefs) { + const base::Value::List& lacros_profile_ids_list = + user_prefs->GetList(prefs::kDesksLacrosProfileIdList); + + std::vector<uint64_t> lacros_profile_ids; + for (const base::Value& value : lacros_profile_ids_list) { + uint64_t lacros_profile_id = 0; + if (base::StringToUint64(value.GetString(), &lacros_profile_id)) { + lacros_profile_ids.push_back(lacros_profile_id); + } else { + lacros_profile_ids.push_back(0); + } + } + return lacros_profile_ids; +} + } // namespace class DesksEditableNamesTest : public DesksTest { @@ -9133,6 +9183,29 @@ testing::ElementsAre(desk1_guid, desk3_guid, desk2_guid)); } +TEST_P(DesksTest, DeskLacrosIdPrefs) { + NewDesk(); + NewDesk(); + + auto* controller = DesksController::Get(); + // Set some lacros profile IDs for the three desks. + controller->GetDeskAtIndex(0)->SetLacrosProfileId(1001); + controller->GetDeskAtIndex(1)->SetLacrosProfileId(2001); + controller->GetDeskAtIndex(2)->SetLacrosProfileId(3001); + EXPECT_THAT(GetDeskRestoreLacrosProfileIds(GetPrimaryUserPrefService()), + testing::ElementsAre(1001, 2001, 3001)); + + // Reorder the last two desks. We expect the prefs to update to match. + controller->ReorderDesk(1, 2); + EXPECT_THAT(GetDeskRestoreLacrosProfileIds(GetPrimaryUserPrefService()), + testing::ElementsAre(1001, 3001, 2001)); + + // Remove the first desk. + RemoveDesk(controller->GetDeskAtIndex(0)); + EXPECT_THAT(GetDeskRestoreLacrosProfileIds(GetPrimaryUserPrefService()), + testing::ElementsAre(3001, 2001)); +} + // Tests that windows are closed when the user interacts with the shelf. TEST_P(DesksCloseAllTest, InteractingWithShelfClosesToast) { auto* shelf_model = ShelfModel::Get();
diff --git a/ash/wm/overview/overview_drop_target.cc b/ash/wm/overview/overview_drop_target.cc index cb334c8..a6f95ad 100644 --- a/ash/wm/overview/overview_drop_target.cc +++ b/ash/wm/overview/overview_drop_target.cc
@@ -10,8 +10,6 @@ #include "ash/wm/overview/overview_constants.h" #include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_utils.h" -#include "ash/wm/window_properties.h" -#include "chromeos/constants/chromeos_features.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/geometry/rect_f.h" @@ -130,8 +128,9 @@ void OverviewDropTarget::EnsureVisible() {} -OverviewFocusableView* OverviewDropTarget::GetFocusableView() const { - return nullptr; +std::vector<OverviewFocusableView*> OverviewDropTarget::GetFocusableViews() + const { + return {}; } views::View* OverviewDropTarget::GetBackDropView() const {
diff --git a/ash/wm/overview/overview_drop_target.h b/ash/wm/overview/overview_drop_target.h index f6fd322..6f7b5ed 100644 --- a/ash/wm/overview/overview_drop_target.h +++ b/ash/wm/overview/overview_drop_target.h
@@ -6,7 +6,6 @@ #define ASH_WM_OVERVIEW_OVERVIEW_DROP_TARGET_H_ #include "ash/wm/overview/overview_item_base.h" -#include "base/memory/raw_ptr.h" namespace aura { class Window; @@ -46,7 +45,7 @@ float GetItemScale(int height) override; void ScaleUpSelectedItem(OverviewAnimationType animation_type) override; void EnsureVisible() override; - OverviewFocusableView* GetFocusableView() const override; + std::vector<OverviewFocusableView*> GetFocusableViews() const override; views::View* GetBackDropView() const override; void UpdateRoundedCornersAndShadow() override; void SetOpacity(float opacity) override;
diff --git a/ash/wm/overview/overview_focus_cycler.cc b/ash/wm/overview/overview_focus_cycler.cc index ba2345d..920abca 100644 --- a/ash/wm/overview/overview_focus_cycler.cc +++ b/ash/wm/overview/overview_focus_cycler.cc
@@ -253,19 +253,7 @@ } OverviewItemBase* OverviewFocusCycler::GetFocusedItem() const { - if (!focused_view_) { - return nullptr; - } - - for (auto& grid : overview_session_->grid_list()) { - for (auto& item : grid->window_list()) { - if (focused_view_->GetView() == item->GetFocusableView()->GetView()) { - return item.get(); - } - } - } - - return nullptr; + return focused_view_ ? focused_view_->GetOverviewItem() : nullptr; } void OverviewFocusCycler::ResetFocusedView() { @@ -305,8 +293,10 @@ } } } else { - for (auto& item : grid->window_list()) { - traversable_views.push_back(item->GetFocusableView()); + for (const auto& item : grid->window_list()) { + for (auto* focusable_view : item->GetFocusableViews()) { + traversable_views.push_back(focusable_view); + } } }
diff --git a/ash/wm/overview/overview_focus_cycler_unittest.cc b/ash/wm/overview/overview_focus_cycler_unittest.cc index 8fd4d767..4327102 100644 --- a/ash/wm/overview/overview_focus_cycler_unittest.cc +++ b/ash/wm/overview/overview_focus_cycler_unittest.cc
@@ -8,7 +8,6 @@ #include "ash/constants/ash_features.h" #include "ash/shell.h" #include "ash/style/close_button.h" -#include "ash/test/ash_test_base.h" #include "ash/wm/desks/desk.h" #include "ash/wm/desks/desk_mini_view.h" #include "ash/wm/desks/desk_name_view.h" @@ -255,7 +254,7 @@ } // Tests three monitors where the grid becomes empty on one of the monitors. -TEST_P(OverviewFocusCyclerTest, ThreeMonitor) { +TEST_P(OverviewFocusCyclerTest, ThreeMonitors) { UpdateDisplay("500x400,500x400,500x400"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); std::unique_ptr<aura::Window> window3(
diff --git a/ash/wm/overview/overview_focusable_view.cc b/ash/wm/overview/overview_focusable_view.cc index 5506f7e8..e66583d6 100644 --- a/ash/wm/overview/overview_focusable_view.cc +++ b/ash/wm/overview/overview_focusable_view.cc
@@ -8,6 +8,10 @@ namespace ash { +OverviewItemBase* OverviewFocusableView::GetOverviewItem() { + return nullptr; +} + bool OverviewFocusableView::MaybeActivateFocusedViewOnOverviewExit( OverviewSession* overview_session) { return false;
diff --git a/ash/wm/overview/overview_focusable_view.h b/ash/wm/overview/overview_focusable_view.h index 8c661de..0015bda 100644 --- a/ash/wm/overview/overview_focusable_view.h +++ b/ash/wm/overview/overview_focusable_view.h
@@ -6,22 +6,30 @@ #define ASH_WM_OVERVIEW_OVERVIEW_FOCUSABLE_VIEW_H_ #include "ash/ash_export.h" -#include "ui/gfx/geometry/point.h" + +namespace gfx { +class Point; +} // namespace gfx namespace views { class View; -} +} // namespace views namespace ash { + +class OverviewItemBase; class OverviewSession; // An interface that must be implemented by classes that want to be // focused in overview. class ASH_EXPORT OverviewFocusableView { public: - // Get the view class associated with |this|. + // Returns the view class associated with `this`. virtual views::View* GetView() = 0; + // Returns nullptr, unless `this` is associated with an `OverviewItem`. + virtual OverviewItemBase* GetOverviewItem(); + // Attempts to activate or close this view. Overriders may do nothing. Closing // supports a primary action and a secondary action, as some overrides may // have two actions that are related to closing.
diff --git a/ash/wm/overview/overview_grid.cc b/ash/wm/overview/overview_grid.cc index 47f02e8..a4240be4 100644 --- a/ash/wm/overview/overview_grid.cc +++ b/ash/wm/overview/overview_grid.cc
@@ -874,14 +874,14 @@ UpdateNumSavedDeskUnsupportedWindows(overview_item->GetWindows(), /*increment=*/false); - // This can also be called when shutting down |this|, at which the item will - // be cleaning up and its associated view may be nullptr. |overview_item| - // needs to still be in |window_list_| so we can compute what the deleted - // index is. - if (OverviewFocusableView* focusable_view = (*iter)->GetFocusableView(); - overview_session_ && focusable_view) { - overview_session_->focus_cycler()->OnViewDestroyingOrDisabling( - focusable_view); + // This can also be called when shutting down `this`, at which point the item + // will be cleaned up and its associated view may be nullptr. `overview_item` + // still needs to be in `window_list_` to compute the corresponding index. + if (overview_session_) { + for (auto* focusable_view : overview_item->GetFocusableViews()) { + overview_session_->focus_cycler()->OnViewDestroyingOrDisabling( + focusable_view); + } } // Erase from the list first because deleting OverviewItem can lead to
diff --git a/ash/wm/overview/overview_group_container_view.cc b/ash/wm/overview/overview_group_container_view.cc index edcc6f7..c6a4ca47 100644 --- a/ash/wm/overview/overview_group_container_view.cc +++ b/ash/wm/overview/overview_group_container_view.cc
@@ -4,78 +4,18 @@ #include "ash/wm/overview/overview_group_container_view.h" -#include "ash/style/style_util.h" -#include "ash/wm/overview/overview_constants.h" #include "ash/wm/overview/overview_group_item.h" #include "ui/base/metadata/metadata_impl_macros.h" -#include "ui/views/controls/focus_ring.h" -#include "ui/views/controls/highlight_path_generator.h" -#include "ui/views/view_utils.h" namespace ash { -namespace { - -constexpr int kFocusRingRoundedCornerRadius = 20; - -} // namespace - OverviewGroupContainerView::OverviewGroupContainerView( OverviewGroupItem* overview_group_item) : overview_group_item_(overview_group_item) { - SetFocusBehavior(FocusBehavior::NEVER); - views::InstallRoundRectHighlightPathGenerator( - this, gfx::Insets(kFocusRingHaloInset), kFocusRingRoundedCornerRadius); - - views::FocusRing* focus_ring = StyleUtil::SetUpFocusRingForView(this); - focus_ring->SetHasFocusPredicate( - base::BindRepeating([](const views::View* view) { - const auto* v = views::AsViewClass<OverviewGroupContainerView>(view); - CHECK(v); - return v->is_focused_; - })); } OverviewGroupContainerView::~OverviewGroupContainerView() = default; -views::View* OverviewGroupContainerView::GetView() { - return this; -} - -void OverviewGroupContainerView::MaybeActivateFocusedView() { - overview_group_item_->OnFocusedViewActivated(); -} - -void OverviewGroupContainerView::MaybeCloseFocusedView(bool primary_action) { - if (primary_action) { - overview_group_item_->OnFocusedViewClosed(); - } -} - -void OverviewGroupContainerView::MaybeSwapFocusedView(bool right) {} - -bool OverviewGroupContainerView::MaybeActivateFocusedViewOnOverviewExit( - OverviewSession* overview_session) { - return true; -} - -void OverviewGroupContainerView::OnFocusableViewFocused() { - UpdateFocusState(/*focus=*/true); -} - -void OverviewGroupContainerView::OnFocusableViewBlurred() { - UpdateFocusState(/*focus=*/false); -} - -void OverviewGroupContainerView::UpdateFocusState(bool focus) { - if (is_focused_ == focus) { - return; - } - - is_focused_ = focus; - views::FocusRing::Get(this)->SchedulePaint(); -} - bool OverviewGroupContainerView::OnMousePressed(const ui::MouseEvent& event) { overview_group_item_->HandleMouseEvent(event); return true;
diff --git a/ash/wm/overview/overview_group_container_view.h b/ash/wm/overview/overview_group_container_view.h index 0d2cef3..c1d93b2 100644 --- a/ash/wm/overview/overview_group_container_view.h +++ b/ash/wm/overview/overview_group_container_view.h
@@ -5,7 +5,6 @@ #ifndef ASH_WM_OVERVIEW_OVERVIEW_GROUP_CONTAINER_VIEW_H_ #define ASH_WM_OVERVIEW_OVERVIEW_GROUP_CONTAINER_VIEW_H_ -#include "ash/wm/overview/overview_focusable_view.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" @@ -14,10 +13,9 @@ class OverviewGroupItem; // A view that contains individual overview item widgets that constitute the -// group item view. This class also implements `OverviewFocusableView` so -// that this will be focused in overview. -class OverviewGroupContainerView : public views::View, - public OverviewFocusableView { +// group item view. This class will be handling events to be passed on to +// `OverviewGroupItem`. +class OverviewGroupContainerView : public views::View { public: METADATA_HEADER(OverviewGroupContainerView); @@ -27,16 +25,6 @@ delete; ~OverviewGroupContainerView() override; - // OverviewFocusableView: - views::View* GetView() override; - void MaybeActivateFocusedView() override; - void MaybeCloseFocusedView(bool primary_action) override; - void MaybeSwapFocusedView(bool right) override; - bool MaybeActivateFocusedViewOnOverviewExit( - OverviewSession* overview_session) override; - void OnFocusableViewFocused() override; - void OnFocusableViewBlurred() override; - protected: // views::View: bool OnMousePressed(const ui::MouseEvent& event) override; @@ -45,12 +33,7 @@ void OnGestureEvent(ui::GestureEvent* event) override; private: - // Shows or hides the focus ring on `this`. - void UpdateFocusState(bool focus); - const raw_ptr<OverviewGroupItem> overview_group_item_; - - bool is_focused_ = false; }; } // namespace ash
diff --git a/ash/wm/overview/overview_group_item.cc b/ash/wm/overview/overview_group_item.cc index fe628b0..df953e5 100644 --- a/ash/wm/overview/overview_group_item.cc +++ b/ash/wm/overview/overview_group_item.cc
@@ -4,8 +4,11 @@ #include "ash/wm/overview/overview_group_item.h" +#include "ash/display/screen_orientation_controller.h" +#include "ash/shell.h" #include "ash/wm/desks/desks_util.h" #include "ash/wm/overview/overview_constants.h" +#include "ash/wm/overview/overview_focusable_view.h" #include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_group_container_view.h" #include "ash/wm/overview/overview_item.h" @@ -34,6 +37,38 @@ constexpr gfx::InsetsF kRightItemBoundsInsets = gfx::InsetsF::TLBR(/*top=*/0, /*left=*/1, /*bottom=*/0, /*right=*/0); +float CalculateSnapRatioForPrimarySnappedWindow( + const aura::Window* primary_window, + const aura::Window* secondary_window) { + const auto primary_window_bounds_in_screen = + primary_window->GetBoundsInScreen(); + const auto secondary_window_bounds_in_screen = + secondary_window->GetBoundsInScreen(); + // TODO(http://b/309539997): Calculate differently for portrait screen + // orientation. + return static_cast<float>(primary_window_bounds_in_screen.width()) / + (primary_window_bounds_in_screen.width() + + secondary_window_bounds_in_screen.width()); +} + +// TODO(http://b/309539997): Calculate differently for portrait screen +// orientation. +gfx::RectF CalculateScreenBoundsForWindow(const gfx::RectF& union_bounds, + const float primary_snap_ratio, + const bool is_primary) { + const float snap_ratio = + is_primary ? primary_snap_ratio : (1 - primary_snap_ratio); + const gfx::PointF origin = + is_primary ? union_bounds.origin() + : gfx::PointF(union_bounds.origin().x() + + union_bounds.width() * primary_snap_ratio, + union_bounds.origin().y()); + gfx::RectF bounds(origin, gfx::SizeF(union_bounds.width() * snap_ratio, + union_bounds.height())); + bounds.Inset(is_primary ? kLeftItemBoundsInsets : kRightItemBoundsInsets); + return bounds; +} + } // namespace OverviewGroupItem::OverviewGroupItem(const Windows& windows, @@ -136,19 +171,22 @@ CHECK_EQ(size, 2); item_widget_->SetBounds(gfx::ToRoundedRect(target_bounds)); - // TODO(michelefan): Set bounds differently based on the screen orientation. - // TODO(michelefan): Calculate the actual snap ratio based on the window - // bounds and apply it on the individual items hosted by `this`. - auto sub_bounds1 = gfx::RectF( - target_bounds.origin(), - gfx::SizeF(target_bounds.width() / 2.f, target_bounds.height())); - sub_bounds1.Inset(kLeftItemBoundsInsets); - overview_items_[0]->SetBounds(sub_bounds1, animation_type); - auto sub_bounds2 = gfx::RectF( - gfx::PointF(target_bounds.top_center()), - gfx::SizeF(target_bounds.width() / 2.f, target_bounds.height())); + // TODO(http://b/309539997): Set bounds differently based on the screen + // orientation. + const float primary_window_snap_ratio = + CalculateSnapRatioForPrimarySnappedWindow( + overview_items_[0]->GetWindow(), overview_items_[1]->GetWindow()); + + gfx::RectF sub_bounds1 = + CalculateScreenBoundsForWindow(target_bounds, primary_window_snap_ratio, + /*is_primary=*/true); + sub_bounds1.Inset(kLeftItemBoundsInsets); + gfx::RectF sub_bounds2 = + CalculateScreenBoundsForWindow(target_bounds, primary_window_snap_ratio, + /*is_primary=*/false); sub_bounds2.Inset(kRightItemBoundsInsets); + overview_items_[0]->SetBounds(sub_bounds1, animation_type); overview_items_[1]->SetBounds(sub_bounds2, animation_type); } @@ -194,8 +232,15 @@ void OverviewGroupItem::EnsureVisible() {} -OverviewFocusableView* OverviewGroupItem::GetFocusableView() const { - return overview_group_container_view_; +std::vector<OverviewFocusableView*> OverviewGroupItem::GetFocusableViews() + const { + std::vector<OverviewFocusableView*> focusable_views; + for (const auto& overview_item : overview_items_) { + if (auto* overview_item_view = overview_item->overview_item_view()) { + focusable_views.push_back(overview_item_view); + } + } + return focusable_views; } views::View* OverviewGroupItem::GetBackDropView() const { @@ -301,7 +346,7 @@ void OverviewGroupItem::UpdateWindowDimensionsType() {} gfx::Point OverviewGroupItem::GetMagnifierFocusPointInScreen() const { - return overview_group_container_view_->GetMagnifierFocusPointInScreen(); + return overview_group_container_view_->GetBoundsInScreen().CenterPoint(); } const gfx::RoundedCornersF OverviewGroupItem::GetRoundedCorners() const {
diff --git a/ash/wm/overview/overview_group_item.h b/ash/wm/overview/overview_group_item.h index df348157..e85f14604 100644 --- a/ash/wm/overview/overview_group_item.h +++ b/ash/wm/overview/overview_group_item.h
@@ -55,7 +55,7 @@ float GetItemScale(int height) override; void ScaleUpSelectedItem(OverviewAnimationType animation_type) override; void EnsureVisible() override; - OverviewFocusableView* GetFocusableView() const override; + std::vector<OverviewFocusableView*> GetFocusableViews() const override; views::View* GetBackDropView() const override; void UpdateRoundedCornersAndShadow() override; void SetOpacity(float opacity) override; @@ -94,6 +94,7 @@ void CreateItemWidget() override; private: + FRIEND_TEST_ALL_PREFIXES(SnapGroupTest, ReflectSnapRatioInOverviewGroupItem); // A list of `OverviewItem`s hosted and owned by `this`. std::vector<std::unique_ptr<OverviewItem>> overview_items_;
diff --git a/ash/wm/overview/overview_item.cc b/ash/wm/overview/overview_item.cc index 5a026aae..0d5f7f65a 100644 --- a/ash/wm/overview/overview_item.cc +++ b/ash/wm/overview/overview_item.cc
@@ -541,8 +541,14 @@ transform_window_.EnsureVisible(); } -OverviewFocusableView* OverviewItem::GetFocusableView() const { - return overview_item_view_; +std::vector<OverviewFocusableView*> OverviewItem::GetFocusableViews() const { + // `overview_item_view_` might be set to nullptr in `RestoreWindow()` or + // `ShutDown()`. + if (!overview_item_view_) { + return {}; + } + + return {overview_item_view_}; } views::View* OverviewItem::GetBackDropView() const {
diff --git a/ash/wm/overview/overview_item.h b/ash/wm/overview/overview_item.h index 0eecc5a..81976f4 100644 --- a/ash/wm/overview/overview_item.h +++ b/ash/wm/overview/overview_item.h
@@ -95,7 +95,7 @@ gfx::RectF GetWindowsUnionScreenBounds() const override; gfx::RectF GetTargetBoundsWithInsets() const override; gfx::RectF GetTransformedBounds() const override; - OverviewFocusableView* GetFocusableView() const override; + std::vector<OverviewFocusableView*> GetFocusableViews() const override; views::View* GetBackDropView() const override; void UpdateRoundedCornersAndShadow() override; void SetOpacity(float opacity) override;
diff --git a/ash/wm/overview/overview_item_base.h b/ash/wm/overview/overview_item_base.h index c0d76aa..8637319 100644 --- a/ash/wm/overview/overview_item_base.h +++ b/ash/wm/overview/overview_item_base.h
@@ -29,7 +29,6 @@ namespace views { class View; -class Widget; } // namespace views namespace ash { @@ -77,7 +76,7 @@ void HandleGestureEvent(ui::GestureEvent* event); // If in tablet mode, maybe forward events to `OverviewGridEventHandler` as we - // might want to process scroll events on the item. + // might want to process scroll events on `this`. void HandleGestureEventForTabletModeLayout(ui::GestureEvent* event); void set_should_animate_when_entering(bool should_animate) { @@ -197,16 +196,16 @@ // Ensures that a possibly minimized window becomes visible after restore. virtual void EnsureVisible() = 0; - // Returns the focusable view of this. - virtual OverviewFocusableView* GetFocusableView() const = 0; + // Returns the focusable views contained in `this`. + virtual std::vector<OverviewFocusableView*> GetFocusableViews() const = 0; - // Returns the backdrop view of this. + // Returns the backdrop view of `this`. virtual views::View* GetBackDropView() const = 0; - // Updates the rounded corners and shadow on this. + // Updates the rounded corners and shadow on `this`. virtual void UpdateRoundedCornersAndShadow() = 0; - // Changes the opacity of all the window(s) the item owns. + // Updates the opacity of all the window(s) owned by `this`. virtual void SetOpacity(float opacity) = 0; virtual float GetOpacity() const = 0; @@ -277,8 +276,8 @@ // remove window(s) from `ScopedOverviewHideWindows`. virtual void Shutdown() = 0; - // Slides the item up or down and then closes the associated window(s). Used - // by overview swipe to close. + // Slides `this` up or down and then closes the associated window(s). Used in + // overview swipe to close. virtual void AnimateAndCloseItem(bool up) = 0; // Stops the current animation of `item_widget_`.
diff --git a/ash/wm/overview/overview_item_view.cc b/ash/wm/overview/overview_item_view.cc index d14bc52b..e515bea 100644 --- a/ash/wm/overview/overview_item_view.cc +++ b/ash/wm/overview/overview_item_view.cc
@@ -195,6 +195,10 @@ return this; } +OverviewItemBase* OverviewItemView::GetOverviewItem() { + return overview_item_; +} + void OverviewItemView::MaybeActivateFocusedView() { if (overview_item_) overview_item_->OnFocusedViewActivated();
diff --git a/ash/wm/overview/overview_item_view.h b/ash/wm/overview/overview_item_view.h index 49900d1..9ad1438 100644 --- a/ash/wm/overview/overview_item_view.h +++ b/ash/wm/overview/overview_item_view.h
@@ -65,6 +65,7 @@ // OverviewFocusableView: views::View* GetView() override; + OverviewItemBase* GetOverviewItem() override; void MaybeActivateFocusedView() override; void MaybeCloseFocusedView(bool primary_action) override; void MaybeSwapFocusedView(bool right) override;
diff --git a/ash/wm/snap_group/snap_group_unittest.cc b/ash/wm/snap_group/snap_group_unittest.cc index 6791756..f46b185 100644 --- a/ash/wm/snap_group/snap_group_unittest.cc +++ b/ash/wm/snap_group/snap_group_unittest.cc
@@ -15,6 +15,7 @@ #include "ash/screen_util.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" +#include "ash/test/ash_test_util.h" #include "ash/wm/desks/desks_test_util.h" #include "ash/wm/desks/desks_util.h" #include "ash/wm/desks/legacy_desk_bar_view.h" @@ -23,6 +24,7 @@ #include "ash/wm/overview/overview_drop_target.h" #include "ash/wm/overview/overview_focus_cycler.h" #include "ash/wm/overview/overview_grid.h" +#include "ash/wm/overview/overview_group_item.h" #include "ash/wm/overview/overview_item.h" #include "ash/wm/overview/overview_item_view.h" #include "ash/wm/overview/overview_session.h" @@ -884,7 +886,6 @@ // Snap `window1` to trigger the overview session shown on the other side of // the screen. - UpdateDisplay("800x600"); SnapOneTestWindow( window1, /*state_type=*/chromeos::WindowStateType::kPrimarySnapped); @@ -1629,9 +1630,54 @@ overview_session->GetOverviewItemForWindow(w2.get())); } +// Tests that the size of the `OverviewItem`s hosted by the `OverviewGroupItem` +// will correspond to the actual window layout. +TEST_F(SnapGroupTest, ReflectSnapRatioInOverviewGroupItem) { + std::unique_ptr<aura::Window> w1(CreateAppWindow()); + std::unique_ptr<aura::Window> w2(CreateAppWindow()); + SnapTwoTestWindows(w1.get(), w2.get()); + ASSERT_TRUE(split_view_divider()); + const gfx::Point hover_location = + split_view_divider_bounds_in_screen().CenterPoint(); + split_view_divider()->StartResizeWithDivider(hover_location); + const gfx::Vector2d drag_delta(-work_area_bounds().width() / 6, 0); + const auto end_point = hover_location + drag_delta; + split_view_divider()->ResizeWithDivider(end_point); + split_view_divider()->EndResizeWithDivider(end_point); + EXPECT_TRUE(split_view_controller()->InSplitViewMode()); + EXPECT_NEAR(0.33f, WindowState::Get(w1.get())->snap_ratio().value(), + /*abs_error=*/0.01); + EXPECT_NEAR(0.67f, WindowState::Get(w2.get())->snap_ratio().value(), + /*abs_error=*/0.01); + + OverviewController* overview_controller = OverviewController::Get(); + overview_controller->StartOverview(OverviewStartAction::kTests); + OverviewSession* overview_session = overview_controller->overview_session(); + ASSERT_TRUE(overview_session); + + OverviewGroupItem* overview_group_item = + static_cast<OverviewGroupItem*>(GetOverviewItemForWindow(w1.get())); + ASSERT_TRUE(overview_group_item); + + const auto& overview_items = overview_group_item->overview_items_; + ASSERT_EQ(overview_items.size(), 2u); + + // Since `w1` is roughly half the width of `w2`, verify that `item1_bounds` is + // also half the width of `item2_bounds`. + const gfx::Rect item1_bounds = + overview_items[0]->item_widget()->GetWindowBoundsInScreen(); + const gfx::Rect item2_bounds = + overview_items[1]->item_widget()->GetWindowBoundsInScreen(); + const float size_ratio = + static_cast<float>(item1_bounds.width()) / item2_bounds.width(); + EXPECT_NEAR(size_ratio, 0.5, /*abs_error=*/0.01); +} + // Tests that the overview group item will be closed when focused in overview // with `Ctrl + W`. -TEST_F(SnapGroupTest, CtrlPlusWToCloseFocusedGroupInOverview) { +// TODO(michelefan@): Re-purpose this test. Currently disabled due to product +// decision change. +TEST_F(SnapGroupTest, DISABLED_CtrlPlusWToCloseFocusedGroupInOverview) { // Explicitly enable immediate close so that we can directly close the // window(s) without waiting the delayed task to be completed in // `ScopedOverviewTransformWindow::Close()`. @@ -1654,7 +1700,7 @@ // avoid double deletion. w0.release(); w1.release(); - SendKey(ui::VKEY_W, ui::EF_CONTROL_DOWN); + SendKey(ui::VKEY_TAB, GetEventGenerator(), ui::EF_CONTROL_DOWN); // Verify that both windows in the snap group will be deleted. EXPECT_FALSE(w0.get()); @@ -1843,14 +1889,14 @@ // Overview items to be cycled: // [window0, window1], window2 SendKeyUntilOverviewItemIsFocused(ui::VKEY_TAB); - SendKey(ui::VKEY_TAB); - SendKey(ui::VKEY_RETURN); + auto* event_generator = GetEventGenerator(); + SendKey(ui::VKEY_TAB, event_generator, ui::EF_NONE, /*count=*/2); + SendKey(ui::VKEY_RETURN, event_generator); EXPECT_FALSE(overview_controller->InOverviewSession()); MruWindowTracker* mru_window_tracker = Shell::Get()->mru_window_tracker(); - EXPECT_EQ( - window_util::GetTopMostWindow( - mru_window_tracker->BuildMruWindowList(DesksMruType::kActiveDesk)), - window2.get()); + aura::Window* top_most_window = window_util::GetTopMostWindow( + mru_window_tracker->BuildMruWindowList(DesksMruType::kActiveDesk)); + EXPECT_EQ(top_most_window, window2.get()); overview_controller->StartOverview(OverviewStartAction::kTests, OverviewEnterExitType::kImmediateEnter); @@ -1859,13 +1905,12 @@ // Overview items to be cycled: // window2, [window0, window1] SendKeyUntilOverviewItemIsFocused(ui::VKEY_TAB); - SendKey(ui::VKEY_TAB); - SendKey(ui::VKEY_RETURN); + SendKey(ui::VKEY_TAB, event_generator, ui::EF_NONE, /*count=*/2); + SendKey(ui::VKEY_RETURN, event_generator); EXPECT_FALSE(overview_controller->InOverviewSession()); - EXPECT_EQ( - window_util::GetTopMostWindow( - mru_window_tracker->BuildMruWindowList(DesksMruType::kActiveDesk)), - window1.get()); + top_most_window = window_util::GetTopMostWindow( + mru_window_tracker->BuildMruWindowList(DesksMruType::kActiveDesk)); + EXPECT_EQ(top_most_window, window1.get()); } // Tests the basic functionality of activating a group item in overview with @@ -2492,7 +2537,7 @@ gfx::RoundedCornersF(kWindowMiniViewCornerRadius)); } - // Destroy `window0` which belongs to a snap group. + // Destroy `window0` which belongs to a snap group while cycling. window0.reset(); auto& new_cycle_item_views = cycle_view->cycle_views_for_testing(); EXPECT_EQ(new_cycle_item_views.size(), 2u); @@ -2508,7 +2553,9 @@ // Tests that the window cycle view will not show with only one snap group // available which is the same behavior pattern as free-form window cycling. -TEST_F(SnapGroupTest, NoWindowCycleViewWithOneSnapGroup) { +// TODO(michelefan): Remove or re-purpose this test after confirming with the +// team since it may not be applicable with the latest product decision. +TEST_F(SnapGroupTest, DISABLED_NoWindowCycleViewWithOneSnapGroup) { std::unique_ptr<aura::Window> window0 = CreateAppWindow(gfx::Rect(100, 200)); std::unique_ptr<aura::Window> window1 = CreateAppWindow(gfx::Rect(200, 300)); SnapTwoTestWindows(window0.get(), window1.get());
diff --git a/ash/wm/splitview/split_view_divider_handler_view.cc b/ash/wm/splitview/split_view_divider_handler_view.cc index ff0a15d2..a33e3406 100644 --- a/ash/wm/splitview/split_view_divider_handler_view.cc +++ b/ash/wm/splitview/split_view_divider_handler_view.cc
@@ -5,7 +5,6 @@ #include "ash/wm/splitview/split_view_divider_handler_view.h" #include "ash/display/screen_orientation_controller.h" -#include "ash/shell.h" #include "ash/style/ash_color_id.h" #include "ash/wm/splitview/split_view_constants.h" #include "ash/wm/splitview/split_view_utils.h"
diff --git a/ash/wm/window_cycle/window_cycle_item_view.cc b/ash/wm/window_cycle/window_cycle_item_view.cc index 046059e7..07da4db 100644 --- a/ash/wm/window_cycle/window_cycle_item_view.cc +++ b/ash/wm/window_cycle/window_cycle_item_view.cc
@@ -12,6 +12,7 @@ #include "ash/wm/window_cycle/window_cycle_controller.h" #include "ash/wm/window_mini_view_header_view.h" #include "ash/wm/window_preview_view.h" +#include "base/containers/cxx20_erase_vector.h" #include "ui/accessibility/ax_action_data.h" #include "ui/aura/window.h" #include "ui/base/metadata/metadata_impl_macros.h" @@ -34,13 +35,14 @@ // The border padding value of the container view. constexpr auto kInsideContainerBorderInset = gfx::Insets(2); -// Spacing between the child `WindowCycleItemView`s of the container view. +// Spacing between the `WindowCycleItemView`s hosted by the container view. constexpr int kBetweenCycleItemsSpacing = 2; } // namespace WindowCycleItemView::WindowCycleItemView(aura::Window* window) - : WindowMiniView(window) { + : WindowMiniView(window), + window_cycle_controller_(Shell::Get()->window_cycle_controller()) { SetFocusBehavior(FocusBehavior::ALWAYS); SetNotifyEnterExitOnChild(true); @@ -51,12 +53,12 @@ } void WindowCycleItemView::OnMouseEntered(const ui::MouseEvent& event) { - Shell::Get()->window_cycle_controller()->SetFocusedWindow(source_window()); + window_cycle_controller_->SetFocusedWindow(source_window()); } bool WindowCycleItemView::OnMousePressed(const ui::MouseEvent& event) { - Shell::Get()->window_cycle_controller()->SetFocusedWindow(source_window()); - Shell::Get()->window_cycle_controller()->CompleteCycling(); + window_cycle_controller_->SetFocusedWindow(source_window()); + window_cycle_controller_->CompleteCycling(); return true; } @@ -131,8 +133,8 @@ // event, then with a mouse release event), override the base impl from // triggering that behavior which leads to a UAF. if (action_data.action == ax::mojom::Action::kDoDefault) { - Shell::Get()->window_cycle_controller()->SetFocusedWindow(source_window()); - Shell::Get()->window_cycle_controller()->CompleteCycling(); + window_cycle_controller_->SetFocusedWindow(source_window()); + window_cycle_controller_->CompleteCycling(); return true; } @@ -149,10 +151,10 @@ END_METADATA GroupContainerCycleView::GroupContainerCycleView(SnapGroup* snap_group) { - mini_view1_ = AddChildView( - std::make_unique<WindowCycleItemView>(snap_group->window1())); - mini_view2_ = AddChildView( - std::make_unique<WindowCycleItemView>(snap_group->window2())); + mini_views_.push_back(AddChildView( + std::make_unique<WindowCycleItemView>(snap_group->window1()))); + mini_views_.push_back(AddChildView( + std::make_unique<WindowCycleItemView>(snap_group->window2()))); SetShowPreview(/*show=*/true); RefreshItemVisuals(); @@ -160,7 +162,7 @@ SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); - // TODO(michelefan@): Orientation should correspond to the window layout. + // TODO(michelefan): Window layout should correspond to screen orientation. views::BoxLayout* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal, @@ -172,16 +174,15 @@ GroupContainerCycleView::~GroupContainerCycleView() = default; bool GroupContainerCycleView::Contains(aura::Window* window) const { - return (mini_view1_ && mini_view1_->Contains(window)) || - (mini_view2_ && mini_view2_->Contains(window)); + return base::ranges::any_of(mini_views_, + [window](const WindowCycleItemView* mini_view) { + return mini_view->Contains(window); + }); } aura::Window* GroupContainerCycleView::GetWindowAtPoint( const gfx::Point& screen_point) const { - for (auto mini_view : {mini_view1_, mini_view2_}) { - if (!mini_view) { - continue; - } + for (auto* mini_view : mini_views_) { if (auto* window = mini_view->GetWindowAtPoint(screen_point)) { return window; } @@ -190,55 +191,44 @@ } void GroupContainerCycleView::SetShowPreview(bool show) { - for (auto mini_view : {mini_view1_, mini_view2_}) { - if (mini_view) { - mini_view->SetShowPreview(show); - } + for (auto* mini_view : mini_views_) { + mini_view->SetShowPreview(show); } } void GroupContainerCycleView::RefreshItemVisuals() { - if (mini_view1_ && mini_view2_) { - mini_view1_->SetRoundedCornersRadius(gfx::RoundedCornersF( + if (mini_views_.size() == 2u) { + mini_views_[0]->SetRoundedCornersRadius(gfx::RoundedCornersF( /*upper_left=*/WindowMiniView::kWindowMiniViewCornerRadius, /*upper_right=*/0, /*lower_right=*/0, /*lower_left=*/WindowMiniView::kWindowMiniViewCornerRadius)); - mini_view2_->SetRoundedCornersRadius(gfx::RoundedCornersF( + mini_views_[1]->SetRoundedCornersRadius(gfx::RoundedCornersF( /*upper_left=*/0, /*upper_right=*/WindowMiniView::kWindowMiniViewCornerRadius, /*lower_right=*/WindowMiniView::kWindowMiniViewCornerRadius, /*lower_left=*/0)); } - for (auto mini_view : {mini_view1_, mini_view2_}) { - if (mini_view) { - mini_view->RefreshItemVisuals(); - } + for (auto* mini_view : mini_views_) { + mini_view->RefreshItemVisuals(); } } int GroupContainerCycleView::TryRemovingChildItem( aura::Window* destroying_window) { - std::vector<raw_ptr<WindowCycleItemView>*> mini_views_ptrs = {&mini_view1_, - &mini_view2_}; - for (auto* mini_view_ptr : mini_views_ptrs) { - if (auto& mini_view = *mini_view_ptr; mini_view) { - // Explicitly reset the current visuals. - mini_view->ResetRoundedCorners(); - if (mini_view->Contains(destroying_window)) { - auto* temp = mini_view.get(); - // Explicitly reset the `mini_view` to avoid dangling pointer detection. - mini_view = nullptr; - RemoveChildViewT(temp); - } + for (auto* mini_view : mini_views_) { + // Explicitly reset the current visuals so that the default rounded corners + // i.e. rounded corners on four corners will be applied on the remaining + // item. + mini_view->ResetRoundedCorners(); + if (mini_view->Contains(destroying_window)) { + base::Erase(mini_views_, mini_view); + RemoveChildViewT(mini_view); } } RefreshItemVisuals(); - - return base::ranges::count_if( - mini_views_ptrs, - [](raw_ptr<WindowCycleItemView>* ptr) { return *ptr != nullptr; }); + return mini_views_.size(); } void GroupContainerCycleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { @@ -250,31 +240,32 @@ } gfx::RoundedCornersF GroupContainerCycleView::GetRoundedCorners() const { - if (!mini_view1_ && !mini_view2_) { + if (mini_views_.empty()) { return gfx::RoundedCornersF(); } - // In normal use cases, the left corners (`upper_left` and `lower_left`) will - // depend on the primary snapped window, and likewise for the right corners. - // However, if one window gets destructed leaving only one mini view hosted by - // this. All the rounded corners have to be from the remaining mini view. - // TODO(b/294294344): for vertical split view, the upper corners will depend - // on the primary snapped window and likewise for the lower corners. - const float upper_left = mini_view1_ - ? mini_view1_->GetRoundedCorners().upper_left() - : mini_view2_->GetRoundedCorners().upper_left(); - const float upper_right = - mini_view2_ ? mini_view2_->GetRoundedCorners().upper_right() - : mini_view1_->GetRoundedCorners().upper_right(); - const float lower_right = mini_view2_ - ? mini_view2_->GetRoundedCorners().lower_right() - : mini_view1_->GetRoundedCorners().lower_left(); - const float lower_left = mini_view1_ - ? mini_view1_->GetRoundedCorners().lower_left() - : mini_view2_->GetRoundedCorners().lower_right(); + if (mini_views_.size() == 1u) { + return mini_views_[0]->GetRoundedCorners(); + } + + CHECK_EQ(mini_views_.size(), 2u); + // The left corners (`upper_left` and `lower_left`) will depend on the primary + // snapped window, and likewise for the right corners. + // TODO(http://b/294294344): for vertical split view, the upper corners will + // depend on the primary snapped window and likewise for the lower corners. + const float upper_left = mini_views_[0]->GetRoundedCorners().upper_left(); + const float upper_right = mini_views_[1]->GetRoundedCorners().upper_right(); + const float lower_right = mini_views_[1]->GetRoundedCorners().lower_right(); + const float lower_left = mini_views_[0]->GetRoundedCorners().lower_left(); return gfx::RoundedCornersF(upper_left, upper_right, lower_right, lower_left); } +void GroupContainerCycleView::UpdateFocusState(bool focus) { + for (auto* mini_view : mini_views_) { + mini_view->UpdateFocusState(focus); + } +} + BEGIN_METADATA(GroupContainerCycleView, WindowMiniViewBase) END_METADATA
diff --git a/ash/wm/window_cycle/window_cycle_item_view.h b/ash/wm/window_cycle/window_cycle_item_view.h index db0bd7d0..166546e 100644 --- a/ash/wm/window_cycle/window_cycle_item_view.h +++ b/ash/wm/window_cycle/window_cycle_item_view.h
@@ -9,7 +9,6 @@ #include "ash/wm/window_mini_view.h" #include "base/memory/raw_ptr.h" #include "ui/base/metadata/metadata_header_macros.h" -#include "ui/events/event.h" namespace aura { class Window; @@ -19,9 +18,14 @@ class Size; } // namespace gfx +namespace ui { +class MouseEvent; +} // namespace ui + namespace ash { class SnapGroup; +class WindowCycleController; // This view represents a single aura::Window by displaying a title and a // thumbnail of the window's contents. @@ -48,6 +52,9 @@ // WindowMiniViewBase: void RefreshItemVisuals() override; + + private: + const raw_ptr<WindowCycleController> window_cycle_controller_; }; // Container view used to host multiple `WindowCycleItemView`s and be the focus @@ -61,6 +68,10 @@ GroupContainerCycleView& operator=(const GroupContainerCycleView&) = delete; ~GroupContainerCycleView() override; + const std::vector<WindowCycleItemView*>& mini_views() const { + return mini_views_; + } + // WindowMiniViewBase: bool Contains(aura::Window* window) const override; aura::Window* GetWindowAtPoint(const gfx::Point& screen_point) const override; @@ -68,15 +79,13 @@ void RefreshItemVisuals() override; int TryRemovingChildItem(aura::Window* destroying_window) override; gfx::RoundedCornersF GetRoundedCorners() const override; + void UpdateFocusState(bool focus) override; // views::View: void GetAccessibleNodeData(ui::AXNodeData* node_data) override; private: - // TODO(b/297070130): Use vector store the child `WindowCycleItemView` hosted - // by this. - raw_ptr<WindowCycleItemView> mini_view1_; - raw_ptr<WindowCycleItemView> mini_view2_; + std::vector<WindowCycleItemView*> mini_views_; }; } // namespace ash
diff --git a/ash/wm/window_mini_view.cc b/ash/wm/window_mini_view.cc index c544ec6..8eb74cb 100644 --- a/ash/wm/window_mini_view.cc +++ b/ash/wm/window_mini_view.cc
@@ -82,15 +82,6 @@ WindowMiniViewBase::~WindowMiniViewBase() = default; -void WindowMiniViewBase::UpdateFocusState(bool focus) { - if (is_focused_ == focus) { - return; - } - - is_focused_ = focus; - views::FocusRing::Get(this)->SchedulePaint(); -} - void WindowMiniViewBase::SetRoundedCornersRadius( const gfx::RoundedCornersF& exposed_rounded_corners) { header_view_rounded_corners_ = @@ -104,34 +95,22 @@ exposed_rounded_corners.lower_left()); } -WindowMiniViewBase::WindowMiniViewBase() { - InstallFocusRing(); -} - -void WindowMiniViewBase::InstallFocusRing() { - // In order to show the focus ring out of the content view, `border_inset` - // needs to be counted when setting the insets for the focus ring. - views::InstallRoundRectHighlightPathGenerator( - this, gfx::Insets(kFocusRingHaloInset), - chromeos::features::IsJellyrollEnabled() ? kFocusRingCornerRadius - : kBackdropBorderRoundingDp); - views::FocusRing::Install(this); - views::FocusRing* focus_ring = views::FocusRing::Get(this); - focus_ring->SetOutsetFocusRingDisabled(true); - focus_ring->SetColorId(ui::kColorAshFocusRing); - focus_ring->SetHasFocusPredicate( - base::BindRepeating([](const views::View* view) { - const auto* v = views::AsViewClass<WindowMiniViewBase>(view); - CHECK(v); - return v->is_focused_; - })); -} +WindowMiniViewBase::WindowMiniViewBase() = default; BEGIN_METADATA(WindowMiniViewBase, views::View) END_METADATA WindowMiniView::~WindowMiniView() = default; +void WindowMiniView::UpdateFocusState(bool focus) { + if (is_focused_ == focus) { + return; + } + + is_focused_ = focus; + views::FocusRing::Get(this)->SchedulePaint(); +} + void WindowMiniView::SetBackdropVisibility(bool visible) { if (!backdrop_view_ && !visible) { return; @@ -264,6 +243,7 @@ WindowMiniView::WindowMiniView(aura::Window* source_window) : source_window_(source_window) { + InstallFocusRing(); window_observation_.Observe(source_window); header_view_ = AddChildView(std::make_unique<WindowMiniViewHeaderView>(this)); } @@ -329,6 +309,25 @@ header_view_->UpdateTitleLabel(window); } +void WindowMiniView::InstallFocusRing() { + // In order to show the focus ring on the content view, `border_inset` + // needs to be counted when setting the insets for the focus ring. + views::InstallRoundRectHighlightPathGenerator( + this, gfx::Insets(kFocusRingHaloInset), + chromeos::features::IsJellyrollEnabled() ? kFocusRingCornerRadius + : kBackdropBorderRoundingDp); + views::FocusRing::Install(this); + views::FocusRing* focus_ring = views::FocusRing::Get(this); + focus_ring->SetOutsetFocusRingDisabled(true); + focus_ring->SetColorId(ui::kColorAshFocusRing); + focus_ring->SetHasFocusPredicate( + base::BindRepeating([](const views::View* view) { + const auto* v = views::AsViewClass<WindowMiniView>(view); + CHECK(v); + return v->is_focused_; + })); +} + BEGIN_METADATA(WindowMiniView, WindowMiniViewBase) END_METADATA
diff --git a/ash/wm/window_mini_view.h b/ash/wm/window_mini_view.h index 052e891..dc457dc2 100644 --- a/ash/wm/window_mini_view.h +++ b/ash/wm/window_mini_view.h
@@ -36,9 +36,6 @@ WindowMiniViewBase& operator=(const WindowMiniViewBase&) = delete; ~WindowMiniViewBase() override; - // Shows or hides a focus ring around this. - void UpdateFocusState(bool focus); - // Sets rounded corners on the exposed corners, the inner corners will be // sharp. void SetRoundedCornersRadius( @@ -69,6 +66,9 @@ // Returns the exposed rounded corners. virtual gfx::RoundedCornersF GetRoundedCorners() const = 0; + // Shows or hides a focus ring around this. + virtual void UpdateFocusState(bool focus) = 0; + protected: WindowMiniViewBase(); @@ -76,12 +76,6 @@ // otherwise the default rounded corners will be used. absl::optional<gfx::RoundedCornersF> header_view_rounded_corners_; absl::optional<gfx::RoundedCornersF> preview_view_rounded_corners_; - - private: - void InstallFocusRing(); - - // True if this view is focused when using keyboard navigation. - bool is_focused_ = false; }; // WindowMiniView is a view which contains a header and optionally a mirror of @@ -115,6 +109,7 @@ views::View* backdrop_view() { return backdrop_view_; } WindowPreviewView* preview_view() { return preview_view_; } const WindowPreviewView* preview_view() const { return preview_view_; } + bool is_mini_view_focused() const { return is_focused_; } // Sets the visibility of |backdrop_view_|. Creates it if it is null. void SetBackdropVisibility(bool visible); @@ -135,6 +130,7 @@ void SetShowPreview(bool show) override; int TryRemovingChildItem(aura::Window* destroying_window) override; gfx::RoundedCornersF GetRoundedCorners() const override; + void UpdateFocusState(bool focus) override; protected: explicit WindowMiniView(aura::Window* source_window); @@ -160,6 +156,8 @@ void OnWindowTitleChanged(aura::Window* window) override; private: + void InstallFocusRing(); + // The window this class is meant to be a header for. This class also may // optionally show a mirrored view of this window. raw_ptr<aura::Window, ExperimentalAsh> source_window_; @@ -175,6 +173,9 @@ raw_ptr<WindowPreviewView, DanglingUntriaged | ExperimentalAsh> preview_view_ = nullptr; + // True if `this` is focused when using keyboard navigation. + bool is_focused_ = false; + base::ScopedObservation<aura::Window, aura::WindowObserver> window_observation_{this}; };
diff --git a/base/BUILD.gn b/base/BUILD.gn index fb5aab4..8ebe2079c 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -4139,6 +4139,7 @@ "task/bind_post_task_nocompile.nc", "task/task_traits_nocompile.nc", "thread_annotations_nocompile.nc", + "traits_bag_nocompile.nc", "types/pass_key_nocompile.nc", "types/variant_util_nocompile.nc", "values_nocompile.nc", @@ -4162,7 +4163,6 @@ "metrics/field_trial_params_nocompile.nc", "metrics/histogram_nocompile.nc", "strings/string_piece_nocompile.nc", - "traits_bag_nocompile.nc", ] deps = [
diff --git a/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h b/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h index 57dc1671..889d3c1 100644 --- a/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h +++ b/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h
@@ -63,7 +63,9 @@ kNoHooks = 1 << 1, // Internal. // Quarantine for a while to ensure no UaF from on-stack pointers. kSchedulerLoopQuarantine = 1 << 2, - kMaxValue = kSchedulerLoopQuarantine, + // Zap the object region on `Free()`. + kZap = 1 << 3, + kMaxValue = kZap, }; PA_DEFINE_OPERATORS_FOR_FLAGS(FreeFlags); } // namespace internal
diff --git a/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_unittest.cc b/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_unittest.cc index df74aff..9c1771d3 100644 --- a/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_unittest.cc +++ b/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_unittest.cc
@@ -3647,6 +3647,24 @@ list.SetCapacityInBytesForTesting(original_capacity_in_bytes); } +TEST_P(PartitionAllocTest, ZapOnFree) { + void* ptr = allocator.root()->Alloc(1, type_name); + EXPECT_TRUE(ptr); + memset(ptr, 'A', 1); + allocator.root()->Free<FreeFlags::kZap>(ptr); + EXPECT_NE('A', *static_cast<unsigned char*>(ptr)); + + constexpr size_t size = 1024; + ptr = allocator.root()->Alloc(size, type_name); + EXPECT_TRUE(ptr); + memset(ptr, 'A', size); + allocator.root()->Free<FreeFlags::kZap>(ptr); + EXPECT_NE('A', *static_cast<unsigned char*>(ptr)); + EXPECT_EQ(kFreedByte, + *(static_cast<unsigned char*>(ptr) + 2 * sizeof(void*))); + EXPECT_EQ(kFreedByte, *(static_cast<unsigned char*>(ptr) + size - 1)); +} + TEST_P(PartitionAllocTest, Bug_897585) { // Need sizes big enough to be direct mapped and a delta small enough to // allow re-use of the slot span when cookied. These numbers fall out of the
diff --git a/base/allocator/partition_allocator/src/partition_alloc/partition_root.h b/base/allocator/partition_allocator/src/partition_alloc/partition_root.h index 5bb8016..275dab17 100644 --- a/base/allocator/partition_allocator/src/partition_alloc/partition_root.h +++ b/base/allocator/partition_allocator/src/partition_alloc/partition_root.h
@@ -1375,6 +1375,12 @@ return; } + if constexpr (ContainsFlags(flags, FreeFlags::kZap)) { + SlotSpan* slot_span = SlotSpan::FromObject(object); + uintptr_t slot_start = ObjectToSlotStart(object); + internal::SecureMemset(internal::SlotStartAddr2Ptr(slot_start), + internal::kFreedByte, GetSlotUsableSize(slot_span)); + } // TODO(https://crbug.com/1497380): Collecting objects for // `kSchedulerLoopQuarantine` here means it "delays" other checks (BRP // refcount, cookie, etc.)
diff --git a/base/files/file_util.h b/base/files/file_util.h index 0318528..1d3fe9d1 100644 --- a/base/files/file_util.h +++ b/base/files/file_util.h
@@ -646,6 +646,11 @@ // Returns true if it was able to set it in the close-on-exec mode, otherwise // false. BASE_EXPORT bool SetCloseOnExec(int fd); + +// Removes close-on-exec flag from the given |fd|. +// Returns true if it was able to remove the close-on-exec flag, otherwise +// false. +BASE_EXPORT bool RemoveCloseOnExec(int fd); #endif // BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) #if BUILDFLAG(IS_MAC)
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc index e4983ca..acb98a7e 100644 --- a/base/files/file_util_posix.cc +++ b/base/files/file_util_posix.cc
@@ -468,6 +468,20 @@ return true; } +bool RemoveCloseOnExec(int fd) { + const int flags = fcntl(fd, F_GETFD); + if (flags == -1) { + return false; + } + if ((flags & FD_CLOEXEC) == 0) { + return true; + } + if (fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC) == -1) { + return false; + } + return true; +} + bool PathExists(const FilePath& path) { ScopedBlockingCall scoped_blocking_call(FROM_HERE, BlockingType::MAY_BLOCK); #if BUILDFLAG(IS_ANDROID)
diff --git a/base/memory/README.md b/base/memory/README.md index 8b16557..d156182 100644 --- a/base/memory/README.md +++ b/base/memory/README.md
@@ -64,21 +64,29 @@ null state. There's also overlap with `raw_ptr`, though this was implemented first. -## `base::scoped_refptr<T>` +## `scoped_refptr<T>` Use when you want manually managed strong refcounting. Use carefully! It’s an owning smart pointer, so it owns a pointer to something allocated in the heap and gives shared ownership of the underlying object, since it can be -copied. When all `scoped_refptr`s pointing to the same object are gone, that +copied. When all `scoped_refptr<T>`s pointing to the same object are gone, that object gets destroyed. This is Chrome's answer to `std::shared_ptr<T>`. It additionally requires T to inherit from `RefCounted` or `RefCountedThreadSafe`, since the ref counting -happens in the object itself, unlike `shared_ptr<T>`. It's preferred for an -object to remain on the same thread, as `RefCounted` is much cheaper. If there -are `scoped_refptr`s to the same object on different threads, use -`RefCountedThreadSafe`, since accesses to the reference count can race. -In this case, without external synchronization, the destructor can run on any -thread. If the destructor interacts with other systems it is important to +happens in the object itself, unlike `shared_ptr<T>`. + +It's preferred for an object to remain on the same thread, as `RefCounted` is +much cheaper. If there are `scoped_refptr<T>`s to the same object on different +threads, use `RefCountedThreadSafe`, since accesses to the reference count can +race. In this case, without external synchronization, the destructor of +`scoped_refptr<T>`, which decreases the reference count by one, can run on any +thread. + +Inheriting from `RefCountedThreadSafe` by itself doesn't make a class `T` or the +underlying object of `scoped_refptr<T>` thread-safe: It merely ensures that the +counter manipulated by `scoped_refptr<T>` is thread-safe. + +If the destructor interacts with other systems it is important to control and know which thread has the last reference to the object, or you can end up with flakiness.
diff --git a/base/memory/safety_checks.h b/base/memory/safety_checks.h index ea7cf619..3213d63 100644 --- a/base/memory/safety_checks.h +++ b/base/memory/safety_checks.h
@@ -42,9 +42,9 @@ // Requires PA-E. kSchedulerLoopQuarantine = (1u << 1), - // TODO(crbug.com/1462223): Implement more advanced checks and add flags here. - // kBRPDereferenceAfterFree = (1u << 2), - // kZapOnFree = (1u << 3), etc. + // Enables |FreeFlags::kZap|. + // Requires PA-E. + kZapOnFree = (1u << 2), }; constexpr MemorySafetyCheck operator|(MemorySafetyCheck a, @@ -62,7 +62,7 @@ // Set of checks for ADVANCED_MEMORY_SAFETY_CHECKS() annotated objects. constexpr auto kAdvancedMemorySafetyChecks = MemorySafetyCheck::kForcePartitionAlloc | - MemorySafetyCheck::kSchedulerLoopQuarantine; + MemorySafetyCheck::kSchedulerLoopQuarantine | MemorySafetyCheck::kZapOnFree; // Define type traits to determine type |T|'s memory safety check status. namespace { @@ -84,7 +84,8 @@ #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) return static_cast<bool>(checks & (MemorySafetyCheck::kForcePartitionAlloc | - MemorySafetyCheck::kSchedulerLoopQuarantine)); + MemorySafetyCheck::kSchedulerLoopQuarantine | + MemorySafetyCheck::kZapOnFree)); #else return false; #endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) @@ -102,6 +103,9 @@ if (static_cast<bool>(checks & MemorySafetyCheck::kSchedulerLoopQuarantine)) { flags |= partition_alloc::FreeFlags::kSchedulerLoopQuarantine; } + if (static_cast<bool>(checks & MemorySafetyCheck::kZapOnFree)) { + flags |= partition_alloc::FreeFlags::kZap; + } return flags; }
diff --git a/base/memory/safety_checks_unitttest.cc b/base/memory/safety_checks_unitttest.cc index f0949d5..5eadf80 100644 --- a/base/memory/safety_checks_unitttest.cc +++ b/base/memory/safety_checks_unitttest.cc
@@ -12,17 +12,26 @@ using base::internal::MemorySafetyCheck; // Normal object: should be targeted by no additional |MemorySafetyCheck|. -struct DefaultChecks {}; +struct DefaultChecks { + public: + char data[16]; +}; // Annotated object: should have |base::internal::kAdvancedMemorySafetyChecks|. struct AdvancedChecks { ADVANCED_MEMORY_SAFETY_CHECKS(); + + public: + char data[16]; }; // Annotated and aligned object for testing aligned allocations. constexpr int kLargeAlignment = 2 * __STDCPP_DEFAULT_NEW_ALIGNMENT__; struct alignas(kLargeAlignment) AlignedAdvancedChecks { ADVANCED_MEMORY_SAFETY_CHECKS(); + + public: + char data[16]; }; // The macro may hook memory allocation/deallocation but should forward the @@ -124,6 +133,36 @@ list.SetCapacityInBytesForTesting(original_capacity_in_bytes); } +TEST(MemorySafetyCheckTest, ZapOnFree) { + static_assert( + !is_memory_safety_checked<DefaultChecks, MemorySafetyCheck::kZapOnFree>); + static_assert( + is_memory_safety_checked<AdvancedChecks, MemorySafetyCheck::kZapOnFree>); + + { + // Without kZapOnFree. + auto* ptr = new DefaultChecks(); + EXPECT_NE(ptr, nullptr); + delete ptr; + // *ptr is undefined. + } + + { + // With kZapOnFree. + auto* ptr = new AdvancedChecks(); + EXPECT_NE(ptr, nullptr); + memset(ptr->data, 'A', sizeof(ptr->data)); + delete ptr; + + // Dereferencing `ptr` is still undefiner behavior, but we can say it is + // somewhat defined as this test is gated behind + // `BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)`. + // I believe behavior here is concrete enough to be tested, but it can be + // affected by changes in PA. Please disable this test if it flakes. + EXPECT_NE(ptr->data[0], 'A'); + } +} + #endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) } // namespace
diff --git a/base/process/launch.h b/base/process/launch.h index e18dde6..a6ac8d2b2 100644 --- a/base/process/launch.h +++ b/base/process/launch.h
@@ -213,6 +213,10 @@ // Sets parent process death signal to SIGKILL. bool kill_on_parent_death = false; + + // File descriptors of the parent process with FD_CLOEXEC flag to be removed + // before calling exec*(). + std::vector<int> fds_to_remove_cloexec; #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #if BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_IOS) && BUILDFLAG(USE_BLINK))
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc index b249686..4b93a56 100644 --- a/base/process/launch_posix.cc +++ b/base/process/launch_posix.cc
@@ -366,6 +366,19 @@ // See comments on the ResetFDOwnership() declaration in // base/files/scoped_file.h regarding why this is called early here. subtle::ResetFDOwnership(); + + // The parent process might set FD_CLOEXEC flag on certain file + // descriptors to prevent them leaking into child processes of the + // embedder application. Remove the flag from the file descriptors + // which meant to be inherited by the child process. + // + // Cannot use STL iterators here, since debug iterators use locks. + // NOLINTNEXTLINE(modernize-loop-convert) + for (size_t i = 0; i < options.fds_to_remove_cloexec.size(); ++i) { + if (!RemoveCloseOnExec(options.fds_to_remove_cloexec[i])) { + RAW_LOG(WARNING, "Failed to remove FD_CLOEXEC flag"); + } + } #endif {
diff --git a/base/strings/string_piece.h b/base/strings/string_piece.h index bc1278a6..13bccd9e 100644 --- a/base/strings/string_piece.h +++ b/base/strings/string_piece.h
@@ -18,7 +18,6 @@ using BasicStringPiece = std::basic_string_view<CharT, Traits>; using StringPiece = std::string_view; using StringPiece16 = std::u16string_view; -using WStringPiece = std::wstring_view; } // namespace base
diff --git a/base/task/sequence_manager/lazily_deallocated_deque.h b/base/task/sequence_manager/lazily_deallocated_deque.h index 3dc25742..dce2988 100644 --- a/base/task/sequence_manager/lazily_deallocated_deque.h +++ b/base/task/sequence_manager/lazily_deallocated_deque.h
@@ -246,11 +246,7 @@ while (!empty()) { pop_front(); } - // Stop referencing the memory with the raw_ptr first, before releasing - // memory. This avoids the raw_ptr to be temporarily dangling. - char* memory = reinterpret_cast<char*>(data_.get()); - data_ = nullptr; - delete[] memory; + delete[] reinterpret_cast<char*>(data_.ExtractAsDangling().get()); } bool empty() const { return back_index_ == front_index_; }
diff --git a/base/task/sequence_manager/sequence_manager_impl.cc b/base/task/sequence_manager/sequence_manager_impl.cc index 9434d13..2ec655d 100644 --- a/base/task/sequence_manager/sequence_manager_impl.cc +++ b/base/task/sequence_manager/sequence_manager_impl.cc
@@ -414,11 +414,11 @@ } void SequenceManagerImpl::SetAddQueueTimeToTasks(bool enable) { - base::subtle::NoBarrier_Store(&add_queue_time_to_tasks_, enable ? 1 : 0); + add_queue_time_to_tasks_.store(enable, std::memory_order_relaxed); } bool SequenceManagerImpl::GetAddQueueTimeToTasks() { - return base::subtle::NoBarrier_Load(&add_queue_time_to_tasks_); + return add_queue_time_to_tasks_.load(std::memory_order_relaxed); } void SequenceManagerImpl::SetObserver(Observer* observer) {
diff --git a/base/task/sequence_manager/sequence_manager_impl.h b/base/task/sequence_manager/sequence_manager_impl.h index 8b72740..c0d515c 100644 --- a/base/task/sequence_manager/sequence_manager_impl.h +++ b/base/task/sequence_manager/sequence_manager_impl.h
@@ -5,6 +5,7 @@ #ifndef BASE_TASK_SEQUENCE_MANAGER_SEQUENCE_MANAGER_IMPL_H_ #define BASE_TASK_SEQUENCE_MANAGER_SEQUENCE_MANAGER_IMPL_H_ +#include <atomic> #include <deque> #include <map> #include <memory> @@ -467,7 +468,7 @@ const MetricRecordingSettings metric_recording_settings_; // Whether to add the queue time to tasks. - base::subtle::Atomic32 add_queue_time_to_tasks_; + std::atomic_bool add_queue_time_to_tasks_; AtomicFlagSet empty_queues_to_reload_;
diff --git a/base/traits_bag_nocompile.nc b/base/traits_bag_nocompile.nc index c5fcbfd..9d2d15e 100644 --- a/base/traits_bag_nocompile.nc +++ b/base/traits_bag_nocompile.nc
@@ -37,15 +37,17 @@ const bool boolean_trait; }; -#if defined(NCTEST_TRAITS_BAG_REQUIRED_TRAIT_NOT_SET) // [r"The traits bag is missing a required trait."] -constexpr TestTraits traits = {}; -#elif defined(NCTEST_TRAITS_BAG_INVALID_TRAIT) // [r"no matching constructor for initialization of 'const TestTraits'"] -constexpr TestTraits traits = {RequiredTrait::A, NotAValidTrait{}}; -#elif defined(NCTEST_TASK_TRAITS_MULTIPLE_REQUIRED_TRAIT) // [r"The traits bag contains multiple traits of the same type."] -constexpr TestTraits traits = {RequiredTrait::A, RequiredTrait::B}; -#elif defined(NCTEST_TASK_TRAITS_REDUNDANT_BOOLEAN_TRAIT) // [r"The traits bag contains multiple traits of the same type."] -constexpr TestTraits traits = {RequiredTrait::A, BooleanTrait(), - BooleanTrait()}; -#endif +constexpr TestTraits traits = {}; // expected-error {{constexpr variable 'traits' must be initialized by a constant expression}} + // expected-error@base/traits_bag.h:* {{The traits bag is missing a required trait.}} + // expected-error@*:* {{no matching constructor for initialization of 'base::trait_helpers::RequiredEnumTraitFilter<base::RequiredTrait>'}} + +constexpr TestTraits traits2 = {RequiredTrait::A, NotAValidTrait{}}; // expected-error {{no matching constructor for initialization of 'const TestTraits'}} + // expected-error@*:* {{type occurs more than once in type list}} + +constexpr TestTraits traits3 = {RequiredTrait::A, RequiredTrait::B}; // expected-error {{constexpr variable 'traits3' must be initialized by a constant expression}} + // expected-error@base/traits_bag.h:* {{The traits bag contains multiple traits of the same type.}} + +constexpr TestTraits traits4 = {RequiredTrait::A, BooleanTrait(), // expected-error {{constexpr variable 'traits4' must be initialized by a constant expression}} + BooleanTrait()}; // expected-error@base/traits_bag.h:* {{The traits bag contains multiple traits of the same type.}} } // namespace base
diff --git a/buildtools/linux64/clang-format.sha1 b/buildtools/linux64/clang-format.sha1 index dcf7ce9..3adca706 100644 --- a/buildtools/linux64/clang-format.sha1 +++ b/buildtools/linux64/clang-format.sha1
@@ -1 +1 @@ -31fce369a66eb7d43259d9222e5eb84918495afe \ No newline at end of file +b42097ca924d1f1736a5a7806068fed9d7345eb4 \ No newline at end of file
diff --git a/buildtools/mac/clang-format.arm64.sha1 b/buildtools/mac/clang-format.arm64.sha1 index 4e4e7a0..15102f5 100644 --- a/buildtools/mac/clang-format.arm64.sha1 +++ b/buildtools/mac/clang-format.arm64.sha1
@@ -1 +1 @@ -dc31487ee07f42f5404f44df3eb4a91307304056 \ No newline at end of file +96c34e77259c4cc1fc7bdf067fc058bfd341ab85 \ No newline at end of file
diff --git a/buildtools/mac/clang-format.x64.sha1 b/buildtools/mac/clang-format.x64.sha1 index e1ea917d..7efbcc0 100644 --- a/buildtools/mac/clang-format.x64.sha1 +++ b/buildtools/mac/clang-format.x64.sha1
@@ -1 +1 @@ -22ddf061a89bedc30b2629e1d25810f6eb8bfdee \ No newline at end of file +0b4bd257a1f4cd27d27d6919b0f9e52ecdfa8f1e \ No newline at end of file
diff --git a/buildtools/win/clang-format.exe.sha1 b/buildtools/win/clang-format.exe.sha1 index 661ad273..ee8aea2 100644 --- a/buildtools/win/clang-format.exe.sha1 +++ b/buildtools/win/clang-format.exe.sha1
@@ -1 +1 @@ -24f2473ea60bd09c66da514f3a5c63b185da1464 \ No newline at end of file +49458d4c1e884a38308f8dc6a2c7eb55fc478755 \ No newline at end of file
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 174755ec..afc7759b 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc
@@ -325,6 +325,8 @@ return; } + const bool container_bounds_changed = + scrollable_ && scroll_node->container_bounds != scroll_container_bounds_; scroll_container_bounds_ = scrollable_ ? scroll_node->container_bounds : gfx::Size(); scroll_contents_bounds_ = scrollable_ ? scroll_node->bounds : gfx::Size(); @@ -334,7 +336,13 @@ if (layer_tree_impl()->settings().scrollbar_animator == LayerTreeSettings::AURA_OVERLAY) { - set_needs_show_scrollbars(scrollable_); + if (layer_tree_impl()->settings().enable_fluent_overlay_scrollbar) { + // Show scrollbars when resizing scrollable areas and + // not when the inside content gets expanded. + set_needs_show_scrollbars(scrollable_ && container_bounds_changed); + } else { + set_needs_show_scrollbars(scrollable_); + } } NoteLayerPropertyChanged();
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index 1ca26e3..92e50806 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -43,6 +43,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using ::testing::Bool; + namespace cc { class FakeResourceTrackingUIResourceManager : public UIResourceManager { @@ -102,12 +104,15 @@ class BaseScrollbarLayerTest : public testing::Test { public: explicit BaseScrollbarLayerTest( - LayerTreeSettings::ScrollbarAnimator animator) { + LayerTreeSettings::ScrollbarAnimator animator, + bool enable_fluent_overlay_scrollbar = false) { layer_tree_settings_.single_thread_proxy_scheduler = false; layer_tree_settings_.use_zero_copy = true; layer_tree_settings_.scrollbar_animator = animator; layer_tree_settings_.scrollbar_fade_delay = base::Milliseconds(20); layer_tree_settings_.scrollbar_fade_duration = base::Milliseconds(20); + layer_tree_settings_.enable_fluent_overlay_scrollbar = + enable_fluent_overlay_scrollbar; animation_host_ = AnimationHost::CreateForTesting(ThreadInstance::kMain); @@ -150,10 +155,13 @@ : BaseScrollbarLayerTest(LayerTreeSettings::ANDROID_OVERLAY) {} }; -class AuraScrollbarLayerTest : public BaseScrollbarLayerTest { +class AuraScrollbarLayerTest : public BaseScrollbarLayerTest, + public testing::WithParamInterface<bool> { public: - AuraScrollbarLayerTest() - : BaseScrollbarLayerTest(LayerTreeSettings::AURA_OVERLAY) {} + explicit AuraScrollbarLayerTest( + bool enable_fluent_overlay_scrollbar = GetParam()) + : BaseScrollbarLayerTest(LayerTreeSettings::AURA_OVERLAY, + enable_fluent_overlay_scrollbar) {} }; class FakePaintedOverlayScrollbar : public FakeScrollbar { @@ -809,7 +817,7 @@ EXPECT_EQ(node->opacity, 0.25f); } -TEST_F(AuraScrollbarLayerTest, ScrollbarLayerPushProperties) { +TEST_P(AuraScrollbarLayerTest, ScrollbarLayerPushProperties) { // Pushing changed bounds of scroll layer can lead to calling // OnOpacityAnimated on scrollbar layer which means OnOpacityAnimated should // be independent of scrollbar layer's properties as scrollbar layer can push @@ -852,7 +860,10 @@ const EffectNode* node = host_impl->active_tree()->property_trees()->effect_tree().Node( scrollbar_layer->effect_tree_index()); - EXPECT_EQ(node->opacity, 1.f); + // If Fluent overlay scrollbars are active, changing the bounds scrollable + // content shouldn't make the scrollbars appear. + EXPECT_EQ(node->opacity, + layer_tree_settings_.enable_fluent_overlay_scrollbar ? 0.f : 1.f); } TEST_F(ScrollbarLayerTest, SubPixelCanScrollOrientation) { @@ -985,7 +996,7 @@ impl.host_impl()->active_tree()->UpdateScrollbarGeometries(); } -TEST_F(AuraScrollbarLayerTest, ScrollbarLayerCreateAfterSetScrollable) { +TEST_P(AuraScrollbarLayerTest, ScrollbarLayerCreateAfterSetScrollable) { // Scrollbar Layer can be created after SetScrollable is called and in a // separate commit. Ensure we do not missing the DidRequestShowFromMainThread // call. @@ -1506,4 +1517,6 @@ TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); } +INSTANTIATE_TEST_SUITE_P(All, AuraScrollbarLayerTest, Bool()); + } // namespace cc
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 799d9ca..f87ea7b 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -260,7 +260,7 @@ "//chrome/browser/policy/android:delegate_public_impl_java", "//chrome/browser/readaloud/android:hooks_public_impl_java", "//chrome/browser/supervised_user:parent_auth_delegate_impl_java", - "//chrome/browser/touch_to_fill/password_manager/android/internal:resource_provider_public_impl_java", + "//chrome/browser/touch_to_fill/android/internal:resource_provider_public_impl_java", "//chrome/browser/ui/android/cars:delegate_public_impl_java", "//chrome/browser/ui/android/hats/internal:provider_public_impl_java", "//chrome/browser/xsurface_provider:hooks_public_impl_java", @@ -805,11 +805,11 @@ "//chrome/browser/password_manager/android/add_username_dialog:java", "//chrome/browser/recent_tabs/internal:java", "//chrome/browser/tabmodel/internal:java", - "//chrome/browser/touch_to_fill/autofill/android/internal:java", + "//chrome/browser/touch_to_fill/android/internal:java", "//chrome/browser/touch_to_fill/common/android:java", - "//chrome/browser/touch_to_fill/password_manager/android/internal:java", - "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:java", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:java", + "//chrome/browser/touch_to_fill/no_passkeys/internal/android:java", + "//chrome/browser/touch_to_fill/password_generation/android/internal:java", + "//chrome/browser/touch_to_fill/payments/android/internal:java", "//chrome/browser/ui/android/appmenu/internal:java", "//chrome/browser/ui/android/autofill/internal:java", "//chrome/browser/ui/android/edge_to_edge/internal:java", @@ -1048,10 +1048,10 @@ "//chrome/browser/tabmodel/internal:java", "//chrome/browser/tabpersistence:junit", "//chrome/browser/thumbnail:java", - "//chrome/browser/touch_to_fill/autofill/android/internal:junit", "//chrome/browser/touch_to_fill/common/android:junit", - "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:junit", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:junit", + "//chrome/browser/touch_to_fill/no_passkeys/internal/android:junit", + "//chrome/browser/touch_to_fill/password_generation/android/internal:junit", + "//chrome/browser/touch_to_fill/payments/android/internal:junit", "//chrome/browser/translate/android:junit", "//chrome/browser/ui/android/appmenu:java", "//chrome/browser/ui/android/appmenu/internal:junit", @@ -1673,8 +1673,8 @@ "//chrome/browser/tabpersistence:java", "//chrome/browser/thumbnail:java", "//chrome/browser/thumbnail:javatests", - "//chrome/browser/touch_to_fill/autofill/android/internal:java_resources", - "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:java_resources", + "//chrome/browser/touch_to_fill/no_passkeys/internal/android:java_resources", + "//chrome/browser/touch_to_fill/payments/android/internal:java_resources", "//chrome/browser/translate/android:java", "//chrome/browser/translate/android:javatests", "//chrome/browser/ui/android/appmenu:java", @@ -2870,10 +2870,10 @@ "//chrome/browser/password_manager/android/pwd_migration:javatests", "//chrome/browser/recent_tabs/internal:recent_tabs_javatests", "//chrome/browser/subresource_filter:subresource_filter_javatests", - "//chrome/browser/touch_to_fill/autofill/android/internal:javatests", - "//chrome/browser/touch_to_fill/password_manager/android:test_java", - "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:javatests", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:javatests", + "//chrome/browser/touch_to_fill/android:test_java", + "//chrome/browser/touch_to_fill/no_passkeys/internal/android:javatests", + "//chrome/browser/touch_to_fill/password_generation/android/internal:javatests", + "//chrome/browser/touch_to_fill/payments/android/internal:javatests", "//chrome/browser/ui/android/fast_checkout/internal:javatests", "//chrome/browser/ui/android/omnibox:javatests", "//chrome/browser/ui/android/webid/internal:javatests", @@ -3751,8 +3751,8 @@ "//chrome/browser/search_engines/android:jni_headers", "//chrome/browser/segmentation_platform:jni_headers", "//chrome/browser/tab:jni_headers", - "//chrome/browser/touch_to_fill/autofill/android:jni_headers", - "//chrome/browser/touch_to_fill/password_manager/android:jni_headers", + "//chrome/browser/touch_to_fill/android:jni_headers", + "//chrome/browser/touch_to_fill/payments/android:jni_headers", "//chrome/browser/ui/android/fast_checkout:jni_headers", "//chrome/browser/ui/android/favicon:jni_headers", "//chrome/browser/ui/android/hats:jni_headers",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 5783ed6e..b6a1940 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -129,6 +129,7 @@ "java/src/org/chromium/chrome/browser/autofill/settings/AndroidPaymentAppPreference.java", "java/src/org/chromium/chrome/browser/autofill/settings/AndroidPaymentAppsFragment.java", "java/src/org/chromium/chrome/browser/autofill/settings/AutofillCreditCardEditor.java", + "java/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteCreditCardConfirmationDialog.java", "java/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteSavedCvcsConfirmationDialog.java", "java/src/org/chromium/chrome/browser/autofill/settings/AutofillEditLinkPreference.java", "java/src/org/chromium/chrome/browser/autofill/settings/AutofillLocalCardEditor.java",
diff --git a/chrome/android/chrome_junit_test_java_sources.gni b/chrome/android/chrome_junit_test_java_sources.gni index 92521441..089e071 100644 --- a/chrome/android/chrome_junit_test_java_sources.gni +++ b/chrome/android/chrome_junit_test_java_sources.gni
@@ -45,6 +45,7 @@ "junit/src/org/chromium/chrome/browser/autofill/SaveUpdateAddressProfilePromptTest.java", "junit/src/org/chromium/chrome/browser/autofill/fp/FacilitatedPaymentBottomSheetBridgeTest.java", "junit/src/org/chromium/chrome/browser/autofill/fp/FacilitatedPaymentBottomSheetContentTest.java", + "junit/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteCreditCardConfirmationDialogTest.java", "junit/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteSavedCvcsConfirmationDialogTest.java", "junit/src/org/chromium/chrome/browser/autofill/settings/AutofillVirtualCardEnrollmentDialogTest.java", "junit/src/org/chromium/chrome/browser/autofill/settings/AutofillVirtualCardUnenrollmentDialogTest.java",
diff --git a/chrome/android/features/keyboard_accessory/BUILD.gn b/chrome/android/features/keyboard_accessory/BUILD.gn index 1472813..7e14bc2 100644 --- a/chrome/android/features/keyboard_accessory/BUILD.gn +++ b/chrome/android/features/keyboard_accessory/BUILD.gn
@@ -95,7 +95,7 @@ "//chrome/browser/password_manager/android:test_support_java", "//chrome/browser/profiles/android:java", "//chrome/browser/tab:java", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android:test_support_java", + "//chrome/browser/touch_to_fill/password_generation/android:test_support_java", "//chrome/browser/ui/android/layouts:java", "//chrome/browser/ui/android/layouts/test:java", "//chrome/browser/ui/messages/android:java",
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java index 14e62056..e5d86f2 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceMediator.java
@@ -18,6 +18,7 @@ import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView.LayoutManager; +import org.chromium.base.ApplicationStatus; import org.chromium.base.Callback; import org.chromium.base.MemoryPressureListener; import org.chromium.base.ObserverList; @@ -414,6 +415,9 @@ /** Update the content based on supervised user or enterprise policy. */ void updateContent() { + // See https://crbug.com/1498004. + if (ApplicationStatus.isEveryActivityDestroyed()) return; + mFeedEnabled = FeedFeatures.isFeedEnabled(); if (mFeedEnabled && !mTabToStreamMap.isEmpty()) { return;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillCreditCardEditor.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillCreditCardEditor.java index 94301f6..f3fa7e16 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillCreditCardEditor.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillCreditCardEditor.java
@@ -14,6 +14,9 @@ import android.widget.ArrayAdapter; import android.widget.Spinner; +import androidx.annotation.NonNull; + +import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill.AutofillEditorBase; import org.chromium.chrome.browser.autofill.PersonalDataManager; @@ -21,15 +24,16 @@ import org.chromium.chrome.browser.feedback.FragmentHelpAndFeedbackLauncher; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncher; import org.chromium.components.autofill.AutofillProfile; +import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager; import java.util.List; -/** - * The base class for credit card settings. - */ -abstract class AutofillCreditCardEditor - extends AutofillEditorBase implements FragmentHelpAndFeedbackLauncher { +/** The base class for credit card settings. */ +public abstract class AutofillCreditCardEditor extends AutofillEditorBase + implements FragmentHelpAndFeedbackLauncher { private HelpAndFeedbackLauncher mHelpAndFeedbackLauncher; + private Supplier<ModalDialogManager> mModalDialogManagerSupplier; protected CreditCard mCard; protected Spinner mBillingAddress; @@ -103,8 +107,7 @@ @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_menu_id) { - deleteEntry(); - getActivity().finish(); + showDeleteCreditCardConfirmationDialog(); return true; } if (item.getItemId() == R.id.help_menu_id) { @@ -120,4 +123,32 @@ public void setHelpAndFeedbackLauncher(HelpAndFeedbackLauncher helpAndFeedbackLauncher) { mHelpAndFeedbackLauncher = helpAndFeedbackLauncher; } + + /** + * Sets Supplier for {@lnk ModalDialogManager} used to display {@link + * AutofillDeleteCreditCardConfirmationDialog}. + */ + public void setModalDialogManagerSupplier( + @NonNull Supplier<ModalDialogManager> modalDialogManagerSupplier) { + mModalDialogManagerSupplier = modalDialogManagerSupplier; + } + + private void showDeleteCreditCardConfirmationDialog() { + assert mModalDialogManagerSupplier != null; + + ModalDialogManager modalDialogManager = mModalDialogManagerSupplier.get(); + assert modalDialogManager != null; + + AutofillDeleteCreditCardConfirmationDialog dialog = + new AutofillDeleteCreditCardConfirmationDialog( + modalDialogManager, + getContext(), + dismissalCause -> { + if (dismissalCause == DialogDismissalCause.POSITIVE_BUTTON_CLICKED) { + deleteEntry(); + getActivity().finish(); + } + }); + dialog.show(); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteCreditCardConfirmationDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteCreditCardConfirmationDialog.java new file mode 100644 index 0000000..d243f01 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteCreditCardConfirmationDialog.java
@@ -0,0 +1,58 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.autofill.settings; + +import android.content.Context; + +import org.chromium.base.Callback; +import org.chromium.chrome.R; +import org.chromium.ui.modaldialog.ModalDialogManager; +import org.chromium.ui.modaldialog.ModalDialogProperties; +import org.chromium.ui.modaldialog.SimpleModalDialogController; +import org.chromium.ui.modelutil.PropertyModel; + +/** Dialog shown to user to confirm deleting a saved credit card. */ +public class AutofillDeleteCreditCardConfirmationDialog { + + private final ModalDialogManager mModalDialogManager; + private final Context mContext; + private final Callback<Integer> mResultHandler; + + public AutofillDeleteCreditCardConfirmationDialog( + ModalDialogManager modalDialogManager, + Context context, + Callback<Integer> resultHandler) { + mModalDialogManager = modalDialogManager; + mContext = context; + mResultHandler = resultHandler; + } + + /** Displays an AutofillDeleteCreditCardConfirmationDialog. */ + public void show() { + ModalDialogProperties.Controller dialogController = + new SimpleModalDialogController(mModalDialogManager, mResultHandler); + + final int titleResId = R.string.autofill_credit_card_delete_confirmation_title; + final int descResId = R.string.autofill_credit_card_delete_confirmation_description; + PropertyModel dialog = + new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) + .with(ModalDialogProperties.CONTROLLER, dialogController) + .with(ModalDialogProperties.TITLE, mContext.getString(titleResId)) + .with( + ModalDialogProperties.MESSAGE_PARAGRAPH_1, + mContext.getString(descResId)) + .with( + ModalDialogProperties.POSITIVE_BUTTON_TEXT, + mContext.getString(R.string.delete)) + .with( + ModalDialogProperties.BUTTON_STYLES, + ModalDialogProperties.ButtonStyles.PRIMARY_FILLED_NEGATIVE_OUTLINE) + .with( + ModalDialogProperties.NEGATIVE_BUTTON_TEXT, + mContext.getString(R.string.cancel)) + .build(); + mModalDialogManager.showDialog(dialog, ModalDialogManager.ModalDialogType.APP); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java index 76cb3b9..6b86958 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
@@ -6,10 +6,24 @@ import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_HEIGHT_DEFAULT; import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_HEIGHT_FIXED; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DEFAULT; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_DEFAULT; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_END; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_DEFAULT; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP; import static androidx.browser.customtabs.CustomTabsIntent.CLOSE_BUTTON_POSITION_DEFAULT; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_HEIGHT_RESIZE_BEHAVIOR; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_POSITION; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_CLOSE_BUTTON_POSITION; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_HEIGHT_PX; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_WIDTH_PX; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_TOOLBAR_CORNER_RADIUS_DP; import android.app.Activity; @@ -33,6 +47,8 @@ import androidx.annotation.VisibleForTesting; import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsIntent.ActivityHeightResizeBehavior; +import androidx.browser.customtabs.CustomTabsIntent.ActivitySideSheetDecorationType; +import androidx.browser.customtabs.CustomTabsIntent.ActivitySideSheetRoundedCornersPosition; import androidx.browser.customtabs.CustomTabsIntent.CloseButtonPosition; import androidx.browser.customtabs.CustomTabsSessionToken; import androidx.browser.customtabs.TrustedWebUtils; @@ -119,14 +135,6 @@ } /** - * Extra that specifies the position of the side sheet. By default it is set to - * {@link #ACTIVITY_SIDE_SHEET_POSITION_END}, which is on the right side in left-to-right - * layout. - */ - public static final String EXTRA_ACTIVITY_SIDE_SHEET_POSITION = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_POSITION"; - - /** * Extra used to keep the caller alive. Its value is an Intent. */ public static final String EXTRA_KEEP_ALIVE = "android.support.customtabs.extra.KEEP_ALIVE"; @@ -232,25 +240,6 @@ "androidx.browser.customtabs.extra.INITIAL_ACTIVITY_HEIGHT_IN_PIXEL"; /** - * Extra that, if set, makes the Custom Tab Activity's width to be x pixels, the Custom Tab - * will behave as a side sheet. x will be clamped between 33% and 100% of window's width based - * on the window size classes as defined by the Android documentation: - * <ul> - * <li>Compact, window width < 600dp - a side sheet will not be displayed.</li> - * <li>Medium, window width >=600dp and< 840 dp - minimum side sheet size is 50% of the - * window's width.</li> - * <li>Expanded, window width >= 840dp - minimum side sheet size is 33% of the - * window's width.</li> - * </ul> - * - * <a - * href="https://developer.android.com/guide/topics/large-screens/support-different-screen-sizes#window_size_classes">Android - * Size Classes</a> - */ - public static final String EXTRA_INITIAL_ACTIVITY_WIDTH_PX = - "androidx.browser.customtabs.extra.INITIAL_ACTIVITY_WIDTH_PX"; - - /** * Extra that, if set, allows you to interact with the background app when a PCCT is launched. * Note: Deprecated. Use {@link CustomTabsIntent#isBackgroundInteractionEnabled(Intent)}. */ @@ -258,36 +247,6 @@ public static final String EXTRA_ENABLE_BACKGROUND_INTERACTION = "androidx.browser.customtabs.extra.ENABLE_BACKGROUND_INTERACTION"; - /** Extra that enables the maximization button on the side sheet Custom Tab toolbar. */ - public static final String EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION"; - - /** - * Extra that, if set, allows you to set a custom breakpoint for the Custom Tab - - * a value, x, for which if the screen's width is higher than x, the Custom Tab will behave as a - * side sheet (if {@link EXTRA_INITIAL_ACTIVITY_WIDTH_PX} is set), otherwise it will behave as a - * bottom sheet (if {@link EXTRA_INITIAL_ACTIVITY_HEIGHT_PX} is set). The default breakpoint - * value if this Intent Extra is not set is 840dp. - * - * If x is set to < 600dp it will automatically be defaulted to 600dp. - */ - public static final String EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_BREAKPOINT_DP"; - - /** - * Extra that, if set, allows you to set how you want to distinguish the PCCT side sheet from - * the rest of the display. Options include shadow, a divider line, or no decoration. - */ - public static final String EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_DECORATION_TYPE"; - - /** - * Extra that, if set, allows you to choose which side sheet corners should be rounded, if any - * at all. Options include top or none. - */ - public static final String EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION"; - /** * Extra that, if set, makes the toolbar's top corner radii to be x pixels. This will only have * effect if the custom tab is behaving as a bottom sheet. Currently, this is capped at 16dp. @@ -364,10 +323,8 @@ private List<CustomButtonParams> mToolbarButtons = new ArrayList<>(1); private List<CustomButtonParams> mBottombarButtons = new ArrayList<>(2); private RemoteViews mRemoteViews; - @SideSheetDecorationType - private int mSideSheetDecorationType; - @SideSheetRoundedCornersPosition - private int mSideSheetRoundedCornersPosition; + @ActivitySideSheetDecorationType private int mSideSheetDecorationType; + @ActivitySideSheetRoundedCornersPosition private int mSideSheetRoundedCornersPosition; private int[] mClickableViewIds; private PendingIntent mRemoteViewsPendingIntent; private PendingIntent mSecondaryToolbarSwipeUpPendingIntent; @@ -481,36 +438,33 @@ } private static int getInitialActivityWidthFromIntent(Intent intent) { - int widthPx = IntentUtils.safeGetIntExtra( - intent, CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 0); + int widthPx = IntentUtils.safeGetIntExtra(intent, EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 0); return widthPx > 0 ? widthPx : 0; } private static int getActivityBreakPointFromIntent(Intent intent) { - int breakPointDp = IntentUtils.safeGetIntExtra(intent, - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, - DEFAULT_BREAKPOINT_DP); + int breakPointDp = + IntentUtils.safeGetIntExtra( + intent, EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, DEFAULT_BREAKPOINT_DP); return breakPointDp < 0 ? DEFAULT_BREAKPOINT_DP : breakPointDp; } private static int getActivitySideSheetDecorationTypeFromIntent(Intent intent) { - int decorationType = - IntentUtils.safeGetIntExtra(intent, EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, - ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DEFAULT); - return decorationType == ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DEFAULT || decorationType < 0 - || decorationType > ACTIVITY_SIDE_SHEET_DECORATION_TYPE_MAX + int decorationType = CustomTabsIntent.getActivitySideSheetDecorationType(intent); + return decorationType == ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DEFAULT + || decorationType < 0 + || decorationType > ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER ? ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW : decorationType; } private static int getActivitySideSheetRoundedCornersPositionFromIntent(Intent intent) { - int roundedCornersPosition = IntentUtils.safeGetIntExtra(intent, - EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_DEFAULT); - return roundedCornersPosition == ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_DEFAULT + int roundedCornersPosition = + CustomTabsIntent.getActivitySideSheetRoundedCornersPosition(intent); + return roundedCornersPosition == ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_DEFAULT || roundedCornersPosition < 0 - || roundedCornersPosition > ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_MAX - ? ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE + || roundedCornersPosition > ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP + ? ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE : roundedCornersPosition; } @@ -970,21 +924,16 @@ || IntentUtils.safeHasExtra(intent, EXTRA_INITIAL_ACTIVITY_HEIGHT_PX)) { featureUsage.log(CustomTabsFeature.EXTRA_INITIAL_ACTIVITY_HEIGHT_PX); } - if (IntentUtils.safeHasExtra( - intent, CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX)) { + if (IntentUtils.safeHasExtra(intent, EXTRA_INITIAL_ACTIVITY_WIDTH_PX)) { featureUsage.log(CustomTabsFeature.EXTRA_INITIAL_ACTIVITY_WIDTH_PX); } - if (IntentUtils.safeHasExtra( - intent, CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP)) { + if (IntentUtils.safeHasExtra(intent, EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP)) { featureUsage.log(CustomTabsFeature.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP); } - if (IntentUtils.safeHasExtra(intent, - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE)) { + if (IntentUtils.safeHasExtra(intent, EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE)) { featureUsage.log(CustomTabsFeature.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE); } - if (IntentUtils.safeHasExtra(intent, - CustomTabIntentDataProvider - .EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION)) { + if (IntentUtils.safeHasExtra(intent, EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION)) { featureUsage.log(CustomTabsFeature.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION); } if (mEnableEmbeddedMediaExperience) { @@ -1065,9 +1014,6 @@ if (CustomTabsConnection.getInstance().shouldEnablePageInsightsForIntent(this)) { featureUsage.log(CustomTabsFeature.EXTRA_ENABLE_PAGE_INSIGHTS_HUB); } - if (IntentUtils.safeHasExtra(intent, EXTRA_ACTIVITY_SIDE_SHEET_POSITION)) { - featureUsage.log(CustomTabsFeature.EXTRA_ACTIVITY_SIDE_SHEET_POSITION); - } } @Override @@ -1367,13 +1313,13 @@ return version; } - @SideSheetDecorationType + @ActivitySideSheetDecorationType @Override public int getActivitySideSheetDecorationType() { return mSideSheetDecorationType; } - @SideSheetRoundedCornersPosition + @ActivitySideSheetRoundedCornersPosition @Override public int getActivitySideSheetRoundedCornersPosition() { return mSideSheetRoundedCornersPosition; @@ -1455,8 +1401,7 @@ @Override public int getSideSheetPosition() { - int position = IntentUtils.safeGetIntExtra( - mIntent, EXTRA_ACTIVITY_SIDE_SHEET_POSITION, ACTIVITY_SIDE_SHEET_POSITION_DEFAULT); + int position = CustomTabsIntent.getActivitySideSheetPosition(mIntent); return position == ACTIVITY_SIDE_SHEET_POSITION_DEFAULT ? ACTIVITY_SIDE_SHEET_POSITION_END : position; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java index c6dd757..8140e0a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
@@ -59,7 +59,6 @@ import org.chromium.chrome.browser.browserservices.SessionDataHolder; import org.chromium.chrome.browser.browserservices.SessionHandler; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; -import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ActivityLayoutState; import org.chromium.chrome.browser.customtabs.ClientManager.CalledWarmup; import org.chromium.chrome.browser.customtabs.content.EngagementSignalsHandler; import org.chromium.chrome.browser.device.DeviceClassManager; @@ -533,11 +532,18 @@ } if (maySpeculate(session)) { + // `IntentHandler.hasAnyIncognitoExtra` check: // Hidden tabs are created always with regular profile, so we need to block hidden tab // creation in incognito mode not to have inconsistent modes between tab model and // hidden tab. (crbug.com/1190971) - boolean canUseHiddenTab = mClientManager.getCanUseHiddenTab(session) - && !IntentHandler.hasAnyIncognitoExtra(extras); + // The incognito check is already performed in the entrypoint + // `mayLaunchUrlInternal`, + // but also performed here to be safe against future callers. + // Read the discussion at + // https://chromium-review.googlesource.com/c/chromium/src/+/5004377/comment/02cf16f4_82578ace/ + boolean canUseHiddenTab = + mClientManager.getCanUseHiddenTab(session) + && !IntentHandler.hasAnyIncognitoExtra(extras); startSpeculation(session, url, canUseHiddenTab, extras, uid); } preconnectUrls(otherLikelyBundles); @@ -1227,14 +1233,20 @@ /** * Called when the Custom Tab's layout has changed. + * * @param left The left coordinate of the custom tab window in pixels * @param top The top coordinate of the custom tab window in pixels * @param right The right coordinate of the custom tab window in pixels * @param bottom The bottom coordinate of the custom tab window in pixels * @param state The current layout state in which the Custom Tab is displayed. */ - public void onActivityLayout(@Nullable CustomTabsSessionToken session, int left, int top, - int right, int bottom, @ActivityLayoutState int state) { + public void onActivityLayout( + @Nullable CustomTabsSessionToken session, + int left, + int top, + int right, + int bottom, + @CustomTabsCallback.ActivityLayoutState int state) { Bundle args = new Bundle(); args.putInt(ON_ACTIVITY_LAYOUT_LEFT_EXTRA, left); args.putInt(ON_ACTIVITY_LAYOUT_TOP_EXTRA, top); @@ -1245,6 +1257,17 @@ if (safeExtraCallback(session, ON_ACTIVITY_LAYOUT_CALLBACK, args) && mLogRequests) { logCallback("extraCallback(" + ON_ACTIVITY_LAYOUT_CALLBACK + ")", args); } + + CustomTabsCallback callback = mClientManager.getCallbackForSession(session); + if (callback == null) return; + try { + callback.onActivityLayout(left, top, right, bottom, state, Bundle.EMPTY); + } catch (Exception e) { + // Catching all exceptions is really bad, but we need it here, + // because Android exposes us to client bugs by throwing a variety + // of exceptions. See crbug.com/517023. + return; + } } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/CustomTabHeightStrategy.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/CustomTabHeightStrategy.java index 80d5e0d6..1e72fbc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/CustomTabHeightStrategy.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/CustomTabHeightStrategy.java
@@ -8,11 +8,11 @@ import android.view.View; import androidx.annotation.Px; +import androidx.browser.customtabs.CustomTabsCallback; import androidx.browser.customtabs.CustomTabsSessionToken; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; -import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ActivityLayoutState; import org.chromium.chrome.browser.customtabs.CustomTabsConnection; import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar; import org.chromium.chrome.browser.findinpage.FindToolbarObserver; @@ -36,7 +36,11 @@ interface OnActivityLayoutCallback { /** The Custom Tab's layout has changed. */ void onActivityLayout( - int left, int top, int right, int bottom, @ActivityLayoutState int state); + int left, + int top, + int right, + int bottom, + @CustomTabsCallback.ActivityLayoutState int state); } public static CustomTabHeightStrategy createStrategy(Activity activity,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBaseStrategy.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBaseStrategy.java index f0681e1..5003d36 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBaseStrategy.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBaseStrategy.java
@@ -6,7 +6,7 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -29,11 +29,11 @@ import androidx.annotation.Nullable; import androidx.annotation.Px; import androidx.annotation.StringRes; +import androidx.browser.customtabs.CustomTabsCallback; import org.chromium.base.Callback; import org.chromium.chrome.R; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; -import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ActivityLayoutState; import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.fullscreen.FullscreenManager; @@ -311,8 +311,7 @@ } protected void invokeActivityLayoutCallback() { - @ActivityLayoutState - int activityLayoutState = getActivityLayoutState(); + @CustomTabsCallback.ActivityLayoutState int activityLayoutState = getActivityLayoutState(); // If we are in full screen then we manually need to set the values as we are using // MATCH_PARENT which has the value -1. @@ -335,7 +334,7 @@ public abstract @StringRes int getTypeStringId(); - protected abstract @ActivityLayoutState int getActivityLayoutState(); + protected abstract @CustomTabsCallback.ActivityLayoutState int getActivityLayoutState(); protected abstract void updatePosition();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBottomSheetStrategy.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBottomSheetStrategy.java index cea195e8..d176552 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBottomSheetStrategy.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBottomSheetStrategy.java
@@ -6,9 +6,9 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET_MAXIMIZED; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET_MAXIMIZED; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; import android.animation.Animator; import android.animation.Animator.AnimatorListener; @@ -34,6 +34,7 @@ import androidx.annotation.Px; import androidx.annotation.StringRes; import androidx.annotation.VisibleForTesting; +import androidx.browser.customtabs.CustomTabsCallback; import androidx.core.view.WindowCompat; import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsControllerCompat; @@ -46,7 +47,6 @@ import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; -import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ActivityLayoutState; import org.chromium.chrome.browser.customtabs.features.partialcustomtab.ContentGestureListener.GestureState; import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar; import org.chromium.chrome.browser.flags.ChromeFeatureList; @@ -380,7 +380,7 @@ } @Override - protected @ActivityLayoutState int getActivityLayoutState() { + protected @CustomTabsCallback.ActivityLayoutState int getActivityLayoutState() { if (isFullscreen()) { return ACTIVITY_LAYOUT_STATE_FULL_SCREEN; } else if (isMaximized()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabFullSizeStrategy.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabFullSizeStrategy.java index 93ed7702..a486a1a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabFullSizeStrategy.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabFullSizeStrategy.java
@@ -6,7 +6,7 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.app.Activity; @@ -18,10 +18,10 @@ import androidx.annotation.Px; import androidx.annotation.StringRes; +import androidx.browser.customtabs.CustomTabsCallback; import org.chromium.chrome.R; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; -import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ActivityLayoutState; import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar; import org.chromium.chrome.browser.fullscreen.FullscreenManager; @@ -114,7 +114,7 @@ } @Override - protected @ActivityLayoutState int getActivityLayoutState() { + protected @CustomTabsCallback.ActivityLayoutState int getActivityLayoutState() { return ACTIVITY_LAYOUT_STATE_FULL_SCREEN; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategy.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategy.java index 5ef243bc..31827a3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategy.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategy.java
@@ -6,13 +6,14 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_SIDE_SHEET; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_SIDE_SHEET; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_START; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; @@ -30,13 +31,14 @@ import androidx.annotation.Px; import androidx.annotation.StringRes; import androidx.annotation.VisibleForTesting; +import androidx.browser.customtabs.CustomTabsCallback; +import androidx.browser.customtabs.CustomTabsIntent; import org.chromium.base.MathUtils; import org.chromium.base.SysUtils; import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.R; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; -import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ActivityLayoutState; import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider; import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbar; import org.chromium.chrome.browser.fullscreen.FullscreenManager; @@ -92,8 +94,7 @@ // Take RTL and position extra from the Intent (start or end) into account to determine // the right side (right or left). boolean isRtl = LocalizationUtils.isLayoutRtl(); - boolean isAtStart = - sheetPosition == CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_POSITION_START; + boolean isAtStart = sheetPosition == ACTIVITY_SIDE_SHEET_POSITION_START; return !(isRtl ^ isAtStart); } @@ -253,7 +254,10 @@ @Override protected int getHandleHeight() { - return isFullscreen() || mRoundedCornersPosition == ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE + return isFullscreen() + || mRoundedCornersPosition + == CustomTabsIntent + .ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE ? 0 : mToolbarCornerRadius; } @@ -308,7 +312,7 @@ @Override protected void adjustCornerRadius(GradientDrawable d, int radius) { - if (mRoundedCornersPosition == ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE) { + if (mRoundedCornersPosition == ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE) { radius = 0; } @@ -333,7 +337,7 @@ } @Override - protected @ActivityLayoutState int getActivityLayoutState() { + protected @CustomTabsCallback.ActivityLayoutState int getActivityLayoutState() { if (isFullscreen()) { return ACTIVITY_LAYOUT_STATE_FULL_SCREEN; } else if (isMaximized()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java index eda23c4..2793c8f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java
@@ -41,6 +41,7 @@ import org.chromium.chrome.browser.accessibility.settings.ChromeAccessibilitySettingsDelegate; import org.chromium.chrome.browser.autofill.options.AutofillOptionsCoordinator; import org.chromium.chrome.browser.autofill.options.AutofillOptionsFragment; +import org.chromium.chrome.browser.autofill.settings.AutofillCreditCardEditor; import org.chromium.chrome.browser.back_press.BackPressHelper; import org.chromium.chrome.browser.back_press.BackPressManager; import org.chromium.chrome.browser.back_press.SecondaryActivityBackPressUma.SecondaryActivity; @@ -596,6 +597,10 @@ tpFragment.setCustomTabIntentHelper( LaunchIntentDispatcher::createCustomTabActivityIntent); } + if (fragment instanceof AutofillCreditCardEditor) { + ((AutofillCreditCardEditor) fragment) + .setModalDialogManagerSupplier(getModalDialogManagerSupplier()); + } } @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/AutofillLocalCardEditorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/AutofillLocalCardEditorTest.java index 3142970..48062797 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/AutofillLocalCardEditorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/AutofillLocalCardEditorTest.java
@@ -6,7 +6,14 @@ import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import android.os.Bundle; +import android.view.MenuItem; import android.view.View; import androidx.test.filters.MediumTest; @@ -18,9 +25,13 @@ import org.junit.Test; import org.junit.rules.TestRule; import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.chromium.base.supplier.ObservableSupplierImpl; import org.chromium.chrome.browser.autofill.AutofillEditorBase; import org.chromium.chrome.browser.autofill.AutofillTestHelper; +import org.chromium.chrome.browser.autofill.PersonalDataManager; import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.settings.SettingsActivity; @@ -32,6 +43,8 @@ import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.components.autofill.VirtualCardEnrollmentState; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.modaldialog.ModalDialogManager; +import org.chromium.ui.test.util.modaldialog.FakeModalDialogManager; /** Instrumentation tests for AutofillLocalCardEditor. */ @RunWith(ChromeJUnit4ClassRunner.class) @@ -85,10 +98,13 @@ /* obfuscatedLastFourDigits= */ "", /* cvc= */ "123"); + @Mock private ObservableSupplierImpl<ModalDialogManager> mModalDialogManagerSupplierMock; + @Mock private PersonalDataManager mPersonalDataManagerMock; private AutofillTestHelper mAutofillTestHelper; @Before public void setUp() { + MockitoAnnotations.initMocks(this); mAutofillTestHelper = new AutofillTestHelper(); } @@ -508,6 +524,78 @@ assertThat(autofillLocalCardEditorFragment.mDoneButton.isEnabled()).isFalse(); } + @Test + @MediumTest + public void deleteCreditCardConfirmationDialog_deleteEntryCanceled_dialogDismissed() + throws Exception { + String guid = mAutofillTestHelper.setCreditCard(SAMPLE_LOCAL_CARD); + SettingsActivity activity = + mSettingsActivityTestRule.startSettingsActivity(fragmentArgs(guid)); + AutofillLocalCardEditor autofillLocalCardEditorFragment = + (AutofillLocalCardEditor) activity.getMainFragment(); + + PersonalDataManager.setInstanceForTesting(mPersonalDataManagerMock); + + FakeModalDialogManager fakeModalDialogManager = + new FakeModalDialogManager(ModalDialogManager.ModalDialogType.APP); + openDeleteCreditCardConfirmationDialog( + autofillLocalCardEditorFragment, fakeModalDialogManager); + + // Verify the dialog is open + Assert.assertNotNull(fakeModalDialogManager.getShownDialogModel()); + TestThreadUtils.runOnUiThreadBlocking(() -> fakeModalDialogManager.clickNegativeButton()); + + // Verify the dialog is closed + Assert.assertNull(fakeModalDialogManager.getShownDialogModel()); + + // Verify the card entry is not deleted + verify(mPersonalDataManagerMock, never()).deleteCreditCard(guid); + } + + @Test + @MediumTest + public void + deleteCreditCardConfirmationDialog_deleteEntryConfirmed_dialogDismissedAndEntryDeleted() + throws Exception { + String guid = mAutofillTestHelper.setCreditCard(SAMPLE_LOCAL_CARD); + SettingsActivity activity = + mSettingsActivityTestRule.startSettingsActivity(fragmentArgs(guid)); + AutofillLocalCardEditor autofillLocalCardEditorFragment = + (AutofillLocalCardEditor) activity.getMainFragment(); + + PersonalDataManager.setInstanceForTesting(mPersonalDataManagerMock); + + FakeModalDialogManager fakeModalDialogManager = + new FakeModalDialogManager(ModalDialogManager.ModalDialogType.APP); + openDeleteCreditCardConfirmationDialog( + autofillLocalCardEditorFragment, fakeModalDialogManager); + + // Verify the dialog is open + Assert.assertNotNull(fakeModalDialogManager.getShownDialogModel()); + TestThreadUtils.runOnUiThreadBlocking(() -> fakeModalDialogManager.clickPositiveButton()); + + // Verify the dialog is closed + Assert.assertNull(fakeModalDialogManager.getShownDialogModel()); + + // Verify the card entry is deleted + verify(mPersonalDataManagerMock, times(1)).deleteCreditCard(guid); + } + + private void openDeleteCreditCardConfirmationDialog( + AutofillLocalCardEditor autofillLocalCardEditorFragment, + ModalDialogManager modalDialogManager) { + when(mModalDialogManagerSupplierMock.get()).thenReturn(modalDialogManager); + autofillLocalCardEditorFragment.setModalDialogManagerSupplier( + mModalDialogManagerSupplierMock); + + TestThreadUtils.runOnUiThreadBlocking( + () -> { + MenuItem deleteButton = mock(MenuItem.class); + when(deleteButton.getItemId()).thenReturn(R.id.delete_menu_id); + autofillLocalCardEditorFragment.onOptionsItemSelected(deleteButton); + }); + } + private void setExpirationDateOnEditor( AutofillLocalCardEditor autofillLocalCardEditorFragment, String date) { TestThreadUtils.runOnUiThreadBlocking(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java index fb450a71..eb3ad71 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -4,7 +4,10 @@ package org.chromium.chrome.browser.customtabs; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_HEIGHT_PX; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_WIDTH_PX; import static androidx.browser.customtabs.CustomTabsIntent.SHARE_STATE_ON; import static androidx.test.espresso.matcher.ViewMatchers.assertThat; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; @@ -2069,10 +2072,9 @@ CustomTabsConnection connection = CustomTabsConnection.getInstance(); connection.newSession(token); connection.overridePackageNameForSessionForTesting(token, "org.chromium.testapp"); - intent.putExtra(CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 100); - intent.putExtra(CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 300); - intent.putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION, true); + intent.putExtra(EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 100); + intent.putExtra(EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 300); + intent.putExtra(EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION, true); mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent); rotateCustomTabActivity( @@ -2131,9 +2133,9 @@ CustomTabsConnection connection = CustomTabsConnection.getInstance(); connection.newSession(token); connection.overridePackageNameForSessionForTesting(token, "org.chromium.testapp"); - intent.putExtra(CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 600); + intent.putExtra(EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 600); intent.putExtra(EXTRA_INITIAL_ACTIVITY_HEIGHT_PX, 300); - intent.putExtra(CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 300); + intent.putExtra(EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 300); mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent); rotateCustomTabActivity( @@ -2215,8 +2217,8 @@ intent.setData(Uri.parse("https://example.com")); String packageName = ContextUtils.getApplicationContext().getPackageName(); intent.setPackage(packageName); - intent.putExtra(CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 300); - intent.putExtra(CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 600); + intent.putExtra(EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 300); + intent.putExtra(EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 600); mChromeTabbedActivityTestRule.startMainActivityOnBlankPage(); CustomTabActivity resultActivity =
diff --git a/chrome/android/junit/BUILD.gn b/chrome/android/junit/BUILD.gn index cbd0f4e..d221f58 100644 --- a/chrome/android/junit/BUILD.gn +++ b/chrome/android/junit/BUILD.gn
@@ -12,7 +12,7 @@ enable_target = is_robolectric java_targets = [ "//chrome/android:chrome_junit_tests", - "//chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests", + "//chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests", ] # Ensure all users of this library include themselves in java_targets.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteCreditCardConfirmationDialogTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteCreditCardConfirmationDialogTest.java new file mode 100644 index 0000000..0ad9624 --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/autofill/settings/AutofillDeleteCreditCardConfirmationDialogTest.java
@@ -0,0 +1,67 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import static com.google.common.truth.Truth.assertThat; + +import static org.mockito.Mockito.verify; + +import androidx.test.core.app.ApplicationProvider; +import androidx.test.filters.SmallTest; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +import org.chromium.base.Callback; +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.chrome.browser.autofill.settings.AutofillDeleteCreditCardConfirmationDialog; +import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager.ModalDialogType; +import org.chromium.ui.modelutil.PropertyModel; +import org.chromium.ui.test.util.modaldialog.FakeModalDialogManager; + +/** Unit tests for {@link AutofillDeleteCreditCardConfirmationDialog}. */ +@RunWith(BaseRobolectricTestRunner.class) +public class AutofillDeleteCreditCardConfirmationDialogTest { + @Rule public MockitoRule mMockitoRule = MockitoJUnit.rule(); + @Mock private Callback<Integer> mResultHandlerMock; + + private FakeModalDialogManager mModalDialogManager; + private AutofillDeleteCreditCardConfirmationDialog mDialog; + + @Before + public void setUp() { + mModalDialogManager = new FakeModalDialogManager(ModalDialogType.APP); + mDialog = + new AutofillDeleteCreditCardConfirmationDialog( + mModalDialogManager, + ApplicationProvider.getApplicationContext(), + mResultHandlerMock); + mDialog.show(); + } + + @Test + @SmallTest + public void testDeleteButtonPressed_handlesPositiveDialogDismissalCause() { + PropertyModel dialogModel = mModalDialogManager.getShownDialogModel(); + assertThat(dialogModel).isNotNull(); + mModalDialogManager.clickPositiveButton(); + assertThat(mModalDialogManager.getShownDialogModel()).isNull(); + verify(mResultHandlerMock).onResult(DialogDismissalCause.POSITIVE_BUTTON_CLICKED); + } + + @Test + @SmallTest + public void testCancelButtonPressed_handlesNegativeDialogDismissalCause() { + PropertyModel dialogModel = mModalDialogManager.getShownDialogModel(); + assertThat(dialogModel).isNotNull(); + mModalDialogManager.clickNegativeButton(); + assertThat(mModalDialogManager.getShownDialogModel()).isNull(); + verify(mResultHandlerMock).onResult(DialogDismissalCause.NEGATIVE_BUTTON_CLICKED); + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProviderTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProviderTest.java index 5faad05..889ff58d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProviderTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProviderTest.java
@@ -7,6 +7,11 @@ import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_HEIGHT_ADJUSTABLE; import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_HEIGHT_DEFAULT; import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_HEIGHT_FIXED; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_DEFAULT; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_END; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_START; import static androidx.browser.customtabs.CustomTabsIntent.COLOR_SCHEME_DARK; import static androidx.browser.customtabs.CustomTabsIntent.COLOR_SCHEME_LIGHT; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_HEIGHT_RESIZE_BEHAVIOR; @@ -20,9 +25,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_POSITION_DEFAULT; -import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_POSITION_END; -import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_POSITION_START; import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_SIDE; import android.app.Activity; @@ -346,7 +348,7 @@ @Test public void testActivityBreakPoint_Custom() { Intent intent = new CustomTabsIntent.Builder().build().intent; - intent.putExtra(CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 300); + intent.putExtra(CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, 300); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals("Break points do not match", 300, dataProvider.getActivityBreakPoint()); } @@ -354,7 +356,7 @@ @Test public void testActivityBreakPoint_Negative() { Intent intent = new CustomTabsIntent.Builder().build().intent; - intent.putExtra(CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, -500); + intent.putExtra(CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_BREAKPOINT_DP, -500); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals("Break points do not match", 840, dataProvider.getActivityBreakPoint()); } @@ -373,7 +375,7 @@ public void testInitialActivityWidth_1Pdisabled() { ChromeFeatureList.sCctResizableSideSheet.setForTesting(false); Intent intent = new CustomTabsIntent.Builder().build().intent; - intent.putExtra(CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 50); + intent.putExtra(CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 50); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals("Width should be 0", 0, dataProvider.getInitialActivityWidth()); } @@ -383,7 +385,7 @@ ChromeFeatureList.sCctResizableSideSheet.setForTesting(true); ChromeFeatureList.sCctResizableSideSheetForThirdParties.setForTesting(true); Intent intent = new CustomTabsIntent.Builder().build().intent; - intent.putExtra(CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 50); + intent.putExtra(CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 50); CustomTabsConnection connection = Mockito.mock(CustomTabsConnection.class); when(connection.getClientPackageNameForSession(any())).thenReturn("com.pixar.woody"); CustomTabsConnection.setInstanceForTesting(connection); @@ -396,7 +398,7 @@ ChromeFeatureList.sCctResizableSideSheet.setForTesting(true); ChromeFeatureList.sCctResizableSideSheetForThirdParties.setForTesting(true); Intent intent = new CustomTabsIntent.Builder().build().intent; - intent.putExtra(CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 50); + intent.putExtra(CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 50); CustomTabsConnection connection = Mockito.mock(CustomTabsConnection.class); when(connection.getClientPackageNameForSession(any())).thenReturn("com.dc.joker"); CustomTabsConnection.setInstanceForTesting(connection); @@ -411,7 +413,7 @@ ChromeFeatureList.sCctResizableSideSheet.setForTesting(true); ChromeFeatureList.sCctResizableSideSheetForThirdParties.setForTesting(false); Intent intent = new CustomTabsIntent.Builder().build().intent; - intent.putExtra(CustomTabIntentDataProvider.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 50); + intent.putExtra(CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_WIDTH_PX, 50); CustomTabsConnection connection = Mockito.mock(CustomTabsConnection.class); when(connection.isFirstParty(any())).thenReturn(true); CustomTabsConnection.setInstanceForTesting(connection); @@ -486,7 +488,7 @@ Intent intent = new Intent() .putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_POSITION, + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_POSITION, ACTIVITY_SIDE_SHEET_POSITION_DEFAULT); dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( @@ -498,7 +500,7 @@ intent = new Intent() .putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_POSITION, + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_POSITION, ACTIVITY_SIDE_SHEET_POSITION_START); dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( @@ -510,7 +512,7 @@ intent = new Intent() .putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_POSITION, + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_POSITION, ACTIVITY_SIDE_SHEET_POSITION_END); dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( @@ -761,17 +763,17 @@ var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( "Decoration types do not match", - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, + ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, dataProvider.getActivitySideSheetDecorationType()); // Decoration set higher than max intent.putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_MAX + 1); + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, + ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER + 1); var dataProvider2 = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( "Decoration types do not match", - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, + ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, dataProvider2.getActivitySideSheetDecorationType()); } @@ -779,12 +781,12 @@ public void testActivityDecorationType_Shadow() { Intent intent = new CustomTabsIntent.Builder().build().intent; intent.putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW); + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, + ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( "Decoration types do not match", - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, + ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, dataProvider.getActivitySideSheetDecorationType()); } @@ -792,12 +794,12 @@ public void testActivityDecorationType_DividerLine() { Intent intent = new CustomTabsIntent.Builder().build().intent; intent.putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER); + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, + ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( "Decoration types do not match", - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER, + ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER, dataProvider.getActivitySideSheetDecorationType()); } @@ -805,12 +807,12 @@ public void testActivityDecorationType_None() { Intent intent = new CustomTabsIntent.Builder().build().intent; intent.putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE); + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, + CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( "Decoration types do not match", - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE, + CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE, dataProvider.getActivitySideSheetDecorationType()); } @@ -818,12 +820,12 @@ public void testActivityRoundedCornersPosition_Default() { Intent intent = new CustomTabsIntent.Builder().build().intent; intent.putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_DEFAULT); + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, + CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_DEFAULT); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( "Rounded corners positions do not match", - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE, + CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE, dataProvider.getActivitySideSheetRoundedCornersPosition()); } @@ -831,12 +833,12 @@ public void testActivityRoundedCornersPosition_None() { Intent intent = new CustomTabsIntent.Builder().build().intent; intent.putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, + CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( "Rounded corners positions do not match", - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE, + CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE, dataProvider.getActivitySideSheetRoundedCornersPosition()); } @@ -844,12 +846,12 @@ public void testActivityRoundedCornersPosition_Top() { Intent intent = new CustomTabsIntent.Builder().build().intent; intent.putExtra( - CustomTabIntentDataProvider.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP); + CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, + CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP); var dataProvider = new CustomTabIntentDataProvider(intent, mContext, COLOR_SCHEME_LIGHT); assertEquals( "Rounded corners positions do not match", - CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP, + CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP, dataProvider.getActivitySideSheetRoundedCornersPosition()); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionUnitTest.java index 8191db3e..92f8cce 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionUnitTest.java
@@ -4,6 +4,8 @@ package org.chromium.chrome.browser.customtabs; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @@ -16,7 +18,6 @@ import static org.mockito.Mockito.when; import static org.robolectric.Shadows.shadowOf; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET; import static org.chromium.chrome.browser.customtabs.CustomTabsConnection.ON_ACTIVITY_LAYOUT_BOTTOM_EXTRA; import static org.chromium.chrome.browser.customtabs.CustomTabsConnection.ON_ACTIVITY_LAYOUT_CALLBACK; import static org.chromium.chrome.browser.customtabs.CustomTabsConnection.ON_ACTIVITY_LAYOUT_LEFT_EXTRA;
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBottomSheetStrategyTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBottomSheetStrategyTest.java index d832edf..e3bd6b2 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBottomSheetStrategyTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabBottomSheetStrategyTest.java
@@ -4,6 +4,10 @@ package org.chromium.chrome.browser.customtabs.features.partialcustomtab; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET_MAXIMIZED; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; @@ -19,9 +23,6 @@ import static org.mockito.Mockito.when; import static org.robolectric.Shadows.shadowOf; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET_MAXIMIZED; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabBottomSheetStrategy.BOTTOM_SHEET_MAX_WIDTH_DP_LANDSCAPE; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabTestRule.DEVICE_HEIGHT; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabTestRule.DEVICE_HEIGHT_LANDSCAPE;
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabDisplayManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabDisplayManagerTest.java index 668ac3b..1095bdd 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabDisplayManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabDisplayManagerTest.java
@@ -4,6 +4,15 @@ package org.chromium.chrome.browser.customtabs.features.partialcustomtab; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_SIDE_SHEET; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_END; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -15,14 +24,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_SIDE_SHEET; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE; -import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_POSITION_END; import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_SIDE; import android.app.Activity; @@ -93,7 +94,7 @@ when(intentData.getSideSheetSlideInBehavior()) .thenReturn(ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_SIDE); when(intentData.getActivitySideSheetRoundedCornersPosition()) - .thenReturn(ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + .thenReturn(ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); PartialCustomTabDisplayManager displayManager = new PartialCustomTabDisplayManager( mPCCTTestRule.mActivity,
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabFullSizeStrategyTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabFullSizeStrategyTest.java index c6970e3..351000ed 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabFullSizeStrategyTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabFullSizeStrategyTest.java
@@ -6,13 +6,14 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; + import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabTestRule.DEVICE_HEIGHT; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabTestRule.DEVICE_WIDTH; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabTestRule.DEVICE_WIDTH_LANDSCAPE;
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategyTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategyTest.java index 9742538..1d51378 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategyTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/features/partialcustomtab/PartialCustomTabSideSheetStrategyTest.java
@@ -4,6 +4,18 @@ package org.chromium.chrome.browser.customtabs.features.partialcustomtab; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_SIDE_SHEET; +import static androidx.browser.customtabs.CustomTabsCallback.ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_DEFAULT; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_END; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_START; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; @@ -17,18 +29,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_FULL_SCREEN; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_SIDE_SHEET; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE; -import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP; import static org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider.ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_SIDE; -import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_POSITION_DEFAULT; -import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_POSITION_END; -import static org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.ACTIVITY_SIDE_SHEET_POSITION_START; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabTestRule.DEVICE_HEIGHT; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabTestRule.DEVICE_HEIGHT_LANDSCAPE; import static org.chromium.chrome.browser.customtabs.features.partialcustomtab.PartialCustomTabTestRule.DEVICE_WIDTH; @@ -89,7 +90,7 @@ widthPx, ACTIVITY_SIDE_SHEET_POSITION_END, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); } private PartialCustomTabSideSheetStrategy createLeftPcctSideSheetStrategy( @@ -107,7 +108,7 @@ widthPx, position, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); } private PartialCustomTabSideSheetStrategy createPcctSideSheetStrategy( @@ -308,7 +309,7 @@ .getDimensionPixelSize(eq(R.dimen.custom_tabs_shadow_offset)); mPCCTTestRule.configLandscapeMode(); - createLeftPcctSideSheetStrategy(2000, ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + createLeftPcctSideSheetStrategy(2000, ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); mPCCTTestRule.verifyWindowFlagsSet(); assertTabIsAtFullLandscapeHeight(); @@ -335,7 +336,7 @@ 2000, ACTIVITY_SIDE_SHEET_POSITION_END, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP); strategy.onToolbarInitialized( mPCCTTestRule.mToolbarCoordinator, mPCCTTestRule.mToolbarView, 5); @@ -352,7 +353,8 @@ .getDimensionPixelSize(eq(R.dimen.custom_tabs_handle_height)); mPCCTTestRule.configLandscapeMode(); var strategy = - createLeftPcctSideSheetStrategy(2000, ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP); + createLeftPcctSideSheetStrategy( + 2000, ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP); strategy.onToolbarInitialized( mPCCTTestRule.mToolbarCoordinator, mPCCTTestRule.mToolbarView, 5); @@ -383,7 +385,7 @@ .getDimensionPixelSize(eq(R.dimen.custom_tabs_shadow_offset)); mPCCTTestRule.configLandscapeMode(); - createLeftPcctSideSheetStrategy(3000, ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + createLeftPcctSideSheetStrategy(3000, ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); mPCCTTestRule.verifyWindowFlagsSet(); assertTabIsAtFullLandscapeHeight(); @@ -417,7 +419,7 @@ 2000, ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_SIDE, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); strategy.onToolbarInitialized( mPCCTTestRule.mToolbarCoordinator, mPCCTTestRule.mToolbarView, 5); mPCCTTestRule.verifyWindowFlagsSet(); @@ -447,7 +449,7 @@ 2000, ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_SIDE, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); strategy.onToolbarInitialized( mPCCTTestRule.mToolbarCoordinator, mPCCTTestRule.mToolbarView, 5); mPCCTTestRule.verifyWindowFlagsSet(); @@ -474,7 +476,7 @@ 2000, ACTIVITY_SIDE_SHEET_POSITION_END, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE); strategy.onToolbarInitialized( mPCCTTestRule.mToolbarCoordinator, mPCCTTestRule.mToolbarView, 5); mPCCTTestRule.verifyWindowFlagsSet(); @@ -504,7 +506,7 @@ 1000, ACTIVITY_SIDE_SHEET_POSITION_END, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP); strategy.onToolbarInitialized( mPCCTTestRule.mToolbarCoordinator, mPCCTTestRule.mToolbarView, 5); verify(mPCCTTestRule.mOnActivityLayoutCallback) @@ -568,7 +570,7 @@ 800, ACTIVITY_SIDE_SHEET_POSITION_END, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP); strategy.onToolbarInitialized( mPCCTTestRule.mToolbarCoordinator, mPCCTTestRule.mToolbarView, 5); verify(mPCCTTestRule.mOnActivityLayoutCallback) @@ -724,7 +726,7 @@ 700, ACTIVITY_SIDE_SHEET_POSITION_END, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP); + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP); strategy.onToolbarInitialized( mPCCTTestRule.mToolbarCoordinator, mPCCTTestRule.mToolbarView, 5); assertNotEquals("Corner not rounded", 0, mPCCTTestRule.mLayoutParams.topMargin);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinatorTest.java index 08b58cde..ffea86a 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinatorTest.java
@@ -41,6 +41,8 @@ import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; +import org.chromium.base.ActivityState; +import org.chromium.base.ApplicationStatus; import org.chromium.base.jank_tracker.PlaceholderJankTracker; import org.chromium.base.supplier.Supplier; import org.chromium.base.test.BaseRobolectricTestRunner; @@ -280,6 +282,8 @@ when(mTabModelSelector.getModel(eq(false))).thenReturn(mTabModel); when(mTabModelSelector.getModel(eq(true))).thenReturn(mTabModelIncognito); + ApplicationStatus.onStateChangeForTesting(mActivity, ActivityState.CREATED); + mCoordinator = createCoordinator(); mRecyclerView.setLayoutManager(mLayoutManager);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceMediatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceMediatorTest.java index c9adfbb6..8775fa2d 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceMediatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/feed/FeedSurfaceMediatorTest.java
@@ -41,6 +41,8 @@ import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; +import org.chromium.base.ActivityState; +import org.chromium.base.ApplicationStatus; import org.chromium.base.supplier.ObservableSupplierImpl; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.JniMocker; @@ -136,6 +138,8 @@ mocker.mock(FeedServiceBridgeJni.TEST_HOOKS, mFeedServiceBridgeJniMock); mocker.mock(WebFeedBridge.getTestHooksForTesting(), mWebFeedBridgeJniMock); + ApplicationStatus.onStateChangeForTesting(mActivity, ActivityState.CREATED); + // We want to make the feed service bridge ignore the ablation flag. when(mFeedServiceBridgeJniMock.isEnabled()) .thenAnswer(invocation -> mPrefService.getBoolean(Pref.ENABLE_SNIPPETS));
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 0c975d9..7548dd0 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -7880,6 +7880,9 @@ <message name="IDS_NTP_WALLPAPER_SEARCH_OFFLINE_TITLE" desc="The title of the message displayed by wallpaper search when the browser is offline."> Looks like you're offline. </message> + <message name="IDS_NTP_WALLPAPER_SEARCH_OPTIONAL_DETAILS_LABEL" desc="The label for optional details."> + Add optional details + </message> <message name="IDS_NTP_WALLPAPER_SEARCH_REQUEST_THROTTLED_DESCRIPTION" desc="The description of the message displayed when a wallpaper search request is throttled."> You can try again tomorrow. </message>
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_WALLPAPER_SEARCH_OPTIONAL_DETAILS_LABEL.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_WALLPAPER_SEARCH_OPTIONAL_DETAILS_LABEL.png.sha1 new file mode 100644 index 0000000..44ec9343 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_WALLPAPER_SEARCH_OPTIONAL_DETAILS_LABEL.png.sha1
@@ -0,0 +1 @@ +eb3d33936fdcaf1309b2df4e0829b55e37a842b3 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 1860895..c9504c6 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -1721,6 +1721,8 @@ "ssl/chrome_security_blocking_page_factory.h", "ssl/connection_help_tab_helper.cc", "ssl/connection_help_tab_helper.h", + "ssl/daily_navigation_counter.cc", + "ssl/daily_navigation_counter.h", "ssl/https_defaulted_callbacks.cc", "ssl/https_defaulted_callbacks.h", "ssl/https_first_mode_settings_tracker.cc", @@ -2130,7 +2132,7 @@ "//chrome/browser/storage_access_api", "//chrome/browser/thumbnail", "//chrome/browser/top_level_storage_access_api:permissions", - "//chrome/browser/touch_to_fill/password_manager", + "//chrome/browser/touch_to_fill", "//chrome/browser/ui", "//chrome/browser/ui/actions:actions", "//chrome/browser/ui/actions:actions_headers", @@ -3411,20 +3413,20 @@ "trusted_vault/trusted_vault_client_android.h", # TODO(crbug.com/1426388): Move to its own target in touch_to_fill/. - "touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.cc", - "touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.h", - "touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.cc", - "touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.h", - "touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.cc", - "touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.h", - "touch_to_fill/password_manager/touch_to_fill_controller.cc", - "touch_to_fill/password_manager/touch_to_fill_controller.h", - "touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.cc", - "touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.h", - "touch_to_fill/password_manager/touch_to_fill_controller_delegate.cc", - "touch_to_fill/password_manager/touch_to_fill_controller_delegate.h", - "touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.cc", - "touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.h", + "touch_to_fill/payments/android/touch_to_fill_credit_card_controller.cc", + "touch_to_fill/payments/android/touch_to_fill_credit_card_controller.h", + "touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.cc", + "touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.h", + "touch_to_fill/touch_to_fill_controller.cc", + "touch_to_fill/touch_to_fill_controller.h", + "touch_to_fill/touch_to_fill_controller_autofill_delegate.cc", + "touch_to_fill/touch_to_fill_controller_autofill_delegate.h", + "touch_to_fill/touch_to_fill_controller_delegate.cc", + "touch_to_fill/touch_to_fill_controller_delegate.h", + "touch_to_fill/touch_to_fill_controller_webauthn_delegate.cc", + "touch_to_fill/touch_to_fill_controller_webauthn_delegate.h", + "touch_to_fill/touch_to_fill_keyboard_suppressor.cc", + "touch_to_fill/touch_to_fill_keyboard_suppressor.h", "translate/android/translate_bridge.cc", "translate/android/translate_bridge.h", "usb/android/usb_bridge.cc", @@ -3510,10 +3512,10 @@ "//chrome/browser/signin/services/android:jni_headers", "//chrome/browser/sync/android:jni_headers", "//chrome/browser/tab:jni_headers", - "//chrome/browser/touch_to_fill/autofill/android:public", - "//chrome/browser/touch_to_fill/password_manager/no_passkeys/android:public", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android:public", + "//chrome/browser/touch_to_fill/no_passkeys/android:public", + "//chrome/browser/touch_to_fill/password_generation/android", + "//chrome/browser/touch_to_fill/password_generation/android:public", + "//chrome/browser/touch_to_fill/payments/android:public", "//chrome/browser/translate/android", "//chrome/browser/translate/android:jni_headers", "//chrome/browser/ui/android/layouts:android",
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 42f2455..a73f18c 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS
@@ -441,6 +441,7 @@ "+services/media_session/public", "+services/metrics/metrics_mojo_service.h", "+services/metrics/public", + "+services/network/cert_verifier_with_trust_anchors.h", "+services/network/network_service.h", "+services/network/public", "+services/network/test",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index b371d8e..c5e12c2 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -83,7 +83,6 @@ #include "components/commerce/core/flag_descriptions.h" #include "components/component_updater/component_updater_command_line_config_policy.h" #include "components/component_updater/component_updater_switches.h" -#include "components/compose/core/browser/compose_features.h" #include "components/content_settings/core/common/features.h" #include "components/contextual_search/core/browser/contextual_search_field_trial.h" #include "components/contextual_search/core/browser/public.h" @@ -4720,6 +4719,13 @@ "DXGIWaitableSwapChain"), }, { + "fluent-overlay-scrollbars", + flag_descriptions::kFluentOverlayScrollbarsName, + flag_descriptions::kFluentOverlayScrollbarsDescription, + kOsWin, + FEATURE_VALUE_TYPE(features::kFluentOverlayScrollbar), + }, + { "fluent-scrollbars", flag_descriptions::kFluentScrollbarsName, flag_descriptions::kFluentScrollbarsDescription, @@ -8343,6 +8349,9 @@ flag_descriptions::kHelpAppAutoTriggerInstallDialogName, flag_descriptions::kHelpAppAutoTriggerInstallDialogDescription, kOsCrOS, FEATURE_VALUE_TYPE(ash::features::kHelpAppAutoTriggerInstallDialog)}, + {"help-app-cros-components", flag_descriptions::kHelpAppCrosComponentsName, + flag_descriptions::kHelpAppCrosComponentsDescription, kOsCrOS, + FEATURE_VALUE_TYPE(ash::features::kHelpAppCrosComponents)}, {"help-app-home-page-app-articles", flag_descriptions::kHelpAppHomePageAppArticlesName, flag_descriptions::kHelpAppHomePageAppArticlesDescription, kOsCrOS, @@ -8668,6 +8677,11 @@ flag_descriptions::kSmdsDbusMigrationDescription, kOsCrOS, FEATURE_VALUE_TYPE(ash::features::kSmdsDbusMigration)}, + {"tethering-experimental-functionality", + flag_descriptions::kTetheringExperimentalFunctionalityName, + flag_descriptions::kTetheringExperimentalFunctionalityDescription, kOsCrOS, + FEATURE_VALUE_TYPE(ash::features::kTetheringExperimentalFunctionality)}, + {"dynamic-search-update-animation", flag_descriptions::kDynamicSearchUpdateAnimationName, flag_descriptions::kDynamicSearchUpdateAnimationDescription, kOsCrOS, @@ -11217,12 +11231,6 @@ kAttachLogsToAutofillRaterExtensionReport)}, #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) - {"fill-multi-line", flag_descriptions::kFillMultiLineName, - flag_descriptions::kFillMultiLineDescription, kOsWin | kOsLinux | kOsMac, - FEATURE_VALUE_TYPE(compose::features::kFillMultiLine)}, -#endif - #if !BUILDFLAG(IS_ANDROID) {"trusted-vault-frequent-degraded-recoverability-polling", flag_descriptions::kTrustedVaultFrequentDegradedRecoverabilityPollingName,
diff --git a/chrome/browser/android/browserservices/intents/java/src/org/chromium/chrome/browser/browserservices/intents/BrowserServicesIntentDataProvider.java b/chrome/browser/android/browserservices/intents/java/src/org/chromium/chrome/browser/browserservices/intents/BrowserServicesIntentDataProvider.java index 7abe8cf..797ba462 100644 --- a/chrome/browser/android/browserservices/intents/java/src/org/chromium/chrome/browser/browserservices/intents/BrowserServicesIntentDataProvider.java +++ b/chrome/browser/android/browserservices/intents/java/src/org/chromium/chrome/browser/browserservices/intents/BrowserServicesIntentDataProvider.java
@@ -4,6 +4,9 @@ package org.chromium.chrome.browser.browserservices.intents; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_END; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE; import static androidx.browser.customtabs.CustomTabsIntent.CLOSE_BUTTON_POSITION_DEFAULT; import android.app.PendingIntent; @@ -60,22 +63,6 @@ int V2_NOTIFICATION_OR_SNACKBAR = 1; } - @IntDef({ACTIVITY_SIDE_SHEET_POSITION_DEFAULT, ACTIVITY_SIDE_SHEET_POSITION_START, - ACTIVITY_SIDE_SHEET_POSITION_END}) - @Retention(RetentionPolicy.SOURCE) - public @interface ActivitySideSheetPosition {} - /** - * Applies the default position for the Custom Tab Activity when it behaves as a - * side sheet. Same as {@link #ACTIVITY_SIDE_SHEET_POSITION_END}. - */ - public static final int ACTIVITY_SIDE_SHEET_POSITION_DEFAULT = 0; - - /** Position the side sheet on the start side of the screen. */ - public static final int ACTIVITY_SIDE_SHEET_POSITION_START = 1; - - /** Position the side sheet on the end side of the screen. */ - public static final int ACTIVITY_SIDE_SHEET_POSITION_END = 2; - @IntDef({ACTIVITY_SIDE_SHEET_SLIDE_IN_DEFAULT, ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_BOTTOM, ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_SIDE}) @Retention(RetentionPolicy.SOURCE) @@ -92,82 +79,6 @@ /** Side shset's slide-in behavior for side-wise animation. */ public static final int ACTIVITY_SIDE_SHEET_SLIDE_IN_FROM_SIDE = 2; - @IntDef({ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DEFAULT, ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE, - ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW, - ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER}) - @Retention(RetentionPolicy.SOURCE) - public @interface SideSheetDecorationType {} - /** - * Side sheet's default decoration type. Same as - * {@link ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW}. - */ - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DEFAULT = 0; - /** - * Side sheet with no decorations - the activity is not bordered by any shadow or divider line. - */ - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE = 1; - /** - * Side sheet with shadow decoration - the activity is bordered by a shadow effect. - */ - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW = 2; - /** - * Side sheet with a divider line - the activity is bordered by a thin opaque line. - */ - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER = 3; - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_MAX = 3; - - @IntDef({ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_DEFAULT, ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP}) - @Retention(RetentionPolicy.SOURCE) - public @interface SideSheetRoundedCornersPosition {} - - /** - * Side sheet's default rounded corner configuration. Same as - * {@link ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE} - */ - public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_DEFAULT = 0; - /** - * Side sheet with no rounded corners. - */ - public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE = 1; - /** - * Side sheet with the inner top corner rounded (if positioned on the right of the screen, this - * will be the top left corner) - */ - public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP = 2; - public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_MAX = 2; - - @IntDef({ACTIVITY_LAYOUT_STATE_NONE, ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET, - ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET_MAXIMIZED, ACTIVITY_LAYOUT_STATE_SIDE_SHEET, - ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED, ACTIVITY_LAYOUT_STATE_FULL_SCREEN}) - @Retention(RetentionPolicy.SOURCE) - public @interface ActivityLayoutState {} - /** - * The activity's layout state is unknown. - */ - public static final int ACTIVITY_LAYOUT_STATE_NONE = 0; - /** - * The activity is being displayed as a bottom-sheet at its initial height. - */ - public static final int ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET = 1; - /** - * The activity is being displayed as a bottom-sheet at its maximized height. - */ - public static final int ACTIVITY_LAYOUT_STATE_BOTTOM_SHEET_MAXIMIZED = 2; - /** - * The activity is being displayed as a side-sheet at its initial width. - */ - public static final int ACTIVITY_LAYOUT_STATE_SIDE_SHEET = 3; - /** - * The activity is being displayed as a side-sheet at its maximized width. - */ - public static final int ACTIVITY_LAYOUT_STATE_SIDE_SHEET_MAXIMIZED = 4; - /** - * The activity is being displayed over the whole window. - */ - public static final int ACTIVITY_LAYOUT_STATE_FULL_SCREEN = 5; - public static final int ACTIVITY_LAYOUT_STATE_MAX = 5; - /** * @return The type of the Activity; */ @@ -627,7 +538,7 @@ * @return An int representing the side sheet rounded corner position for the Activity */ public int getActivitySideSheetRoundedCornersPosition() { - return ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE; + return ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_NONE; } /**
diff --git a/chrome/browser/android/examples/custom_tabs_client/src/java/org/chromium/customtabsclient/MainActivity.java b/chrome/browser/android/examples/custom_tabs_client/src/java/org/chromium/customtabsclient/MainActivity.java index 6b378af1..5e03049 100644 --- a/chrome/browser/android/examples/custom_tabs_client/src/java/org/chromium/customtabsclient/MainActivity.java +++ b/chrome/browser/android/examples/custom_tabs_client/src/java/org/chromium/customtabsclient/MainActivity.java
@@ -4,7 +4,17 @@ package org.chromium.customtabsclient; import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_HEIGHT_FIXED; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_END; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_POSITION_START; +import static androidx.browser.customtabs.CustomTabsIntent.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_HEIGHT_RESIZE_BEHAVIOR; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_POSITION; +import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_CLOSE_BUTTON_POSITION; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_INITIAL_ACTIVITY_HEIGHT_PX; import static androidx.browser.customtabs.CustomTabsIntent.EXTRA_TOOLBAR_CORNER_RADIUS_DP; @@ -114,10 +124,6 @@ private static final int CHECKED = 1; private static final int BACKGROUND_INTERACT_OFF_VALUE = 2; - /** Extra that enables the maximization button on the side sheet Custom Tab toolbar. */ - public static final String EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION"; - /** * Minimal height the bottom sheet CCT should show is half of the display height. */ @@ -173,28 +179,6 @@ private @Px int mMaxWidth; private @Px int mInitialWidth; - public static final int ACTIVITY_SIDE_SHEET_POSITION_DEFAULT = 0; - public static final int ACTIVITY_SIDE_SHEET_POSITION_START = 1; - public static final int ACTIVITY_SIDE_SHEET_POSITION_END = 2; - - public static final String EXTRA_ACTIVITY_SIDE_SHEET_POSITION = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_POSITION"; - - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DEFAULT = 0; - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_NONE = 1; - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_SHADOW = 2; - public static final int ACTIVITY_SIDE_SHEET_DECORATION_TYPE_DIVIDER = 3; - - public static final String EXTRA_ACTIVITY_SIDE_SHEEET_DECORATION_TYPE = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_DECORATION_TYPE"; - - public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_DEFAULT = 0; - public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_NONE = 1; - public static final int ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP = 2; - - public static final String EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION = - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION"; - public static final String EXTRA_ACTIVITY_SCROLL_CONTENT_RESIZE = "androidx.browser.customtabs.extra.ACTIVITY_SCROLL_CONTENT_RESIZE"; /** @@ -235,6 +219,17 @@ } @Override + public void onActivityLayout( + int left, + int top, + int right, + int bottom, + @ActivityLayoutState int state, + Bundle extras) { + logOnActivityLayout("onActivityLayout:", left, top, right, bottom, state); + } + + @Override public void extraCallback(@NonNull String callbackName, @Nullable Bundle args) { if (args == null) return; @@ -244,24 +239,42 @@ Log.w(TAG, "onResized: size = " + args.getInt("size")); // CustomTabsConnection#ON_ACTIVITY_LAYOUT_CALLBACK } else if (callbackName.equals("onActivityLayout")) { - Log.w(TAG, - "onActivityLayout:" - // CustomTabsConnection#ON_ACTIVITY_LAYOUT_LEFT_EXTRA - + " left = " - + args.getInt("left") - // CustomTabsConnection#ON_ACTIVITY_LAYOUT_TOP_EXTRA - + " top = " - + args.getInt("top") - // CustomTabsConnection#ON_ACTIVITY_LAYOUT_RIGHT_EXTRA - + " right = " - + args.getInt("right") - // CustomTabsConnection#ON_ACTIVITY_LAYOUT_BOTTOM_EXTRA - + " bottom = " - + args.getInt("bottom") - // CustomTabsConnection#ON_ACTIVITY_LAYOUT_STATE_EXTRA - + " state = " + args.getInt("state")); + logOnActivityLayout( + "onActivityLayout extraCallback:", + args.getInt("left"), + args.getInt("top"), + args.getInt("right"), + args.getInt("bottom"), + args.getInt("state")); } } + + private void logOnActivityLayout( + String callbackName, + int left, + int top, + int right, + int bottom, + @ActivityLayoutState int state) { + Log.w( + TAG, + callbackName + // CustomTabsConnection#ON_ACTIVITY_LAYOUT_LEFT_EXTRA + + " left = " + + left + // CustomTabsConnection#ON_ACTIVITY_LAYOUT_TOP_EXTRA + + " top = " + + top + // CustomTabsConnection#ON_ACTIVITY_LAYOUT_RIGHT_EXTRA + + " right = " + + right + // CustomTabsConnection#ON_ACTIVITY_LAYOUT_BOTTOM_EXTRA + + " bottom = " + + bottom + // CustomTabsConnection#ON_ACTIVITY_LAYOUT_STATE_EXTRA + + " state = " + + state); + } } private class EngagementCallback implements EngagementSignalsCallback { @@ -889,6 +902,15 @@ if (isPCCT) { editor.putString(SHARED_PREF_CCT, "Partial CCT"); + int pcctInitialWidthPx = mPcctInitialWidthSlider.getProgress(); + if (pcctInitialWidthPx != 0) { + builder.setInitialActivityWidthPx(pcctInitialWidthPx); + } + + int pcctBreakpointDp = mPcctBreakpointSlider.getProgress(); + if (pcctBreakpointDp != 0) { + builder.setActivitySideSheetBreakpointDp(pcctBreakpointDp); + } customTabsIntent = builder.build(); int toolbarCornerRadiusDp = mToolbarCornerRadiusSlider.getProgress(); @@ -899,20 +921,12 @@ customTabsIntent.intent.putExtra( EXTRA_INITIAL_ACTIVITY_HEIGHT_PX, pcctInitialHeightPx); } - int pcctInitialWidthPx = mPcctInitialWidthSlider.getProgress(); - if (pcctInitialWidthPx != 0) { - customTabsIntent.intent.putExtra( - "androidx.browser.customtabs.extra.INITIAL_ACTIVITY_WIDTH_PX", - pcctInitialWidthPx); - } - int pcctBreakpointDp = mPcctBreakpointSlider.getProgress(); - customTabsIntent.intent.putExtra( - "androidx.browser.customtabs.extra.ACTIVITY_SIDE_SHEET_BREAKPOINT_DP", - pcctBreakpointDp); + if (mSideSheetMaxButtonCheckbox.isChecked()) { customTabsIntent.intent.putExtra( EXTRA_ACTIVITY_SIDE_SHEET_ENABLE_MAXIMIZATION, true); } + if (!mPcctHeightResizableCheckbox.isChecked()) { customTabsIntent.intent.putExtra( EXTRA_ACTIVITY_HEIGHT_RESIZE_BEHAVIOR, ACTIVITY_HEIGHT_FIXED); @@ -923,15 +937,16 @@ BACKGROUND_INTERACT_OFF_VALUE); } if (mSideSheetRoundedCornerCheckbox.isChecked()) { - customTabsIntent.intent.putExtra(EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, - ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_TOP); + customTabsIntent.intent.putExtra( + EXTRA_ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION, + ACTIVITY_SIDE_SHEET_ROUNDED_CORNERS_POSITION_TOP); } if (mContentScrollCheckbox.isChecked()) { customTabsIntent.intent.putExtra(EXTRA_ACTIVITY_SCROLL_CONTENT_RESIZE, true); } customTabsIntent.intent.putExtra(EXTRA_ACTIVITY_SIDE_SHEET_POSITION, sideSheetPosition); customTabsIntent.intent.putExtra( - EXTRA_ACTIVITY_SIDE_SHEEET_DECORATION_TYPE, decorationType); + EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE, decorationType); } else { editor.putString( SHARED_PREF_CCT, mCctType.equals("Incognito CCT") ? "Incognito CCT" : "CCT");
diff --git a/chrome/browser/android/webapk/webapk_sync_bridge.cc b/chrome/browser/android/webapk/webapk_sync_bridge.cc index debd0c5..0b33036 100644 --- a/chrome/browser/android/webapk/webapk_sync_bridge.cc +++ b/chrome/browser/android/webapk/webapk_sync_bridge.cc
@@ -338,11 +338,30 @@ return absl::nullopt; } +void WebApkSyncBridge::PrepareRegistryUpdateFromSyncApps( + const syncer::EntityChangeList& sync_changes, + RegistryUpdateData* registry_update_from_sync) const { + const std::vector<const sync_pb::WebApkSpecifics*> sync_update_from_installed; + PrepareRegistryUpdateFromInstalledAndSyncApps( + sync_update_from_installed, sync_changes, registry_update_from_sync); +} + absl::optional<syncer::ModelError> WebApkSyncBridge::ApplyIncrementalSyncChanges( std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, syncer::EntityChangeList entity_changes) { - // TODO(hartmanng): implement + std::unique_ptr<RegistryUpdateData> registry_update_from_sync = + std::make_unique<RegistryUpdateData>(); + PrepareRegistryUpdateFromSyncApps(entity_changes, + registry_update_from_sync.get()); + + database_->Write( + *registry_update_from_sync, std::move(metadata_change_list), + base::BindOnce(&WebApkSyncBridge::OnDataWritten, + weak_ptr_factory_.GetWeakPtr(), base::DoNothing())); + + ApplyIncrementalSyncChangesToRegistry(std::move(registry_update_from_sync)); + return absl::nullopt; }
diff --git a/chrome/browser/android/webapk/webapk_sync_bridge.h b/chrome/browser/android/webapk/webapk_sync_bridge.h index 0f7058d9..18f006f 100644 --- a/chrome/browser/android/webapk/webapk_sync_bridge.h +++ b/chrome/browser/android/webapk/webapk_sync_bridge.h
@@ -152,6 +152,9 @@ // https://docs.google.com/document/d/1Pce17EEuIs0dIbw-L1RZVf2HA4H8-Lu8RqVxHGmdJds. void ApplyIncrementalSyncChangesToRegistry( std::unique_ptr<RegistryUpdateData> update_data); + void PrepareRegistryUpdateFromSyncApps( + const syncer::EntityChangeList& sync_changes, + RegistryUpdateData* registry_update_from_sync) const; std::unique_ptr<WebApkDatabase> database_; Registry registry_;
diff --git a/chrome/browser/android/webapk/webapk_sync_bridge_unittest.cc b/chrome/browser/android/webapk/webapk_sync_bridge_unittest.cc index 2647953..ff4d863 100644 --- a/chrome/browser/android/webapk/webapk_sync_bridge_unittest.cc +++ b/chrome/browser/android/webapk/webapk_sync_bridge_unittest.cc
@@ -738,6 +738,147 @@ EXPECT_EQ(0u, database_factory().ReadRegistry().size()); } +TEST_F(WebApkSyncBridgeTest, ApplyIncrementalSyncChanges) { + base::test::SingleThreadTaskEnvironment task_environment; + + const std::string manifest_id_1 = "https://example.com/app1"; + const std::string manifest_id_2 = "https://example.com/app2"; + const std::string manifest_id_3 = "https://example.com/app3"; + const std::string manifest_id_4 = "https://example.com/app4"; + + Registry registry; + + // left as-is + std::unique_ptr<WebApkProto> registry_app1 = + CreateWebApkProto(manifest_id_1, "app1_registry"); + InsertAppIntoRegistry(®istry, std::move(registry_app1)); + + // deleted + std::unique_ptr<WebApkProto> registry_app2 = + CreateWebApkProto(manifest_id_2, "app2_registry"); + InsertAppIntoRegistry(®istry, std::move(registry_app2)); + + // replaced + std::unique_ptr<WebApkProto> registry_app3 = + CreateWebApkProto(manifest_id_3, "app3_registry"); + InsertAppIntoRegistry(®istry, std::move(registry_app3)); + + database_factory().WriteRegistry(registry); + + EXPECT_CALL(processor(), ModelReadyToSync(_)).Times(1); + EXPECT_CALL(processor(), Put(_, _, _)).Times(0); + EXPECT_CALL(processor(), Delete(_, _)).Times(0); + + InitSyncBridge(); + + std::unique_ptr<syncer::EntityChange> sync_change_2 = + syncer::EntityChange::CreateDelete(ManifestIdStrToAppId(manifest_id_2)); + + syncer::EntityData sync_data_3; + sync_pb::WebApkSpecifics* sync_specifics_3 = + sync_data_3.specifics.mutable_web_apk(); + sync_specifics_3->set_manifest_id(manifest_id_3); + sync_specifics_3->set_name("app3_sync"); + std::unique_ptr<syncer::EntityChange> sync_change_3 = + syncer::EntityChange::CreateAdd(ManifestIdStrToAppId(manifest_id_3), + std::move(sync_data_3)); + + syncer::EntityData sync_data_4; + sync_pb::WebApkSpecifics* sync_specifics_4 = + sync_data_4.specifics.mutable_web_apk(); + sync_specifics_4->set_manifest_id(manifest_id_4); + sync_specifics_4->set_name("app4_sync"); + std::unique_ptr<syncer::EntityChange> sync_change_4 = + syncer::EntityChange::CreateAdd(ManifestIdStrToAppId(manifest_id_4), + std::move(sync_data_4)); + + syncer::EntityChangeList sync_changes; + sync_changes.push_back(std::move(sync_change_2)); + sync_changes.push_back(std::move(sync_change_3)); + sync_changes.push_back(std::move(sync_change_4)); + + std::unique_ptr<syncer::MetadataChangeList> metadata_change_list = + syncer::ModelTypeStore::WriteBatch::CreateMetadataChangeList(); + absl::optional<syncer::ModelError> result = + sync_bridge().ApplyIncrementalSyncChanges(std::move(metadata_change_list), + std::move(sync_changes)); + + EXPECT_EQ(absl::nullopt, result); + + const Registry& final_registry = sync_bridge().GetRegistryForTesting(); + EXPECT_EQ(3u, final_registry.size()); + + EXPECT_EQ(manifest_id_1, + final_registry.at(ManifestIdStrToAppId(manifest_id_1)) + ->sync_data() + .manifest_id()); + EXPECT_EQ("app1_registry", + final_registry.at(ManifestIdStrToAppId(manifest_id_1)) + ->sync_data() + .name()); + + EXPECT_EQ(manifest_id_3, + final_registry.at(ManifestIdStrToAppId(manifest_id_3)) + ->sync_data() + .manifest_id()); + EXPECT_EQ("app3_sync", final_registry.at(ManifestIdStrToAppId(manifest_id_3)) + ->sync_data() + .name()); + + EXPECT_EQ(manifest_id_4, + final_registry.at(ManifestIdStrToAppId(manifest_id_4)) + ->sync_data() + .manifest_id()); + EXPECT_EQ("app4_sync", final_registry.at(ManifestIdStrToAppId(manifest_id_4)) + ->sync_data() + .name()); + + const Registry db_registry = database_factory().ReadRegistry(); + EXPECT_EQ(3u, db_registry.size()); + + EXPECT_EQ(manifest_id_1, db_registry.at(ManifestIdStrToAppId(manifest_id_1)) + ->sync_data() + .manifest_id()); + EXPECT_EQ( + "app1_registry", + db_registry.at(ManifestIdStrToAppId(manifest_id_1))->sync_data().name()); + + EXPECT_EQ(manifest_id_3, db_registry.at(ManifestIdStrToAppId(manifest_id_3)) + ->sync_data() + .manifest_id()); + EXPECT_EQ( + "app3_sync", + db_registry.at(ManifestIdStrToAppId(manifest_id_3))->sync_data().name()); + + EXPECT_EQ(manifest_id_4, db_registry.at(ManifestIdStrToAppId(manifest_id_4)) + ->sync_data() + .manifest_id()); + EXPECT_EQ( + "app4_sync", + db_registry.at(ManifestIdStrToAppId(manifest_id_4))->sync_data().name()); +} + +TEST_F(WebApkSyncBridgeTest, ApplyIncrementalSyncChanges_NoChanges) { + base::test::SingleThreadTaskEnvironment task_environment; + + EXPECT_CALL(processor(), ModelReadyToSync(_)).Times(1); + EXPECT_CALL(processor(), Put(_, _, _)).Times(0); + EXPECT_CALL(processor(), Delete(_, _)).Times(0); + + InitSyncBridge(); + + std::unique_ptr<syncer::MetadataChangeList> metadata_change_list = + syncer::ModelTypeStore::WriteBatch::CreateMetadataChangeList(); + syncer::EntityChangeList sync_changes; + absl::optional<syncer::ModelError> result = + sync_bridge().ApplyIncrementalSyncChanges(std::move(metadata_change_list), + std::move(sync_changes)); + + EXPECT_EQ(absl::nullopt, result); + EXPECT_EQ(0u, sync_bridge().GetRegistryForTesting().size()); + EXPECT_EQ(0u, database_factory().ReadRegistry().size()); +} + // Tests that the WebApkSyncBridge correctly reports data from the // WebApkDatabase. TEST_F(WebApkSyncBridgeTest, GetData) {
diff --git a/chrome/browser/app_controller_mac.h b/chrome/browser/app_controller_mac.h index 2168a79..007017d 100644 --- a/chrome/browser/app_controller_mac.h +++ b/chrome/browser/app_controller_mac.h
@@ -151,8 +151,8 @@ - (BOOL)windowHasBrowserTabs:(NSWindow*)window; // Testing API. -- (void)setCmdWMenuItemForTesting:(NSMenuItem*)menuItem; -- (void)setShiftCmdWMenuItemForTesting:(NSMenuItem*)menuItem; +- (void)setCloseWindowMenuItemForTesting:(NSMenuItem*)menuItem; +- (void)setCloseTabMenuItemForTesting:(NSMenuItem*)menuItem; - (void)setLastProfileForTesting:(Profile*)profile; @end
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 54434bb..56477e06 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm
@@ -603,9 +603,11 @@ std::vector<GURL> _startupUrls; BOOL _startupComplete; - // Outlets for testing close tab/window menu items. - NSMenuItem* __strong _cmdWMenuItemForTesting; - NSMenuItem* __strong _shiftCmdWMenuItemForTesting; + // Outlets for the close tab/window menu items so that we can adjust the + // command-key equivalent depending on the kind of window and how many + // tabs it has. + NSMenuItem* __strong _closeTabMenuItemForTesting; + NSMenuItem* __strong _closeWindowMenuItemForTesting; std::unique_ptr<PrefChangeRegistrar> _profilePrefRegistrar; PrefChangeRegistrar _localPrefRegistrar; @@ -676,36 +678,20 @@ return [[NSApp.mainMenu itemWithTag:IDC_FILE_MENU] submenu]; } -// Returns the Cmd-W menu item in the File menu. -- (NSMenuItem*)cmdWMenuItem { - if (_cmdWMenuItemForTesting != nil) { - return _cmdWMenuItemForTesting; +- (NSMenuItem*)closeTabMenuItem { + if (_closeTabMenuItemForTesting != nil) { + return _closeTabMenuItemForTesting; } - for (NSMenuItem* item in [self fileMenu].itemArray) { - if ([@"w" isEqualToString:item.keyEquivalent] && - item.keyEquivalentModifierMask == NSEventModifierFlagCommand) { - return item; - } - } - - return nil; + return [[self fileMenu] itemWithTag:IDC_CLOSE_TAB]; } -// Returns the Shift-Cmd-W menu item in the File menu. -- (NSMenuItem*)shiftCmdWMenuItem { - if (_shiftCmdWMenuItemForTesting != nil) { - return _shiftCmdWMenuItemForTesting; +- (NSMenuItem*)closeWindowMenuItem { + if (_closeWindowMenuItemForTesting != nil) { + return _closeWindowMenuItemForTesting; } - for (NSMenuItem* item in [self fileMenu].itemArray) { - if ([@"W" isEqualToString:item.keyEquivalent] && - item.keyEquivalentModifierMask == NSEventModifierFlagCommand) { - return item; - } - } - - return nil; + return [[self fileMenu] itemWithTag:IDC_CLOSE_WINDOW]; } // This method is called very early in application startup (ie, before @@ -732,8 +718,8 @@ name:NSWorkspaceWillPowerOffNotification object:nil]; - DCHECK([self cmdWMenuItem]); - DCHECK([self shiftCmdWMenuItem]); + DCHECK([self closeTabMenuItem]); + DCHECK([self closeWindowMenuItem]); // Set up the command updater for when there are no windows open [self initMenuState]; @@ -1590,7 +1576,7 @@ - (void)initShareMenu { _shareMenuController = [[ShareMenuController alloc] init]; - NSMenu* fileMenu = [self fileMenu]; + NSMenu* fileMenu = [NSApp.mainMenu itemWithTag:IDC_FILE_MENU].submenu; NSString* shareMenuTitle = l10n_util::GetNSString(IDS_SHARE_MAC); NSMenuItem* shareMenuItem = [fileMenu itemWithTitle:shareMenuTitle]; NSMenu* shareSubmenu = [[NSMenu alloc] initWithTitle:shareMenuTitle]; @@ -1943,58 +1929,22 @@ } } - // If the browser window has tabs, assign Shift-Cmd-W to "Close Window" - // and Cmd-W to "Close Tab", otherwise hide the "Close Tab" item and - // assign Cmd-W to "Close Window". - // - // One way to shuffle these shortcuts is to simply find the "Close Window" - // and "Close Tab" menu items and change their key equivalents. For some - // reason, the AppKit won't let us do that. For example, if the "Close Tab" - // item has @"w" as its equivalent and we temporarily assign @"w" to - // "Close Window", we can never set @"w" as the key equivalent for the - // "Close Tab" item. It doesn't appear to be an issue with some other item - // having that same equivalent, the AppKit just won't take it. We get around - // this problem by leaving key equivalents alone and instead change the - // titles and actions of the menu items that own those equivalents. - NSMenuItem* cmdWMenuItem = [self cmdWMenuItem]; - NSMenuItem* shiftCmdWMenuItem = [self shiftCmdWMenuItem]; + NSMenuItem* closeTabMenuItem = [self closeTabMenuItem]; + NSMenuItem* closeWindowMenuItem = [self closeWindowMenuItem]; + // If the browser window has tabs, assign Cmd-Shift-W to "Close Window", + // otherwise leave it as the normal Cmd-W. Capitalization of the key + // equivalent affects whether the Shift modifier is used. if ([self windowHasBrowserTabs:targetWindow]) { - // Assign Shift-Cmd-W to "Close Window". - shiftCmdWMenuItem.hidden = NO; - shiftCmdWMenuItem.title = - l10n_util::GetNSStringWithFixup(IDS_CLOSE_WINDOW_MAC); - shiftCmdWMenuItem.tag = IDC_CLOSE_WINDOW; - - // Assign Cmd-W to "Close Tab". - cmdWMenuItem.title = l10n_util::GetNSStringWithFixup(IDS_CLOSE_TAB_MAC); - cmdWMenuItem.tag = IDC_CLOSE_TAB; + [closeTabMenuItem cr_setKeyEquivalent:@"w" + modifierMask:NSEventModifierFlagCommand]; + [closeWindowMenuItem cr_setKeyEquivalent:@"W" + modifierMask:NSEventModifierFlagCommand]; } else { - // We don't need a Shift-Cmd-W command, so hide the menu item. - shiftCmdWMenuItem.hidden = YES; - - // Assign Cmd-W to "Close Window". - cmdWMenuItem.title = l10n_util::GetNSStringWithFixup(IDS_CLOSE_WINDOW_MAC); - cmdWMenuItem.tag = IDC_CLOSE_WINDOW; + [closeTabMenuItem cr_clearKeyEquivalent]; + [closeWindowMenuItem cr_setKeyEquivalent:@"w" + modifierMask:NSEventModifierFlagCommand]; } - - // This menu item shuffling makes a "Close All" item appear. The AppKit wants - // to own the File menu, so this item's appearance is likely a result of - // magic code in the AppKit. However, we prefer to add and manage our own - // menu items (localization, for example). Also, this "Close All" menu item - // complicates the positioning of the "Close Window" and "Close Tab" items. - // Locate the "Close All" menu item and remove it. - NSMenu* fileMenu = [self fileMenu]; - for (NSMenuItem* item in [[fileMenu itemArray] copy]) { - if (item.action == @selector(closeAll:)) { - [fileMenu removeItem:item]; - break; - } - } - - // Force no longer hidden items to appear, or newly hidden items to - // disappear. - [fileMenu update]; } // This only has an effect on macOS 12+, and requests any state restoration @@ -2135,12 +2085,12 @@ }); } -- (void)setCmdWMenuItemForTesting:(NSMenuItem*)menuItem { - _cmdWMenuItemForTesting = menuItem; +- (void)setCloseWindowMenuItemForTesting:(NSMenuItem*)menuItem { + _closeWindowMenuItemForTesting = menuItem; } -- (void)setShiftCmdWMenuItemForTesting:(NSMenuItem*)menuItem { - _shiftCmdWMenuItemForTesting = menuItem; +- (void)setCloseTabMenuItemForTesting:(NSMenuItem*)menuItem { + _closeTabMenuItemForTesting = menuItem; } - (void)setLastProfileForTesting:(Profile*)profile {
diff --git a/chrome/browser/app_controller_mac_unittest.mm b/chrome/browser/app_controller_mac_unittest.mm index 0647037..5d541cf 100644 --- a/chrome/browser/app_controller_mac_unittest.mm +++ b/chrome/browser/app_controller_mac_unittest.mm
@@ -19,13 +19,11 @@ #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/pref_names.h" -#include "chrome/grit/generated_resources.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" #include "content/public/test/browser_task_environment.h" #include "testing/platform_test.h" -#include "ui/base/l10n/l10n_util_mac.h" namespace { @@ -94,60 +92,56 @@ std::make_unique<base::apple::ScopedObjCClassSwizzler>( [NSApp class], [AppControllerKeyEquivalentTestHelper class], @selector(targetForAction:)); - _app_controller_swizzler = + app_controller_swizzler_ = std::make_unique<base::apple::ScopedObjCClassSwizzler>( [AppController class], [AppControllerKeyEquivalentTestHelper class], @selector(windowHasBrowserTabs:)); - _app_controller = AppController.sharedController; + app_controller_ = AppController.sharedController; - _cmdw_menu_item = [[NSMenuItem alloc] initWithTitle:@"" - action:nullptr - keyEquivalent:@"w"]; - [_app_controller setCmdWMenuItemForTesting:_cmdw_menu_item]; + close_window_menu_item_ = [[NSMenuItem alloc] initWithTitle:@"" + action:nullptr + keyEquivalent:@""]; + [app_controller_ setCloseWindowMenuItemForTesting:close_window_menu_item_]; - _shift_cmdw_menu_item = [[NSMenuItem alloc] initWithTitle:@"" - action:nullptr - keyEquivalent:@"W"]; - [_app_controller setShiftCmdWMenuItemForTesting:_shift_cmdw_menu_item]; + close_tab_menu_item_ = [[NSMenuItem alloc] initWithTitle:@"" + action:nullptr + keyEquivalent:@""]; + [app_controller_ setCloseTabMenuItemForTesting:close_tab_menu_item_]; } void CheckMenuItemsMatchBrowserWindow() { ASSERT_EQ([NSApp targetForAction:@selector(performClose:)], *TargetForAction()); - [_app_controller updateMenuItemKeyEquivalents]; + [app_controller_ updateMenuItemKeyEquivalents]; - EXPECT_FALSE(_shift_cmdw_menu_item.hidden); - EXPECT_EQ(_shift_cmdw_menu_item.tag, IDC_CLOSE_WINDOW); - EXPECT_TRUE([_shift_cmdw_menu_item.title - isEqualToString:l10n_util::GetNSStringWithFixup(IDS_CLOSE_WINDOW_MAC)]); - - EXPECT_FALSE(_cmdw_menu_item.hidden); - EXPECT_EQ(_cmdw_menu_item.tag, IDC_CLOSE_TAB); - EXPECT_TRUE([_cmdw_menu_item.title - isEqualToString:l10n_util::GetNSStringWithFixup(IDS_CLOSE_TAB_MAC)]); + EXPECT_TRUE([[close_window_menu_item_ keyEquivalent] isEqualToString:@"W"]); + EXPECT_EQ([close_window_menu_item_ keyEquivalentModifierMask], + NSEventModifierFlagCommand); + EXPECT_TRUE([[close_tab_menu_item_ keyEquivalent] isEqualToString:@"w"]); + EXPECT_EQ([close_tab_menu_item_ keyEquivalentModifierMask], + NSEventModifierFlagCommand); } void CheckMenuItemsMatchNonBrowserWindow() { ASSERT_EQ([NSApp targetForAction:@selector(performClose:)], *TargetForAction()); - [_app_controller updateMenuItemKeyEquivalents]; + [app_controller_ updateMenuItemKeyEquivalents]; - EXPECT_TRUE(_shift_cmdw_menu_item.hidden); - - EXPECT_FALSE(_cmdw_menu_item.hidden); - EXPECT_EQ(_cmdw_menu_item.tag, IDC_CLOSE_WINDOW); - EXPECT_TRUE([_cmdw_menu_item.title - isEqualToString:l10n_util::GetNSStringWithFixup(IDS_CLOSE_WINDOW_MAC)]); + EXPECT_TRUE([[close_window_menu_item_ keyEquivalent] isEqualToString:@"w"]); + EXPECT_EQ([close_window_menu_item_ keyEquivalentModifierMask], + NSEventModifierFlagCommand); + EXPECT_TRUE([[close_tab_menu_item_ keyEquivalent] isEqualToString:@""]); + EXPECT_EQ([close_tab_menu_item_ keyEquivalentModifierMask], 0UL); } void TearDown() override { PlatformTest::TearDown(); - [_app_controller setCmdWMenuItemForTesting:nil]; - [_app_controller setShiftCmdWMenuItemForTesting:nil]; + [app_controller_ setCloseWindowMenuItemForTesting:nil]; + [app_controller_ setCloseTabMenuItemForTesting:nil]; *TargetForAction() = nil; } @@ -155,10 +149,10 @@ std::unique_ptr<base::apple::ScopedObjCClassSwizzler> nsapp_target_for_action_swizzler_; std::unique_ptr<base::apple::ScopedObjCClassSwizzler> - _app_controller_swizzler; - AppController* __strong _app_controller; - NSMenuItem* __strong _cmdw_menu_item; - NSMenuItem* __strong _shift_cmdw_menu_item; + app_controller_swizzler_; + AppController* __strong app_controller_; + NSMenuItem* __strong close_window_menu_item_; + NSMenuItem* __strong close_tab_menu_item_; }; TEST_F(AppControllerTest, DockMenuProfileNotLoaded) {
diff --git a/chrome/browser/apps/app_service/app_install/app_install_navigation_throttle.cc b/chrome/browser/apps/app_service/app_install/app_install_navigation_throttle.cc index e069e96..044cdc3 100644 --- a/chrome/browser/apps/app_service/app_install/app_install_navigation_throttle.cc +++ b/chrome/browser/apps/app_service/app_install/app_install_navigation_throttle.cc
@@ -103,7 +103,9 @@ Profile* profile = Profile::FromBrowserContext( navigation_handle()->GetWebContents()->GetBrowserContext()); auto* proxy = AppServiceProxyFactory::GetForProfile(profile); - proxy->AppInstallService().InstallApp(package_id.value()); + proxy->AppInstallService().InstallApp( + AppInstallSurface::kAppInstallNavigationThrottle, package_id.value(), + base::DoNothing()); } return content::NavigationThrottle::CANCEL_AND_IGNORE;
diff --git a/chrome/browser/apps/app_service/app_install/app_install_service.cc b/chrome/browser/apps/app_service/app_install/app_install_service.cc index cc868c6..29c62a4 100644 --- a/chrome/browser/apps/app_service/app_install/app_install_service.cc +++ b/chrome/browser/apps/app_service/app_install/app_install_service.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/apps/app_service/app_install/app_install_service.h" +#include <ostream> + #include "base/functional/bind.h" #include "base/functional/callback.h" #include "base/functional/callback_helpers.h" @@ -67,29 +69,44 @@ } // namespace +std::ostream& operator<<(std::ostream& out, AppInstallSurface surface) { + switch (surface) { + case AppInstallSurface::kAppInstallNavigationThrottle: + return out << "AppInstallNavigationThrottle"; + } +} + AppInstallService::AppInstallService(Profile& profile) : profile_(profile), device_info_manager_(&*profile_) {} AppInstallService::~AppInstallService() = default; -void AppInstallService::InstallApp(PackageId package_id) { +void AppInstallService::InstallApp(AppInstallSurface surface, + PackageId package_id, + base::OnceClosure callback) { // TODO(b/303350800): Generalize to work with all app types. CHECK_EQ(package_id.app_type(), AppType::kWeb); device_info_manager_.GetDeviceInfo( base::BindOnce(&AppInstallService::InstallAppWithDeviceInfo, - weak_ptr_factory_.GetWeakPtr(), std::move(package_id))); + weak_ptr_factory_.GetWeakPtr(), surface, + std::move(package_id), std::move(callback))); } -void AppInstallService::InstallAppWithDeviceInfo(PackageId package_id, +void AppInstallService::InstallAppWithDeviceInfo(AppInstallSurface surface, + PackageId package_id, + base::OnceClosure callback, DeviceInfo device_info) { connector_.GetAppInstallInfo( package_id, std::move(device_info), *profile_->GetURLLoaderFactory(), base::BindOnce(&AppInstallService::InstallFromFetchedData, - weak_ptr_factory_.GetWeakPtr(), package_id)); + weak_ptr_factory_.GetWeakPtr(), surface, package_id, + std::move(callback))); } void AppInstallService::InstallFromFetchedData( - const PackageId& expected_package_id, + AppInstallSurface surface, + PackageId expected_package_id, + base::OnceClosure callback, absl::optional<AppInstallData> data) { AppInstallResult result = [&] { if (!data) { @@ -131,12 +148,12 @@ base::UmaHistogramEnumeration("Apps.AppInstallService.AppInstallResult", result); - - // New uses must add an install surface parameter to be used as a variant of - // this histogram. base::UmaHistogramEnumeration( - "Apps.AppInstallService.AppInstallResult.AppInstallNavigationThrottle", + base::StrCat({"Apps.AppInstallService.AppInstallResult.", + base::ToString(surface)}), result); + + std::move(callback).Run(); } } // namespace apps
diff --git a/chrome/browser/apps/app_service/app_install/app_install_service.h b/chrome/browser/apps/app_service/app_install/app_install_service.h index 0f6ba74..c8ffe6fb 100644 --- a/chrome/browser/apps/app_service/app_install/app_install_service.h +++ b/chrome/browser/apps/app_service/app_install/app_install_service.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_APPS_APP_SERVICE_APP_INSTALL_APP_INSTALL_SERVICE_H_ #define CHROME_BROWSER_APPS_APP_SERVICE_APP_INSTALL_APP_INSTALL_SERVICE_H_ +#include <iosfwd> + #include "base/functional/callback_forward.h" #include "base/memory/raw_ref.h" #include "base/memory/weak_ptr.h" @@ -17,6 +19,12 @@ struct DeviceInfo; class PackageId; +enum class AppInstallSurface { + kAppInstallNavigationThrottle, +}; + +std::ostream& operator<<(std::ostream& out, AppInstallSurface surface); + class AppInstallService { public: explicit AppInstallService(Profile& profile); @@ -24,14 +32,18 @@ AppInstallService& operator=(const AppInstallService&) = delete; ~AppInstallService(); - // TODO(b/304680287): Add completion callback with error reporting. - // New uses must add an install surface parameter to be used as a variant of - // the Apps.AppInstallService.AppInstallResult histogram. - void InstallApp(PackageId package_id); + void InstallApp(AppInstallSurface surface, + PackageId package_id, + base::OnceClosure callback); private: - void InstallAppWithDeviceInfo(PackageId package_id, DeviceInfo device_info); - void InstallFromFetchedData(const PackageId& expected_package_id, + void InstallAppWithDeviceInfo(AppInstallSurface surface, + PackageId package_id, + base::OnceClosure callback, + DeviceInfo device_info); + void InstallFromFetchedData(AppInstallSurface surface, + PackageId expected_package_id, + base::OnceClosure callback, absl::optional<AppInstallData> data); raw_ref<Profile> profile_;
diff --git a/chrome/browser/apps/app_service/publishers/browser_shortcuts_crosapi_publisher.cc b/chrome/browser/apps/app_service/publishers/browser_shortcuts_crosapi_publisher.cc index e7b4732..8b12927 100644 --- a/chrome/browser/apps/app_service/publishers/browser_shortcuts_crosapi_publisher.cc +++ b/chrome/browser/apps/app_service/publishers/browser_shortcuts_crosapi_publisher.cc
@@ -55,6 +55,22 @@ std::move(callback).Run(); } +void BrowserShortcutsCrosapiPublisher::RegisterAppShortcutController( + mojo::PendingRemote<crosapi::mojom::AppShortcutController> controller, + RegisterAppShortcutControllerCallback callback) { + if (controller_.is_bound()) { + std::move(callback).Run( + crosapi::mojom::ControllerRegistrationResult::kFailed); + return; + } + controller_.Bind(std::move(controller)); + controller_.set_disconnect_handler(base::BindOnce( + &BrowserShortcutsCrosapiPublisher::OnControllerDisconnected, + base::Unretained(this))); + std::move(callback).Run( + crosapi::mojom::ControllerRegistrationResult::kSuccess); +} + void BrowserShortcutsCrosapiPublisher::LaunchShortcut( const std::string& host_app_id, const std::string& local_shortcut_id, @@ -73,6 +89,11 @@ void BrowserShortcutsCrosapiPublisher::OnCrosapiDisconnected() { receiver_.reset(); + controller_.reset(); +} + +void BrowserShortcutsCrosapiPublisher::OnControllerDisconnected() { + controller_.reset(); } } // namespace apps
diff --git a/chrome/browser/apps/app_service/publishers/browser_shortcuts_crosapi_publisher.h b/chrome/browser/apps/app_service/publishers/browser_shortcuts_crosapi_publisher.h index 6eb429b6..9ef6454d 100644 --- a/chrome/browser/apps/app_service/publishers/browser_shortcuts_crosapi_publisher.h +++ b/chrome/browser/apps/app_service/publishers/browser_shortcuts_crosapi_publisher.h
@@ -16,6 +16,7 @@ #include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/shortcut/shortcut.h" #include "mojo/public/cpp/bindings/receiver.h" +#include "mojo/public/cpp/bindings/remote.h" namespace apps { @@ -43,6 +44,9 @@ // crosapi::mojom::AppShortcutPublisher overrides. void PublishShortcuts(std::vector<apps::ShortcutPtr> deltas, PublishShortcutsCallback callback) override; + void RegisterAppShortcutController( + mojo::PendingRemote<crosapi::mojom::AppShortcutController> controller, + RegisterAppShortcutControllerCallback callback) override; // apps::ShortcutPublisher overrides. void LaunchShortcut(const std::string& host_app_id, @@ -54,8 +58,10 @@ apps::UninstallSource uninstall_source) override; void OnCrosapiDisconnected(); + void OnControllerDisconnected(); mojo::Receiver<crosapi::mojom::AppShortcutPublisher> receiver_{this}; + mojo::Remote<crosapi::mojom::AppShortcutController> controller_; const raw_ptr<apps::AppServiceProxy> proxy_; base::WeakPtrFactory<BrowserShortcutsCrosapiPublisher> weak_factory_{this};
diff --git a/chrome/browser/ash/apps/apk_web_app_service.cc b/chrome/browser/ash/apps/apk_web_app_service.cc index 0754b5b..335bdb7 100644 --- a/chrome/browser/ash/apps/apk_web_app_service.cc +++ b/chrome/browser/ash/apps/apk_web_app_service.cc
@@ -755,7 +755,7 @@ void ApkWebAppService::RemoveInstallingWebApkPackageName( const std::string& app_id) { std::string package_name = currently_installing_apks_[app_id]; - if (ash::features::ArePromiseIconsEnabled()) { + if (ash::features::ArePromiseIconsEnabled() && !package_name.empty()) { apps::AppServiceProxyFactory::GetForProfile(profile_) ->PromiseAppService() ->OnApkWebAppInstallationFinished(package_name);
diff --git a/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc b/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc index ea09d27..d8e15fb2 100644 --- a/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc +++ b/chrome/browser/ash/arc/input_overlay/arc_input_overlay_manager_unittest.cc
@@ -40,6 +40,11 @@ constexpr const float kTolerance = 0.999f; +constexpr const float kAction0PositionRatio = 0.5f; +constexpr const float kAction1PositionRatio = 0.9f; + +constexpr const gfx::Rect window_bounds = gfx::Rect(10, 10, 100, 100); + } // namespace class TestArcInputOverlayManager : public ArcInputOverlayManager { @@ -193,8 +198,8 @@ aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); // Test app with input overlay data. auto arc_window = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kEnabledPackageName); auto* arc_window_ptr = arc_window->GetNativeWindow(); EXPECT_TRUE(IsObserving(arc_window_ptr)); EXPECT_TRUE(IsInputOverlayEnabled(arc_window_ptr)); @@ -211,8 +216,8 @@ // Test app without input overlay data. auto arc_window_no_data = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kRandomPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kRandomPackageName); EXPECT_FALSE(IsObserving(arc_window_ptr)); EXPECT_FALSE(IsInputOverlayEnabled(arc_window_no_data->GetNativeWindow())); } @@ -220,9 +225,8 @@ TEST_P(VersionArcInputOverlayManagerTest, TestWindowDestroyNoWait) { // This test is to check UAF issue reported in crbug.com/1363030. task_environment()->RunUntilIdle(); - auto arc_window = - CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + auto arc_window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), + window_bounds, kEnabledPackageName); const auto* arc_window_ptr = arc_window->GetNativeWindow(); // Destroy window before finishing I/O reading. The window can't be destroyed @@ -240,8 +244,8 @@ aura::client::FocusClient* focus_client = aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); auto arc_window = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kEnabledPackageName); focus_client->FocusWindow(arc_window->GetNativeWindow()); ui::InputMethod* input_method = GetInputMethod(); EXPECT_TRUE(GetInputMethod()); @@ -261,18 +265,18 @@ aura::client::FocusClient* focus_client = aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); auto arc_window = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kEnabledPackageName); auto arc_window_no_data = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kRandomPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kRandomPackageName); EXPECT_EQ(1, EnabledWindows()); auto* injector = GetTouchInjector(arc_window->GetNativeWindow()); EXPECT_TRUE(injector); // The action number should be adjusted with the data in the // org.chromium.arc.testapp.inputoverlay.json. - EXPECT_EQ(3, (int)injector->actions().size()); + EXPECT_EQ(3u, injector->actions().size()); EXPECT_TRUE(!GetRegisteredWindow() && !GetDisplayOverlayController()); focus_client->FocusWindow(arc_window->GetNativeWindow()); @@ -286,8 +290,8 @@ // Launch app in tablet mode and switch to desktop mode. ash::TabletModeControllerTestApi().EnterTabletMode(); auto arc_window = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kEnabledPackageName); EXPECT_TRUE(IsInputOverlayEnabled(arc_window->GetNativeWindow())); EXPECT_FALSE(GetRegisteredWindow()); ash::TabletModeControllerTestApi().LeaveTabletMode(); @@ -296,9 +300,9 @@ // Launch app in desktop mode and switch to tablet mode. ash::TabletModeControllerTestApi().LeaveTabletMode(); - arc_window = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + arc_window = CreateArcWindowSyncAndWait(task_environment(), + ash::Shell::GetPrimaryRootWindow(), + window_bounds, kEnabledPackageName); EXPECT_TRUE(IsInputOverlayEnabled(arc_window->GetNativeWindow())); EXPECT_TRUE(GetRegisteredWindow()); ash::TabletModeControllerTestApi().EnterTabletMode(); @@ -321,10 +325,12 @@ // window. EXPECT_FALSE(GetKeyEventSourceRewriter()); task_environment()->RunUntilIdle(); - auto arc_window = CreateArcWindow( - root_windows[1], gfx::Rect(1010, 910, 100, 100), kEnabledPackageName); - arc_window->GetNativeWindow()->SetBoundsInScreen( - gfx::Rect(1010, 910, 100, 100), display1); + auto screen_bounds = window_bounds; + const auto& display_bounds = display1.bounds(); + screen_bounds.Offset(display_bounds.x(), display_bounds.y()); + auto arc_window = + CreateArcWindow(root_windows[1], screen_bounds, kEnabledPackageName); + arc_window->GetNativeWindow()->SetBoundsInScreen(screen_bounds, display1); // I/O takes time here. task_environment()->FastForwardBy(kIORead); // Make sure to dismiss the educational dialog in beforehand. @@ -348,25 +354,22 @@ event_capturer.Clear(); root_windows[1]->RemovePostTargetHandler(&event_capturer); // Move to the primary display. - arc_window->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(10, 10, 100, 100), - display0); + arc_window->GetNativeWindow()->SetBoundsInScreen(window_bounds, display0); EXPECT_FALSE(GetKeyEventSourceRewriter()); // Move back to the secondary display. - arc_window->GetNativeWindow()->SetBoundsInScreen( - gfx::Rect(1010, 910, 100, 100), display1); + arc_window->GetNativeWindow()->SetBoundsInScreen(screen_bounds, display1); EXPECT_TRUE(GetKeyEventSourceRewriter()); arc_window.reset(); // Test when launching input overlay window on the primary display, there // shouldn't be `key_event_source_rewriter_`. EXPECT_FALSE(GetKeyEventSourceRewriter()); - arc_window = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + arc_window = CreateArcWindowSyncAndWait(task_environment(), + ash::Shell::GetPrimaryRootWindow(), + window_bounds, kEnabledPackageName); EXPECT_FALSE(GetKeyEventSourceRewriter()); // Move to the secondary display. - arc_window->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(10, 10, 100, 100), - display1); + arc_window->GetNativeWindow()->SetBoundsInScreen(window_bounds, display1); EXPECT_TRUE(GetKeyEventSourceRewriter()); // When losing focus, `key_event_source_rewriter_` should be destroyed too. focus_client->FocusWindow(nullptr); @@ -376,8 +379,8 @@ // Test when this is non input overlay window launched on the secondry // display, there shouldn't be `key_event_source_rewriter_`. auto arc_window_no_data = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kRandomPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kRandomPackageName); focus_client->FocusWindow(arc_window_no_data->GetNativeWindow()); EXPECT_FALSE(GetKeyEventSourceRewriter()); arc_window_no_data.reset(); @@ -388,13 +391,11 @@ // registered/not focused, primary window should receive key events. root_windows[0]->AddPostTargetHandler(&event_capturer); arc_window = CreateArcWindowSyncAndWait(task_environment(), root_windows[1], - gfx::Rect(1010, 910, 100, 100), - kEnabledPackageName); - arc_window->GetNativeWindow()->SetBoundsInScreen( - gfx::Rect(1010, 910, 100, 100), display1); + screen_bounds, kEnabledPackageName); + arc_window->GetNativeWindow()->SetBoundsInScreen(screen_bounds, display1); arc_window_no_data = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kRandomPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kRandomPackageName); // Focus on window without input overlay. focus_client->FocusWindow(arc_window_no_data->GetNativeWindow()); event_generator->PressKey(ui::VKEY_A, ui::EF_NONE, 1 /* keyboard id */); @@ -415,8 +416,8 @@ auto* focus_client = aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); auto arc_window = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kEnabledPackageName); // Make sure to dismiss the educational dialog in beforehand. auto* injector = GetTouchInjector(arc_window->GetNativeWindow()); DCHECK(injector); @@ -425,32 +426,48 @@ ->frame_view() ->GetWindowBoundsForClientBounds(gfx::Rect()) .y(); - EXPECT_EQ(injector->content_bounds_f(), - gfx::RectF(10, 10 + caption_height, 100, 100 - caption_height)); + auto expected_content_bounds = gfx::RectF( + window_bounds.x(), window_bounds.y() + caption_height, + window_bounds.width(), window_bounds.height() - caption_height); + EXPECT_EQ(injector->content_bounds_f(), expected_content_bounds); EXPECT_POINTF_NEAR( injector->actions()[0]->touch_down_positions()[0], - gfx::PointF(60, (100 - caption_height) * 0.5 + 10 + caption_height), + gfx::PointF(expected_content_bounds.x() + + expected_content_bounds.width() * kAction0PositionRatio, + expected_content_bounds.y() + + expected_content_bounds.height() * kAction0PositionRatio), kTolerance); EXPECT_POINTF_NEAR( injector->actions()[1]->touch_down_positions()[0], - gfx::PointF(100, (100 - caption_height) * 0.9 + 10 + caption_height), + gfx::PointF(expected_content_bounds.x() + + expected_content_bounds.width() * kAction1PositionRatio, + expected_content_bounds.y() + + expected_content_bounds.height() * kAction1PositionRatio), kTolerance); // Confirm the content bounds and touch down positions are updated after // window bounds changed. auto display = display::Screen::GetScreen()->GetDisplayMatching( ash::Shell::GetPrimaryRootWindow()->GetBoundsInScreen()); - arc_window->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(10, 10, 150, 150), - display); - EXPECT_EQ(injector->content_bounds_f(), - gfx::RectF(10, 10 + caption_height, 150, 150 - caption_height)); + auto new_window_bounds = gfx::Rect(10, 10, 150, 150); + arc_window->GetNativeWindow()->SetBoundsInScreen(new_window_bounds, display); + expected_content_bounds = gfx::RectF( + new_window_bounds.x(), new_window_bounds.y() + caption_height, + new_window_bounds.width(), new_window_bounds.height() - caption_height); + EXPECT_EQ(injector->content_bounds_f(), expected_content_bounds); EXPECT_POINTF_NEAR( injector->actions()[0]->touch_down_positions()[0], - gfx::PointF(85, (150 - caption_height) * 0.5 + 10 + caption_height), + gfx::PointF(expected_content_bounds.x() + + expected_content_bounds.width() * kAction0PositionRatio, + expected_content_bounds.y() + + expected_content_bounds.height() * kAction0PositionRatio), kTolerance); EXPECT_POINTF_NEAR( injector->actions()[1]->touch_down_positions()[0], - gfx::PointF(145, (150 - caption_height) * 0.9 + 10 + caption_height), + gfx::PointF(expected_content_bounds.x() + + expected_content_bounds.width() * kAction1PositionRatio, + expected_content_bounds.y() + + expected_content_bounds.height() * kAction1PositionRatio), kTolerance); } @@ -458,8 +475,8 @@ aura::client::FocusClient* focus_client = aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); auto arc_window = CreateArcWindowSyncAndWait( - task_environment(), ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + task_environment(), ash::Shell::GetPrimaryRootWindow(), window_bounds, + kEnabledPackageName); // Make sure to dismiss the educational dialog in beforehand. auto* injector = GetTouchInjector(arc_window->GetNativeWindow()); DCHECK(injector); @@ -469,22 +486,29 @@ ->frame_view() ->GetWindowBoundsForClientBounds(gfx::Rect()) .y(); - auto expect_bounds = - gfx::RectF(10, 10 + caption_height, 100, 100 - caption_height); - EXPECT_EQ(injector->content_bounds_f(), expect_bounds); + auto expected_content_bounds = gfx::RectF( + window_bounds.x(), window_bounds.y() + caption_height, + window_bounds.width(), window_bounds.height() - caption_height); + EXPECT_EQ(injector->content_bounds_f(), expected_content_bounds); auto expect_touch_a = - gfx::PointF(60, (100 - caption_height) * 0.5 + 10 + caption_height); + gfx::PointF(expected_content_bounds.x() + + expected_content_bounds.width() * kAction0PositionRatio, + expected_content_bounds.y() + + expected_content_bounds.height() * kAction0PositionRatio); EXPECT_POINTF_NEAR(injector->actions()[0]->touch_down_positions()[0], expect_touch_a, kTolerance); auto expect_touch_b = - gfx::PointF(100, (100 - caption_height) * 0.9 + 10 + caption_height); + gfx::PointF(expected_content_bounds.x() + + expected_content_bounds.width() * kAction1PositionRatio, + expected_content_bounds.y() + + expected_content_bounds.height() * kAction1PositionRatio); EXPECT_POINTF_NEAR(injector->actions()[1]->touch_down_positions()[0], expect_touch_b, kTolerance); // Confirm the touch down positions are updated after display rotated. UpdateDisplay("800x600/r"); EXPECT_TRUE(injector->rotation_transform()); - EXPECT_EQ(injector->content_bounds_f(), expect_bounds); + EXPECT_EQ(injector->content_bounds_f(), expected_content_bounds); expect_touch_a = injector->rotation_transform()->MapPoint(expect_touch_a); EXPECT_POINTF_NEAR(injector->actions()[0]->touch_down_positions()[0], expect_touch_a, kTolerance); @@ -495,9 +519,8 @@ TEST_P(VersionArcInputOverlayManagerTest, TestNonGameApp) { // Test a random non-game app. - auto window = - CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kRandomPackageName); + auto window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), + window_bounds, kRandomPackageName); task_environment()->FastForwardBy(kIORead); auto* injector = GetTouchInjector(window->GetNativeWindow()); EXPECT_FALSE(injector); @@ -506,9 +529,8 @@ TEST_P(VersionArcInputOverlayManagerTest, TestGameWithDefaultMapping) { // Test with a game with default mapping. - auto window = - CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + auto window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), + window_bounds, kEnabledPackageName); task_environment()->FastForwardBy(kIORead); auto* injector = GetTouchInjector(window->GetNativeWindow()); EXPECT_TRUE(injector); @@ -523,8 +545,8 @@ // Relaunch the game to check whether previous customized data is loaded. window.reset(); - window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), window_bounds, + kEnabledPackageName); task_environment()->FastForwardBy(kIORead); injector = GetTouchInjector(window->GetNativeWindow()); EXPECT_TRUE(injector); @@ -539,9 +561,8 @@ TEST_P(VersionArcInputOverlayManagerTest, TestGameWithoutDefaultMapping) { // Test with a random non-O4C game. - auto game_window = - CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kRandomGamePackageName); + auto game_window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), + window_bounds, kRandomGamePackageName); task_environment()->FastForwardBy(kIORead); auto* injector = GetTouchInjector(game_window->GetNativeWindow()); if (IsBetaVersion()) { @@ -558,9 +579,8 @@ // Relaunch the game to check whether previous customized_data is loaded. game_window.reset(); task_environment()->RunUntilIdle(); - game_window = - CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kRandomGamePackageName); + game_window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), + window_bounds, kRandomGamePackageName); task_environment()->FastForwardBy(kIORead); injector = GetTouchInjector(game_window->GetNativeWindow()); if (IsBetaVersion()) { @@ -578,9 +598,9 @@ kGameControlsOptOutPackageName, /*is_gc_opt_out=*/true, /*is_game=*/true); - auto game_window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), - kGameControlsOptOutPackageName); + auto game_window = + CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), window_bounds, + kGameControlsOptOutPackageName); EXPECT_FALSE(GetTouchInjector(game_window->GetNativeWindow())); } @@ -588,9 +608,8 @@ // Test an O4C game without any input mapping. arc_app_test_.compatibility_mode_instance()->set_o4c_pkg( kRandomGamePackageName); - auto game_window = - CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kRandomGamePackageName); + auto game_window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), + window_bounds, kRandomGamePackageName); task_environment()->FastForwardBy(kIORead); auto* injector = GetTouchInjector(game_window->GetNativeWindow()); EXPECT_FALSE(injector); @@ -599,9 +618,8 @@ // Test an O4C game with input mappings. arc_app_test_.compatibility_mode_instance()->set_o4c_pkg(kEnabledPackageName); - game_window = - CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), - gfx::Rect(10, 10, 100, 100), kEnabledPackageName); + game_window = CreateArcWindow(ash::Shell::GetPrimaryRootWindow(), + window_bounds, kEnabledPackageName); task_environment()->FastForwardBy(kIORead); injector = GetTouchInjector(game_window->GetNativeWindow()); EXPECT_TRUE(injector);
diff --git a/chrome/browser/ash/arc/input_overlay/ui/touch_point.cc b/chrome/browser/ash/arc/input_overlay/ui/touch_point.cc index 3e06d442f..28de210 100644 --- a/chrome/browser/ash/arc/input_overlay/ui/touch_point.cc +++ b/chrome/browser/ash/arc/input_overlay/ui/touch_point.cc
@@ -6,9 +6,13 @@ #include <cmath> -#include "base/debug/stack_trace.h" +#include "base/notreached.h" #include "cc/paint/paint_flags.h" +#include "chrome/browser/ash/arc/input_overlay/actions/action.h" +#include "chrome/browser/ash/arc/input_overlay/constants.h" +#include "chrome/browser/ash/arc/input_overlay/db/proto/app_data.pb.h" #include "chrome/browser/ash/arc/input_overlay/ui/action_view.h" +#include "chrome/browser/ash/arc/input_overlay/ui/ui_utils.h" #include "chrome/browser/ash/arc/input_overlay/util.h" #include "chromeos/strings/grit/chromeos_strings.h" #include "ui/accessibility/ax_enums.mojom.h" @@ -17,9 +21,11 @@ #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/chromeos/styles/cros_tokens_color_mappings.h" #include "ui/color/color_id.h" +#include "ui/color/color_provider.h" #include "ui/gfx/canvas.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/color_utils.h" +#include "ui/gfx/geometry/point.h" #include "ui/views/background.h" #include "ui/views/controls/focus_ring.h" #include "ui/views/widget/widget.h" @@ -28,6 +34,9 @@ namespace { +// `TouchPoint` consists of outside stroke, inside stroke and center. +constexpr size_t kTouchPointComponentSize = 3u; + constexpr int kDotCenterDiameter = 14; constexpr int kDotInsideStrokeThickness = 1; constexpr int kDotOutsideStrokeThickness = 3; @@ -73,11 +82,11 @@ SkPath DrawCrossPath(SkScalar overall_length, SkScalar mid_length, SkScalar corner_radius, - SkScalar out_stroke_thickness) { + SkScalar out_stroke_thickness, + SkPoint center) { SkPath path; SkScalar short_length = (overall_length - mid_length) / 2; - path.moveTo(short_length + out_stroke_thickness, - short_length + out_stroke_thickness); + path.moveTo(center.x() - mid_length / 2, center.y() - mid_length / 2); // #0 path.rLineTo(0, -(short_length - corner_radius)); path.rArcTo(corner_radius, corner_radius, 0, SkPath::kSmall_ArcSize, @@ -121,24 +130,89 @@ return path; } -SkPath DrawCrossCenter() { +SkPath DrawCrossCenter(const gfx::Point& center) { return DrawCrossPath( /*overall_length=*/SkIntToScalar(kCrossCenterLength), /*mid_length=*/SkIntToScalar(kCrossCenterMiddleLength), /*corner_radius=*/SkIntToScalar(kCrossCornerRadius), /*out_stroke_thickness=*/ - SkIntToScalar(kCrossOutsideStrokeThickness + - kCrossInsideStrokeThickness)); + SkIntToScalar(kCrossOutsideStrokeThickness + kCrossInsideStrokeThickness), + /*center=*/SkPoint::Make(center.x(), center.y())); } -SkPath DrawCrossOutsideStroke() { +SkPath DrawCrossOutsideStroke(const gfx::Point& center) { return DrawCrossPath( /*overall_length=*/SkIntToScalar(kCrossCenterLength + 2 * kCrossInsideStrokeThickness), /*mid_length=*/ SkIntToScalar(kCrossCenterMiddleLength + 2 * kCrossInsideStrokeThickness), /*corner_radius=*/SkIntToScalar(kCrossCornerRadius), - /*out_stroke_thickness=*/SkIntToScalar(kCrossOutsideStrokeThickness)); + /*out_stroke_thickness=*/SkIntToScalar(kCrossOutsideStrokeThickness), + /*center=*/SkPoint::Make(center.x(), center.y())); +} + +SkColor GetOutsideStrokeColor(ui::ColorProvider* color_provider, + UIState ui_state) { + switch (ui_state) { + case UIState::kDefault: + return IsBeta() ? SkColorSetA(SK_ColorWHITE, GetAlpha(/*percent=*/0.8f)) + : kOutsideStrokeColor; + case UIState::kHover: + return IsBeta() ? SkColorSetA(SK_ColorWHITE, GetAlpha(/*percent=*/0.8f)) + : kOutsideStrokeColorHover; + case UIState::kDrag: + return IsBeta() ? color_provider->GetColor( + cros_tokens::kCrosSysGamingControlButtonBorderHover) + : kOutsideStrokeColorDrag; + default: + NOTREACHED(); + } +} + +SkColor GetInsideStrokeColor(ui::ColorProvider* color_provider, + UIState ui_state) { + switch (ui_state) { + case UIState::kDefault: + return IsBeta() ? SkColorSetA(SK_ColorBLACK, GetAlpha(/*percent=*/0.2f)) + : kInsideStrokeColor; + case UIState::kHover: + return IsBeta() ? SkColorSetA(SK_ColorBLACK, GetAlpha(/*percent=*/0.2f)) + : kInsideStrokeColorHover; + case UIState::kDrag: + return IsBeta() ? SkColorSetA(SK_ColorBLACK, GetAlpha(/*percent=*/0.4f)) + : kInsideStrokeColorDrag; + default: + NOTREACHED(); + } +} + +SkColor GetCenterColor(ui::ColorProvider* color_provider, UIState ui_state) { + switch (ui_state) { + case UIState::kDefault: + return IsBeta() ? color_provider->GetColor( + cros_tokens::kCrosSysGamingControlButtonDefault) + : kCenterColor; + case UIState::kHover: + return IsBeta() ? color_provider->GetColor( + cros_tokens::kCrosSysGamingControlButtonHover) + : color_utils::GetResultingPaintColor( + kCenterColorHover20White, kCenterColor); + case UIState::kDrag: + return IsBeta() ? color_provider->GetColor( + cros_tokens::kCrosSysGamingControlButtonHover) + : color_utils::GetResultingPaintColor( + kCenterColorDrag30White, kCenterColor); + default: + NOTREACHED(); + } +} + +std::array<SkColor, kTouchPointComponentSize> GetColors( + ui::ColorProvider* color_provider, + UIState ui_state) { + return {GetOutsideStrokeColor(color_provider, ui_state), + GetInsideStrokeColor(color_provider, ui_state), + GetCenterColor(color_provider, ui_state)}; } class CrossTouchPoint : public TouchPoint { @@ -159,29 +233,11 @@ // views::View: gfx::Size CalculatePreferredSize() const override { - int size = kCrossCenterLength + 2 * kCrossInsideStrokeThickness + - 2 * kCrossOutsideStrokeThickness; - return gfx::Size(size, size); + return GetSize(ActionType::MOVE); } void OnPaintBackground(gfx::Canvas* canvas) override { - cc::PaintFlags flags; - flags.setAntiAlias(true); - - // Draw outside stroke. - flags.setStyle(cc::PaintFlags::kStroke_Style); - flags.setStrokeWidth(kCrossOutsideStrokeThickness); - flags.setColor(GetOutsideStrokeColor()); - canvas->DrawPath(DrawCrossOutsideStroke(), flags); - // Draw center. - flags.setStyle(cc::PaintFlags::kFill_Style); - flags.setColor(GetCenterColor()); - canvas->DrawPath(DrawCrossCenter(), flags); - // Draw inside stroke. - flags.setStyle(cc::PaintFlags::kStroke_Style); - flags.setStrokeWidth(kCrossInsideStrokeThickness); - flags.setColor(GetInsideStrokeColor()); - canvas->DrawPath(DrawCrossCenter(), flags); + PaintBackground(canvas, ActionType::MOVE); } }; @@ -203,33 +259,11 @@ // views::View: gfx::Size CalculatePreferredSize() const override { - int size = kDotCenterDiameter + 2 * kDotInsideStrokeThickness + - 2 * kDotOutsideStrokeThickness; - return gfx::Size(size, size); + return GetSize(ActionType::TAP); } void OnPaintBackground(gfx::Canvas* canvas) override { - cc::PaintFlags flags; - flags.setAntiAlias(true); - int radius = kDotCenterDiameter / 2; - int center = - radius + kDotInsideStrokeThickness + kDotOutsideStrokeThickness; - - // Draw outside stroke. - flags.setStyle(cc::PaintFlags::kStroke_Style); - flags.setStrokeWidth(kDotOutsideStrokeThickness); - flags.setColor(GetOutsideStrokeColor()); - canvas->DrawCircle(gfx::Point(center, center), - radius + kDotInsideStrokeThickness, flags); - // Draw center. - flags.setStyle(cc::PaintFlags::kFill_Style); - flags.setColor(GetCenterColor()); - canvas->DrawCircle(gfx::Point(center, center), radius, flags); - // Draw inside stroke. - flags.setStyle(cc::PaintFlags::kStroke_Style); - flags.setStrokeWidth(kDotInsideStrokeThickness); - flags.setColor(GetInsideStrokeColor()); - canvas->DrawCircle(gfx::Point(center, center), radius, flags); + PaintBackground(canvas, ActionType::TAP); } }; @@ -274,6 +308,66 @@ return gfx::Size(size, size); } +// static +void TouchPoint::DrawTouchPoint(gfx::Canvas* canvas, + ui::ColorProvider* color_provider, + ActionType action_type, + UIState ui_state, + const gfx::Point& center) { + DCHECK(canvas); + DCHECK(color_provider); + + cc::PaintFlags flags; + flags.setAntiAlias(true); + + const auto colors = GetColors(color_provider, ui_state); + DCHECK_EQ(colors.size(), kTouchPointComponentSize); + + switch (action_type) { + case ActionType::TAP: { + const int radius = kDotCenterDiameter / 2; + const int center_x = center.x(); + const int center_y = center.y(); + + // Draw outside stroke. + flags.setStyle(cc::PaintFlags::kStroke_Style); + flags.setStrokeWidth(kDotOutsideStrokeThickness); + flags.setColor(colors[0]); + canvas->DrawCircle(gfx::Point(center_x, center_y), + radius + kDotInsideStrokeThickness, flags); + // Draw center. + flags.setStyle(cc::PaintFlags::kFill_Style); + flags.setColor(colors[2]); + canvas->DrawCircle(gfx::Point(center_x, center_y), radius, flags); + // Draw inside stroke. + flags.setStyle(cc::PaintFlags::kStroke_Style); + flags.setStrokeWidth(kDotInsideStrokeThickness); + flags.setColor(colors[1]); + canvas->DrawCircle(gfx::Point(center_x, center_y), radius, flags); + } break; + + case ActionType::MOVE: + // Draw outside stroke. + flags.setStyle(cc::PaintFlags::kStroke_Style); + flags.setStrokeWidth(kCrossOutsideStrokeThickness); + flags.setColor(colors[0]); + canvas->DrawPath(DrawCrossOutsideStroke(center), flags); + // Draw center. + flags.setStyle(cc::PaintFlags::kFill_Style); + flags.setColor(colors[2]); + canvas->DrawPath(DrawCrossCenter(center), flags); + // Draw inside stroke. + flags.setStyle(cc::PaintFlags::kStroke_Style); + flags.setStrokeWidth(kCrossInsideStrokeThickness); + flags.setColor(colors[1]); + canvas->DrawPath(DrawCrossCenter(center), flags); + break; + + default: + NOTREACHED(); + } +} + TouchPoint::TouchPoint(const gfx::Point& center_pos) : center_pos_(center_pos) {} @@ -373,70 +467,10 @@ static_cast<ActionView*>(parent())->RemoveMessage(); } -SkColor TouchPoint::GetCenterColor() { - ui::ColorProvider* color_provider = GetColorProvider(); - switch (ui_state_) { - case UIState::kDefault: - return IsBeta() ? color_provider->GetColor(cros_tokens::kCrosRefPrimary70) - : kCenterColor; - case UIState::kHover: - return IsBeta() ? color_provider->GetColor(cros_tokens::kCrosRefPrimary80) - : color_utils::GetResultingPaintColor( - kCenterColorHover20White, kCenterColor); - case UIState::kDrag: - return IsBeta() ? color_provider->GetColor(cros_tokens::kCrosRefPrimary60) - : color_utils::GetResultingPaintColor( - kCenterColorDrag30White, kCenterColor); - default: - NOTREACHED(); - } -} - -SkColor TouchPoint::GetInsideStrokeColor() { - ui::ColorProvider* color_provider = GetColorProvider(); - switch (ui_state_) { - case UIState::kDefault: - return IsBeta() ? SkColorSetA(color_provider->GetColor( - cros_tokens::kCrosRefNeutral100), - 0x99 /*60%*/) - : kInsideStrokeColor; - case UIState::kHover: - return IsBeta() ? SkColorSetA(color_provider->GetColor( - cros_tokens::kCrosRefNeutral100), - 0x99 /*60%*/) - : kInsideStrokeColorHover; - case UIState::kDrag: - return IsBeta() ? color_provider->GetColor(cros_tokens::kCrosRefNeutral90) - : kInsideStrokeColorDrag; - default: - NOTREACHED(); - } -} - -SkColor TouchPoint::GetOutsideStrokeColor() { - ui::ColorProvider* color_provider = GetColorProvider(); - switch (ui_state_) { - case UIState::kDefault: - return IsBeta() - ? SkColorSetA( - color_provider->GetColor(cros_tokens::kCrosSysSurface5), - 0xB3 /*70%*/) - : kOutsideStrokeColor; - case UIState::kHover: - return IsBeta() - ? SkColorSetA( - color_provider->GetColor(cros_tokens::kCrosSysSurface5), - 0xB3 /*70%*/) - : kOutsideStrokeColorHover; - case UIState::kDrag: - return IsBeta() - ? SkColorSetA( - color_provider->GetColor(cros_tokens::kCrosRefPrimary30), - 0x99 /*60%*/) - : kOutsideStrokeColorDrag; - default: - NOTREACHED(); - } +void TouchPoint::PaintBackground(gfx::Canvas* canvas, ActionType action_type) { + const auto size = GetSize(action_type); + DrawTouchPoint(canvas, GetColorProvider(), action_type, ui_state_, + /*center=*/gfx::Point(size.width() / 2, size.height() / 2)); } void TouchPoint::SetToDefault() {
diff --git a/chrome/browser/ash/arc/input_overlay/ui/touch_point.h b/chrome/browser/ash/arc/input_overlay/ui/touch_point.h index 92c5d663..0d579486 100644 --- a/chrome/browser/ash/arc/input_overlay/ui/touch_point.h +++ b/chrome/browser/ash/arc/input_overlay/ui/touch_point.h
@@ -10,6 +10,10 @@ #include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" +namespace gfx { +class Canvas; +} // namespace gfx + namespace ui { class Cursor; } // namespace ui @@ -26,6 +30,15 @@ const gfx::Point& center_pos); static gfx::Size GetSize(ActionType action_type); + // Draws TouchPoint of `action_type` on `canvas`. `ui_state` is related + // whether the TouchPoint is dragged or mouse hovered. `center` is the + // TouchPoint's center coordinates. + static void DrawTouchPoint(gfx::Canvas* canvas, + ui::ColorProvider* color_provider, + ActionType action_type, + UIState ui_state, + const gfx::Point& center); + explicit TouchPoint(const gfx::Point& center_pos); TouchPoint(const TouchPoint&) = delete; TouchPoint& operator=(const TouchPoint&) = delete; @@ -49,9 +62,7 @@ void OnBlur() override; protected: - SkColor GetCenterColor(); - SkColor GetInsideStrokeColor(); - SkColor GetOutsideStrokeColor(); + void PaintBackground(gfx::Canvas* canvas, ActionType action_type); private: void SetToDefault();
diff --git a/chrome/browser/ash/arc/input_overlay/ui/ui_utils.cc b/chrome/browser/ash/arc/input_overlay/ui/ui_utils.cc index 4f4201c..e6f2b82 100644 --- a/chrome/browser/ash/arc/input_overlay/ui/ui_utils.cc +++ b/chrome/browser/ash/arc/input_overlay/ui/ui_utils.cc
@@ -8,6 +8,7 @@ #include "ash/public/cpp/shelf_types.h" #include "ash/root_window_controller.h" #include "ash/shelf/shelf.h" +#include "base/numerics/safe_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ash/arc/input_overlay/constants.h" @@ -158,4 +159,9 @@ return gfx::Rect(x, y, width, height); } +SkAlpha GetAlpha(float opacity_percent) { + return base::saturated_cast<SkAlpha>(std::numeric_limits<SkAlpha>::max() * + opacity_percent); +} + } // namespace arc::input_overlay
diff --git a/chrome/browser/ash/arc/input_overlay/ui/ui_utils.h b/chrome/browser/ash/arc/input_overlay/ui/ui_utils.h index 01aac72..8d9e361 100644 --- a/chrome/browser/ash/arc/input_overlay/ui/ui_utils.h +++ b/chrome/browser/ash/arc/input_overlay/ui/ui_utils.h
@@ -7,6 +7,7 @@ #include <string> +#include "third_party/skia/include/core/SkColor.h" #include "ui/events/keycodes/dom/dom_code.h" namespace aura { @@ -29,6 +30,10 @@ // Returns bounds of `root_window` excluding the shelf if the shelf is visible. gfx::Rect CalculateAvailableBounds(aura::Window* root_window); +// `opacity_percent` is contained within [0.0, 1.0] where 0.0 corresponds to +// fully transparent and 1.0 corresponds to fully opaque. +SkAlpha GetAlpha(float opacity_percent); + } // namespace arc::input_overlay #endif // CHROME_BROWSER_ASH_ARC_INPUT_OVERLAY_UI_UI_UTILS_H_
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest.cc b/chrome/browser/ash/file_manager/file_manager_browsertest.cc index 5435423..e58363e 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest.cc
@@ -1285,64 +1285,43 @@ DriveSpecific, /* drive_specific.js */ LoggedInUserFilesAppBrowserTest, ::testing::Values( - // Google One offer banner checks device state, locale, and country. + // Google One offer banner checks device state. Device state is NOT set + // to `policy::DeviceMode::DEVICE_MODE_CONSUMER` in + // `FilesAppBrowserTest`. TestCase("driveGoogleOneOfferBannerEnabled") .SetDeviceMode(DeviceMode::kConsumerOwned) .SetTestAccountType(TestAccountType::kNonManaged) - .SetLocale("en-US") - .SetCountry("us"), - // Disabled by the flag case. + .EnableGoogleOneOfferFilesBanner(), + // Google One offer banner is disabled by default. TestCase("driveGoogleOneOfferBannerDisabled") .SetDeviceMode(DeviceMode::kConsumerOwned) - .SetTestAccountType(TestAccountType::kNonManaged) - .SetLocale("en-US") - .SetCountry("us") - .DisableGoogleOneOfferFilesBanner(), - // A country is not in supported countries set case. - TestCase("driveGoogleOneOfferBannerDisabled") - .SetDeviceMode(DeviceMode::kConsumerOwned) - .SetTestAccountType(TestAccountType::kNonManaged) - .SetLocale("en-US") - .SetCountry("jp"), - // A locale is not in a supported locales set case. - TestCase("driveGoogleOneOfferBannerDisabled") - .SetDeviceMode(DeviceMode::kConsumerOwned) - .SetTestAccountType(TestAccountType::kNonManaged) - .SetLocale("ja") - .SetCountry("us"), + .SetTestAccountType(TestAccountType::kNonManaged), TestCase("driveGoogleOneOfferBannerDismiss") .SetDeviceMode(DeviceMode::kConsumerOwned) .SetTestAccountType(TestAccountType::kNonManaged) - .SetLocale("en-US") - .SetCountry("us"), + .EnableGoogleOneOfferFilesBanner(), TestCase("driveGoogleOneOfferBannerDismiss") .SetDeviceMode(DeviceMode::kConsumerOwned) .SetTestAccountType(TestAccountType::kNonManaged) - .SetLocale("en-US") - .SetCountry("us") + .EnableGoogleOneOfferFilesBanner() .EnableCrosComponents(), TestCase("driveGoogleOneOfferBannerDisabled") - .SetLocale("en-US") - .SetCountry("us") + .EnableGoogleOneOfferFilesBanner() .SetDeviceMode(DeviceMode::kConsumerOwned) .SetTestAccountType(TestAccountType::kEnterprise), TestCase("driveGoogleOneOfferBannerDisabled") - .SetLocale("en-US") - .SetCountry("us") + .EnableGoogleOneOfferFilesBanner() .SetDeviceMode(DeviceMode::kConsumerOwned) .SetTestAccountType(TestAccountType::kChild), // Google One offer is for a device. The banner will not // be shown for an enrolled device. TestCase("driveGoogleOneOfferBannerDisabled") - .SetLocale("en-US") - .SetCountry("us") + .EnableGoogleOneOfferFilesBanner() .SetDeviceMode(DeviceMode::kEnrolled) .SetTestAccountType(TestAccountType::kNonManaged), // We do not show a banner if a profile is not an owner profile. TestCase("driveGoogleOneOfferBannerDisabled") .EnableGoogleOneOfferFilesBanner() - .SetLocale("en-US") - .SetCountry("us") .SetDeviceMode(kConsumerOwned) .SetTestAccountType(kNonManagedNonOwner), TestCase("driveBulkPinningBannerEnabled") @@ -1473,25 +1452,33 @@ FilesAppBrowserTest, ::testing::Values( TestCase("tabindexSearchBoxFocus").NewDirectoryTree(), - // TODO(b/307657533): enable the tests - // TestCase("tabindexFocus").NewDirectoryTree(), - // TestCase("tabindexFocus").EnableCrosComponents().NewDirectoryTree(), - // TestCase("tabindexFocusDownloads").NewDirectoryTree(), - // TestCase("tabindexFocusDownloads") - // .EnableCrosComponents() - // .NewDirectoryTree(), - // TestCase("tabindexFocusDownloads").InGuestMode().NewDirectoryTree(), - // TestCase("tabindexFocusDirectorySelected").NewDirectoryTree(), - // TestCase("tabindexFocusDirectorySelected") - // .EnableCrosComponents() - // .NewDirectoryTree(), - // TestCase("tabindexOpenDialogDownloads") - // .WithBrowser() - // .NewDirectoryTree(), - // TestCase("tabindexOpenDialogDownloads") - // .WithBrowser() - // .EnableCrosComponents() - // .NewDirectoryTree(), + TestCase("tabindexFocus").NewDirectoryTree(), + TestCase("tabindexFocus").EnableCrosComponents().NewDirectoryTree(), + TestCase("tabindexFocusDownloads").NewDirectoryTree(), + TestCase("tabindexFocusDownloads") + .EnableCrosComponents() + .NewDirectoryTree(), + TestCase("tabindexFocusDownloads").InGuestMode().NewDirectoryTree(), + TestCase("tabindexFocusDirectorySelected").NewDirectoryTree(), + TestCase("tabindexFocusDirectorySelected") + .EnableCrosComponents() + .NewDirectoryTree(), + TestCase("tabindexOpenDialogDownloads") + .WithBrowser() + .NewDirectoryTree(), + TestCase("tabindexOpenDialogDownloads") + .WithBrowser() + .EnableCrosComponents() + .NewDirectoryTree(), + TestCase("tabindexOpenDialogDownloads") + .WithBrowser() + .InGuestMode() + .NewDirectoryTree(), + TestCase("tabindexOpenDialogDownloads") + .WithBrowser() + .InGuestMode() + .EnableCrosComponents() + .NewDirectoryTree(), // Section end - browser tests for new directory tree TestCase("tabindexSearchBoxFocus"), TestCase("tabindexFocus"), @@ -1504,11 +1491,12 @@ TestCase("tabindexOpenDialogDownloads").WithBrowser(), TestCase("tabindexOpenDialogDownloads") .WithBrowser() + .EnableCrosComponents(), + TestCase("tabindexOpenDialogDownloads").WithBrowser().InGuestMode(), + TestCase("tabindexOpenDialogDownloads") + .WithBrowser() + .InGuestMode() .EnableCrosComponents() - // TODO(b/189173190): Enable - // TestCase("tabindexOpenDialogDownloads").WithBrowser(), - // TODO(b/189173190): Enable - // TestCase("tabindexOpenDialogDownloads").WithBrowser().InGuestMode(), // TODO(crbug.com/1236842): Remove flakiness and enable this test. // , // TestCase("tabindexSaveFileDialogDrive").WithBrowser(),
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index cc0c60a..cfc3f4f 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc
@@ -137,7 +137,6 @@ #include "components/prefs/pref_service.h" #include "components/services/app_service/public/cpp/app_launch_util.h" #include "components/user_manager/user_manager.h" -#include "components/variations/service/variations_service.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/storage_partition.h" @@ -200,39 +199,6 @@ namespace file_manager { namespace { -// Waits `ash::locale_util::SwitchLanguage`. -class SwitchLanguageWaiter { - public: - ash::locale_util::SwitchLanguageCallback CreateCallback() { - CHECK(!callback_created_) - << "Only a single callback can be created for a waiter."; - - callback_created_ = true; - return base::BindOnce(&SwitchLanguageWaiter::OnLanguageSwitch, - weak_ptr_factory_.GetWeakPtr()); - } - - void Wait() { - CHECK(!run_loop_.running()) << "This waiter is already waiting."; - run_loop_.Run(); - } - - private: - void OnLanguageSwitch(const ash::locale_util::LanguageSwitchResult& result) { - CHECK(result.success); - CHECK_EQ(result.requested_locale, result.loaded_locale) - << "Requested " << result.requested_locale << " but " - << result.loaded_locale << " is loaded."; - - run_loop_.Quit(); - } - - bool callback_created_ = false; - base::RunLoop run_loop_; - - base::WeakPtrFactory<SwitchLanguageWaiter> weak_ptr_factory_{this}; -}; - // Specialization of the navigation observer that stores web content every time // the OnDidFinishNavigation is called. class WebContentCapturingObserver : public content::TestNavigationObserver { @@ -2468,20 +2434,6 @@ CHECK(profile()); CHECK_EQ(!!browser(), options.browser); - if (!options.locale.empty()) { - SwitchLanguageWaiter waiter; - ash::locale_util::SwitchLanguage( - options.locale, /*enable_locale_keyboard_layouts=*/true, - /*login_layouts_only=*/false, waiter.CreateCallback(), profile()); - waiter.Wait(); - } - - if (!options.country.empty()) { - CHECK( - g_browser_process->variations_service()->OverrideStoredPermanentCountry( - options.country)); - } - if (!options.mount_volumes) { VolumeManager::Get(profile())->RemoveDownloadsDirectoryForTesting(); } else {
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.h b/chrome/browser/ash/file_manager/file_manager_browsertest_base.h index 61939c8..8104526 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.h +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.h
@@ -85,12 +85,6 @@ // Should test run in Guest or Incognito mode? GuestMode guest_mode = NOT_IN_GUEST_MODE; - // Locale used for this test to run. - std::string locale; - - // A stored permanent country in `VariationsService` for this test to run. - std::string country; - // Account type used to log-in for a test session. This option is valid only // for `LoggedInUserFilesAppBrowserTest`. This won't work with `guest_mode` // option. @@ -190,9 +184,8 @@ // Whether test should run with the fsps-in-recents flag. bool enable_fsps_in_recents = false; - // Whether tests should enable Google One offer Files banner. This flag is - // enabled by default. - bool enable_google_one_offer_files_banner = true; + // Whether tests should enable Google One offer Files banner. + bool enable_google_one_offer_files_banner = false; // Whether tests should enable the Google Drive bulk pinning feature. bool enable_drive_bulk_pinning = false;
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_utils.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_utils.cc index a10952d..a89990a 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_utils.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_utils.cc
@@ -26,16 +26,6 @@ return *this; } -TestCase& TestCase::SetLocale(const std::string& locale) { - options.locale = locale; - return *this; -} - -TestCase& TestCase::SetCountry(const std::string& country) { - options.country = country; - return *this; -} - TestCase& TestCase::EnableGenericDocumentsProvider() { options.arc = true; options.generic_documents_provider = true; @@ -184,11 +174,6 @@ return *this; } -TestCase& TestCase::DisableGoogleOneOfferFilesBanner() { - options.enable_google_one_offer_files_banner = false; - return *this; -} - TestCase& TestCase::FeatureIds(const std::vector<std::string>& ids) { options.feature_ids = ids; return *this; @@ -234,17 +219,6 @@ full_name += "_TabletMode"; } - if (!options.locale.empty()) { - // You cannot use `-` in a test case name. - std::string locale_for_name; - base::ReplaceChars(options.locale, "-", "_", &locale_for_name); - full_name += "_" + locale_for_name; - } - - if (!options.country.empty()) { - full_name += "_" + options.country; - } - if (options.offline) { full_name += "_Offline"; }
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_utils.h b/chrome/browser/ash/file_manager/file_manager_browsertest_utils.h index 388cf84..48b7d62 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_utils.h +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_utils.h
@@ -32,10 +32,6 @@ TestCase& TabletMode(); - TestCase& SetLocale(const std::string& locale); - - TestCase& SetCountry(const std::string& country); - TestCase& EnableGenericDocumentsProvider(); TestCase& DisableGenericDocumentsProvider(); @@ -102,8 +98,6 @@ TestCase& EnableGoogleOneOfferFilesBanner(); - TestCase& DisableGoogleOneOfferFilesBanner(); - TestCase& FeatureIds(const std::vector<std::string>& ids); TestCase& EnableBulkPinning();
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 d7abbb6..13bde33 100644 --- a/chrome/browser/ash/file_manager/file_manager_string_util.cc +++ b/chrome/browser/ash/file_manager/file_manager_string_util.cc
@@ -11,7 +11,6 @@ #include "ash/constants/ash_features.h" #include "ash/system/time/calendar_utils.h" #include "ash/system/time/date_helper.h" -#include "base/containers/fixed_flat_set.h" #include "base/feature_list.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -39,7 +38,6 @@ #include "chromeos/constants/chromeos_features.h" #include "components/strings/grit/components_strings.h" #include "components/user_manager/user_manager.h" -#include "components/variations/service/variations_service.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/webui/web_ui_util.h" #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" @@ -88,14 +86,6 @@ // Location of the help page about no-action-available files. const int kNoActionForFileHelpNumber = 1700055; -// Supported locales of Google One offer banner. -constexpr auto kGoogleOneOfferBannerSupportedLocales = - base::MakeFixedFlatSet<std::string>({"en-US", "en-GB", "en-AU", "en-CA"}); - -// Supported countries of Google One offer banner. -constexpr auto kGoogleOneOfferBannerSupportedCountries = - base::MakeFixedFlatSet<std::string>({"us", "gb", "au", "ca"}); - #define SET_STRING(id, idr) dict->Set(id, l10n_util::GetStringUTF16(idr)) #define SET_STRING_PLURAL(id, idr, n) \ @@ -1219,17 +1209,6 @@ return false; } - if (!kGoogleOneOfferBannerSupportedLocales.contains( - g_browser_process->GetApplicationLocale())) { - return false; - } - - if (!kGoogleOneOfferBannerSupportedCountries.contains( - g_browser_process->variations_service() - ->GetStoredPermanentCountry())) { - return false; - } - return base::FeatureList::IsEnabled( ash::features::kGoogleOneOfferFilesBanner); }
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_browsertest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_browsertest.cc index b1168ba5..293411b 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_browsertest.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_browsertest.cc
@@ -81,7 +81,7 @@ // Additional webapp usage buffer period before the browser is actually closed. // Used when validating reported app usage data. -constexpr base::TimeDelta kWebAppUsageBufferPeriod = base::Seconds(5); +constexpr base::TimeDelta kWebAppUsageBufferPeriod = base::Seconds(10); void AssertRecordData(Priority priority, const Record& record) { EXPECT_THAT(priority, Eq(Priority::MANUAL_BATCH));
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.cc index d8bbff2..f3ab9af 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.cc
@@ -92,20 +92,21 @@ : FatalCrashEventsObserver( base::FilePath(kDefaultReportedLocalIdSaveFilePath), base::FilePath(kDefaultUploadedCrashInfoSaveFilePath), - /*reported_local_id_io_task_runner=*/nullptr) {} + /*reported_local_id_io_task_runner=*/nullptr, + /*uploaded_crash_info_io_task_runner=*/nullptr) {} FatalCrashEventsObserver::FatalCrashEventsObserver( base::FilePath reported_local_id_save_file, base::FilePath uploaded_crash_info_save_file, - scoped_refptr<base::SequencedTaskRunner> reported_local_id_io_task_runner) + scoped_refptr<base::SequencedTaskRunner> reported_local_id_io_task_runner, + scoped_refptr<base::SequencedTaskRunner> uploaded_crash_info_io_task_runner) : MojoServiceEventsObserverBase<ash::cros_healthd::mojom::EventObserver>( this), reported_local_id_manager_{ReportedLocalIdManager::Create( std::move(reported_local_id_save_file), // Don't BindPostTask here, because it would risk calling // `ProcessEventsBeforeSaveFilesLoaded` twice, once from - // reported_local_id_manager_, once from uploaded_crash_info_manager_ - // (TODO(b/266018440): to be implemented). + // reported_local_id_manager_, once from uploaded_crash_info_manager_. /*save_file_loaded_callback=*/ base::BindOnce( &FatalCrashEventsObserver::ProcessEventsBeforeSaveFilesLoaded, @@ -114,7 +115,17 @@ base::Unretained(this)), std::move(reported_local_id_io_task_runner))}, uploaded_crash_info_manager_{UploadedCrashInfoManager::Create( - std::move(uploaded_crash_info_save_file))} {} + std::move(uploaded_crash_info_save_file), + // Don't BindPostTask here, because it would risk calling + // `ProcessEventsBeforeSaveFilesLoaded` twice, once from + // reported_local_id_manager_, once from uploaded_crash_info_manager_. + /*save_file_loaded_callback=*/ + base::BindOnce( + &FatalCrashEventsObserver::ProcessEventsBeforeSaveFilesLoaded, + // Called from member uploaded_crash_info_manager_ from + // the same sequence, safe to assume this instance is still alive. + base::Unretained(this)), + std::move(uploaded_crash_info_io_task_runner))} {} FatalCrashEventsObserver::~FatalCrashEventsObserver() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -234,8 +245,8 @@ bool FatalCrashEventsObserver::AreSaveFilesLoaded() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - // TODO(b/266018440): Also off-load uploaded_crash_info_manager_'s save file. - return reported_local_id_manager_->IsSaveFileLoaded(); + return reported_local_id_manager_->IsSaveFileLoaded() && + uploaded_crash_info_manager_->IsSaveFileLoaded(); } void FatalCrashEventsObserver::ProcessEventsBeforeSaveFilesLoaded() { @@ -243,8 +254,7 @@ if (!AreSaveFilesLoaded()) { // Don't do anything if not yet loaded. There are two save files, // REPORTED_LOCAL_IDS and UPLOADED_CRASH_INFO. This function is called when - // either save file is loaded(TODO(b/266018440): UPLOADED_CRASH_INFO to be - // implemented). + // either save file is loaded. // // The first call to this method would likely reach here as it is called // when the first save file is loaded, since the other file is not yet
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.h b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.h index 236e350..951ffe8 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.h +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.h
@@ -84,10 +84,12 @@ // This constructor enables the test code to use non-default values of the // input parameters to accommodate the test environment. In production code, // they are always the default value specified in the default constructor. - FatalCrashEventsObserver(base::FilePath reported_local_id_save_file, - base::FilePath uploaded_crash_info_save_file, - scoped_refptr<base::SequencedTaskRunner> - reported_local_id_io_task_runner); + FatalCrashEventsObserver( + base::FilePath reported_local_id_save_file, + base::FilePath uploaded_crash_info_save_file, + scoped_refptr<base::SequencedTaskRunner> reported_local_id_io_task_runner, + scoped_refptr<base::SequencedTaskRunner> + uploaded_crash_info_io_task_runner); MetricData FillFatalCrashTelemetry( const ::ash::cros_healthd::mojom::CrashEventInfoPtr& info);
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_reported_local_id_manager.h b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_reported_local_id_manager.h index c91a51b4..12841b8 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_reported_local_id_manager.h +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_reported_local_id_manager.h
@@ -41,7 +41,7 @@ // // - save_file_path: Path to the save file. // - save_file_loaded_callback: The value of `save_file_loaded_callback_`. See - // - its document. + // its document. // - io_task_runner: The task runner to run IO tasks on. If nullptr, the // constructor would create a default task runner. static std::unique_ptr<ReportedLocalIdManager> Create( @@ -142,6 +142,8 @@ // Remove the local ID entry corresponding to the earliest unuploaded crash. void RemoveEarliestLocalIdEntry(); + // This instance is always on the same sequence as that of the owning + // `FatalCrashEventsObserver` instance. SEQUENCE_CHECKER(sequence_checker_); // The file that saves reported local IDs. It is in the CSV format: csv @@ -179,10 +181,8 @@ SaveFileLoadedCallback save_file_loaded_callback_ GUARDED_BY_CONTEXT(sequence_checker_); - // The task runner that performs IO. This instance would not be recreated in - // production code, but may be in unit tests. - const scoped_refptr<base::SequencedTaskRunner> io_task_runner_ - GUARDED_BY_CONTEXT(sequence_checker_); + // The task runner that performs IO. + const scoped_refptr<base::SequencedTaskRunner> io_task_runner_; base::WeakPtrFactory<ReportedLocalIdManager> weak_factory_{this}; };
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_test_util.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_test_util.cc index fa45f07..4a06d9d5 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_test_util.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_test_util.cc
@@ -8,6 +8,7 @@ #include "base/files/file_path.h" #include "base/functional/bind.h" +#include "base/functional/callback_helpers.h" #include "base/memory/ptr_util.h" #include "base/memory/scoped_refptr.h" #include "base/run_loop.h" @@ -26,16 +27,27 @@ std::unique_ptr<FatalCrashEventsObserver> FatalCrashEventsObserver::TestEnvironment::CreateFatalCrashEventsObserver( - scoped_refptr<base::SequencedTaskRunner> reported_local_id_io_task_runner) + scoped_refptr<base::SequencedTaskRunner> reported_local_id_io_task_runner, + scoped_refptr<base::SequencedTaskRunner> uploaded_crash_info_io_task_runner) const { auto observer = base::WrapUnique(new FatalCrashEventsObserver( GetReportedLocalIdSaveFilePath(), GetUploadedCrashInfoSaveFilePath(), - reported_local_id_io_task_runner)); + reported_local_id_io_task_runner, uploaded_crash_info_io_task_runner)); + DCHECK_CALLED_ON_VALID_SEQUENCE(observer->sequence_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE( + observer->reported_local_id_manager_->sequence_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE( + observer->uploaded_crash_info_manager_->sequence_checker_); + + // For most tests, we focus on the behavior after save files are loaded. In + // these tests, no IO task runner is specifically provided by the test code. + // Thus, make sure IO is completed to prevent flaky tests. if (reported_local_id_io_task_runner == nullptr) { - // For most tests, we focus on the behavior after save files are loaded. - // Thus, make sure IO is completed to prevent flaky tests. - FlushIoTasks(*observer); + FlushTaskRunner(observer->reported_local_id_manager_->io_task_runner_); + } + if (uploaded_crash_info_io_task_runner == nullptr) { + FlushTaskRunner(observer->uploaded_crash_info_manager_->io_task_runner_); } // Clear tasks such as registering the observer. @@ -78,14 +90,33 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(observer.sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE( observer.reported_local_id_manager_->sequence_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE( + observer.uploaded_crash_info_manager_->sequence_checker_); - // Block the main thread while flushing IO tasks. Not using `PostTaskAndReply` - // on QuitClosure because the QuitClosure task must be posted first before the - // main thread can be unblocked to prevent race. + FlushTaskRunner(observer.reported_local_id_manager_->io_task_runner_); + FlushTaskRunner(observer.uploaded_crash_info_manager_->io_task_runner_); +} + +// static +void FatalCrashEventsObserver::TestEnvironment::FlushTaskRunner( + scoped_refptr<base::SequencedTaskRunner> task_runner) { + base::RunLoop run_loop; + task_runner->PostTaskAndReply(FROM_HERE, base::DoNothing(), + run_loop.QuitClosure()); + run_loop.Run(); +} + +// static +void FatalCrashEventsObserver::TestEnvironment:: + FlushTaskRunnerWithCurrentSequenceBlocked( + scoped_refptr<base::SequencedTaskRunner> task_runner) { + // Block the main thread while flushing IO tasks. Not using + // `PostTaskAndReply` on QuitClosure because the QuitClosure task must be + // posted first before the main thread can be unblocked to prevent race. SequenceBlocker sequence_blocker( base::SequencedTaskRunner::GetCurrentDefault()); base::RunLoop run_loop; - observer.reported_local_id_manager_->io_task_runner_->PostTask( + task_runner->PostTask( FROM_HERE, base::BindOnce( [](scoped_refptr<base::SequencedTaskRunner> main_task_runner,
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_test_util.h b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_test_util.h index 0e5c1e1..3e5d3bc 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_test_util.h +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_test_util.h
@@ -65,7 +65,9 @@ // runner to the caller). std::unique_ptr<FatalCrashEventsObserver> CreateFatalCrashEventsObserver( scoped_refptr<base::SequencedTaskRunner> - reported_local_id_io_task_runner = nullptr) const; + reported_local_id_io_task_runner = nullptr, + scoped_refptr<base::SequencedTaskRunner> + uploaded_crash_info_io_task_runner = nullptr) const; // Get the mutable test settings of the observer. static SettingsForTest& GetTestSettings(FatalCrashEventsObserver& observer); @@ -77,16 +79,25 @@ // usage is correctly limited. static size_t GetLocalIdEntryQueueSize(FatalCrashEventsObserver& observer); - // Flushes all IO tasks. Also post a blocking task to the calling thread to - // prevent the calling thread to move forward beyond the current tasks in - // queue. Unblock the calling thread once the IO tasks are flushed. + // Flushes all IO tasks at the time of the call. static void FlushIoTasks(FatalCrashEventsObserver& observer); + // Flush the tasks on the given task runner at the time of the call. + static void FlushTaskRunner( + scoped_refptr<base::SequencedTaskRunner> task_runner); + + // Flush the tasks on the given task runner at the time of the call. Also + // posts a blocking task to the calling thread to prevent the calling thread + // to move forward beyond the current tasks in queue. Unblock the calling + // thread once the IO tasks are flushed. + static void FlushTaskRunnerWithCurrentSequenceBlocked( + scoped_refptr<base::SequencedTaskRunner> task_runner); + private: - base::FilePath temp_dir_{base::CreateUniqueTempDirectoryScopedToTest()}; - base::FilePath reported_local_id_save_file_path_{ + const base::FilePath temp_dir_{base::CreateUniqueTempDirectoryScopedToTest()}; + const base::FilePath reported_local_id_save_file_path_{ temp_dir_.Append("REPORTED_LOCAL_IDS")}; - base::FilePath uploaded_crash_info_save_file_path_{ + const base::FilePath uploaded_crash_info_save_file_path_{ temp_dir_.Append("UPLOADED_CRASH_INFO")}; }; } // namespace reporting
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_unittest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_unittest.cc index dd6a7188..a2b667d 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_unittest.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_unittest.cc
@@ -403,11 +403,6 @@ // FatalCrashEventsObserver::OnEvent directly to emulate the effect of // FakeCrosHealthd::Get()->EmitEventForCategory(). - if (is_uploaded()) { - GTEST_SKIP() << "Slow file loading for uploaded crashes will be added once " - "its IO offloading is done"; - } - // Need 4 crash events to work around limitations in manipulating tasks in a // sequence. static constexpr size_t kNumCrashes = 4; @@ -415,13 +410,17 @@ "First local ID", "Second local ID", "Third Local ID", "Fourth Local ID"}; std::array<CrashEventInfoPtr, kNumCrashes> crash_event_infos = { - NewCrashEventInfo(/*is_uploaded=*/is_uploaded()), - NewCrashEventInfo(/*is_uploaded=*/is_uploaded()), - NewCrashEventInfo(/*is_uploaded=*/is_uploaded()), - NewCrashEventInfo(/*is_uploaded=*/is_uploaded())}; + NewCrashEventInfo(is_uploaded()), NewCrashEventInfo(is_uploaded()), + NewCrashEventInfo(is_uploaded()), NewCrashEventInfo(is_uploaded())}; for (size_t i = 0; i < crash_event_infos.size(); ++i) { // Test the local ID field sufficient. crash_event_infos[i]->local_id = kLocalIds[i]; + + // Make uploaded crashes have increasing offset, which is the most practical + // scenario. + if (crash_event_infos[i]->upload_info) { + crash_event_infos[i]->upload_info->offset = i; + } } const auto io_task_runner = base::ThreadPool::CreateSequencedTaskRunner( @@ -433,7 +432,10 @@ // Create and set up the observer object. auto observer = fatal_crash_test_environment_.CreateFatalCrashEventsObserver( - /*reported_local_id_io_task_runner=*/io_task_runner); + /*reported_local_id_io_task_runner=*/is_uploaded() ? nullptr + : io_task_runner, + /*uploaded_crash_info_io_task_runner=*/is_uploaded() ? io_task_runner + : nullptr); DCHECK_CALLED_ON_VALID_SEQUENCE( FatalCrashEventsObserver::TestEnvironment::GetTestSettings(*observer) .sequence_checker); @@ -477,7 +479,8 @@ ASSERT_TRUE(!observer->AreSaveFilesLoaded()) << "Internal error: Save files are loaded even task thread is blocked"; sequence_blocker.Unblock(); - FatalCrashEventsObserver::TestEnvironment::FlushIoTasks(*observer); + FatalCrashEventsObserver::TestEnvironment:: + FlushTaskRunnerWithCurrentSequenceBlocked(io_task_runner); ASSERT_TRUE(observer->AreSaveFilesLoaded()) << "Internal error: Flushing IO tasks does not finish loading save files"; base::SequencedTaskRunner::GetCurrentDefault()->PostTask( @@ -1619,6 +1622,10 @@ CreateFatalCrashEvent(kCrashReportId, kZeroCreationTime, kZeroOffset, *fatal_crash_events_observer, &result_metric_data); + // Make sure the save file writing task is executed. + FatalCrashEventsObserver::TestEnvironment::FlushIoTasks( + *fatal_crash_events_observer); + // The save file is now available. Make it unreadable. ASSERT_TRUE(base::PathExists(GetSaveFilePath())); ASSERT_TRUE(base::MakeFileUnreadable(GetSaveFilePath()));
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_uploaded_crash_info_manager.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_uploaded_crash_info_manager.cc index 5ea68ed2..c6d277bd 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_uploaded_crash_info_manager.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_uploaded_crash_info_manager.cc
@@ -21,8 +21,13 @@ #include "base/sequence_checker.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" +#include "base/task/task_runner.h" +#include "base/task/thread_pool.h" #include "base/time/time.h" +#include "base/types/expected.h" #include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_events.mojom.h" +#include "components/reporting/util/status.h" +#include "components/reporting/util/statusor.h" namespace reporting { @@ -39,23 +44,26 @@ // static std::unique_ptr<FatalCrashEventsObserver::UploadedCrashInfoManager> FatalCrashEventsObserver::UploadedCrashInfoManager::Create( - base::FilePath save_file_path) { - return base::WrapUnique( - new UploadedCrashInfoManager(std::move(save_file_path))); + base::FilePath save_file_path, + SaveFileLoadedCallback save_file_loaded_callback, + scoped_refptr<base::SequencedTaskRunner> io_task_runner) { + return base::WrapUnique(new UploadedCrashInfoManager( + std::move(save_file_path), std::move(save_file_loaded_callback), + std::move(io_task_runner))); } FatalCrashEventsObserver::UploadedCrashInfoManager::UploadedCrashInfoManager( - base::FilePath save_file_path) - : save_file_{std::move(save_file_path)} { - auto result = LoadSaveFile(); - if (!result.has_value()) { - LOG(ERROR) << result.error(); - return; - } - - uploads_log_creation_time_ = base::Time::FromMillisecondsSinceUnixEpoch( - result.value().uploads_log_creation_timestamp_ms); - uploads_log_offset_ = result.value().uploads_log_offset; + base::FilePath save_file_path, + SaveFileLoadedCallback save_file_loaded_callback, + scoped_refptr<base::SequencedTaskRunner> io_task_runner) + : save_file_{std::move(save_file_path)}, + save_file_loaded_callback_{std::move(save_file_loaded_callback)}, + io_task_runner_{io_task_runner == nullptr + ? base::ThreadPool::CreateSequencedTaskRunner( + {base::TaskShutdownBehavior::BLOCK_SHUTDOWN, + base::MayBlock()}) + : std::move(io_task_runner)} { + LoadSaveFile(); } FatalCrashEventsObserver::UploadedCrashInfoManager:: @@ -63,81 +71,110 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } -base::expected<FatalCrashEventsObserver::UploadedCrashInfoManager::ParseResult, - Status> -FatalCrashEventsObserver::UploadedCrashInfoManager::LoadSaveFile() { +void FatalCrashEventsObserver::UploadedCrashInfoManager::LoadSaveFile() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - std::string content; - if (!base::ReadFileToString(save_file_, &content)) { - return base::unexpected(Status( - error::INTERNAL, - base::StrCat({"Failed to read save file: ", save_file_.value()}))); + io_task_runner_->PostTaskAndReplyWithResult( + FROM_HERE, + base::BindOnce( + [](base::FilePath save_file) -> StatusOr<std::string> { + if (!base::PathExists(save_file)) { + // File has never been written yet, skip loading it. + return std::string(); + } + + std::string content; + if (!base::ReadFileToString(save_file, &content)) { + std::string error_message = base::StrCat( + {"Failed to read save file: ", save_file.value()}); + LOG(ERROR) << error_message; + return base::unexpected( + Status(error::INTERNAL, std::move(error_message))); + } + + return content; + }, + save_file_), + base::BindOnce(&UploadedCrashInfoManager::ResumeLoadingSaveFile, + weak_factory_.GetWeakPtr())); +} + +void FatalCrashEventsObserver::UploadedCrashInfoManager::ResumeLoadingSaveFile( + const StatusOr<std::string>& content) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + CHECK(save_file_loaded_callback_); + + base::ScopedClosureRunner run_callback_on_return(base::BindOnce( + [](bool* save_file_loaded, SaveFileLoadedCallback callback) { + *save_file_loaded = true; + std::move(callback).Run(); + }, + &save_file_loaded_, std::move(save_file_loaded_callback_))); + + if (!content.has_value()) { + // Error already logged immediately after reading file fails. + return; } const auto parsed_result = - base::JSONReader::ReadAndReturnValueWithError(content); + base::JSONReader::ReadAndReturnValueWithError(content.value()); if (!parsed_result.has_value()) { - return base::unexpected(Status( - error::INTERNAL, - base::StrCat({"Failed to parse the save file ", save_file_.value(), - " as JSON: ", parsed_result.error().ToString()}))); + LOG(ERROR) << "Failed to parse the save file " << save_file_.value() + << " as JSON: " << parsed_result.error().ToString(); + return; } const auto* const dict_result = parsed_result.value().GetIfDict(); if (dict_result == nullptr) { - return base::unexpected( - Status(error::INTERNAL, - base::StrCat({"Parsed JSON string is not a dict: ", - TruncateString(content, /*size=*/200u)}))); + LOG(ERROR) << "Parsed JSON string is not a dict: " + << TruncateString(content.value(), /*size=*/200u); + return; } const auto* const creation_timestamp_ms_string = dict_result->FindString(kCreationTimestampMsJsonKey); if (creation_timestamp_ms_string == nullptr) { - return base::unexpected(Status( - error::INTERNAL, - base::StrCat( - {"Creation timestamp key ", kCreationTimestampMsJsonKey, - " not found in JSON: ", TruncateString(content, /*size=*/200u)}))); + LOG(ERROR) << "Creation timestamp key " << kCreationTimestampMsJsonKey + << " not found in JSON: " + << TruncateString(content.value(), /*size=*/200u); + return; } ParseResult result; if (!base::StringToInt64(*creation_timestamp_ms_string, &result.uploads_log_creation_timestamp_ms)) { - return base::unexpected( - Status(error::INTERNAL, - base::StrCat({"Failed to convert timestamp ", - *creation_timestamp_ms_string, " to int64."}))); + LOG(ERROR) << "Failed to convert timestamp " + << *creation_timestamp_ms_string << " to int64."; + return; } if (result.uploads_log_creation_timestamp_ms < 0) { - return base::unexpected( - Status(error::INTERNAL, - base::StrCat({"Timestamp ", *creation_timestamp_ms_string, - " is negative."}))); + LOG(ERROR) << "Timestamp " << *creation_timestamp_ms_string + << " is negative."; + return; } const auto* const offset_string = dict_result->FindString(kOffsetJsonKey); if (offset_string == nullptr) { - return base::unexpected(Status( - error::INTERNAL, - base::StrCat({"Offset key ", kOffsetJsonKey, " not found in JSON: ", - TruncateString(content, /*size=*/200u)}))); + LOG(ERROR) << "Offset key " << kOffsetJsonKey << " not found in JSON: " + << TruncateString(content.value(), /*size=*/200u); + return; } if (!base::StringToUint64(*offset_string, &result.uploads_log_offset)) { - return base::unexpected( - Status(error::INTERNAL, base::StrCat({"Failed to convert offset ", - *offset_string, " to uint64."}))); + LOG(ERROR) << "Failed to convert offset " << *offset_string + << " to uint64."; + return; } // Ignore additional keys here even if they are present, so as to keep // slightly better flexibility when more fields are added to this JSON file // (thus reversion won't break the current code). - return result; + uploads_log_creation_time_ = base::Time::FromMillisecondsSinceUnixEpoch( + result.uploads_log_creation_timestamp_ms); + uploads_log_offset_ = result.uploads_log_offset; } Status FatalCrashEventsObserver::UploadedCrashInfoManager::WriteSaveFile() @@ -156,20 +193,31 @@ "Failed to create a JSON string for uploaded crash info"); } - // Write to the temp save file first, then rename it to the official save - // file. This would prevent partly written file to be effective, as renaming - // within the same partition is atomic on POSIX systems. - if (!base::WriteFile(save_file_tmp_, content.value())) { - return Status(error::INTERNAL, base::StrCat({"Failed to write save file ", - save_file_tmp_.value()})); - } - if (base::File::Error err; - !base::ReplaceFile(save_file_tmp_, save_file_, &err)) { - std::ostringstream err_msg; - err_msg << "Failed to move file from " << save_file_tmp_ << " to " - << save_file_ << ": " << err; - return Status(error::INTERNAL, err_msg.str()); - } + // TODO(b/266018440): Find a way to cancel all tasks on io_task_runner_ that + // has not been executed yet, as later save file writing tasks will always + // override the results of earlier ones. + io_task_runner_->PostTask( + FROM_HERE, + base::BindOnce( + [](base::FilePath save_file, base::FilePath save_file_tmp, + std::string content) { + // Write to the temp save file first, then rename it to the official + // save file. This would prevent partly written file to be + // effective, as renaming within the same partition is atomic on + // POSIX systems. + if (!base::WriteFile(save_file_tmp, content)) { + LOG(ERROR) << "Failed to write save file " << save_file_tmp; + return; + } + if (base::File::Error err; + !base::ReplaceFile(save_file_tmp, save_file, &err)) { + LOG(ERROR) << "Failed to move file from " << save_file_tmp + << " to " << save_file << ": " << err; + return; + } + // Successfully written the save file. + }, + save_file_, save_file_tmp_, std::move(content).value())); return Status::StatusOK(); } @@ -207,4 +255,10 @@ return; } } + +bool FatalCrashEventsObserver::UploadedCrashInfoManager::IsSaveFileLoaded() + const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + return save_file_loaded_; +} } // namespace reporting
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_uploaded_crash_info_manager.h b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_uploaded_crash_info_manager.h index 32d8d82..b09f9a0 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_uploaded_crash_info_manager.h +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer_uploaded_crash_info_manager.h
@@ -8,19 +8,35 @@ #include <memory> #include <string_view> +#include "base/memory/scoped_refptr.h" #include "base/sequence_checker.h" +#include "base/task/sequenced_task_runner.h" #include "base/time/time.h" -#include "base/types/expected.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/fatal_crash/fatal_crash_events_observer.h" #include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_events.mojom.h" #include "components/reporting/util/status.h" +#include "components/reporting/util/statusor.h" namespace reporting { class FatalCrashEventsObserver::UploadedCrashInfoManager { public: + // Callback type once the save file is loaded. + using SaveFileLoadedCallback = base::OnceCallback<void()>; + + // Create a `UploadedCrashInfoManager` instance. + // + // Params: + // + // - save_file_path: Path to the save file. + // - save_file_loaded_callback: The value of `save_file_loaded_callback_`. See + // its document. + // - io_task_runner: The task runner to run IO tasks on. If nullptr, the + // constructor would create a default task runner. static std::unique_ptr<UploadedCrashInfoManager> Create( - base::FilePath save_file_path); + base::FilePath save_file_path, + SaveFileLoadedCallback save_file_loaded_callback, + scoped_refptr<base::SequencedTaskRunner> io_task_runner); UploadedCrashInfoManager(const UploadedCrashInfoManager&) = delete; UploadedCrashInfoManager& operator=(const UploadedCrashInfoManager&) = delete; virtual ~UploadedCrashInfoManager(); @@ -33,6 +49,9 @@ void Update(base::Time uploads_log_creation_time, uint64_t uploads_log_offset); + // Indicates whether the save file has been loaded. + bool IsSaveFileLoaded() const; + private: // Give `TestEnvironment` the access to the JSON key strings. friend class FatalCrashEventsObserver::TestEnvironment; @@ -47,32 +66,61 @@ "creation_timestamp_ms"; static constexpr std::string_view kOffsetJsonKey = "offset"; - explicit UploadedCrashInfoManager(base::FilePath save_file_path); + explicit UploadedCrashInfoManager( + base::FilePath save_file_path, + SaveFileLoadedCallback save_file_loaded_callback, + scoped_refptr<base::SequencedTaskRunner> io_task_runner); // Loads the save file in JSON format. - [[nodiscard]] base::expected<ParseResult, Status> LoadSaveFile(); - // Writes the save file in JSON format. + void LoadSaveFile(); + + // Resume loading save file after the IO part is done. + void ResumeLoadingSaveFile(const StatusOr<std::string>& content); + + // Writes the save file in JSON format. Returns an OK status if everything + // other than file writing itself succeeds. If file writing fails, it will be + // logged from the IO sequence. Status WriteSaveFile() const; + // Is the given creation time and offset newer than the currently saved. bool IsNewer(base::Time uploads_log_creation_time, uint64_t uploads_log_offset) const; + // This instance is always on the same sequence as that of the owning + // `FatalCrashEventsObserver` instance. SEQUENCE_CHECKER(sequence_checker_); // The JSON file that saves the creation time and offset of uploads.log // since last report. const base::FilePath save_file_ GUARDED_BY_CONTEXT(sequence_checker_); + // The temporary save file that was written to before updating `save_file_`. const base::FilePath save_file_tmp_ GUARDED_BY_CONTEXT(sequence_checker_){ save_file_.AddExtension(".tmp")}; + // The creation time of uploads.log of the last reported crash. Initialize // this to minimum creation time possible so that the first uploaded crash // (which always has a creation time larger than `base::Time::Min()`) would // always be reported. base::Time uploads_log_creation_time_ GUARDED_BY_CONTEXT(sequence_checker_){ base::Time::Min()}; + // The offset of uploads.log of the last reported crash. uint64_t uploads_log_offset_ GUARDED_BY_CONTEXT(sequence_checker_){0u}; + + // Indicates whether loading has finished. + bool save_file_loaded_ GUARDED_BY_CONTEXT(sequence_checker_){false}; + + // Called when the save file is loaded. Should only be called once because the + // save file is only loaded once throughout the lifetime of this class + // instance. + SaveFileLoadedCallback save_file_loaded_callback_ + GUARDED_BY_CONTEXT(sequence_checker_); + + // The task runner that performs IO. + const scoped_refptr<base::SequencedTaskRunner> io_task_runner_; + + base::WeakPtrFactory<UploadedCrashInfoManager> weak_factory_{this}; }; } // namespace reporting
diff --git a/chrome/browser/ash/system_web_apps/apps/help_app/help_app_untrusted_ui_config.cc b/chrome/browser/ash/system_web_apps/apps/help_app/help_app_untrusted_ui_config.cc index c1397fc..583dc2ff 100644 --- a/chrome/browser/ash/system_web_apps/apps/help_app/help_app_untrusted_ui_config.cc +++ b/chrome/browser/ash/system_web_apps/apps/help_app/help_app_untrusted_ui_config.cc
@@ -80,10 +80,10 @@ "device-help-content-id")); // Add any features that have been enabled. - source->AddBoolean("colorThemes", true); source->AddBoolean("HelpAppAppsGamesBannerV2", true); - source->AddBoolean("HelpAppDynamicHomePageBanner", true); - source->AddBoolean("HelpAppReleaseNotes", true); + source->AddBoolean( + "HelpAppCrosComponents", + base::FeatureList::IsEnabled(ash::features::kHelpAppCrosComponents)); source->AddBoolean( "HelpAppHomePageAppArticles", base::FeatureList::IsEnabled(ash::features::kHelpAppHomePageAppArticles)); @@ -99,7 +99,6 @@ base::FeatureList::IsEnabled(features::kEnableLocalSearchService)); source->AddBoolean("isCloudGamingDevice", chromeos::features::IsCloudGamingDeviceEnabled()); - source->AddBoolean("jelly", chromeos::features::IsJellyEnabled()); Profile* profile = Profile::FromWebUI(web_ui); PrefService* pref_service = profile->GetPrefs();
diff --git a/chrome/browser/banners/app_banner_manager_browsertest.cc b/chrome/browser/banners/app_banner_manager_browsertest.cc index 8cc0e60..a0cd679 100644 --- a/chrome/browser/banners/app_banner_manager_browsertest.cc +++ b/chrome/browser/banners/app_banner_manager_browsertest.cc
@@ -20,11 +20,7 @@ #include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "chrome/browser/banners/app_banner_manager_browsertest_base.h" -#include "chrome/browser/banners/app_banner_manager_desktop.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/test/base/ui_test_utils.h" #include "components/network_session_configurator/common/network_switches.h" #include "components/site_engagement/content/site_engagement_score.h" #include "components/site_engagement/content/site_engagement_service.h" @@ -51,6 +47,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/features.h" +#if !BUILDFLAG(IS_ANDROID) +#include "chrome/browser/ui/browser.h" +#endif namespace webapps { @@ -255,30 +254,29 @@ } protected: - std::unique_ptr<AppBannerManagerTest> CreateAppBannerManager( - Browser* browser) { + std::unique_ptr<AppBannerManagerTest> CreateAppBannerManager() { content::WebContents* web_contents = - browser->tab_strip_model()->GetActiveWebContents(); + chrome_test_utils::GetActiveWebContents(this); return std::make_unique<AppBannerManagerTest>(web_contents); } void RunBannerTest( - Browser* browser, + content::WebContents* web_contents, AppBannerManagerTest* manager, const GURL& url, - absl::optional<InstallableStatusCode> expected_code_for_histogram) { + absl::optional<InstallableStatusCode> expected_code_for_histogram, + bool is_off_the_record = false) { base::HistogramTester histograms; site_engagement::SiteEngagementService* service = - site_engagement::SiteEngagementService::Get(browser->profile()); + site_engagement::SiteEngagementService::Get(profile()); service->ResetBaseScoreForURL(url, 10); // Spin the run loop and wait for the manager to finish. base::RunLoop run_loop; manager->clear_will_show(); manager->PrepareDone(run_loop.QuitClosure()); - NavigateParams nav_params(browser, url, ui::PAGE_TRANSITION_LINK); - ui_test_utils::NavigateToURL(&nav_params); + ASSERT_TRUE(content::NavigateToURL(web_contents, url)); run_loop.Run(); EXPECT_EQ(expected_code_for_histogram.value_or(MAX_ERROR_CODE) == @@ -294,7 +292,7 @@ manager->state() == State::INACTIVE); // If in incognito, ensure that nothing is recorded. - if (browser->profile()->IsOffTheRecord() || !expected_code_for_histogram) { + if (is_off_the_record || !expected_code_for_histogram) { histograms.ExpectTotalCount(kInstallableStatusCodeHistogram, 0); } else { histograms.ExpectUniqueSample(kInstallableStatusCodeHistogram, @@ -302,24 +300,20 @@ } } - void TriggerBannerFlowWithNavigation(Browser* browser, - AppBannerManagerTest* manager, + void TriggerBannerFlowWithNavigation(AppBannerManagerTest* manager, const GURL& url, bool expected_will_show, absl::optional<State> expected_state) { // Use NavigateToURLWithDisposition as it isn't overloaded, so can be used // with Bind. TriggerBannerFlow( - browser, manager, - base::BindOnce( - base::IgnoreResult(&ui_test_utils::NavigateToURLWithDisposition), - browser, url, WindowOpenDisposition::CURRENT_TAB, - ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP), + manager, base::BindLambdaForTesting([&]() { + ASSERT_TRUE(content::NavigateToURL(web_contents(), url)); + }), expected_will_show, expected_state); } - void TriggerBannerFlow(Browser* browser, - AppBannerManagerTest* manager, + void TriggerBannerFlow(AppBannerManagerTest* manager, base::OnceClosure trigger_task, bool expected_will_show, absl::optional<State> expected_state) { @@ -342,65 +336,57 @@ IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerNoTypeInManifest) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); - RunBannerTest(browser(), manager.get(), + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); + RunBannerTest(web_contents(), manager.get(), GetBannerURLWithManifest("/banners/manifest_no_type.json"), absl::nullopt); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerNoTypeInManifestCapsExtension) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); - RunBannerTest(browser(), manager.get(), + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); + RunBannerTest(web_contents(), manager.get(), GetBannerURLWithManifest("/banners/manifest_no_type_caps.json"), absl::nullopt); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerSvgIcon) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); - RunBannerTest(browser(), manager.get(), + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); + RunBannerTest(web_contents(), manager.get(), GetBannerURLWithManifest("/banners/manifest_svg_icon.json"), absl::nullopt); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerWebPIcon) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); - RunBannerTest(browser(), manager.get(), + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); + RunBannerTest(web_contents(), manager.get(), GetBannerURLWithManifest("/banners/manifest_webp_icon.json"), absl::nullopt); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, DelayedManifestTriggersPipeline) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); RunBannerTest( - browser(), manager.get(), + web_contents(), manager.get(), embedded_test_server()->GetURL("/banners/no_manifest_test_page.html"), NO_MANIFEST); // Dynamically add the manifest. base::HistogramTester histograms; - TriggerBannerFlow(browser(), manager.get(), base::BindLambdaForTesting([&]() { - EXPECT_TRUE(content::ExecJs( - browser()->tab_strip_model()->GetActiveWebContents(), - "addManifestLinkTag()")); - }), - false, - AppBannerManager::State::PENDING_PROMPT_NOT_CANCELED); + TriggerBannerFlow( + manager.get(), base::BindLambdaForTesting([&]() { + EXPECT_TRUE(content::ExecJs(web_contents(), "addManifestLinkTag()")); + }), + false, AppBannerManager::State::PENDING_PROMPT_NOT_CANCELED); histograms.ExpectTotalCount(kInstallableStatusCodeHistogram, 0); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, RemovingManifestStopsPipeline) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); RunBannerTest( - browser(), manager.get(), + web_contents(), manager.get(), embedded_test_server()->GetURL("/banners/manifest_test_page.html"), absl::nullopt); EXPECT_EQ(manager->state(), @@ -408,12 +394,11 @@ // Dynamically remove the manifest. base::HistogramTester histograms; - TriggerBannerFlow(browser(), manager.get(), base::BindLambdaForTesting([&]() { - EXPECT_TRUE(content::ExecJs( - browser()->tab_strip_model()->GetActiveWebContents(), - "removeAllManifestTags()")); - }), - false, AppBannerManager::State::COMPLETE); + TriggerBannerFlow( + manager.get(), base::BindLambdaForTesting([&]() { + EXPECT_TRUE(content::ExecJs(web_contents(), "removeAllManifestTags()")); + }), + false, AppBannerManager::State::COMPLETE); histograms.ExpectTotalCount(kInstallableStatusCodeHistogram, 1); histograms.ExpectUniqueSample(kInstallableStatusCodeHistogram, RENDERER_CANCELLED, 1); @@ -421,13 +406,12 @@ IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, ManifestChangeTriggersPipeline) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); // Cause the manifest test page to reach the PENDING_PROMPT stage of the // app banner pipeline. RunBannerTest( - browser(), manager.get(), + web_contents(), manager.get(), embedded_test_server()->GetURL("/banners/manifest_test_page.html"), absl::nullopt); EXPECT_EQ(manager->state(), @@ -440,9 +424,9 @@ // Note - The state of the appbannermanager here will be racy, so don't // check for that. TriggerBannerFlow( - browser(), manager.get(), base::BindLambdaForTesting([&]() { + manager.get(), base::BindLambdaForTesting([&]() { EXPECT_TRUE(content::ExecJs( - browser()->tab_strip_model()->GetActiveWebContents(), + web_contents(), "addManifestLinkTag('/banners/manifest_one_icon.json')")); }), false, absl::nullopt); @@ -465,55 +449,56 @@ } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, NoManifest) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); RunBannerTest( - browser(), manager.get(), + web_contents(), manager.get(), embedded_test_server()->GetURL("/banners/no_manifest_test_page.html"), NO_MANIFEST); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, MissingManifest) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); - RunBannerTest(browser(), manager.get(), + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); + RunBannerTest(web_contents(), manager.get(), GetBannerURLWithManifest("/banners/manifest_missing.json"), MANIFEST_EMPTY); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerInIFrame) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); RunBannerTest( - browser(), manager.get(), + web_contents(), manager.get(), embedded_test_server()->GetURL("/banners/iframe_test_page.html"), NO_MANIFEST); } +#if !BUILDFLAG(IS_ANDROID) IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, DoesNotShowInIncognito) { Browser* incognito_browser = OpenURLOffTheRecord(browser()->profile(), GURL("about:blank")); - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(incognito_browser)); - RunBannerTest(incognito_browser, manager.get(), GetBannerURL(), IN_INCOGNITO); + content::WebContents* web_contents = + incognito_browser->tab_strip_model()->GetActiveWebContents(); + std::unique_ptr<AppBannerManagerTest> manager = + std::make_unique<AppBannerManagerTest>(web_contents); + RunBannerTest(web_contents, manager.get(), GetBannerURL(), IN_INCOGNITO, + true); } +#endif IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerInsufficientEngagement) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; GURL test_url = GetBannerURL(); // First run through: expect the manager to end up stopped in the pending // state, without showing a banner. - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, + TriggerBannerFlowWithNavigation(manager.get(), test_url, false /* expected_will_show */, State::PENDING_ENGAGEMENT); // Navigate and expect Stop() to be called. - TriggerBannerFlowWithNavigation(browser(), manager.get(), GURL("about:blank"), + TriggerBannerFlowWithNavigation(manager.get(), GURL("about:blank"), false /* expected_will_show */, State::INACTIVE); @@ -522,22 +507,21 @@ } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerNotCreated) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; site_engagement::SiteEngagementService* service = - site_engagement::SiteEngagementService::Get(browser()->profile()); + site_engagement::SiteEngagementService::Get(profile()); GURL test_url = GetBannerURL(); service->ResetBaseScoreForURL(test_url, 10); // Navigate and expect the manager to end up waiting for prompt to be called. - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, + TriggerBannerFlowWithNavigation(manager.get(), test_url, false /* expected_will_show */, State::PENDING_PROMPT_NOT_CANCELED); // Navigate and expect Stop() to be called. - TriggerBannerFlowWithNavigation(browser(), manager.get(), GURL("about:blank"), + TriggerBannerFlowWithNavigation(manager.get(), GURL("about:blank"), false /* expected_will_show */, State::INACTIVE); @@ -546,12 +530,11 @@ } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerCancelled) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; site_engagement::SiteEngagementService* service = - site_engagement::SiteEngagementService::Get(browser()->profile()); + site_engagement::SiteEngagementService::Get(profile()); // Explicitly call preventDefault(), but don't call prompt(). GURL test_url = GetBannerURLWithAction("cancel_prompt"); @@ -559,12 +542,12 @@ // Navigate and expect the manager to end up waiting for prompt() to be // called. - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, + TriggerBannerFlowWithNavigation(manager.get(), test_url, false /* expected_will_show */, State::PENDING_PROMPT_CANCELED); // Navigate to about:blank and expect Stop() to be called. - TriggerBannerFlowWithNavigation(browser(), manager.get(), GURL("about:blank"), + TriggerBannerFlowWithNavigation(manager.get(), GURL("about:blank"), false /* expected_will_show */, State::INACTIVE); @@ -574,26 +557,25 @@ IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerPromptWithGesture) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; site_engagement::SiteEngagementService* service = - site_engagement::SiteEngagementService::Get(browser()->profile()); + site_engagement::SiteEngagementService::Get(profile()); GURL test_url = GetBannerURLWithAction("stash_event"); service->ResetBaseScoreForURL(test_url, 10); // Navigate to page and get the pipeline started. - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, + TriggerBannerFlowWithNavigation(manager.get(), test_url, false /* expected_will_show */, State::PENDING_PROMPT_NOT_CANCELED); // Now let the page call prompt with a gesture. The banner should be shown. - TriggerBannerFlow( - browser(), manager.get(), - base::BindOnce(&AppBannerManagerBrowserTest::ExecuteScript, browser(), - "callStashedPrompt();", true /* with_gesture */), - true /* expected_will_show */, State::COMPLETE); + TriggerBannerFlow(manager.get(), + base::BindOnce(&AppBannerManagerBrowserTest::ExecuteScript, + web_contents(), "callStashedPrompt();", + true /* with_gesture */), + true /* expected_will_show */, State::COMPLETE); histograms.ExpectUniqueSample(kInstallableStatusCodeHistogram, SHOWING_WEB_APP_BANNER, 1); @@ -601,65 +583,62 @@ IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerNeedsEngagement) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::AutoReset<double> scoped_engagement = AppBannerSettingsHelper::ScopeTotalEngagementForTesting(1); base::HistogramTester histograms; site_engagement::SiteEngagementService* service = - site_engagement::SiteEngagementService::Get(browser()->profile()); + site_engagement::SiteEngagementService::Get(profile()); GURL test_url = GetBannerURLWithAction("stash_event"); service->ResetBaseScoreForURL(test_url, 0); // Navigate and expect the manager to end up waiting for sufficient // engagement. - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, + TriggerBannerFlowWithNavigation(manager.get(), test_url, false /* expected_will_show */, State::PENDING_ENGAGEMENT); // Trigger an engagement increase that signals observers and expect the // manager to end up waiting for prompt to be called. TriggerBannerFlow( - browser(), manager.get(), + manager.get(), base::BindOnce(&site_engagement::SiteEngagementService::HandleNavigation, - base::Unretained(service), - browser()->tab_strip_model()->GetActiveWebContents(), + base::Unretained(service), web_contents(), ui::PageTransition::PAGE_TRANSITION_TYPED), false /* expected_will_show */, State::PENDING_PROMPT_NOT_CANCELED); // Trigger prompt() and expect the banner to be shown. - TriggerBannerFlow( - browser(), manager.get(), - base::BindOnce(&AppBannerManagerBrowserTest::ExecuteScript, browser(), - "callStashedPrompt();", true /* with_gesture */), - true /* expected_will_show */, State::COMPLETE); + TriggerBannerFlow(manager.get(), + base::BindOnce(&AppBannerManagerBrowserTest::ExecuteScript, + web_contents(), "callStashedPrompt();", + true /* with_gesture */), + true /* expected_will_show */, State::COMPLETE); histograms.ExpectUniqueSample(kInstallableStatusCodeHistogram, SHOWING_WEB_APP_BANNER, 1); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerReprompt) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; site_engagement::SiteEngagementService* service = - site_engagement::SiteEngagementService::Get(browser()->profile()); + site_engagement::SiteEngagementService::Get(profile()); GURL test_url = GetBannerURLWithAction("stash_event"); service->ResetBaseScoreForURL(test_url, 10); // Navigate to page and get the pipeline started. - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, + TriggerBannerFlowWithNavigation(manager.get(), test_url, false /* expected_will_show */, State::PENDING_PROMPT_NOT_CANCELED); // Call prompt to show the banner. - TriggerBannerFlow( - browser(), manager.get(), - base::BindOnce(&AppBannerManagerBrowserTest::ExecuteScript, browser(), - "callStashedPrompt();", true /* with_gesture */), - true /* expected_will_show */, State::COMPLETE); + TriggerBannerFlow(manager.get(), + base::BindOnce(&AppBannerManagerBrowserTest::ExecuteScript, + web_contents(), "callStashedPrompt();", + true /* with_gesture */), + true /* expected_will_show */, State::COMPLETE); // Dismiss the banner. base::RunLoop run_loop; @@ -670,79 +649,73 @@ run_loop.Run(); // Call prompt again to show the banner again. - TriggerBannerFlow( - browser(), manager.get(), - base::BindOnce(&AppBannerManagerBrowserTest::ExecuteScript, browser(), - "callStashedPrompt();", true /* with_gesture */), - true /* expected_will_show */, State::COMPLETE); + TriggerBannerFlow(manager.get(), + base::BindOnce(&AppBannerManagerBrowserTest::ExecuteScript, + web_contents(), "callStashedPrompt();", + true /* with_gesture */), + true /* expected_will_show */, State::COMPLETE); histograms.ExpectUniqueSample(kInstallableStatusCodeHistogram, SHOWING_WEB_APP_BANNER, 1); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, PreferRelatedAppUnknown) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); GURL test_url = embedded_test_server()->GetURL( "/banners/manifest_test_page.html?manifest=" "manifest_prefer_related_apps_unknown.json"); - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, + TriggerBannerFlowWithNavigation(manager.get(), test_url, false /* expected_will_show */, State::PENDING_ENGAGEMENT); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, PreferRelatedChromeApp) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; GURL test_url = embedded_test_server()->GetURL( "/banners/manifest_test_page.html?manifest=" "manifest_prefer_related_chrome_app.json"); - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, - false /* expected_will_show */, - State::COMPLETE); + TriggerBannerFlowWithNavigation( + manager.get(), test_url, false /* expected_will_show */, State::COMPLETE); histograms.ExpectUniqueSample(kInstallableStatusCodeHistogram, PREFER_RELATED_APPLICATIONS, 1); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, ListedRelatedChromeAppInstalled) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; GURL test_url = embedded_test_server()->GetURL( "/banners/manifest_test_page.html?manifest=" "manifest_listing_related_chrome_app.json"); - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, - false /* expected_will_show */, - State::COMPLETE); + TriggerBannerFlowWithNavigation( + manager.get(), test_url, false /* expected_will_show */, State::COMPLETE); histograms.ExpectUniqueSample(kInstallableStatusCodeHistogram, PREFER_RELATED_APPLICATIONS, 1); } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerTerminated) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; site_engagement::SiteEngagementService* service = - site_engagement::SiteEngagementService::Get(browser()->profile()); + site_engagement::SiteEngagementService::Get(profile()); GURL test_url = GetBannerURL(); service->ResetBaseScoreForURL(test_url, 10); // Navigate and expect the manager to end up waiting for prompt() to be // called. - TriggerBannerFlowWithNavigation(browser(), manager.get(), test_url, + TriggerBannerFlowWithNavigation(manager.get(), test_url, false /* expected_will_show */, State::PENDING_PROMPT_NOT_CANCELED); // Navigate to about:blank and expect it to be terminated because the previous // URL is still pending. - TriggerBannerFlowWithNavigation(browser(), manager.get(), GURL("about:blank"), + TriggerBannerFlowWithNavigation(manager.get(), GURL("about:blank"), false /* expected_will_show */, State::INACTIVE); @@ -778,10 +751,6 @@ content::GetDefaultDisabledBackForwardCacheFeaturesForTesting()); } - content::WebContents* web_contents() const { - return browser()->tab_strip_model()->GetActiveWebContents(); - } - content::RenderFrameHost* current_frame_host() { return web_contents()->GetPrimaryMainFrame(); } @@ -811,12 +780,11 @@ AppBannerSettingsHelper::ScopeTotalEngagementForTesting(1); ASSERT_TRUE(embedded_test_server()->Start()); - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); base::HistogramTester histograms; // Triggering flow to first URL with a pending prompt. - TriggerBannerFlowWithNavigation(browser(), manager.get(), GetBannerURL(), + TriggerBannerFlowWithNavigation(manager.get(), GetBannerURL(), /*expected_will_show=*/false, State::PENDING_PROMPT_NOT_CANCELED); content::RenderFrameHostWrapper rfh_a(current_frame_host()); @@ -826,8 +794,7 @@ // Navigating to 2nd installable URL while PENDING_PROMPT will trigger // the pipeline. - TriggerBannerFlowWithNavigation(browser(), manager.get(), - Get2ndInstallableURL(), + TriggerBannerFlowWithNavigation(manager.get(), Get2ndInstallableURL(), /*expected_will_show=*/false, absl::nullopt); AssertBackForwardCacheIsUsedAsExpected(rfh_a); @@ -888,10 +855,6 @@ host_resolver()->AddRule("*", "127.0.0.1"); AppBannerManagerBrowserTest::SetUpOnMainThread(); } - - content::WebContents* GetWebContents() { - return browser()->tab_strip_model()->GetActiveWebContents(); - } }; class AppBannerManagerPrerenderBrowserTest @@ -899,7 +862,7 @@ public: AppBannerManagerPrerenderBrowserTest() : prerender_helper_(base::BindRepeating( - &AppBannerManagerPrerenderBrowserTest::GetWebContents, + &AppBannerManagerPrerenderBrowserTest::web_contents, base::Unretained(this))) {} ~AppBannerManagerPrerenderBrowserTest() override = default; AppBannerManagerPrerenderBrowserTest( @@ -924,17 +887,15 @@ IN_PROC_BROWSER_TEST_F(AppBannerManagerPrerenderBrowserTest, PrerenderingShouldNotUpdateState) { auto initial_url = embedded_test_server()->GetURL("/empty.html"); - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), initial_url)); + ASSERT_TRUE(content::NavigateToURL(web_contents(), initial_url)); - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); EXPECT_EQ(manager->state(), AppBannerManager::State::INACTIVE); // Load a page in the prerender. GURL prerender_url = GetBannerURL(); const int host_id = prerender_test_helper().AddPrerender(prerender_url); - content::test::PrerenderHostObserver host_observer(*GetWebContents(), - host_id); + content::test::PrerenderHostObserver host_observer(*web_contents(), host_id); EXPECT_FALSE(host_observer.was_activated()); EXPECT_EQ(manager->state(), AppBannerManager::State::INACTIVE); @@ -967,15 +928,13 @@ FencedFrameShouldNotUpdateState) { // Navigate to an initial page. const GURL initial_url = embedded_test_server()->GetURL("/empty.html"); - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), initial_url)); + ASSERT_TRUE(content::NavigateToURL(web_contents(), initial_url)); // Initialize a MockWebContentsObserver to ensure that DidUpdateManifestURL is // not invoked for fenced frame. - testing::NiceMock<content::MockWebContentsObserver> observer( - GetWebContents()); + testing::NiceMock<content::MockWebContentsObserver> observer(web_contents()); - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); EXPECT_EQ(manager->state(), AppBannerManager::State::INACTIVE); // Create a fenced frame. @@ -984,7 +943,7 @@ "manifest.json"); content::RenderFrameHost* fenced_frame_host = fenced_frame_test_helper().CreateFencedFrame( - GetWebContents()->GetPrimaryMainFrame(), fenced_frame_url); + web_contents()->GetPrimaryMainFrame(), fenced_frame_url); EXPECT_NE(nullptr, fenced_frame_host); EXPECT_EQ(manager->state(), AppBannerManager::State::INACTIVE); @@ -1000,10 +959,9 @@ } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, ShowBanner) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); RunBannerTest( - browser(), manager.get(), + web_contents(), manager.get(), embedded_test_server()->GetURL("/banners/manifest_test_page.html"), absl::nullopt); EXPECT_EQ(manager->state(), @@ -1013,10 +971,9 @@ } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, NoServiceWorker) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); - RunBannerTest(browser(), manager.get(), + RunBannerTest(web_contents(), manager.get(), embedded_test_server()->GetURL( "/banners/manifest_no_service_worker.html"), /*expected_code_for_histogram=*/absl::nullopt); @@ -1028,10 +985,9 @@ } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, NoFetchHandler) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); - RunBannerTest(browser(), manager.get(), + RunBannerTest(web_contents(), manager.get(), embedded_test_server()->GetURL( "/banners/no_sw_fetch_handler_test_page.html"), /*expected_code_for_histogram=*/absl::nullopt); @@ -1044,12 +1000,10 @@ } IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, PendingServiceWorker) { - content::WebContents* web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); std::unique_ptr<AppBannerManagerTest> manager = - std::make_unique<AppBannerManagerTest>(web_contents); + std::make_unique<AppBannerManagerTest>(web_contents()); - RunBannerTest(browser(), manager.get(), + RunBannerTest(web_contents(), manager.get(), embedded_test_server()->GetURL( "/banners/manifest_no_service_worker.html"), absl::nullopt); @@ -1116,10 +1070,9 @@ }; IN_PROC_BROWSER_TEST_P(AppBannerInstallCriteriaTest, ValidManifestShowBanner) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); RunBannerTest( - browser(), manager.get(), + web_contents(), manager.get(), embedded_test_server()->GetURL("/banners/manifest_test_page.html"), absl::nullopt); EXPECT_EQ(manager->state(), @@ -1129,14 +1082,13 @@ } IN_PROC_BROWSER_TEST_P(AppBannerInstallCriteriaTest, kImplicitName) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); GURL test_url = embedded_test_server()->GetURL( "/banners/manifest_test_page.html?manifest=" "manifest_empty_name_short_name.json&application-name=TestApp"); - RunBannerTest(browser(), manager.get(), test_url, + RunBannerTest(web_contents(), manager.get(), test_url, MANIFEST_MISSING_NAME_OR_SHORT_NAME); CheckBannerResult(manager.get()); @@ -1147,14 +1099,13 @@ IN_PROC_BROWSER_TEST_P(AppBannerInstallCriteriaTest, kImplicitNameDocumentTitle) { - std::unique_ptr<AppBannerManagerTest> manager( - CreateAppBannerManager(browser())); + std::unique_ptr<AppBannerManagerTest> manager(CreateAppBannerManager()); GURL test_url = embedded_test_server()->GetURL( "/banners/manifest_test_page.html?manifest=" "manifest_empty_name_short_name.json"); - RunBannerTest(browser(), manager.get(), test_url, + RunBannerTest(web_contents(), manager.get(), test_url, MANIFEST_MISSING_NAME_OR_SHORT_NAME); CheckBannerResult(manager.get());
diff --git a/chrome/browser/banners/app_banner_manager_browsertest_base.cc b/chrome/browser/banners/app_banner_manager_browsertest_base.cc index 9489d84..cee6b41d 100644 --- a/chrome/browser/banners/app_banner_manager_browsertest_base.cc +++ b/chrome/browser/banners/app_banner_manager_browsertest_base.cc
@@ -3,15 +3,17 @@ // found in the LICENSE file. #include "chrome/browser/banners/app_banner_manager_browsertest_base.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/browser/web_applications/test/web_app_install_test_utils.h" -#include "chrome/browser/web_applications/web_app_provider.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "net/base/url_util.h" #include "net/test/embedded_test_server/embedded_test_server.h" +#if !BUILDFLAG(IS_ANDROID) +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/web_applications/test/web_app_install_test_utils.h" +#include "chrome/browser/web_applications/web_app_provider.h" +#endif + AppBannerManagerBrowserTestBase::AppBannerManagerBrowserTestBase() = default; AppBannerManagerBrowserTestBase::~AppBannerManagerBrowserTestBase() = default; @@ -19,10 +21,12 @@ void AppBannerManagerBrowserTestBase::SetUpOnMainThread() { ASSERT_TRUE(embedded_test_server()->Start()); - InProcessBrowserTest::SetUpOnMainThread(); + PlatformBrowserTest::SetUpOnMainThread(); +#if !BUILDFLAG(IS_ANDROID) web_app::test::WaitUntilReady( web_app::WebAppProvider::GetForTest(browser()->profile())); +#endif } GURL AppBannerManagerBrowserTestBase::GetBannerURL() { @@ -30,11 +34,10 @@ } // static -void AppBannerManagerBrowserTestBase::ExecuteScript(Browser* browser, - const std::string& script, - bool with_gesture) { - content::WebContents* web_contents = - browser->tab_strip_model()->GetActiveWebContents(); +void AppBannerManagerBrowserTestBase::ExecuteScript( + content::WebContents* web_contents, + const std::string& script, + bool with_gesture) { if (with_gesture) EXPECT_TRUE(content::ExecJs(web_contents, script)); else @@ -42,6 +45,14 @@ content::EXECUTE_SCRIPT_NO_USER_GESTURE)); } +content::WebContents* AppBannerManagerBrowserTestBase::web_contents() { + return chrome_test_utils::GetActiveWebContents(this); +} + +Profile* AppBannerManagerBrowserTestBase::profile() { + return chrome_test_utils::GetProfile(this); +} + GURL AppBannerManagerBrowserTestBase::GetBannerURLWithAction( const std::string& action) { GURL url = GetBannerURL();
diff --git a/chrome/browser/banners/app_banner_manager_browsertest_base.h b/chrome/browser/banners/app_banner_manager_browsertest_base.h index 25637946..e7b50ae 100644 --- a/chrome/browser/banners/app_banner_manager_browsertest_base.h +++ b/chrome/browser/banners/app_banner_manager_browsertest_base.h
@@ -6,16 +6,20 @@ #define CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_BROWSERTEST_BASE_H_ #include <string> - -#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" -#include "chrome/test/base/in_process_browser_test.h" +#include "build/build_config.h" +#include "chrome/test/base/chrome_test_utils.h" #include "url/gurl.h" -class Browser; +#if BUILDFLAG(IS_ANDROID) +#include "chrome/test/base/android/android_browser_test.h" +#else +#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" +#include "chrome/test/base/in_process_browser_test.h" +#endif // Common base class for browser tests exercising AppBannerManager. Contains // methods for generating test URLs that trigger app banners. -class AppBannerManagerBrowserTestBase : public InProcessBrowserTest { +class AppBannerManagerBrowserTestBase : public PlatformBrowserTest { public: AppBannerManagerBrowserTestBase(); @@ -30,10 +34,14 @@ protected: // Executes JavaScript in |script| in the active WebContents of |browser|, // possibly with a user gesture depending on |with_gesture|. - static void ExecuteScript(Browser* browser, + static void ExecuteScript(content::WebContents* web_contents, const std::string& script, bool with_gesture); + content::WebContents* web_contents(); + + Profile* profile(); + // Returns a test server URL to a page with generates a banner. GURL GetBannerURL(); @@ -48,7 +56,10 @@ GURL GetBannerURLWithManifestAndQuery(const std::string& manifest_url, const std::string& key, const std::string& value); + +#if !BUILDFLAG(IS_ANDROID) web_app::OsIntegrationManager::ScopedSuppressForTesting os_hooks_suppress_; +#endif }; #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_BROWSERTEST_BASE_H_
diff --git a/chrome/browser/banners/app_banner_manager_desktop_browsertest.cc b/chrome/browser/banners/app_banner_manager_desktop_browsertest.cc index 21e057f..8ab3279 100644 --- a/chrome/browser/banners/app_banner_manager_desktop_browsertest.cc +++ b/chrome/browser/banners/app_banner_manager_desktop_browsertest.cc
@@ -121,7 +121,8 @@ // Trigger the installation prompt and wait for installation to occur. base::RunLoop run_loop; manager->PrepareDone(run_loop.QuitClosure()); - ExecuteScript(browser(), "callStashedPrompt();", true /* with_gesture */); + ExecuteScript(web_contents, "callStashedPrompt();", + true /* with_gesture */); run_loop.Run(); EXPECT_EQ(State::COMPLETE, manager->state()); } @@ -169,7 +170,8 @@ callback_called = true; })); - ExecuteScript(browser(), "callStashedPrompt();", true /* with_gesture */); + ExecuteScript(web_contents, "callStashedPrompt();", + true /* with_gesture */); run_loop.Run(); @@ -218,7 +220,8 @@ run_loop.Quit(); })); - ExecuteScript(browser(), "callStashedPrompt();", true /* with_gesture */); + ExecuteScript(web_contents, "callStashedPrompt();", + true /* with_gesture */); // Closing WebContents destroys WebContents and AppBannerManager. browser()->tab_strip_model()->CloseWebContentsAt( @@ -422,7 +425,8 @@ // Trigger the installation prompt and wait for installation to occur. base::RunLoop run_loop; manager->PrepareDone(run_loop.QuitClosure()); - ExecuteScript(browser(), "callStashedPrompt();", true /* with_gesture */); + ExecuteScript(web_contents, "callStashedPrompt();", + true /* with_gesture */); run_loop.Run(); EXPECT_EQ(State::COMPLETE, manager->state()); }
diff --git a/chrome/browser/chromeos/reporting/websites/website_usage_telemetry_sampler_ash_browsertest.cc b/chrome/browser/chromeos/reporting/websites/website_usage_telemetry_sampler_ash_browsertest.cc index 3b26e1d..30debcb 100644 --- a/chrome/browser/chromeos/reporting/websites/website_usage_telemetry_sampler_ash_browsertest.cc +++ b/chrome/browser/chromeos/reporting/websites/website_usage_telemetry_sampler_ash_browsertest.cc
@@ -52,7 +52,7 @@ // Additional website usage buffer period before the browser is actually closed. // Used when validating reported website usage data. -constexpr base::TimeDelta kWebsiteUsageBufferPeriod = base::Seconds(5); +constexpr base::TimeDelta kWebsiteUsageBufferPeriod = base::Seconds(10); void AssertRecordData(Priority priority, const Record& record) { EXPECT_THAT(priority, Eq(Priority::MANUAL_BATCH));
diff --git a/chrome/browser/chromeos/reporting/websites/website_usage_telemetry_sampler_lacros_browsertest.cc b/chrome/browser/chromeos/reporting/websites/website_usage_telemetry_sampler_lacros_browsertest.cc index 1c274b7eb..de98f12 100644 --- a/chrome/browser/chromeos/reporting/websites/website_usage_telemetry_sampler_lacros_browsertest.cc +++ b/chrome/browser/chromeos/reporting/websites/website_usage_telemetry_sampler_lacros_browsertest.cc
@@ -53,7 +53,7 @@ // Additional website usage buffer period before the browser is actually closed. // Used when validating reported website usage data. -constexpr base::TimeDelta kWebsiteUsageBufferPeriod = base::Seconds(5); +constexpr base::TimeDelta kWebsiteUsageBufferPeriod = base::Seconds(10); void SetupUserDeviceAffiliation() { ::enterprise_management::PolicyData profile_policy_data;
diff --git a/chrome/browser/companion/core/companion_url_builder_unittest.cc b/chrome/browser/companion/core/companion_url_builder_unittest.cc index 34afbc4..a7ad0e9 100644 --- a/chrome/browser/companion/core/companion_url_builder_unittest.cc +++ b/chrome/browser/companion/core/companion_url_builder_unittest.cc
@@ -242,7 +242,7 @@ EXPECT_TRUE(proto.is_signed_in()); EXPECT_TRUE(proto.is_entrypoint_pinned_by_default()); EXPECT_TRUE(proto.links_open_in_new_tab()); - EXPECT_FALSE(proto.is_vqs_enabled_on_chrome()); + EXPECT_TRUE(proto.is_vqs_enabled_on_chrome()); EXPECT_TRUE(proto.is_upload_dialog_supported()); EXPECT_TRUE(proto.is_hard_refresh_supported());
diff --git a/chrome/browser/companion/core/features.cc b/chrome/browser/companion/core/features.cc index 57744d60..e29904c 100644 --- a/chrome/browser/companion/core/features.cc +++ b/chrome/browser/companion/core/features.cc
@@ -25,7 +25,7 @@ // that's permanent consistent). BASE_FEATURE(kSidePanelCompanion, "SidePanelCompanion", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kSidePanelCompanion2, "SidePanelCompanion2", base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/chrome/browser/companion/core/utils.cc b/chrome/browser/companion/core/utils.cc index 17d2d6ea..5e5c9cc5 100644 --- a/chrome/browser/companion/core/utils.cc +++ b/chrome/browser/companion/core/utils.cc
@@ -77,7 +77,7 @@ // Allow multiple field trials to control the value. This is needed because // companion may be enabled by any of the field trials. return base::GetFieldTrialParamByFeatureAsBool( - *GetFeatureToUse(), "open-companion-for-image-search", true); + *GetFeatureToUse(), "open-companion-for-image-search", false); } bool ShouldEnableOpenCompanionForWebSearch() { @@ -85,13 +85,13 @@ // companion may be enabled by any of the field trials. return base::GetFieldTrialParamByFeatureAsBool( - *GetFeatureToUse(), "open-companion-for-web-search", true); + *GetFeatureToUse(), "open-companion-for-web-search", false); } bool ShouldOpenLinksInCurrentTab() { // Allow multiple field trials to control the value. This is needed because // companion may be enabled by any of the field trials. return base::GetFieldTrialParamByFeatureAsBool( - *GetFeatureToUse(), "open-links-in-current-tab", true); + *GetFeatureToUse(), "open-links-in-current-tab", false); } std::string GetExpsRegistrationSuccessPageURLs() { @@ -110,7 +110,7 @@ // Allow multiple field trials to control the value. This is needed because // companion may be enabled by any of the field trials. return base::GetFieldTrialParamByFeatureAsBool( - *GetFeatureToUse(), "open-contextual-lens-panel", true); + *GetFeatureToUse(), "open-contextual-lens-panel", false); } // Checks to see if the page url is a valid one to be sent to companion.
diff --git a/chrome/browser/companion/core/utils_unittest.cc b/chrome/browser/companion/core/utils_unittest.cc index c22e2b0..0d2eaad 100644 --- a/chrome/browser/companion/core/utils_unittest.cc +++ b/chrome/browser/companion/core/utils_unittest.cc
@@ -38,11 +38,10 @@ TEST_F(CompanionCoreUtilsTest, HomepageURLForCompanionWithParams_kSidePanelCompanion2) { base::test::ScopedFeatureList scoped_list; - - base::FieldTrialParams params; - params.insert({"companion-homepage-url", "https://foo.com/bar"}); - scoped_list.InitAndEnableFeatureWithParameters( - features::internal::kSidePanelCompanion2, params); + scoped_list.InitWithFeaturesAndParameters( + {{features::internal::kSidePanelCompanion2, + {{"companion-homepage-url", "https://foo.com/bar"}}}}, + {{features::internal::kSidePanelCompanion}}); EXPECT_EQ("https://foo.com/bar", GetHomepageURLForCompanion()); }
diff --git a/chrome/browser/compose/chrome_compose_client.cc b/chrome/browser/compose/chrome_compose_client.cc index a8b84af..599987514 100644 --- a/chrome/browser/compose/chrome_compose_client.cc +++ b/chrome/browser/compose/chrome_compose_client.cc
@@ -108,6 +108,8 @@ gfx::RectF bounds_in_screen = trigger_field.bounds; bounds_in_screen.Offset( GetWebContents().GetContainerBounds().OffsetFromOrigin()); + + show_dialog_start_ = base::TimeTicks::Now(); compose_dialog_controller_ = chrome::ShowComposeDialog(GetWebContents(), bounds_in_screen); } @@ -122,6 +124,8 @@ void ChromeComposeClient::ShowUI() { if (compose_dialog_controller_) { compose_dialog_controller_->ShowUI(); + compose::LogComposeDialogOpenLatency(base::TimeTicks::Now() - + show_dialog_start_); } }
diff --git a/chrome/browser/compose/chrome_compose_client.h b/chrome/browser/compose/chrome_compose_client.h index 584216f..b066c14 100644 --- a/chrome/browser/compose/chrome_compose_client.h +++ b/chrome/browser/compose/chrome_compose_client.h
@@ -149,6 +149,9 @@ mojo::Receiver<compose::mojom::ComposeClientPageHandler> client_page_receiver_; + // Time that the last call to show the dialog was started. + base::TimeTicks show_dialog_start_; + // Used to test Compose in a tab at |chrome://compose|. std::unique_ptr<ComposeSession> debug_session_;
diff --git a/chrome/browser/compose/compose_enabling.cc b/chrome/browser/compose/compose_enabling.cc index 3fc8a24..35a345f0 100644 --- a/chrome/browser/compose/compose_enabling.cc +++ b/chrome/browser/compose/compose_enabling.cc
@@ -63,8 +63,7 @@ } // Check that the feature flag is enabled. - if (!base::FeatureList::IsEnabled(compose::features::kEnableCompose) && - !base::FeatureList::IsEnabled(compose::features::kFillMultiLine)) { + if (!base::FeatureList::IsEnabled(compose::features::kEnableCompose)) { DVLOG(2) << "feature not enabled "; return base::unexpected(compose::ComposeShowStatus::kGenericBlocked); } @@ -171,6 +170,7 @@ // sufficient for now. TODO(b/309162238) follow up on whether this is // sufficient long-term. if (top_level_frame_origin != element_frame_origin) { + DVLOG(2) << "cross frame origin not supported"; return base::unexpected( compose::ComposeShowStatus::kFormFieldInCrossOriginFrame); }
diff --git a/chrome/browser/compose/compose_enabling_unittest.cc b/chrome/browser/compose/compose_enabling_unittest.cc index 85e91d4..ef57950 100644 --- a/chrome/browser/compose/compose_enabling_unittest.cc +++ b/chrome/browser/compose/compose_enabling_unittest.cc
@@ -182,25 +182,6 @@ base::ok()); } -TEST_F(ComposeEnablingTest, AlternateFlagEnabledTest) { - ComposeEnabling compose_enabling(&mock_translate_language_provider_); - // Ensure alternate feature flag is on and normal feature flag is off. - scoped_feature_list_.Reset(); - scoped_feature_list_.InitWithFeatures( - /* enabled features */ - {compose::features::kFillMultiLine, - compose::features::kEnableComposeNudge}, - /* disabled features */ - {compose::features::kEnableCompose}); - // Sign in, with sync turned on. - SignIn(signin::ConsentLevel::kSync); - // Turn on MSBB. - SetMsbbState(true); - EXPECT_EQ(compose_enabling.IsEnabled(GetProfile(), - identity_test_env_.identity_manager()), - base::ok()); -} - TEST_F(ComposeEnablingTest, ShouldTriggerContextMenuDisabledTest) { ComposeEnabling compose_enabling(&mock_translate_language_provider_);
diff --git a/chrome/browser/controlled_frame/controlled_frame_apitest.cc b/chrome/browser/controlled_frame/controlled_frame_apitest.cc index c161a5a..002beebc 100644 --- a/chrome/browser/controlled_frame/controlled_frame_apitest.cc +++ b/chrome/browser/controlled_frame/controlled_frame_apitest.cc
@@ -38,7 +38,6 @@ // context. For more details, see https://crbug.com/1462384. // This test is the same as ServiceWorkerBasedBackgroundTest.Basic. IN_PROC_BROWSER_TEST_F(ControlledFrameServiceWorkerTest, PRE_Basic) { - base::HistogramTester histogram_tester; ExtensionTestMessageListener newtab_listener("CREATED"); newtab_listener.set_failure_message("CREATE_FAILED"); ExtensionTestMessageListener worker_listener("WORKER_RUNNING"); @@ -58,31 +57,6 @@ // Service Worker extension does not have ExtensionHost. EXPECT_FALSE(process_manager()->GetBackgroundHostForExtension(extension_id)); - - // Call to runtime.onInstalled and tabs.onCreated are expected. - histogram_tester.ExpectTotalCount( - "Extensions.Events.DispatchToAckTime.ExtensionServiceWorker2", - /*expected_count=*/2); - histogram_tester.ExpectTotalCount( - "Extensions.Events.DispatchToAckLongTime.ExtensionServiceWorker2", - /*expected_count=*/2); - histogram_tester.ExpectTotalCount( - "Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker", - /*expected_count=*/2); - - // Verify that the recorded values are sane -- that is, that they are less - // than the maximum bucket. - // This is the best we can do, since the other buckets are determined - // by the histogram, rather than by us. - histogram_tester.ExpectBucketCount( - "Extensions.Events.DispatchToAckTime.ExtensionServiceWorker2", - /*sample=*/base::Minutes(5).InMicroseconds(), /*expected_count=*/0); - histogram_tester.ExpectBucketCount( - "Extensions.Events.DispatchToAckLongTime.ExtensionServiceWorker2", - /*sample=*/base::Days(1).InMilliseconds(), /*expected_count=*/0); - histogram_tester.ExpectBucketCount( - "Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker", - /*sample=*/false, /*expected_count=*/0); } // After browser restarts, this test step ensures that opening a tab fires
diff --git a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc index e8975988..e505b506 100644 --- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc +++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc
@@ -54,7 +54,7 @@ const std::string& install_parameter) { std::unique_ptr<TemplateURLData> data; if (search_provider.prepopulated_id) { - data = TemplateURLPrepopulateData::GetPrepopulatedEngine( + data = TemplateURLPrepopulateData::GetPrepopulatedEngineFromFullList( prefs, *search_provider.prepopulated_id); if (data) { // We need to override the prepopulate_id and Sync GUID of the generated
diff --git a/chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc b/chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc index 73004ed..9c2c1ea7 100644 --- a/chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc +++ b/chrome/browser/extensions/api/settings_overrides/settings_overrides_browsertest.cc
@@ -36,11 +36,26 @@ namespace { #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) -// Prepopulated id hardcoded in test_extension. -const int kTestExtensionPrepopulatedId = 3; +// Prepopulated id hardcoded in test_extension. We select it to be a +// prepopulated ID unlikely to match an engine that is part of the TopEngines +// tier for the environments where the test run, but still matches some +// known engine (context around these requirements: https://crbug.com/1500526). +// The default set of engines (when no country is available) has ids 1, 2 +// and 3. The ID 83 is associated with mail.ru, chosen because it's not part +// of the prepopulated set where we run tests. +// TODO(crbug.com/1500526): Update the test to fix the country in such a way +// that we have more control on what is in the prepopulated set or not. +const int kTestExtensionPrepopulatedId = 83; // TemplateURLData with search engines settings from test extension manifest. // chrome/test/data/extensions/settings_override/manifest.json std::unique_ptr<TemplateURLData> TestExtensionSearchEngine(PrefService* prefs) { + // Enforcing that `kTestExtensionPrepopulatedId` is not part of the + // prepopulated set for the current profile's country. + for (auto& data : + TemplateURLPrepopulateData::GetPrepopulatedEngines(prefs, nullptr)) { + EXPECT_NE(data->prepopulate_id, kTestExtensionPrepopulatedId); + } + auto result = std::make_unique<TemplateURLData>(); result->SetShortName(u"name.de"); result->SetKeyword(u"keyword.de"); @@ -56,8 +71,9 @@ result->input_encodings.push_back("UTF-8"); std::unique_ptr<TemplateURLData> prepopulated = - TemplateURLPrepopulateData::GetPrepopulatedEngine( + TemplateURLPrepopulateData::GetPrepopulatedEngineFromFullList( prefs, kTestExtensionPrepopulatedId); + CHECK(prepopulated); // Values below do not exist in extension manifest and are taken from // prepopulated engine with prepopulated_id set in extension manifest. result->contextual_search_url = prepopulated->contextual_search_url;
diff --git a/chrome/browser/extensions/event_metrics_browsertest.cc b/chrome/browser/extensions/event_metrics_browsertest.cc index ed05fac..43e98073 100644 --- a/chrome/browser/extensions/event_metrics_browsertest.cc +++ b/chrome/browser/extensions/event_metrics_browsertest.cc
@@ -44,9 +44,12 @@ ContextType::kServiceWorker, {}}, // DidDispatchToAckSucceed - {"Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker", + {"Extensions.Events.DidDispatchToAckSucceed.ExtensionPage", + ContextType::kFromManifest, // event page + {"Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker2"}}, + {"Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker2", ContextType::kServiceWorker, - {}}, + {"Extensions.Events.DidDispatchToAckSucceed.ExtensionPage"}}, }; for (const auto& test_case : test_cases) { @@ -232,7 +235,10 @@ "Extensions.Events.DispatchToAckLongTime.ExtensionServiceWorker2", /*expected_count=*/0); histogram_tester.ExpectTotalCount( - "Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker", + "Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker2", + /*expected_count=*/0); + histogram_tester.ExpectTotalCount( + "Extensions.Events.DidDispatchToAckSucceed.ExtensionPage", /*expected_count=*/0); // We do always log starting/finishing an external request.
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index 53e1beb..9212643d 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -858,9 +858,10 @@ bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( const std::string& extension_id, - const std::string& script) { + const std::string& script, + browsertest_util::ScriptUserActivation script_user_activation) { return browsertest_util::ExecuteScriptInBackgroundPageNoWait( - profile(), extension_id, script); + profile(), extension_id, script, script_user_activation); } content::ServiceWorkerContext* ExtensionBrowserTest::GetServiceWorkerContext() {
diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index c4e9fbd0..15d9aa8 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h
@@ -363,8 +363,11 @@ browsertest_util::ScriptUserActivation script_user_activation = browsertest_util::ScriptUserActivation::kDontActivate); - bool ExecuteScriptInBackgroundPageNoWait(const std::string& extension_id, - const std::string& script); + bool ExecuteScriptInBackgroundPageNoWait( + const std::string& extension_id, + const std::string& script, + browsertest_util::ScriptUserActivation script_user_activation = + browsertest_util::ScriptUserActivation::kDontActivate); // Get the ServiceWorkerContext for the default browser's profile. content::ServiceWorkerContext* GetServiceWorkerContext();
diff --git a/chrome/browser/extensions/extension_security_exploit_browsertest.cc b/chrome/browser/extensions/extension_security_exploit_browsertest.cc index 5113229..262950a 100644 --- a/chrome/browser/extensions/extension_security_exploit_browsertest.cc +++ b/chrome/browser/extensions/extension_security_exploit_browsertest.cc
@@ -143,15 +143,26 @@ }; #if !BUILDFLAG(ENABLE_EXTENSIONS_LEGACY_IPC) -class ServiceWorkerHostInterceptor +class ServiceWorkerHostInterceptorForProcessDeath : public mojom::ServiceWorkerHostInterceptorForTesting { public: - // The caller needs to ensure that `worker` stays alive longer than the - // constructed ServiceWorkerHostInterceptor. - explicit ServiceWorkerHostInterceptor(extensions::ServiceWorkerHost* worker) - : impl_(worker->receiver_for_testing().SwapImplForTesting(this)) {} + // We use `worker_id` to have an weak handle to the `ServiceWorkerHost` + // which will be destroyed when this object mutates the IPC to cause + // a bad message resulting in process death. + explicit ServiceWorkerHostInterceptorForProcessDeath( + const WorkerId& worker_id) + : worker_id_(worker_id) { + auto* host = extensions::ServiceWorkerHost::GetWorkerFor(worker_id_); + CHECK(host); + std::ignore = host->receiver_for_testing().SwapImplForTesting(this); + } - mojom::ServiceWorkerHost* GetForwardingInterface() override { return impl_; } + mojom::ServiceWorkerHost* GetForwardingInterface() override { + // This should be non-null if this interface is still receiving events. + auto* host = extensions::ServiceWorkerHost::GetWorkerFor(worker_id_); + CHECK(host); + return host; + } void OpenChannelToExtension( extensions::mojom::ExternalConnectionInfoPtr info, @@ -180,7 +191,7 @@ private: OpenChannelToExtensionMutator open_extension_mutator_; - const raw_ptr<mojom::ServiceWorkerHost> impl_; + const WorkerId worker_id_; }; #endif @@ -882,9 +893,9 @@ ExtensionHostMsg_OpenChannelToExtension( source_context, info, channel_type, channel_name, port_id)); #else - ServiceWorkerHost* host = ServiceWorkerHost::GetWorkerFor(service_workers[0]); - ASSERT_TRUE(host); - auto interceptor = std::make_unique<ServiceWorkerHostInterceptor>(host); + auto interceptor = + std::make_unique<ServiceWorkerHostInterceptorForProcessDeath>( + service_workers[0]); interceptor->SetOpenChannelToExtensionMutator(base::BindLambdaForTesting( [this](extensions::mojom::ExternalConnectionInfo& info) { EXPECT_EQ(MessagingEndpoint::Type::kExtension,
diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc index fa1fbfef4..d368229 100644 --- a/chrome/browser/extensions/service_worker_apitest.cc +++ b/chrome/browser/extensions/service_worker_apitest.cc
@@ -464,8 +464,15 @@ // Tests that an extension can fetch a file scheme URL from the service worker, // if it has file access. +// TODO(crbug.com/1499141): Flaky on mac +#if BUILDFLAG(IS_MAC) +#define MAYBE_FetchFileSchemeURLWithFileAccess \ + DISABLED_FetchFileSchemeURLWithFileAccess +#else +#define MAYBE_FetchFileSchemeURLWithFileAccess FetchFileSchemeURLWithFileAccess +#endif IN_PROC_BROWSER_TEST_F(ServiceWorkerBasedBackgroundTest, - FetchFileSchemeURLWithFileAccess) { + MAYBE_FetchFileSchemeURLWithFileAccess) { ASSERT_TRUE( RunExtensionTest("service_worker/worker_based_background/" "fetch_file_scheme_url_with_file_access",
diff --git a/chrome/browser/fast_checkout/fast_checkout_client_impl.h b/chrome/browser/fast_checkout/fast_checkout_client_impl.h index 8dcbbf8..0e257f7 100644 --- a/chrome/browser/fast_checkout/fast_checkout_client_impl.h +++ b/chrome/browser/fast_checkout/fast_checkout_client_impl.h
@@ -11,7 +11,7 @@ #include "chrome/browser/fast_checkout/fast_checkout_capabilities_fetcher.h" #include "chrome/browser/fast_checkout/fast_checkout_personal_data_helper.h" #include "chrome/browser/fast_checkout/fast_checkout_trigger_validator.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.h" #include "chrome/browser/ui/fast_checkout/fast_checkout_controller_impl.h" #include "components/autofill/content/browser/content_autofill_client.h" #include "components/autofill/core/browser/data_model/autofill_profile.h"
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index dd0ad3c..4888933 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -4246,11 +4246,6 @@ "expiry_milestone": 129 }, { - "name": "fill-multi-line", - "owners": ["//components/compose/OWNERS", "chrome-compose-frontend@google.com"], - "expiry_milestone": 130 - }, - { "name": "fill-on-account-select", "owners": [ "kazinova@google.com", "vasilii@chromium.org" ], "expiry_milestone": 125 @@ -4282,6 +4277,15 @@ "expiry_milestone": 130 }, { + "name": "fluent-overlay-scrollbars", + "owners": [ + "gastonr@microsoft.com", + "gerchiko@microsoft.com", + "yshalivskyy@microsoft.com" + ], + "expiry_milestone": 130 + }, + { "name": "fluent-scrollbars", "owners": [ "gastonr@microsoft.com", @@ -4510,6 +4514,11 @@ "expiry_milestone": 117 }, { + "name": "help-app-cros-components", + "owners": [ "//ash/webui/help_app_ui/OWNERS" ], + "expiry_milestone": 125 + }, + { "name": "help-app-home-page-app-articles", "owners": [ "//ash/webui/help_app_ui/OWNERS" ], "expiry_milestone": 124 @@ -7604,6 +7613,13 @@ "expiry_milestone": 125 }, { + "name": "tethering-experimental-functionality", + "owners": [ "jiajunz@google.com" , "cros-connectivity@google.com" ], + // This flag is used for developing and testing tethering on experimental + // carriers, modem and modem FW. + "expiry_milestone": -1 + }, + { "name": "text-based-audio-descriptions", "owners": [ "abigailbklein@google.com", "evliu@google.com", "//ui/accessibility/OWNERS" ], "expiry_milestone": 130
diff --git a/chrome/browser/flag-never-expire-list.json b/chrome/browser/flag-never-expire-list.json index d50dc7bb..dcb8133 100644 --- a/chrome/browser/flag-never-expire-list.json +++ b/chrome/browser/flag-never-expire-list.json
@@ -122,6 +122,7 @@ "synthesized-restore-session", "system-keyboard-lock", "terminal-dev", + "tethering-experimental-functionality", "tint-composited-content", "top-chrome-touch-ui", "translate-force-trigger-on-english",
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 8c7fcfcc..6a7d1c5f 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1728,6 +1728,11 @@ "This flag enables password filling across grouped websites. Information " "about website groups is provided by the affiliation service."; +const char kFluentOverlayScrollbarsName[] = "Windows Fluent Overlay scrollbars."; +const char kFluentOverlayScrollbarsDescription[] = + "Stylizes scrollbars with Microsoft Fluent design and makes them overlay " + "over the web's content."; + const char kFluentScrollbarsName[] = "Windows Fluent scrollbars."; const char kFluentScrollbarsDescription[] = "Stylizes scrollbars with Microsoft Fluent design."; @@ -6496,6 +6501,10 @@ "Enables the logic that auto triggers the install dialog during the web " "app install flow initiated from the Help App."; +const char kHelpAppCrosComponentsName[] = "Help App cros components"; +const char kHelpAppCrosComponentsDescription[] = + "If enabled, the Help app will render with Cros components."; + const char kHelpAppHomePageAppArticlesName[] = "Help App home page app articles"; const char kHelpAppHomePageAppArticlesDescription[] = @@ -7217,6 +7226,12 @@ "Feature to enable the usage of DBus APIs that improve the stability" "around performing SM-DS scans."; +const char kTetheringExperimentalFunctionalityName[] = + "Tethering Allow Experimental Functionality"; +const char kTetheringExperimentalFunctionalityDescription[] = + "Feature to enable Chromebook hotspot functionality for experimental " + "carriers, modem and modem FW."; + const char kOobeJellyName[] = "Jelly design for OOBE"; const char kOobeJellyDescription[] = "Feature to enable the Jelly design in out of box experience."; @@ -7751,9 +7766,6 @@ "are normally recorded in chrome://password-manager-internals and " "chrome://autofill-internals will be recorded on files on the disk. At the " "end of the report, these files will be attached to the report."; - -const char kFillMultiLineName[] = "Multi Line Fill"; -const char kFillMultiLineDescription[] = "Enables multi line fill feature"; #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) #if BUILDFLAG(ENABLE_HLS_DEMUXER)
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index fb052ca..a92a2fa9 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -980,6 +980,9 @@ extern const char kFillingAcrossGroupedSitesName[]; extern const char kFillingAcrossGroupedSitesDescription[]; +extern const char kFluentOverlayScrollbarsName[]; +extern const char kFluentOverlayScrollbarsDescription[]; + extern const char kFluentScrollbarsName[]; extern const char kFluentScrollbarsDescription[]; @@ -3739,6 +3742,9 @@ extern const char kHelpAppAutoTriggerInstallDialogName[]; extern const char kHelpAppAutoTriggerInstallDialogDescription[]; +extern const char kHelpAppCrosComponentsName[]; +extern const char kHelpAppCrosComponentsDescription[]; + extern const char kHelpAppHomePageAppArticlesName[]; extern const char kHelpAppHomePageAppArticlesDescription[]; @@ -4140,6 +4146,9 @@ extern const char kSmdsDbusMigrationName[]; extern const char kSmdsDbusMigrationDescription[]; +extern const char kTetheringExperimentalFunctionalityName[]; +extern const char kTetheringExperimentalFunctionalityDescription[]; + extern const char kOobeJellyName[]; extern const char kOobeJellyDescription[]; @@ -4481,9 +4490,6 @@ extern const char kAttachLogsToAutofillRaterExtensionReportName[]; extern const char kAttachLogsToAutofillRaterExtensionReportDescription[]; -extern const char kFillMultiLineName[]; -extern const char kFillMultiLineDescription[]; - #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) #if BUILDFLAG(ENABLE_HLS_DEMUXER)
diff --git a/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc b/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc index 3c05490..0ddd8d27 100644 --- a/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc +++ b/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc
@@ -150,15 +150,21 @@ success_future.GetCallback()); ASSERT_TRUE(success_future.Take()); - // Close all app windows. + // Wait for the app window to be shown, which is not guaranteed by + // WaitForShelfItem above. It's necessary to wait because otherwise + // WaitForWindowDestruction below might terminate immediately despite the + // window still being alive (and affecting the behavior of SelectItemInShelf). extensions::AppWindowRegistry::AppWindowList app_windows = extensions::AppWindowRegistry::Get(profile())->app_windows(); - for (extensions::AppWindow* app_window : app_windows) { - std::string window_id = lacros_window_utility::GetRootWindowUniqueId( - app_window->GetNativeWindow()->GetRootWindow()); - app_window->GetBaseWindow()->Close(); - ASSERT_TRUE(browser_test_util::WaitForWindowDestruction(window_id)); - } + ASSERT_EQ(1u, app_windows.size()); + extensions::AppWindow* app_window = app_windows.front(); + std::string window_id = lacros_window_utility::GetRootWindowUniqueId( + app_window->GetNativeWindow()->GetRootWindow()); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(window_id)); + + // Close the app window. + app_window->GetBaseWindow()->Close(); + ASSERT_TRUE(browser_test_util::WaitForWindowDestruction(window_id)); // Confirm that there are no open windows. ASSERT_TRUE(
diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc index ff90240..39212763 100644 --- a/chrome/browser/net/profile_network_context_service.cc +++ b/chrome/browser/net/profile_network_context_service.cc
@@ -146,11 +146,10 @@ } #if BUILDFLAG(IS_CHROMEOS) -cert_verifier::mojom::AdditionalCertificatesPtr GetAdditionalCertificates( +network::mojom::AdditionalCertificatesPtr GetAdditionalCertificates( const policy::PolicyCertService* policy_cert_service, const base::FilePath& storage_partition_path) { - auto additional_certificates = - cert_verifier::mojom::AdditionalCertificates::New(); + auto additional_certificates = network::mojom::AdditionalCertificates::New(); policy_cert_service->GetPolicyCertificatesForStoragePartition( storage_partition_path, &(additional_certificates->all_certificates), &(additional_certificates->trust_anchors)); @@ -355,8 +354,8 @@ content::StoragePartition* storage_partition) { auto additional_certificates = GetAdditionalCertificates( policy_cert_service, storage_partition->GetPath()); - storage_partition->GetCertVerifierServiceUpdater() - ->UpdateAdditionalCertificates(std::move(additional_certificates)); + storage_partition->GetNetworkContext()->UpdateAdditionalCertificates( + std::move(additional_certificates)); }, policy_cert_service)); } @@ -774,12 +773,12 @@ #if BUILDFLAG(IS_CHROMEOS) void ProfileNetworkContextService::PopulateInitialAdditionalCerts( const base::FilePath& relative_partition_path, - cert_verifier::mojom::CertVerifierCreationParams* creation_params) { + network::mojom::NetworkContextParams* network_context_params) { if (policy::PolicyCertServiceFactory::CreateAndStartObservingForProfile( profile_)) { const policy::PolicyCertService* policy_cert_service = policy::PolicyCertServiceFactory::GetForProfile(profile_); - creation_params->initial_additional_certificates = + network_context_params->initial_additional_certificates = GetAdditionalCertificates(policy_cert_service, GetPartitionPath(relative_partition_path)); } @@ -950,7 +949,7 @@ } PopulateInitialAdditionalCerts(relative_partition_path, - cert_verifier_creation_params); + network_context_params); #endif #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -975,7 +974,7 @@ } if (profile_supports_policy_certs) { PopulateInitialAdditionalCerts(relative_partition_path, - cert_verifier_creation_params); + network_context_params); } #endif
diff --git a/chrome/browser/net/profile_network_context_service.h b/chrome/browser/net/profile_network_context_service.h index 6099e20..1f0e5ff 100644 --- a/chrome/browser/net/profile_network_context_service.h +++ b/chrome/browser/net/profile_network_context_service.h
@@ -170,7 +170,7 @@ // authority certificates for |relative_partition_path|. void PopulateInitialAdditionalCerts( const base::FilePath& relative_partition_path, - cert_verifier::mojom::CertVerifierCreationParams* creation_params); + network::mojom::NetworkContextParams* network_context_params); // content_settings::Observer: void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc index 696858d..5a28cf8 100644 --- a/chrome/browser/net/system_network_context_manager.cc +++ b/chrome/browser/net/system_network_context_manager.cc
@@ -892,9 +892,6 @@ cert_verifier_creation_params = cert_verifier::mojom::CertVerifierCreationParams::New(); ConfigureDefaultNetworkContextParams(network_context_params.get()); - // The system network context doesn't update the CertVerifyProc - // InstanceParams while running, so it does not attach a - // CertVerifierServiceUpdater. network_context_params->cert_verifier_params = content::GetCertVerifierParams(std::move(cert_verifier_creation_params)); network_context_params->acam_preflight_spec_conformant =
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc index fdf65b8..c8d11774 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/profiles/profile_key.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/identity_manager_factory.h" +#include "chrome/browser/sync/sync_service_factory.h" #include "chrome/common/chrome_paths.h" #include "components/component_updater/pref_names.h" #include "components/leveldb_proto/public/proto_database_provider.h" @@ -129,6 +130,16 @@ return nullptr; } +void OptimizationGuideKeyedService:: + SimulateBrowserRestartForControllerTesting() { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + if (!model_execution_features_controller_) { + return; + } + model_execution_features_controller_ + ->SimulateBrowserRestartForTesting(); // IN-TEST +} + OptimizationGuideKeyedService::OptimizationGuideKeyedService( content::BrowserContext* browser_context) : browser_context_(browser_context) { @@ -302,9 +313,9 @@ if (browser_context_ && !browser_context_->IsOffTheRecord() && !profile->IsGuestSession()) { model_execution_features_controller_ = - std::make_unique<optimization_guide::internal:: - OptimizationGuideModelExecutionFeaturesController>( - profile->GetPrefs()); + std::make_unique<optimization_guide::ModelExecutionFeaturesController>( + profile->GetPrefs(), + IdentityManagerFactory::GetForProfile(profile)); } } @@ -480,11 +491,30 @@ return model_execution_features_controller_->IsSettingVisible(feature); } -bool OptimizationGuideKeyedService::IsSettingEnabled( +bool OptimizationGuideKeyedService::ShouldFeatureBeCurrentlyEnabledForUser( optimization_guide::proto::ModelExecutionFeature feature) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!model_execution_features_controller_) { return false; } - return model_execution_features_controller_->IsSettingEnabled(feature); + return model_execution_features_controller_ + ->ShouldFeatureBeCurrentlyEnabledForUser(feature); +} + +void OptimizationGuideKeyedService::AddModelExecutionSettingsEnabledObserver( + optimization_guide::SettingsEnabledObserver* observer) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + if (!model_execution_features_controller_) { + return; + } + model_execution_features_controller_->AddObserver(observer); +} + +void OptimizationGuideKeyedService::RemoveModelExecutionSettingsEnabledObserver( + optimization_guide::SettingsEnabledObserver* observer) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + if (!model_execution_features_controller_) { + return; + } + model_execution_features_controller_->RemoveObserver(observer); }
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service.h b/chrome/browser/optimization_guide/optimization_guide_keyed_service.h index 7fb0c76..b7a77e5b 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service.h +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service.h
@@ -13,6 +13,7 @@ #include "build/build_config.h" #include "chrome/browser/profiles/profile_observer.h" #include "components/keyed_service/core/keyed_service.h" +#include "components/optimization_guide/core/model_execution/model_execution_features_controller.h" #include "components/optimization_guide/core/model_quality/model_quality_logs_uploader.h" #include "components/optimization_guide/core/optimization_guide_decider.h" #include "components/optimization_guide/core/optimization_guide_model_executor.h" @@ -37,9 +38,6 @@ namespace android { class OptimizationGuideBridge; } // namespace android -namespace internal { -class OptimizationGuideModelExecutionFeaturesController; -} // namespace internal class ChromeHintsManager; class ModelExecutionManager; class ModelInfo; @@ -60,6 +58,10 @@ class OptimizationGuideNavigationData; class Profile; +namespace settings { +class SettingsUI; +} // namespace settings + // Keyed service that can be used to get information received from the remote // Optimization Guide Service. For regular profiles, this will do the work to // fetch the necessary information from the remote Optimization Guide Service @@ -121,15 +123,19 @@ std::unique_ptr<optimization_guide::ModelQualityLogEntry> log_entry) override; - // Returns true if the opt-in setting should be shown for this profile for - // given `feature`. - bool IsSettingVisible( + // Returns true if the `feature` should be currently enabled for this user. + // Note that the return value here may not match the feature enable state on + // chrome settings page since the latter takes effect on browser restart. + bool ShouldFeatureBeCurrentlyEnabledForUser( optimization_guide::proto::ModelExecutionFeature feature) const; - // Returns true if the opt-in setting has been enabled by the user for this - // profile for given `feature`. - bool IsSettingEnabled( - optimization_guide::proto::ModelExecutionFeature feature) const; + // Adds `observer` which can observe the change in feature settings. + void AddModelExecutionSettingsEnabledObserver( + optimization_guide::SettingsEnabledObserver* observer); + + // Removes `observer`. + void RemoveModelExecutionSettingsEnabledObserver( + optimization_guide::SettingsEnabledObserver* observer); // Adds hints for a URL with provided metadata to the optimization guide. // For testing purposes only. This will flush any callbacks for |url| that @@ -156,6 +162,10 @@ return optimization_guide_logger_.get(); } + // Simulates browser restart. Useful for testing controller functionality + // where some of the settings change take effect on browser restart. + void SimulateBrowserRestartForControllerTesting(); + private: friend class ChromeBrowserMainExtraPartsOptimizationGuide; friend class ChromeBrowsingDataRemoverDelegate; @@ -169,6 +179,7 @@ friend class optimization_guide::PredictionModelStoreBrowserTestBase; friend class optimization_guide::android::OptimizationGuideBridge; friend class PersonalizedHintsFetcherBrowserTest; + friend class settings::SettingsUI; // Initializes |this|. void Initialize(); @@ -211,6 +222,11 @@ optimization_guide::OnDemandOptimizationGuideDecisionRepeatingCallback callback) override; + // Returns true if the opt-in setting should be shown for this profile for + // given `feature`. This should only be called by settings UX. + bool IsSettingVisible( + optimization_guide::proto::ModelExecutionFeature feature) const; + download::BackgroundDownloadService* BackgroundDownloadServiceProvider(); bool ComponentUpdatesEnabledProvider() const; @@ -250,8 +266,7 @@ std::unique_ptr<optimization_guide::ModelExecutionManager> model_execution_manager_; - std::unique_ptr<optimization_guide::internal:: - OptimizationGuideModelExecutionFeaturesController> + std::unique_ptr<optimization_guide::ModelExecutionFeaturesController> model_execution_features_controller_; // Used to observe profile initialization event.
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc index e247c54..a47aff0 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -156,8 +157,12 @@ OptimizationGuideKeyedServiceBrowserTest() : network_connection_tracker_( network::TestNetworkConnectionTracker::CreateInstance()) { + // Enable visibility of tab organization feature. scoped_feature_list_.InitWithFeatures( - {optimization_guide::features::kOptimizationHints}, {}); + {optimization_guide::features::kOptimizationHints, + optimization_guide::features::internal:: + kTabOrganizationSettingsVisibility}, + {}); } OptimizationGuideKeyedServiceBrowserTest( @@ -189,8 +194,27 @@ https_server_->GetURL("/redirect?https://nohints.com/"); SetConnectionType(network::mojom::ConnectionType::CONNECTION_2G); + + identity_test_env_adaptor_ = + std::make_unique<IdentityTestEnvironmentProfileAdaptor>( + browser()->profile()); } + void SetUpInProcessBrowserTestFixture() override { + create_services_subscription_ = + BrowserContextDependencyManager::GetInstance() + ->RegisterCreateServicesCallbackForTesting( + base::BindRepeating(&OptimizationGuideKeyedServiceBrowserTest:: + OnWillCreateBrowserContextServices, + base::Unretained(this))); + } + + void OnWillCreateBrowserContextServices(content::BrowserContext* context) { + IdentityTestEnvironmentProfileAdaptor:: + SetIdentityTestEnvironmentFactoriesOnBrowserContext(context); + } + + base::CallbackListSubscription create_services_subscription_; void TearDownOnMainThread() override { EXPECT_TRUE(https_server_->ShutdownAndWaitUntilComplete()); @@ -278,6 +302,23 @@ base::HistogramTester* histogram_tester() { return &histogram_tester_; } + void EnableSignIn() { + identity_test_env_adaptor_->identity_test_env() + ->MakePrimaryAccountAvailable("user@gmail.com", + signin::ConsentLevel::kSignin); + } + + void SignOut() { + identity_test_env_adaptor_->identity_test_env()->ClearPrimaryAccount(); + } + + bool IsSettingVisible( + optimization_guide::proto::ModelExecutionFeature feature) { + return OptimizationGuideKeyedServiceFactory::GetForProfile( + browser()->profile()) + ->IsSettingVisible(feature); + } + private: std::unique_ptr<net::test_server::HttpResponse> HandleRequest( const net::test_server::HttpRequest& request) { @@ -311,6 +352,10 @@ // Histogram tester used specifically to capture metrics that are recorded // during browser initialization. base::HistogramTester histogram_tester_; + + // Identity test support. + std::unique_ptr<IdentityTestEnvironmentProfileAdaptor> + identity_test_env_adaptor_; }; IN_PROC_BROWSER_TEST_F(OptimizationGuideKeyedServiceBrowserTest, @@ -671,24 +716,79 @@ run_loop->Run(); } +class TestSettingsEnabledObserver + : public optimization_guide::SettingsEnabledObserver { + public: + explicit TestSettingsEnabledObserver( + optimization_guide::proto::ModelExecutionFeature feature) + : SettingsEnabledObserver(feature) {} + void PrepareToEnableOnRestart() override { + ++count_received_prepare_to_enable_on_restart_notifications_; + } + + int count_received_prepare_to_enable_on_restart_notifications_ = 0; +}; + +IN_PROC_BROWSER_TEST_F(OptimizationGuideKeyedServiceBrowserTest, + SettingsVisibilitySignedOutVsSignedIn) { + // User is not signed-in. + EXPECT_FALSE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + // Visibility of tab organizer is enabled via finch but the feature is still + // not visible. + EXPECT_FALSE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); + + // MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION should now be visible after + // sign-in. + EnableSignIn(); + + EXPECT_FALSE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_TRUE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); + +#if !BUILDFLAG(IS_CHROMEOS) + // SignOut not supported on ChromeOS. + SignOut(); + EXPECT_FALSE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); +#endif +} + // Verifies that Model Execution Features Controller is available for incognito // profiles and the visibility of settings is correct. IN_PROC_BROWSER_TEST_F(OptimizationGuideKeyedServiceBrowserTest, SettingsVisibilityUpdatedCorrectly) { - OptimizationGuideKeyedService* ogks = - OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile()); + EnableSignIn(); EXPECT_FALSE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + // Visibility of tab organizer is enabled via finch. + EXPECT_TRUE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); EXPECT_FALSE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); - - EXPECT_FALSE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_COMPOSE)); + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); auto* prefs = browser()->profile()->GetPrefs(); prefs->SetInteger( @@ -697,17 +797,28 @@ MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH), static_cast<int>(optimization_guide::prefs::FeatureOptInState::kEnabled)); + EXPECT_FALSE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + OptimizationGuideKeyedService* ogks = + OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile()); + + ogks->SimulateBrowserRestartForControllerTesting(); + + // Restarting the browser should cause wallpaper setting to be visible since + // the feature is enabled. EXPECT_TRUE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_TRUE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); EXPECT_FALSE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); - - EXPECT_FALSE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_COMPOSE)); + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); prefs->SetInteger( optimization_guide::prefs::GetSettingEnabledPrefName( @@ -716,17 +827,101 @@ static_cast<int>( optimization_guide::prefs::FeatureOptInState::kDisabled)); + EXPECT_TRUE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + ogks->SimulateBrowserRestartForControllerTesting(); + + // Restarting the browser should cause wallpaper setting to be not visible + // since the feature is no-longer enabled. EXPECT_FALSE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_TRUE( + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); EXPECT_FALSE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); +} - EXPECT_FALSE( - ogks->IsSettingVisible(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_COMPOSE)); +IN_PROC_BROWSER_TEST_F(OptimizationGuideKeyedServiceBrowserTest, + SettingsOptInRevokedAfterSignOut) { + OptimizationGuideKeyedService* ogks = + OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile()); + + EnableSignIn(); + + TestSettingsEnabledObserver wallpaper_search_observer( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH); + TestSettingsEnabledObserver compose_observer( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE); + + ogks->AddModelExecutionSettingsEnabledObserver(&wallpaper_search_observer); + ogks->AddModelExecutionSettingsEnabledObserver(&compose_observer); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); + + auto* prefs = browser()->profile()->GetPrefs(); + prefs->SetInteger( + optimization_guide::prefs::GetSettingEnabledPrefName( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH), + static_cast<int>(optimization_guide::prefs::FeatureOptInState::kEnabled)); + EXPECT_EQ(1, wallpaper_search_observer + .count_received_prepare_to_enable_on_restart_notifications_); + EXPECT_EQ(0, compose_observer + .count_received_prepare_to_enable_on_restart_notifications_); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + ogks->SimulateBrowserRestartForControllerTesting(); + + EXPECT_TRUE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); + +#if !BUILDFLAG(IS_CHROMEOS) + // SignOut not supported on ChromeOS. + SignOut(); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); +#endif } // Verifies that Model Execution Features Controller is available for incognito @@ -736,17 +931,29 @@ OptimizationGuideKeyedService* ogks = OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile()); - EXPECT_FALSE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + EnableSignIn(); - EXPECT_FALSE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + TestSettingsEnabledObserver wallpaper_search_observer( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH); + TestSettingsEnabledObserver compose_observer( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE); - EXPECT_FALSE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_COMPOSE)); + ogks->AddModelExecutionSettingsEnabledObserver(&wallpaper_search_observer); + ogks->AddModelExecutionSettingsEnabledObserver(&compose_observer); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); auto* prefs = browser()->profile()->GetPrefs(); prefs->SetInteger( @@ -754,18 +961,28 @@ optimization_guide::proto::ModelExecutionFeature:: MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH), static_cast<int>(optimization_guide::prefs::FeatureOptInState::kEnabled)); + EXPECT_EQ(1, wallpaper_search_observer + .count_received_prepare_to_enable_on_restart_notifications_); + EXPECT_EQ(0, compose_observer + .count_received_prepare_to_enable_on_restart_notifications_); - EXPECT_TRUE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); - EXPECT_FALSE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + ogks->SimulateBrowserRestartForControllerTesting(); - EXPECT_FALSE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_COMPOSE)); + EXPECT_TRUE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); prefs->SetInteger( optimization_guide::prefs::GetSettingEnabledPrefName( @@ -773,18 +990,130 @@ MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH), static_cast<int>( optimization_guide::prefs::FeatureOptInState::kDisabled)); + EXPECT_EQ(1, wallpaper_search_observer + .count_received_prepare_to_enable_on_restart_notifications_); + EXPECT_EQ(0, compose_observer + .count_received_prepare_to_enable_on_restart_notifications_); - EXPECT_FALSE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + EXPECT_TRUE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); - EXPECT_FALSE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + ogks->SimulateBrowserRestartForControllerTesting(); - EXPECT_FALSE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_COMPOSE)); + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); +} + +// Verifies that Model Execution Features Controller updates feature prefs +// correctly when the main toggle pref changes. +IN_PROC_BROWSER_TEST_F(OptimizationGuideKeyedServiceBrowserTest, + MainToggleUpdatesSettingsCorrectly) { + OptimizationGuideKeyedService* ogks = + OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile()); + + EnableSignIn(); + + TestSettingsEnabledObserver wallpaper_search_observer( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH); + TestSettingsEnabledObserver compose_observer( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE); + TestSettingsEnabledObserver tab_observer( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION); + + ogks->AddModelExecutionSettingsEnabledObserver(&wallpaper_search_observer); + ogks->AddModelExecutionSettingsEnabledObserver(&compose_observer); + ogks->AddModelExecutionSettingsEnabledObserver(&tab_observer); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); + + // Enable the main feature toggle. This should enable the tab organizer + // feature on restart. + auto* prefs = browser()->profile()->GetPrefs(); + prefs->SetInteger( + optimization_guide::prefs::kModelExecutionMainToggleSettingState, + static_cast<int>(optimization_guide::prefs::FeatureOptInState::kEnabled)); + // Visibility of tab organizer feature is enabled via finch. Only tab + // organizer feature should be enabled. + EXPECT_EQ(0, wallpaper_search_observer + .count_received_prepare_to_enable_on_restart_notifications_); + EXPECT_EQ(0, compose_observer + .count_received_prepare_to_enable_on_restart_notifications_); + EXPECT_EQ( + 1, + tab_observer.count_received_prepare_to_enable_on_restart_notifications_); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + ogks->SimulateBrowserRestartForControllerTesting(); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_TRUE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); + + // Disable main toggle. The tab organizer feature should be disabled on + // restart. + prefs->SetInteger( + optimization_guide::prefs::kModelExecutionMainToggleSettingState, + static_cast<int>( + optimization_guide::prefs::FeatureOptInState::kDisabled)); + EXPECT_EQ(0, wallpaper_search_observer + .count_received_prepare_to_enable_on_restart_notifications_); + EXPECT_EQ(0, compose_observer + .count_received_prepare_to_enable_on_restart_notifications_); + EXPECT_EQ( + 1, + tab_observer.count_received_prepare_to_enable_on_restart_notifications_); + + EXPECT_TRUE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + ogks->SimulateBrowserRestartForControllerTesting(); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION)); + + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_COMPOSE)); } // Verifies that Model Execution Features Controller returns null for incognito @@ -809,7 +1138,7 @@ MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH), static_cast<int>(optimization_guide::prefs::FeatureOptInState::kEnabled)); - EXPECT_FALSE(otr_ogks->IsSettingEnabled( + EXPECT_FALSE(otr_ogks->ShouldFeatureBeCurrentlyEnabledForUser( optimization_guide::proto::ModelExecutionFeature:: MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); } @@ -832,6 +1161,8 @@ auto* prefs = browser()->profile()->GetPrefs(); auto* guest_prefs = guest_browser->profile()->GetPrefs(); + EnableSignIn(); + prefs->SetInteger( optimization_guide::prefs::GetSettingEnabledPrefName( optimization_guide::proto::ModelExecutionFeature:: @@ -843,12 +1174,22 @@ MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH), static_cast<int>(optimization_guide::prefs::FeatureOptInState::kEnabled)); - EXPECT_FALSE(guest_ogks->IsSettingEnabled( + EXPECT_FALSE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( optimization_guide::proto::ModelExecutionFeature:: MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); - EXPECT_TRUE( - ogks->IsSettingEnabled(optimization_guide::proto::ModelExecutionFeature:: - MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + EXPECT_FALSE(guest_ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + + ogks->SimulateBrowserRestartForControllerTesting(); + guest_ogks->SimulateBrowserRestartForControllerTesting(); + + EXPECT_TRUE(ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); + EXPECT_FALSE(guest_ogks->ShouldFeatureBeCurrentlyEnabledForUser( + optimization_guide::proto::ModelExecutionFeature:: + MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH)); } #endif
diff --git a/chrome/browser/password_manager/android/BUILD.gn b/chrome/browser/password_manager/android/BUILD.gn index fa09f39..21c787f 100644 --- a/chrome/browser/password_manager/android/BUILD.gn +++ b/chrome/browser/password_manager/android/BUILD.gn
@@ -500,8 +500,8 @@ "//chrome/browser", "//chrome/browser/autofill", "//chrome/browser/password_manager/android/add_username_dialog:android", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android:public", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android:test_support", + "//chrome/browser/touch_to_fill/password_generation/android:public", + "//chrome/browser/touch_to_fill/password_generation/android:test_support", "//chrome/test:test_support", "//components/autofill/core/browser", "//components/autofill/core/common",
diff --git a/chrome/browser/password_manager/android/password_generation_controller.h b/chrome/browser/password_manager/android/password_generation_controller.h index 704d16c..6d2a183 100644 --- a/chrome/browser/password_manager/android/password_generation_controller.h +++ b/chrome/browser/password_manager/android/password_generation_controller.h
@@ -8,7 +8,7 @@ #include <memory> #include "base/memory/weak_ptr.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h" #include "components/autofill/core/common/mojom/autofill_types.mojom-forward.h" #include "components/autofill/core/common/password_generation_util.h" #include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/password_manager/android/password_generation_controller_impl.cc b/chrome/browser/password_manager/android/password_generation_controller_impl.cc index 9bf1cc69..f3dc0264 100644 --- a/chrome/browser/password_manager/android/password_generation_controller_impl.cc +++ b/chrome/browser/password_manager/android/password_generation_controller_impl.cc
@@ -18,8 +18,8 @@ #include "chrome/browser/password_manager/android/password_generation_dialog_view_interface.h" #include "chrome/browser/password_manager/android/password_infobar_utils.h" #include "chrome/browser/password_manager/chrome_password_manager_client.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge_impl.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge_impl.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h" #include "components/autofill/core/browser/ui/accessory_sheet_enums.h" #include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/password_generation_util.h"
diff --git a/chrome/browser/password_manager/android/password_generation_controller_impl.h b/chrome/browser/password_manager/android/password_generation_controller_impl.h index 5df727cc..f9fd88b 100644 --- a/chrome/browser/password_manager/android/password_generation_controller_impl.h +++ b/chrome/browser/password_manager/android/password_generation_controller_impl.h
@@ -10,7 +10,7 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/password_manager/android/password_generation_controller.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h" #include "components/autofill/core/common/password_generation_util.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h"
diff --git a/chrome/browser/password_manager/android/password_generation_controller_impl_unittest.cc b/chrome/browser/password_manager/android/password_generation_controller_impl_unittest.cc index f56f6b6..af3944a 100644 --- a/chrome/browser/password_manager/android/password_generation_controller_impl_unittest.cc +++ b/chrome/browser/password_manager/android/password_generation_controller_impl_unittest.cc
@@ -17,9 +17,9 @@ #include "chrome/browser/autofill/mock_manual_filling_controller.h" #include "chrome/browser/password_manager/android/password_generation_dialog_view_interface.h" #include "chrome/browser/password_manager/chrome_password_manager_client.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/fake_touch_to_fill_password_generation_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h" +#include "chrome/browser/touch_to_fill/password_generation/android/fake_touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "components/autofill/core/browser/autofill_client.h" #include "components/autofill/core/browser/test_autofill_client.h"
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc index 5b635d83..95527977 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -133,9 +133,9 @@ #include "chrome/browser/password_manager/android/password_manager_launcher_android.h" #include "chrome/browser/password_manager/android/password_manager_ui_util_android.h" #include "chrome/browser/password_manager/android/password_migration_warning_startup_launcher.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.h" #include "components/password_manager/content/browser/keyboard_replacing_surface_visibility_controller_impl.h" #include "components/password_manager/core/browser/credential_cache.h" #include "components/password_manager/core/browser/password_credential_filler_impl.h"
diff --git a/chrome/browser/performance_manager/mechanisms/page_freezer.cc b/chrome/browser/performance_manager/mechanisms/page_freezer.cc index 99c813b..7ac6dcd7 100644 --- a/chrome/browser/performance_manager/mechanisms/page_freezer.cc +++ b/chrome/browser/performance_manager/mechanisms/page_freezer.cc
@@ -42,6 +42,11 @@ return; } + // A visible page should not be frozen. + if (contents->GetVisibility() == content::Visibility::VISIBLE) { + return; + } + contents->SetPageFrozen(true); }
diff --git a/chrome/browser/policy/networking/policy_cert_service_factory.cc b/chrome/browser/policy/networking/policy_cert_service_factory.cc index 17f3937..79e0e1e 100644 --- a/chrome/browser/policy/networking/policy_cert_service_factory.cc +++ b/chrome/browser/policy/networking/policy_cert_service_factory.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "components/prefs/scoped_user_pref_update.h" +#include "services/network/cert_verifier_with_trust_anchors.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_features.h"
diff --git a/chrome/browser/policy/test/policy_certs_browsertest.cc b/chrome/browser/policy/test/policy_certs_browsertest.cc index 5eb3bb7..2dcf4cd7 100644 --- a/chrome/browser/policy/test/policy_certs_browsertest.cc +++ b/chrome/browser/policy/test/policy_certs_browsertest.cc
@@ -19,8 +19,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/net/nss_service.h" #include "chrome/browser/net/nss_service_factory.h" -#include "chrome/browser/policy/networking/policy_cert_service.h" -#include "chrome/browser/policy/networking/policy_cert_service_factory.h" #include "chrome/browser/policy/networking/user_network_configuration_updater_ash.h" #include "chrome/browser/policy/networking/user_network_configuration_updater_factory.h" #include "chrome/browser/policy/profile_policy_connector_builder.h" @@ -249,9 +247,6 @@ // Note that this relies on the implementation detail that the notification // is sent even if the trust roots effectively remain the same. - // - // Ideally this should wait on the roots making it all the way to the - // CertVerifierService, but there is no good way to do this currently. trust_roots_changed_observer.Wait(); user_network_configuration_updater->RemovePolicyProvidedCertsObserver( &trust_roots_changed_observer); @@ -432,8 +427,6 @@ EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, VerifyTestServerCert(multi_profile_policy_helper_.profile_2(), user_policy_certs_helper_.server_cert())); - EXPECT_FALSE(PolicyCertServiceFactory::GetForProfile(browser()->profile()) - ->UsedPolicyCertificates()); } IN_PROC_BROWSER_TEST_F(PolicyProvidedCertsRegularUserTest, TrustAnchorApplied) { @@ -443,8 +436,6 @@ EXPECT_EQ(net::OK, VerifyTestServerCert(multi_profile_policy_helper_.profile_1(), user_policy_certs_helper_.server_cert())); - EXPECT_TRUE(PolicyCertServiceFactory::GetForProfile(browser()->profile()) - ->UsedPolicyCertificates()); } // Test that policy provided trust anchors are available in Incognito mode. @@ -475,12 +466,6 @@ EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, VerifyTestServerCert(multi_profile_policy_helper_.profile_2(), user_policy_certs_helper_.server_cert())); - EXPECT_TRUE(PolicyCertServiceFactory::GetForProfile( - multi_profile_policy_helper_.profile_1()) - ->UsedPolicyCertificates()); - EXPECT_FALSE(PolicyCertServiceFactory::GetForProfile( - multi_profile_policy_helper_.profile_2()) - ->UsedPolicyCertificates()); } IN_PROC_BROWSER_TEST_F(PolicyProvidedCertsRegularUserTest, @@ -598,11 +583,6 @@ EXPECT_EQ(net::OK, VerifyTestServerCert(ash::ProfileHelper::GetLockScreenProfile(), user_policy_certs_helper_.server_cert())); - EXPECT_TRUE(PolicyCertServiceFactory::GetForProfile(browser()->profile()) - ->UsedPolicyCertificates()); - EXPECT_TRUE(PolicyCertServiceFactory::GetForProfile( - ash::ProfileHelper::GetLockScreenProfile()) - ->UsedPolicyCertificates()); } // Test that the lock screen profile doesn't use the policy provided custom @@ -664,11 +644,6 @@ EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, VerifyTestServerCert(ash::ProfileHelper::GetLockScreenProfile(), user_policy_certs_helper_.server_cert())); - EXPECT_TRUE(PolicyCertServiceFactory::GetForProfile(browser()->profile()) - ->UsedPolicyCertificates()); - // The lock screen profile does not have a PolicyCertService initialized. - EXPECT_FALSE(PolicyCertServiceFactory::GetForProfile( - ash::ProfileHelper::GetLockScreenProfile())); } #endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/printing/system_access_process_print_browsertest.cc b/chrome/browser/printing/system_access_process_print_browsertest.cc index bb66cde..a76ea11b 100644 --- a/chrome/browser/printing/system_access_process_print_browsertest.cc +++ b/chrome/browser/printing/system_access_process_print_browsertest.cc
@@ -2549,9 +2549,7 @@ #endif // BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG) #if BUILDFLAG(IS_MAC) -IN_PROC_BROWSER_TEST_P(SystemAccessProcessPrintBrowserTest, - // TODO(crbug.com/1500113): Re-enable this test - DISABLED_OpenPdfInPreview) { +IN_PROC_BROWSER_TEST_P(SystemAccessProcessPrintBrowserTest, OpenPdfInPreview) { AddPrinter("printer1"); SetPrinterNameForSubsequentContexts("printer1"); @@ -2575,9 +2573,10 @@ SetNumExpectedMessages(/*num=*/5); } else { // The expected events for this are: - // 1. Wait for the one print job to be destroyed, to ensure printing + // 1. Update printer settings. + // 2. Wait for the one print job to be destroyed, to ensure printing // finished cleanly before completing the test. - SetNumExpectedMessages(/*num=*/1); + SetNumExpectedMessages(/*num=*/2); } OpenPdfInPreviewOnceReadyAndLoaded(); @@ -3470,8 +3469,7 @@ #if BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(ContentAnalysisBeforePrintPreviewBrowserTest, - // TODO(crbug.com/1500113): Re-enable this test - DISABLED_OpenPdfInPreviewFromPrintPreview) { + OpenPdfInPreviewFromPrintPreview) { AddPrinter("printer_name"); ASSERT_TRUE(embedded_test_server()->Started()); @@ -3504,9 +3502,10 @@ // The expected events for this are: // 1. The document is composited for content analysis. // 2. The print job used for scanning is destroyed. - // 3. Wait for the actual printing job to be destroyed, to ensure + // 3. Update printer settings. + // 4. Wait for the actual printing job to be destroyed, to ensure // printing finished cleanly before completing the test. - SetNumExpectedMessages(/*num=*/3); + SetNumExpectedMessages(/*num=*/4); } OpenPdfInPreviewOnceReadyAndLoaded(); } else { @@ -3768,8 +3767,7 @@ #if BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(ContentAnalysisAfterPrintPreviewBrowserTest, - // TODO(crbug.com/1500113): Re-enable this test - DISABLED_OpenPdfInPreviewFromPrintPreview) { + OpenPdfInPreviewFromPrintPreview) { AddPrinter("printer_name"); if (UseService() && !PrintAllowedOrNonBlockingPolicy()) {
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc index a637492..f0adce0 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.cc
@@ -16,6 +16,7 @@ #include "build/buildflag.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" +#include "chrome/browser/privacy_sandbox/tracking_protection_onboarding_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/tpcd/experiment/experiment_manager.h" @@ -28,6 +29,7 @@ #include "components/privacy_sandbox/privacy_sandbox_features.h" #include "components/privacy_sandbox/privacy_sandbox_prefs.h" #include "components/privacy_sandbox/tpcd_experiment_eligibility.h" +#include "components/privacy_sandbox/tracking_protection_onboarding.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/tribool.h" #include "content/public/common/content_features.h" @@ -305,3 +307,32 @@ webapp_registry_ = std::move(webapp_registry); } #endif + +bool PrivacySandboxSettingsDelegate::IsCookieDeprecationLabelAllowed() const { + if (!IsCookieDeprecationExperimentEligible()) { + return false; + } + + if (!tpcd::experiment::kDisable3PCookies.Get()) { + return true; + } + + auto* tracking_protection_onboarding = + TrackingProtectionOnboardingFactory::GetForProfile(profile_); + if (!tracking_protection_onboarding) { + return false; + } + + switch (tracking_protection_onboarding->GetOnboardingStatus()) { + case privacy_sandbox::TrackingProtectionOnboarding::OnboardingStatus:: + kIneligible: + case privacy_sandbox::TrackingProtectionOnboarding::OnboardingStatus:: + kEligible: + case privacy_sandbox::TrackingProtectionOnboarding::OnboardingStatus:: + kOffboarded: + return false; + case privacy_sandbox::TrackingProtectionOnboarding::OnboardingStatus:: + kOnboarded: + return true; + } +}
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.h b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.h index 5effb3e..8c4096f 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.h +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate.h
@@ -41,6 +41,7 @@ bool IsCookieDeprecationExperimentEligible() const override; privacy_sandbox::TpcdExperimentEligibility GetCookieDeprecationExperimentCurrentEligibility() const override; + bool IsCookieDeprecationLabelAllowed() const override; #if BUILDFLAG(IS_ANDROID) void OverrideWebappRegistryForTesting(
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate_unittest.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate_unittest.cc index df8fbc5..d1fabef 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate_unittest.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_delegate_unittest.cc
@@ -15,6 +15,7 @@ #include "build/build_config.h" #include "build/buildflag.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" +#include "chrome/browser/privacy_sandbox/tracking_protection_onboarding_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" #include "chrome/browser/supervised_user/supervised_user_test_util.h" @@ -30,6 +31,7 @@ #include "components/privacy_sandbox/privacy_sandbox_features.h" #include "components/privacy_sandbox/privacy_sandbox_prefs.h" #include "components/privacy_sandbox/tpcd_experiment_eligibility.h" +#include "components/privacy_sandbox/tracking_protection_onboarding.h" #include "components/privacy_sandbox/tracking_protection_prefs.h" #include "components/signin/public/identity_manager/account_capabilities_test_mutator.h" #include "components/signin/public/identity_manager/identity_test_environment.h" @@ -487,6 +489,19 @@ : public PrivacySandboxSettingsDelegateTest, public testing::WithParamInterface<bool> {}; +// The parameter indicates whether to disable 3pcs. +class CookieDeprecationLabelAllowedTest + : public PrivacySandboxSettingsDelegateTest, + public testing::WithParamInterface<bool> { + public: + CookieDeprecationLabelAllowedTest() { + feature_list()->InitAndEnableFeatureWithParameters( + features::kCookieDeprecationFacilitatedTesting, + {{tpcd::experiment::kDisable3PCookiesName, + GetParam() ? "true" : "false"}}); + } +}; + } // namespace TEST_F(PrivacySandboxSettingsDelegateTest, IsEligible) { @@ -666,3 +681,70 @@ INSTANTIATE_TEST_SUITE_P(All, CookieDeprecationExperimentEligibilityOTRProfileTest, testing::Bool()); + +TEST_P(CookieDeprecationLabelAllowedTest, IsClientEligibleChecked) { + const bool disable_3pcs = GetParam(); + if (disable_3pcs) { + auto* onboarding_service = + TrackingProtectionOnboardingFactory::GetForProfile(profile()); + // Simulate onboarding a profile. + onboarding_service->MaybeMarkEligible(); + onboarding_service->OnboardingNoticeShown(); + } + + for (bool is_client_eligible : {false, true}) { + SCOPED_TRACE(is_client_eligible); + + EXPECT_CALL(*experiment_manager(), IsClientEligible) + .WillOnce(::testing::Return(is_client_eligible)); + EXPECT_EQ(delegate()->IsCookieDeprecationLabelAllowed(), + is_client_eligible); + } +} + +TEST_P(CookieDeprecationLabelAllowedTest, OnboardingStatusChecked) { + const struct { + privacy_sandbox::TrackingProtectionOnboarding::OnboardingStatus + onboarding_status; + bool expected_allowed; + } kTestCases[] = { + { + .onboarding_status = privacy_sandbox::TrackingProtectionOnboarding:: + OnboardingStatus::kIneligible, + .expected_allowed = false, + }, + { + .onboarding_status = privacy_sandbox::TrackingProtectionOnboarding:: + OnboardingStatus::kEligible, + .expected_allowed = false, + }, + { + .onboarding_status = privacy_sandbox::TrackingProtectionOnboarding:: + OnboardingStatus::kOnboarded, + .expected_allowed = true, + }, + + }; + + EXPECT_CALL(*experiment_manager(), IsClientEligible) + .WillRepeatedly(::testing::Return(true)); + + const bool disable_3pcs = GetParam(); + + for (const auto& test_case : kTestCases) { + SCOPED_TRACE(static_cast<int>(test_case.onboarding_status)); + + prefs()->SetInteger(prefs::kTrackingProtectionOnboardingStatus, + static_cast<int>(test_case.onboarding_status)); + if (disable_3pcs) { + EXPECT_EQ(delegate()->IsCookieDeprecationLabelAllowed(), + test_case.expected_allowed); + } else { + EXPECT_TRUE(delegate()->IsCookieDeprecationLabelAllowed()); + } + } +} + +INSTANTIATE_TEST_SUITE_P(All, + CookieDeprecationLabelAllowedTest, + testing::Bool());
diff --git a/chrome/browser/readaloud/android/BUILD.gn b/chrome/browser/readaloud/android/BUILD.gn index 22864d4..031ae223 100644 --- a/chrome/browser/readaloud/android/BUILD.gn +++ b/chrome/browser/readaloud/android/BUILD.gn
@@ -81,7 +81,10 @@ "java/res/drawable/primary_gray_rounded.xml", "java/res/drawable/replay_10_button.xml", "java/res/drawable/rounded_ripple.xml", + "java/res/drawable/scrubber_select_handle.xml", "java/res/drawable/secondary_gray_rounded.xml", + "java/res/drawable/seekbar_progress.xml", + "java/res/drawable/seekbar_style.xml", "java/res/drawable/translate_24.xml", "java/res/layout/readaloud_expanded_player_layout.xml", "java/res/layout/readaloud_menu.xml",
diff --git a/chrome/browser/readaloud/android/java/res/drawable/scrubber_select_handle.xml b/chrome/browser/readaloud/android/java/res/drawable/scrubber_select_handle.xml new file mode 100644 index 0000000..b587e9d --- /dev/null +++ b/chrome/browser/readaloud/android/java/res/drawable/scrubber_select_handle.xml
@@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Copyright 2023 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape android:shape="rectangle"> + <solid android:color="@macro/default_icon_color"/> + <size + android:width="@dimen/readaloud_expanded_player_seek_bar_scrubber_handle_width" + android:height="@dimen/readaloud_expanded_player_seek_bar_scrubber_handle_height"/> + <corners android:radius="8dp" /> + </shape> + </item> +</layer-list> \ No newline at end of file
diff --git a/chrome/browser/readaloud/android/java/res/drawable/seekbar_progress.xml b/chrome/browser/readaloud/android/java/res/drawable/seekbar_progress.xml new file mode 100644 index 0000000..d3ee3dd --- /dev/null +++ b/chrome/browser/readaloud/android/java/res/drawable/seekbar_progress.xml
@@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Copyright 2023 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> +<layer-list + xmlns:android="http://schemas.android.com/apk/res/android" > + <item + android:id="@+id/progressshape" > + <clip> + <shape + android:shape="rectangle" > + <corners + android:radius="5dp" /> + <solid android:color="@macro/default_icon_color"/> + </shape> + </clip> + </item> +</layer-list> \ No newline at end of file
diff --git a/chrome/browser/readaloud/android/java/res/drawable/seekbar_style.xml b/chrome/browser/readaloud/android/java/res/drawable/seekbar_style.xml new file mode 100644 index 0000000..c727817 --- /dev/null +++ b/chrome/browser/readaloud/android/java/res/drawable/seekbar_style.xml
@@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Copyright 2023 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape> + <size android:height="@dimen/readaloud_expanded_player_seek_bar_height"/> + <corners + android:radius="5dp"/> + <solid android:color="@macro/divider_line_bg_color"/> + </shape> + </item> + <item + android:id="@android:id/progress"> + <clip + android:drawable="@drawable/seekbar_progress"/> + </item> +</layer-list> \ No newline at end of file
diff --git a/chrome/browser/readaloud/android/java/res/layout/readaloud_expanded_player_layout.xml b/chrome/browser/readaloud/android/java/res/layout/readaloud_expanded_player_layout.xml index 2e816ea..015e2bfa 100644 --- a/chrome/browser/readaloud/android/java/res/layout/readaloud_expanded_player_layout.xml +++ b/chrome/browser/readaloud/android/java/res/layout/readaloud_expanded_player_layout.xml
@@ -89,13 +89,20 @@ </LinearLayout> <!-- Seek bar and times. --> - <!-- TODO replace with working bar --> - <View + <SeekBar android:id="@+id/readaloud_expanded_player_seek_bar" - android:layout_width="match_parent" - android:layout_height="@dimen/readaloud_expanded_player_seek_bar_height" android:layout_marginTop="@dimen/readaloud_expanded_player_seek_bar_margin_top" - android:background="?attr/colorSurfaceVariant"/> + android:padding="0dp" + android:paddingEnd="0dp" + android:paddingStart="0dp" + android:layout_width="match_parent" + android:layout_height="@dimen/readaloud_expanded_player_seek_bar_scrubber_handle_height" + android:max="1000" + android:progress="0" + android:maxHeight="@dimen/readaloud_expanded_player_seek_bar_height" + android:progressDrawable="@drawable/seekbar_style" + android:thumb="@drawable/scrubber_select_handle" + android:splitTrack="false"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
diff --git a/chrome/browser/readaloud/android/java/res/layout/readaloud_mini_player_layout.xml b/chrome/browser/readaloud/android/java/res/layout/readaloud_mini_player_layout.xml index 9fd517e..ecc8e0f 100644 --- a/chrome/browser/readaloud/android/java/res/layout/readaloud_mini_player_layout.xml +++ b/chrome/browser/readaloud/android/java/res/layout/readaloud_mini_player_layout.xml
@@ -38,7 +38,8 @@ android:id="@+id/mini_player_container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingHorizontal="16dp"> + android:paddingHorizontal="16dp" + android:alpha="0"> <!-- Buffering/unknown layout. --> <LinearLayout @@ -190,6 +191,7 @@ android:progress="0" android:progressTint="@macro/default_icon_color" android:progressTintMode="src_atop" - android:visibility="gone"/> + android:visibility="gone" + android:alpha="0"/> </FrameLayout> </org.chromium.chrome.browser.readaloud.player.mini.MiniPlayerLayout> \ No newline at end of file
diff --git a/chrome/browser/readaloud/android/java/res/values/dimens.xml b/chrome/browser/readaloud/android/java/res/values/dimens.xml index d43d6123..30d7696 100644 --- a/chrome/browser/readaloud/android/java/res/values/dimens.xml +++ b/chrome/browser/readaloud/android/java/res/values/dimens.xml
@@ -39,6 +39,8 @@ <!-- Seek bar --> <dimen name="readaloud_expanded_player_seek_bar_height">4dp</dimen> <dimen name="readaloud_expanded_player_seek_bar_margin_top">38dp</dimen> + <dimen name="readaloud_expanded_player_seek_bar_scrubber_handle_width">4dp</dimen> + <dimen name="readaloud_expanded_player_seek_bar_scrubber_handle_height">16dp</dimen> <!-- Times --> <dimen name="readaloud_expanded_player_times_margin_top">4dp</dimen>
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerCoordinatorUnitTest.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerCoordinatorUnitTest.java index 9d2bd5b..56d7fb0 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerCoordinatorUnitTest.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerCoordinatorUnitTest.java
@@ -17,6 +17,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewStub; +import android.widget.SeekBar; import android.widget.TextView; import org.junit.Before; @@ -68,6 +69,7 @@ @Mock private View mForwardButton; @Mock private View mBackButton; @Mock private Resources mResources; + @Mock private SeekBar mSeekBar; private MockPrefServiceHelper mMockPrefServiceHelper; private PlayerCoordinator mPlayerCoordinator; @@ -102,6 +104,9 @@ doReturn(Mockito.mock(TextView.class)) .when(mExpandedPlayerContentView) .findViewById(anyInt()); + doReturn(Mockito.mock(SeekBar.class)) + .when(mExpandedPlayerContentView) + .findViewById(R.id.readaloud_expanded_player_seek_bar); doReturn(mMenu).when(mLayoutInflater).inflate(eq(R.layout.readaloud_menu), any()); doReturn(Mockito.mock(TextView.class)).when(mMenu).findViewById(anyInt());
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerMediator.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerMediator.java index 1d59ff7a..1c3d0e0 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerMediator.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerMediator.java
@@ -8,6 +8,7 @@ import static org.chromium.chrome.modules.readaloud.PlaybackListener.State.PLAYING; import static org.chromium.chrome.modules.readaloud.PlaybackListener.State.STOPPED; +import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import androidx.annotation.Nullable; @@ -40,6 +41,23 @@ mModel.set(PlayerProperties.DURATION_NANOS, data.totalDurationNanos()); } }; + private final OnSeekBarChangeListener mSeekBarChangeListener = + new OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + if (!fromUser) { + return; + } + float percent = (float) progress / (float) seekBar.getMax(); + mPlayback.seek((long) (mModel.get(PlayerProperties.DURATION_NANOS) * percent)); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) {} + + @Override + public void onStopTrackingTouch(SeekBar seekBar) {} + }; private Playback mPlayback; @@ -135,8 +153,7 @@ @Override public OnSeekBarChangeListener getSeekBarChangeListener() { - // TODO implement - return null; + return mSeekBarChangeListener; } @Override
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerMediatorUnitTest.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerMediatorUnitTest.java index cd876fc..ca5b590 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerMediatorUnitTest.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/PlayerMediatorUnitTest.java
@@ -15,6 +15,8 @@ import static org.mockito.Mockito.verify; import android.app.Activity; +import android.widget.SeekBar; +import android.widget.SeekBar.OnSeekBarChangeListener; import org.junit.Before; import org.junit.Rule; @@ -61,7 +63,9 @@ @Mock private PlayerCoordinator mPlayerCoordinator; @Mock private Playback mPlayback; @Mock private Playback.Metadata mPlaybackMetadata; + @Mock private SeekBar mSeekbar; private MockPrefServiceHelper mMockPrefServiceHelper; + private OnSeekBarChangeListener mOnSeekBarChangeListener; @Captor private ArgumentCaptor<PlaybackListener> mPlaybackListenerCaptor; @@ -186,6 +190,7 @@ mDelegate = new TestPlayerDelegate(); mModel = new PropertyModel.Builder(PlayerProperties.ALL_KEYS).build(); mMediator = new PlayerMediator(mPlayerCoordinator, mDelegate, mModel); + mOnSeekBarChangeListener = mMediator.getSeekBarChangeListener(); } @Test @@ -353,6 +358,19 @@ } @Test + public void testOnProgressChanged() { + mMediator.setPlayback(mPlayback); + mModel.set(PlayerProperties.DURATION_NANOS, 100L); + // if not from user, make sure doesn't seek playback + mOnSeekBarChangeListener.onProgressChanged(mSeekbar, 20, false); + verify(mPlayback, never()).seek(anyLong()); + + // from user, so should seek + mOnSeekBarChangeListener.onProgressChanged(mSeekbar, 20, true); + verify(mPlayback).seek(anyLong()); + } + + @Test public void testOnSpeedChange() { mMediator.onSpeedChange(2f); assertEquals(2f, ReadAloudPrefs.getSpeed(mDelegate.getPrefService()), /* delta= */ 0f);
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerCoordinatorUnitTest.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerCoordinatorUnitTest.java index 8406679..cd201fc1 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerCoordinatorUnitTest.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerCoordinatorUnitTest.java
@@ -138,6 +138,12 @@ } @Test + public void testBindProgress() { + mModel.set(PlayerProperties.PROGRESS, 0.5f); + verify(mSheetContent).setProgress(eq(0.5f)); + } + + @Test public void testBindSpeed() { mModel.set(PlayerProperties.SPEED, 2f); verify(mSheetContent).setSpeed(eq(2f));
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerSheetContent.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerSheetContent.java index ce1bd5b..4ddada7 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerSheetContent.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerSheetContent.java
@@ -10,6 +10,7 @@ import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; +import android.widget.SeekBar; import android.widget.TextView; import androidx.annotation.Nullable; @@ -33,6 +34,7 @@ private final Context mContext; private final BottomSheetController mBottomSheetController; private final PropertyModel mModel; + private final SeekBar mSeekBar; private View mContentView; private OptionsMenuSheetContent mOptionsMenu; @@ -68,6 +70,7 @@ .findViewById(R.id.readaloud_seek_forward_button) .setContentDescription(res.getString(R.string.readaloud_forward, FORWARD_SECONDS)); setSpeed(DEFAULT_INITIAL_SPEED); + mSeekBar = (SeekBar) mContentView.findViewById(R.id.readaloud_expanded_player_seek_bar); } public void show() { @@ -112,6 +115,10 @@ setOnClickListener(R.id.readaloud_seek_forward_button, handler::onSeekForwardClick); setOnClickListener(R.id.readaloud_expanded_player_publisher, handler::onPublisherClick); setOnClickListener(R.id.readaloud_more_button, this::showOptionsMenu); + + SeekBar seekBar = + (SeekBar) mContentView.findViewById(R.id.readaloud_expanded_player_seek_bar); + seekBar.setOnSeekBarChangeListener(handler.getSeekBarChangeListener()); } @SuppressWarnings({"SetTextI18n", "DefaultLocale"}) @@ -140,6 +147,13 @@ } } + /** + * @param percentProgress out of 1.0 + */ + public void setProgress(float percent) { + mSeekBar.setProgress((int) (percent * mSeekBar.getMax()), true); + } + @Nullable OptionsMenuSheetContent getOptionsMenu() { return mOptionsMenu;
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerSheetContentUnitTest.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerSheetContentUnitTest.java index 5ed47bb..ea2e5e9 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerSheetContentUnitTest.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerSheetContentUnitTest.java
@@ -15,6 +15,7 @@ import android.graphics.drawable.Drawable; import android.view.View; import android.widget.ImageView; +import android.widget.SeekBar; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; @@ -54,6 +55,7 @@ private ImageView mBackButton; private ImageView mForwardButton; private ImageView mPlayPauseButton; + private SeekBar mSeekbar; private View mContentView; private Activity mActivity; @@ -77,6 +79,7 @@ mBackButton = (ImageView) mContentView.findViewById(R.id.readaloud_seek_back_button); mForwardButton = (ImageView) mContentView.findViewById(R.id.readaloud_seek_forward_button); mPlayPauseButton = (ImageView) mContentView.findViewById(R.id.readaloud_play_pause_button); + mSeekbar = (SeekBar) mContentView.findViewById(R.id.readaloud_expanded_player_seek_bar); mContent = new ExpandedPlayerSheetContent( mContext, mBottomSheetController, mContentView, mModel); @@ -171,6 +174,15 @@ } @Test + public void testSetProgress() { + mContent.setProgress(0.5f); + assertEquals(mSeekbar.getProgress(), (int) (mSeekbar.getMax() * 0.5f)); + + mContent.setProgress(0.75f); + assertEquals(mSeekbar.getProgress(), (int) (mSeekbar.getMax() * 0.75f)); + } + + @Test public void testShow() { mContent.show(); verify(mBottomSheetController, times(1)).requestShowContent(eq(mContent), eq(true));
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerViewBinder.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerViewBinder.java index 59b6b813..ef93dd2c 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerViewBinder.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/expanded/ExpandedPlayerViewBinder.java
@@ -35,6 +35,8 @@ } else if (key == PlayerProperties.PLAYBACK_STATE) { content.setPlaying( model.get(PlayerProperties.PLAYBACK_STATE) == PlaybackListener.State.PLAYING); + } else if (key == PlayerProperties.PROGRESS) { + content.setProgress(model.get(PlayerProperties.PROGRESS)); } else if (key == PlayerProperties.SPEED) { content.setSpeed(model.get(PlayerProperties.SPEED)); } else if (key == PlayerProperties.ELAPSED_NANOS) {
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerLayout.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerLayout.java index f77aa78e..de22cca 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerLayout.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerLayout.java
@@ -19,6 +19,7 @@ import android.util.AttributeSet; import android.view.View; import android.view.animation.Interpolator; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; @@ -26,6 +27,8 @@ import androidx.annotation.ColorInt; +import com.google.android.material.animation.ChildrenAlphaProperty; + import org.chromium.chrome.browser.readaloud.player.InteractionHandler; import org.chromium.chrome.browser.readaloud.player.R; import org.chromium.chrome.browser.readaloud.player.VisibilityState; @@ -37,14 +40,16 @@ /** Convenience class for manipulating mini player UI layout. */ public class MiniPlayerLayout extends LinearLayout { - private static final long SHOW_HIDE_DURATION_MS = 150L; - private static final Interpolator SHOW_HIDE_INTERPOLATOR = + private static final long FADE_DURATION_MS = 300L; + private static final Interpolator FADE_INTERPOLATOR = Interpolators.FAST_OUT_SLOW_IN_INTERPOLATOR; private TextView mTitle; private TextView mPublisher; private ProgressBar mProgressBar; private ImageView mPlayPauseView; + private FrameLayout mBackdrop; + private View mContents; // Layouts related to different playback states. private LinearLayout mNormalLayout; @@ -54,12 +59,10 @@ private @PlaybackListener.State int mLastPlaybackState; private boolean mEnableAnimations; private InteractionHandler mInteractionHandler; - private int mHeightPx; - private ObjectAnimator mTranslationYAnimator; + private ObjectAnimator mAnimator; private @VisibilityState int mFinalVisibility; - private boolean mPendingShowHideAnimation; private MiniPlayerMediator mMediator; - private long mNextAnimationPlayTime; + private float mFinalOpacity; /** Constructor for inflating from XML. */ public MiniPlayerLayout(Context context, AttributeSet attrs) { @@ -68,7 +71,7 @@ } void destroy() { - destroyYTranslationAnimator(); + destroyAnimator(); } @Override @@ -79,6 +82,8 @@ mProgressBar = (ProgressBar) findViewById(R.id.progress_bar); mPlayPauseView = (ImageView) findViewById(R.id.play_button); + mBackdrop = (FrameLayout) findViewById(R.id.backdrop); + mContents = findViewById(R.id.mini_player_container); mNormalLayout = (LinearLayout) findViewById(R.id.normal_layout); mBufferingLayout = (LinearLayout) findViewById(R.id.buffering_layout); mErrorLayout = (LinearLayout) findViewById(R.id.error_layout); @@ -95,64 +100,55 @@ mProgressBar.setProgressTintList(ColorStateList.valueOf(progressBarColor)); mLastPlaybackState = PlaybackListener.State.UNKNOWN; - mNextAnimationPlayTime = 0L; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - int height = getHeight(); - if (height != 0) { - mHeightPx = height; + + int height = mBackdrop.getHeight(); + if (height == 0) { + return; } - if (mPendingShowHideAnimation) { - runShowHideAnimation(); - mPendingShowHideAnimation = false; - } + assert (mMediator != null) + : "onLayout() with nonzero height shouldn't happen before setMediator()."; + mMediator.onHeightKnown(height); } - void updateVisibility(@VisibilityState int visibility) { - // If "showing" or "hiding", eventually the view will be "visible" or "gone". - if (visibility == VisibilityState.SHOWING) { - visibility = VisibilityState.VISIBLE; - } else if (visibility == VisibilityState.HIDING) { - visibility = VisibilityState.GONE; - } - - // Stop now if no change is needed. - if (mFinalVisibility == visibility) { - return; - } else { - mFinalVisibility = visibility; - } - - // If there's an animation running, it must be going in the wrong direction. - // Destroy it. - mNextAnimationPlayTime = 0L; - if (mTranslationYAnimator != null) { - // Record the old animation's progress so the new one can start from the same - // position rather than starting at fully shown or hidden. - mNextAnimationPlayTime = - SHOW_HIDE_DURATION_MS - mTranslationYAnimator.getCurrentPlayTime(); - destroyYTranslationAnimator(); - } - - // If animation is disabled, show or hide the view immediately and return. - if (!mEnableAnimations) { - setTranslationY(0); - setVisibility(mFinalVisibility == VisibilityState.VISIBLE ? View.VISIBLE : View.GONE); - notifyVisibilityChanged(); + void changeOpacity(float startValue, float endValue) { + assert (mMediator != null) + : "Can't call changeOpacity() before setMediator() which should happen during" + + " mediator init."; + if (endValue == mFinalOpacity) { return; } + mFinalOpacity = endValue; - // Otherwise kick off animations. Need to calculate view height at least once. - if (mHeightPx == 0) { - mPendingShowHideAnimation = true; - // Causes onLayout() to run. - setVisibility(View.INVISIBLE); + Runnable onFinished = + endValue == 1f ? mMediator::onFullOpacityReached : mMediator::onZeroOpacityReached; + + if (mEnableAnimations) { + // TODO: handle case where existing animation is incomplete and needs to be reversed + destroyAnimator(); + mAnimator = + ObjectAnimator.ofFloat( + mBackdrop, ChildrenAlphaProperty.CHILDREN_ALPHA, endValue); + mAnimator.setDuration(FADE_DURATION_MS); + mAnimator.setInterpolator(FADE_INTERPOLATOR); + mAnimator.addListener( + new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + destroyAnimator(); + onFinished.run(); + } + }); + mAnimator.start(); } else { - runShowHideAnimation(); + mContents.setAlpha(endValue); + mProgressBar.setAlpha(endValue); + onFinished.run(); } } @@ -246,52 +242,15 @@ findViewById(id).setOnClickListener((v) -> { handler.run(); }); } - private void notifyVisibilityChanged() { - if (mMediator != null) { - mMediator.onVisibilityChanged(mFinalVisibility); + private void destroyAnimator() { + if (mAnimator != null) { + mAnimator.removeAllListeners(); + mAnimator.cancel(); + mAnimator = null; } } - private void runShowHideAnimation() { - int startTranslationY = mHeightPx; - int endTranslationY = 0; - if (mFinalVisibility == VisibilityState.GONE) { - startTranslationY = 0; - endTranslationY = mHeightPx; - } - - setTranslationY(startTranslationY); - // View starts out VISIBLE for both show and hide. - setVisibility(View.VISIBLE); - - mTranslationYAnimator = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, endTranslationY); - mTranslationYAnimator.setDuration(SHOW_HIDE_DURATION_MS); - mTranslationYAnimator.setInterpolator(SHOW_HIDE_INTERPOLATOR); - mTranslationYAnimator.addListener( - new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - destroyYTranslationAnimator(); - if (mFinalVisibility == VisibilityState.GONE) { - setVisibility(View.GONE); - } - notifyVisibilityChanged(); - } - }); - // This call must come after setDuration(). - mTranslationYAnimator.setCurrentPlayTime(mNextAnimationPlayTime); - mTranslationYAnimator.start(); - } - - private void destroyYTranslationAnimator() { - if (mTranslationYAnimator != null) { - mTranslationYAnimator.removeAllListeners(); - mTranslationYAnimator.cancel(); - mTranslationYAnimator = null; - } - } - - ObjectAnimator getYTranslationAnimatorForTesting() { - return mTranslationYAnimator; + ObjectAnimator getAnimatorForTesting() { + return mAnimator; } }
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerLayoutUnitTest.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerLayoutUnitTest.java index 8abc180..7cb14ae 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerLayoutUnitTest.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerLayoutUnitTest.java
@@ -4,19 +4,15 @@ package org.chromium.chrome.browser.readaloud.player.mini; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.eq; import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import android.animation.ObjectAnimator; import android.app.Activity; -import android.os.SystemClock; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; @@ -35,7 +31,6 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.chrome.browser.readaloud.player.InteractionHandler; import org.chromium.chrome.browser.readaloud.player.R; -import org.chromium.chrome.browser.readaloud.player.VisibilityState; import org.chromium.chrome.modules.readaloud.PlaybackListener; /** Unit tests for {@link PlayerCoordinator}. */ @@ -44,11 +39,8 @@ manifest = Config.NONE, shadows = {ShadowSystemClock.class}) public class MiniPlayerLayoutUnitTest { - private static final float HEIGHT = 210f; - private static final long ANIMATION_DURATION_MS = 150L; - private static final int INITIAL_SYSTEM_TIME_MS = 1000; private final Activity mActivity; - private final MiniPlayerLayout mLayout; + private MiniPlayerLayout mLayout; @Mock private InteractionHandler mInteractionHandler; @Mock private MiniPlayerMediator mMediator; @@ -57,19 +49,18 @@ mActivity = Robolectric.buildActivity(AppCompatActivity.class).setup().get(); // Need to set theme before inflating layout. mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); + } + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); mLayout = (MiniPlayerLayout) mActivity .getLayoutInflater() .inflate(R.layout.readaloud_mini_player_layout, null); assertNotNull(mLayout); - } - - @Before - public void setUp() { - MockitoAnnotations.initMocks(this); mLayout.setMediator(mMediator); - SystemClock.setCurrentTimeMillis(INITIAL_SYSTEM_TIME_MS); } @Test @@ -174,229 +165,106 @@ } @Test - public void testShow() { - mLayout.enableAnimations(false); - mLayout.updateVisibility(VisibilityState.SHOWING); + public void testFadeInWithoutAnimation() { + View container = mLayout.findViewById(R.id.mini_player_container); + assertEquals(0f, container.getAlpha(), /* delta= */ 0f); - // No animation, so state should immediately become VISIBLE. - assertEquals(View.VISIBLE, mLayout.getVisibility()); - assertEquals(0f, mLayout.getTranslationY(), /* delta= */ 1e-6); - verify(mMediator).onVisibilityChanged(eq(VisibilityState.VISIBLE)); + mLayout.enableAnimations(false); + mLayout.changeOpacity(0f, 1f); + + assertNull(mLayout.getAnimatorForTesting()); + assertEquals(1f, container.getAlpha(), /* delta= */ 0f); + verify(mMediator).onFullOpacityReached(); } @Test - public void testShow_alreadyShowing() { - // Show once. - mLayout.enableAnimations(false); - mLayout.updateVisibility(VisibilityState.SHOWING); - verify(mMediator).onVisibilityChanged(eq(VisibilityState.VISIBLE)); + public void testFadeInWithAnimation() { + View container = mLayout.findViewById(R.id.mini_player_container); + assertEquals(0f, container.getAlpha(), /* delta= */ 0f); - // Showing again shouldn't have an effect. - reset(mMediator); - mLayout.updateVisibility(VisibilityState.SHOWING); - verify(mMediator, never()).onVisibilityChanged(anyInt()); - } - - @Test - public void testHide() { - mLayout.enableAnimations(false); - - // Show. - mLayout.updateVisibility(VisibilityState.SHOWING); - verify(mMediator).onVisibilityChanged(eq(VisibilityState.VISIBLE)); - - // Hide. - mLayout.updateVisibility(VisibilityState.HIDING); - verify(mMediator).onVisibilityChanged(eq(VisibilityState.GONE)); - assertEquals(View.GONE, mLayout.getVisibility()); - assertEquals(0f, mLayout.getTranslationY(), /* delta= */ 1e-6); - } - - @Test - public void testHide_alreadyHiding() { - mLayout.enableAnimations(false); - assertEquals(View.GONE, mLayout.getVisibility()); - // No effect yet since initial state is GONE. - mLayout.updateVisibility(VisibilityState.HIDING); - verify(mMediator, never()).onVisibilityChanged(anyInt()); - } - - @Test - public void testAnimatedShow() { - // Start show animation. mLayout.enableAnimations(true); - mLayout.updateVisibility(VisibilityState.SHOWING); + mLayout.changeOpacity(0f, 1f); - // Visibility gets set from GONE to INVISIBLE to trigger layout. - assertEquals(View.INVISIBLE, mLayout.getVisibility()); - - // Pretend the layout step was triggered so the real height will be calculated. - mLayout.layout(0, 0, 0, (int) HEIGHT); - assertEquals((int) HEIGHT, mLayout.getHeight()); - - // Set up and run the animation. - // Start out visible and translated down by HEIGHT pixels. - assertEquals(View.VISIBLE, mLayout.getVisibility()); - assertEquals(HEIGHT, mLayout.getTranslationY(), /* delta= */ 1e-6); - - ObjectAnimator animator = mLayout.getYTranslationAnimatorForTesting(); + ObjectAnimator animator = mLayout.getAnimatorForTesting(); assertNotNull(animator); - assertEquals(HEIGHT, (Float) animator.getAnimatedValue(), /* delta= */ 1e-6); - assertEquals(150L, animator.getDuration()); + assertEquals(300L, animator.getDuration()); - // Skip to the end. animator.end(); - - // Translation is now 0, so the view is in its fully visible position. - assertEquals(0f, (Float) animator.getAnimatedValue(), /* delta= */ 1e-6); - verify(mMediator).onVisibilityChanged(eq(VisibilityState.VISIBLE)); + assertEquals(1f, container.getAlpha(), /* delta= */ 0f); + verify(mMediator).onFullOpacityReached(); } @Test - public void testAnimatedHide() { - mLayout.layout(0, 0, 0, (int) HEIGHT); - assertEquals((int) HEIGHT, mLayout.getHeight()); - + public void testFadeOutWithoutAnimation() { + // Fade in first. mLayout.enableAnimations(false); - mLayout.updateVisibility(VisibilityState.VISIBLE); - verify(mMediator).onVisibilityChanged(eq(VisibilityState.VISIBLE)); + mLayout.changeOpacity(0f, 1f); + + // Ensure we're starting with full opacity. + View container = mLayout.findViewById(R.id.mini_player_container); + assertEquals(1f, container.getAlpha(), /* delta= */ 0f); + + // Fade out. + mLayout.changeOpacity(1f, 0f); + + assertNull(mLayout.getAnimatorForTesting()); + assertEquals(0f, container.getAlpha(), /* delta= */ 0f); + verify(mMediator).onZeroOpacityReached(); + } + + @Test + public void testFadeOutWithAnimation() { + // Fade in first. + mLayout.enableAnimations(false); + mLayout.changeOpacity(0f, 1f); + + // Ensure we're starting with full opacity. + View container = mLayout.findViewById(R.id.mini_player_container); + assertEquals(1f, container.getAlpha(), /* delta= */ 0f); + + // Fade out. + mLayout.enableAnimations(true); + mLayout.changeOpacity(1f, 0f); + + ObjectAnimator animator = mLayout.getAnimatorForTesting(); + assertNotNull(animator); + assertEquals(300L, animator.getDuration()); + + animator.end(); + assertEquals(0f, container.getAlpha(), /* delta= */ 0f); + verify(mMediator).onZeroOpacityReached(); + } + + @Test + public void testAlreadyFadedInAndOut() { + mLayout.enableAnimations(false); + + // 0 -> 1 + mLayout.changeOpacity(0f, 1f); + verify(mMediator).onFullOpacityReached(); reset(mMediator); - // Start hide animation. - mLayout.enableAnimations(true); - mLayout.updateVisibility(VisibilityState.HIDING); + // 0 -> 1 again has no effect. + mLayout.changeOpacity(0f, 1f); + verify(mMediator, never()).onFullOpacityReached(); - // Start out visible and with no translation. - assertEquals(View.VISIBLE, mLayout.getVisibility()); - assertEquals(0f, mLayout.getTranslationY(), /* delta= */ 1e-6); + // 1 -> 0 + mLayout.changeOpacity(1f, 0f); + verify(mMediator).onZeroOpacityReached(); + reset(mMediator); - ObjectAnimator animator = mLayout.getYTranslationAnimatorForTesting(); - assertNotNull(animator); - assertEquals(0f, (Float) animator.getAnimatedValue(), /* delta= */ 1e-6); - assertEquals(150L, animator.getDuration()); - - // Skip to the end. - animator.end(); - - // Translation is now 0, so the view is in its fully visible position. - assertEquals(HEIGHT, (Float) animator.getAnimatedValue(), /* delta= */ 1e-6); - verify(mMediator).onVisibilityChanged(eq(VisibilityState.GONE)); - } - - @Test - public void testAnimatedShowTwice() { - // Start show animation. - mLayout.enableAnimations(true); - mLayout.updateVisibility(VisibilityState.SHOWING); - - // Pretend layout to set view height. - mLayout.layout(0, 0, 0, (int) HEIGHT); - assertEquals((int) HEIGHT, mLayout.getHeight()); - - // Animation should be started and not yet ended. - ObjectAnimator animator = mLayout.getYTranslationAnimatorForTesting(); - assertTrue(animator.isStarted()); - - // Calling updateVisibility(SHOWING) again shouldn't interrupt the ongoing animation. - mLayout.updateVisibility(VisibilityState.SHOWING); - assertEquals(animator, mLayout.getYTranslationAnimatorForTesting()); - assertTrue(animator.isStarted()); - } - - @Test - public void testAnimatedHideDuringShow() { - // Start show animation. - mLayout.enableAnimations(true); - mLayout.updateVisibility(VisibilityState.SHOWING); - - // Pretend layout to set view height. - mLayout.layout(0, 0, 0, (int) HEIGHT); - assertEquals((int) HEIGHT, mLayout.getHeight()); - - // Animation should be started and not yet ended. - ObjectAnimator animator = mLayout.getYTranslationAnimatorForTesting(); - assertTrue(animator.isStarted()); - - // Pretend some time has passed. - long elapsedMs = 100L; - animator.setCurrentPlayTime(elapsedMs); - - // Start hide animation while the show animation is still running. - mLayout.updateVisibility(VisibilityState.HIDING); - - // There should be a new animator for hiding. - ObjectAnimator newAnimator = mLayout.getYTranslationAnimatorForTesting(); - assertNotNull(newAnimator); - assertNotEquals(animator, newAnimator); - assertTrue(newAnimator.isStarted()); - - // The new animation should have started at (duration - 100) ms. - assertEquals((ANIMATION_DURATION_MS - elapsedMs), newAnimator.getCurrentPlayTime()); + // 1 -> 0 again has no effect. + mLayout.changeOpacity(1f, 0f); + verify(mMediator, never()).onZeroOpacityReached(); } @Test public void testDestroyCancelsAnimation() { - mLayout.layout(0, 0, 0, (int) HEIGHT); - assertEquals((int) HEIGHT, mLayout.getHeight()); mLayout.enableAnimations(true); - mLayout.updateVisibility(VisibilityState.SHOWING); - - ObjectAnimator animator = mLayout.getYTranslationAnimatorForTesting(); - assertTrue(animator.isStarted()); + mLayout.changeOpacity(0f, 1f); + assertNotNull(mLayout.getAnimatorForTesting()); mLayout.destroy(); - assertFalse(animator.isStarted()); - } - - @Test - public void testAnimatedShowHideShow() { - /// Show #1 - - // Start show animation. - mLayout.enableAnimations(true); - mLayout.updateVisibility(VisibilityState.SHOWING); - - // Pretend the layout step was triggered so the real height will be calculated. - mLayout.layout(0, 0, 0, (int) HEIGHT); - assertEquals((int) HEIGHT, mLayout.getHeight()); - - assertEquals(HEIGHT, mLayout.getTranslationY(), /* delta= */ 1e-6); - - ObjectAnimator animator = mLayout.getYTranslationAnimatorForTesting(); - assertNotNull(animator); - assertEquals(HEIGHT, (Float) animator.getAnimatedValue(), /* delta= */ 1e-6); - assertEquals(150L, animator.getDuration()); - - // Skip to the end. - animator.end(); - - // Translation is now 0, so the view is in its fully visible position. - assertEquals(0f, mLayout.getTranslationY(), /* delta= */ 1e-6); - verify(mMediator).onVisibilityChanged(eq(VisibilityState.VISIBLE)); - - /// Hide - - mLayout.updateVisibility(VisibilityState.HIDING); - assertEquals(View.VISIBLE, mLayout.getVisibility()); - assertEquals(0f, mLayout.getTranslationY(), /* delta= */ 1e-6); - - animator = mLayout.getYTranslationAnimatorForTesting(); - assertNotNull(animator); - assertEquals(0f, (Float) animator.getAnimatedValue(), /* delta= */ 1e-6); - assertEquals(150L, animator.getDuration()); - - animator.end(); - - assertEquals(HEIGHT, mLayout.getTranslationY(), /* delta= */ 1e-6); - - /// Show #2 - - mLayout.updateVisibility(VisibilityState.SHOWING); - - assertEquals(HEIGHT, mLayout.getTranslationY(), /* delta= */ 1e-6); - - mLayout.getYTranslationAnimatorForTesting().end(); - - assertEquals(0f, mLayout.getTranslationY(), /* delta= */ 1e-6); + assertNull(mLayout.getAnimatorForTesting()); } }
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerMediator.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerMediator.java index 7a05038..f270eb1 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerMediator.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerMediator.java
@@ -53,4 +53,16 @@ public void onVisibilityChanged(@VisibilityState int newState) { mModel.set(Properties.VISIBILITY, newState); } + + void onHeightKnown(int heightPx) { + // TODO: implement + } + + void onFullOpacityReached() { + // TODO: implement + } + + void onZeroOpacityReached() { + // TODO: implement + } }
diff --git a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerViewBinder.java b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerViewBinder.java index 1c13522ec..ac84c11 100644 --- a/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerViewBinder.java +++ b/chrome/browser/readaloud/android/java/src/org/chromium/chrome/browser/readaloud/player/mini/MiniPlayerViewBinder.java
@@ -4,8 +4,11 @@ package org.chromium.chrome.browser.readaloud.player.mini; +import android.view.View; + import org.chromium.chrome.browser.readaloud.ReadAloudMiniPlayerSceneLayer; import org.chromium.chrome.browser.readaloud.player.PlayerProperties; +import org.chromium.chrome.browser.readaloud.player.VisibilityState; import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyModel; @@ -50,7 +53,15 @@ public static void bindMiniPlayerProperties( PropertyModel model, ViewHolder viewHolder, PropertyKey key) { if (key == Properties.VISIBILITY) { - viewHolder.view.updateVisibility(model.get(Properties.VISIBILITY)); + // TODO: temporary measure to keep show and hide working during changes, remove + // once mediator changes are in place. + if (model.get(Properties.VISIBILITY) == VisibilityState.SHOWING) { + viewHolder.view.setVisibility(View.VISIBLE); + model.set(Properties.VISIBILITY, VisibilityState.VISIBLE); + } else if (model.get(Properties.VISIBILITY) == VisibilityState.HIDING) { + viewHolder.view.setVisibility(View.GONE); + model.set(Properties.VISIBILITY, VisibilityState.GONE); + } } else if (key == Properties.ANIMATE_VISIBILITY_CHANGES) { viewHolder.view.enableAnimations(model.get(Properties.ANIMATE_VISIBILITY_CHANGES)); @@ -63,6 +74,12 @@ } else if (key == Properties.COMPOSITED_VIEW_VISIBLE) { viewHolder.sceneLayer.setIsVisible(model.get(Properties.COMPOSITED_VIEW_VISIBLE)); + } else if (key == Properties.CONTENTS_OPAQUE) { + if (model.get(Properties.CONTENTS_OPAQUE)) { + viewHolder.view.changeOpacity(/* startValue= */ 0f, /* endValue= */ 1f); + } else { + viewHolder.view.changeOpacity(/* startValue= */ 1f, /* endValue= */ 0f); + } } } }
diff --git a/chrome/browser/resources/ash/settings/internet_page/hotspot_subpage.ts b/chrome/browser/resources/ash/settings/internet_page/hotspot_subpage.ts index 1d28183f..d2f7917 100644 --- a/chrome/browser/resources/ash/settings/internet_page/hotspot_subpage.ts +++ b/chrome/browser/resources/ash/settings/internet_page/hotspot_subpage.ts
@@ -116,6 +116,9 @@ if (!this.hotspotInfo) { return true; } + if (this.hotspotInfo.state === HotspotState.kEnabling) { + return false; + } if (this.hotspotInfo.allowStatus !== HotspotAllowStatus.kAllowed) { return true; }
diff --git a/chrome/browser/resources/ash/settings/internet_page/hotspot_summary_item.html b/chrome/browser/resources/ash/settings/internet_page/hotspot_summary_item.html index cd2041b0..3e62f11 100644 --- a/chrome/browser/resources/ash/settings/internet_page/hotspot_summary_item.html +++ b/chrome/browser/resources/ash/settings/internet_page/hotspot_summary_item.html
@@ -21,11 +21,13 @@ <div id="hotspotPageTitle" class="middle settings-box-text"> $i18n{hotspotPageTitle} <div class="secondary" id="hotspotStateSublabel" - hidden="[[shouldHideHotspotStateSublabel_(hotspotInfo.allowStatus)]]"> + hidden="[[shouldHideHotspotStateSublabel_( + hotspotInfo.allowStatus, hotspotInfo.state)]]"> [[getHotspotStateSublabel_(hotspotInfo.state)]] </div> <localized-link class="secondary" id="hotspotDisabledSublabelLink" - hidden="[[!shouldHideHotspotStateSublabel_(hotspotInfo.allowStatus)]]" + hidden="[[!shouldHideHotspotStateSublabel_( + hotspotInfo.allowStatus, hotspotInfo.state)]]" localized-string="[[getHotspotDisabledSublabelLink_( hotspotInfo.allowStatus)]]"> </localized-link> @@ -39,7 +41,7 @@ </template> <template is="dom-if" if="[[shouldShowArrowButton_( - hotspotInfo.allowStatus)]]" restamp> + hotspotInfo.allowStatus, hotspotInfo.state)]]" restamp> <cr-icon-button id="hotspotSummaryItemRowArrowIcon" class="subpage-arrow layout end" aria-label="$i18n{hotspotPageTitle}"
diff --git a/chrome/browser/resources/ash/settings/internet_page/hotspot_summary_item.ts b/chrome/browser/resources/ash/settings/internet_page/hotspot_summary_item.ts index a4ad70b..772a9ed 100644 --- a/chrome/browser/resources/ash/settings/internet_page/hotspot_summary_item.ts +++ b/chrome/browser/resources/ash/settings/internet_page/hotspot_summary_item.ts
@@ -69,7 +69,7 @@ } private navigateToDetailPage_(): void { - if (!this.shouldShowArrowButton_(this.hotspotInfo.allowStatus)) { + if (!this.shouldShowArrowButton_()) { return; } @@ -90,10 +90,15 @@ return this.i18n('hotspotSummaryStateOff'); } - private shouldHideHotspotStateSublabel_(allowStatus: HotspotAllowStatus): - boolean { - return allowStatus === HotspotAllowStatus.kDisallowedReadinessCheckFail || - allowStatus === HotspotAllowStatus.kDisallowedNoMobileData; + private shouldHideHotspotStateSublabel_(): boolean { + if (this.hotspotInfo.state === HotspotState.kEnabling || + this.hotspotInfo.state === HotspotState.kEnabled) { + return false; + } + return this.hotspotInfo.allowStatus === + HotspotAllowStatus.kDisallowedReadinessCheckFail || + this.hotspotInfo.allowStatus === + HotspotAllowStatus.kDisallowedNoMobileData; } private getHotspotDisabledSublabelLink_(allowStatus: HotspotAllowStatus): @@ -118,15 +123,20 @@ } private isToggleDisabled_(): boolean { - if (!this.shouldShowArrowButton_(this.hotspotInfo.allowStatus)) { + if (this.hotspotInfo.state === HotspotState.kDisabling) { return true; } - - return this.hotspotInfo.state === HotspotState.kDisabling; + if (this.hotspotInfo.state === HotspotState.kEnabling || + this.hotspotInfo.state === HotspotState.kEnabled) { + return false; + } + return this.hotspotInfo.allowStatus !== HotspotAllowStatus.kAllowed; } - private shouldShowArrowButton_(allowStatus: HotspotAllowStatus): boolean { - return allowStatus === HotspotAllowStatus.kAllowed; + private shouldShowArrowButton_(): boolean { + return this.hotspotInfo.allowStatus === HotspotAllowStatus.kAllowed || + this.hotspotInfo.state === HotspotState.kEnabling || + this.hotspotInfo.state === HotspotState.kEnabled; } private getIconClass_(isHotspotToggleOn: boolean): string {
diff --git a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/parse/sandboxed_pumpkin_tagger.js b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/parse/sandboxed_pumpkin_tagger.js index c9ee9543..bcda9d3 100644 --- a/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/parse/sandboxed_pumpkin_tagger.js +++ b/chrome/browser/resources/chromeos/accessibility/accessibility_common/dictation/parse/sandboxed_pumpkin_tagger.js
@@ -133,7 +133,7 @@ const taggerWasmJsFile = new TextDecoder().decode(taggerWasmBytes); // A promise that resolves once the web assembly module loads. const wasmLoadPromise = new Promise((resolve) => { - goog['global']['Module'] = { + globalThis['goog']['global']['Module'] = { onRuntimeInitialized() { resolve(); },
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn b/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn index 781d0e2..6299e89 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn
@@ -375,7 +375,6 @@ "../common/testing/accessibility_test_base.js", "../common/testing/assert_additions.js", "../common/testing/callback_helper.js", - "../common/closure_shim.js", "background/braille/expanding_braille_translator.js", "background/braille/pan_strategy.js", "background/braille/spans.js",
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_text_base_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_text_base_test.js index 1533e683..da49987 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_text_base_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_text_base_test.js
@@ -130,7 +130,6 @@ ChromeVoxEditableTextUnitTest.prototype.extraLibraries = [ '../../../common/testing/assert_additions.js', - '../../../common/closure_shim.js', ]; function createEditableText(value, start, end, isPassword, tts) {
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/common/key_sequence_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/common/key_sequence_test.js index 470e99c9..84fce1a 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/common/key_sequence_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/common/key_sequence_test.js
@@ -157,7 +157,6 @@ /** @override */ ChromeVoxKeySequenceUnitTest.prototype.extraLibraries = [ '../../common/testing/assert_additions.js', - '../../common/closure_shim.js', '../testing/fake_dom.js', ];
diff --git a/chrome/browser/resources/chromeos/accessibility/common/BUILD.gn b/chrome/browser/resources/chromeos/accessibility/common/BUILD.gn index cdf8fbe..72aae2a9 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/BUILD.gn +++ b/chrome/browser/resources/chromeos/accessibility/common/BUILD.gn
@@ -34,7 +34,6 @@ "automation_util.js", "browser_util.js", "chrome_event_handler.js", - "closure_shim.js", "constants.js", "cursors/cursor.js", "cursors/range.js", @@ -92,9 +91,6 @@ sources = [ "constants.js" ] } -js_library("closure_shim") { -} - js_library("automation_util") { deps = [ ":automation_predicate", @@ -128,7 +124,6 @@ } js_library("instance_checker") { - deps = [ ":closure_shim" ] } js_library("node_navigation_utils") {
diff --git a/chrome/browser/resources/chromeos/accessibility/common/closure_shim.js b/chrome/browser/resources/chromeos/accessibility/common/closure_shim.js deleted file mode 100644 index ce208d0..0000000 --- a/chrome/browser/resources/chromeos/accessibility/common/closure_shim.js +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * Provides a shim to allow select-to-speak to use closure files. - */ - -var goog = {}; - -goog.addDependency = function() {}; - -goog.provide = function(n) { - globalThis[n] = {}; -}; - -goog.require = function() {}; - -goog.scope = function(c) { - c(); -};
diff --git a/chrome/browser/resources/chromeos/accessibility/enhanced_network_tts/background.html b/chrome/browser/resources/chromeos/accessibility/enhanced_network_tts/background.html index b731534..94713b46 100644 --- a/chrome/browser/resources/chromeos/accessibility/enhanced_network_tts/background.html +++ b/chrome/browser/resources/chromeos/accessibility/enhanced_network_tts/background.html
@@ -1,5 +1,2 @@ -<!-- Global scripts. --> -<script src="/common/closure_shim.js"></script> - <!-- Module entry point. --> <script type="module" src="/enhanced_network_tts/background.js"></script>
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/BUILD.gn b/chrome/browser/resources/chromeos/accessibility/select_to_speak/BUILD.gn index da835db..44104e7 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/BUILD.gn +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/BUILD.gn
@@ -151,7 +151,6 @@ ":ui_manager", "../common:automation_predicate", "../common:automation_util", - "../common:closure_shim", "../common:constants", "../common:key_code", "../common:node_navigation_utils",
diff --git a/chrome/browser/resources/chromeos/accessibility/select_to_speak/background.html b/chrome/browser/resources/chromeos/accessibility/select_to_speak/background.html index a38ba79..8409c11 100644 --- a/chrome/browser/resources/chromeos/accessibility/select_to_speak/background.html +++ b/chrome/browser/resources/chromeos/accessibility/select_to_speak/background.html
@@ -1,5 +1,2 @@ -<!-- Global scripts. --> -<script src="/common/closure_shim.js"></script> - <!-- Module entrypoint. --> <script type="module" src="/select_to_speak/select_to_speak_main.js"></script>
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/BUILD.gn b/chrome/browser/resources/chromeos/accessibility/switch_access/BUILD.gn index ae6c80e..20187c2 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/BUILD.gn +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/BUILD.gn
@@ -175,7 +175,6 @@ ":text_navigation_manager", ":window_node", "../common:automation_predicate", - "../common:closure_shim", "../common:constants", "../common:event_generator", "../common:key_code",
diff --git a/chrome/browser/resources/settings/autofill_page/payments_manager_proxy.ts b/chrome/browser/resources/settings/autofill_page/payments_manager_proxy.ts index 5024901..c8b8262 100644 --- a/chrome/browser/resources/settings/autofill_page/payments_manager_proxy.ts +++ b/chrome/browser/resources/settings/autofill_page/payments_manager_proxy.ts
@@ -104,6 +104,13 @@ */ checkIfDeviceAuthAvailable(): Promise<boolean>; // </if> + + /** + * Bulk delete all the CVCs (server and local) from the local webdata + * database. For server CVCs, this will also clear them from the Chrome + * sync server and thus other devices. + */ + bulkDeleteAllCvcs(): void; } /** @@ -193,6 +200,10 @@ } // </if> + bulkDeleteAllCvcs() { + chrome.autofillPrivate.bulkDeleteAllCvcs(); + } + static getInstance(): PaymentsManagerProxy { return instance || (instance = new PaymentsManagerImpl()); }
diff --git a/chrome/browser/resources/settings/autofill_page/payments_section.ts b/chrome/browser/resources/settings/autofill_page/payments_section.ts index 20b90a52..fca4c3a 100644 --- a/chrome/browser/resources/settings/autofill_page/payments_section.ts +++ b/chrome/browser/resources/settings/autofill_page/payments_section.ts
@@ -667,10 +667,17 @@ /** * Method to bulk delete all the CVCs present on the local DB. - * TODO(crbug/1464441): Add the code to delete all the CVCs from the local DB. */ private onShowBulkRemoveCvcConfirmationDialogClose_() { assert(this.cvcStorageAvailable_); + const confirmationDialog = + this.shadowRoot!.querySelector<SettingsSimpleConfirmationDialogElement>( + '#bulkDeleteCvcConfirmDialog'); + assert(confirmationDialog); + + if (confirmationDialog.wasConfirmed()) { + this.paymentsManager_.bulkDeleteAllCvcs(); + } this.showBulkRemoveCvcConfirmationDialog_ = false; }
diff --git a/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/combobox/customize_chrome_combobox.html b/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/combobox/customize_chrome_combobox.html index f272a34..a9d48036 100644 --- a/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/combobox/customize_chrome_combobox.html +++ b/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/combobox/customize_chrome_combobox.html
@@ -6,6 +6,7 @@ .md-select { text-align: start; + width: inherit; } .md-select div { @@ -32,6 +33,10 @@ display: block; } +:host([right-align-dropbox]) #dropdownContainer { + right: 0; +} + #dropdown { box-sizing: border-box; overflow-x: hidden;
diff --git a/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/combobox/customize_chrome_combobox.ts b/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/combobox/customize_chrome_combobox.ts index 740280d..4933e54 100644 --- a/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/combobox/customize_chrome_combobox.ts +++ b/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/combobox/customize_chrome_combobox.ts
@@ -46,6 +46,11 @@ }, highlightedElement_: Object, label: String, + rightAlignDropbox: { + type: Boolean, + value: false, + reflectToAttribute: true, + }, selectedElement_: { type: Object, observer: 'onSelectedElementChanged_',
diff --git a/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/wallpaper_search.html b/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/wallpaper_search.html index 1ed32cf..d169b96d 100644 --- a/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/wallpaper_search.html +++ b/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/wallpaper_search.html
@@ -18,7 +18,6 @@ #error { height: 100px; line-height: 20px; - width: 272px; } #errorTitle { @@ -49,7 +48,10 @@ color: var(--color-side-panel-card-primary-foreground); font-size: 12px; line-height: 16px; - width: 220px; + } + + #descriptorComboboxA { + width: 100%; } .category-item { @@ -101,6 +103,25 @@ white-space: nowrap; } + #optionalDetails { + display: flex; + flex-wrap: wrap; + gap: 8px; + margin-top: 16px; + } + + #optionalDetailsLabel { + color: var(--color-side-panel-card-secondary-foreground); + font-size: 12px; + font-weight: 500; + line-height: 16px; + width: 100%; + } + + #optionalDetails customize-chrome-combobox { + width: 132px; + } + #descriptorComboboxB .dropdown-item { height: 48px; } @@ -117,10 +138,9 @@ #descriptorMenuD { display: flex; - height: 48px; justify-content: space-between; - margin-top: 16px; - width: 272px; + margin-top: 8px; + width: 100%; } #descriptorMenuD cr-button { @@ -132,7 +152,7 @@ padding: 0px; } - .color-check-mark-wrapper { + .color-check-mark { --customize-chrome-check-mark-wrapper-end: -2px; --customize-chrome-check-mark-wrapper-size: 16px; --customize-chrome-check-mark-wrapper-top: -2px; @@ -200,13 +220,13 @@ transform: translateX(-50%); } - .image-check-mark-wrapper { + .image-check-mark { --customize-chrome-check-mark-wrapper-end: -4px; --customize-chrome-check-mark-wrapper-size: 20px; --customize-chrome-check-mark-wrapper-top: -6px; } - .image-check-mark-wrapper[checked] .image-container { + .image-check-mark[checked] .image-container { padding-top: calc(100% - 4px); width: calc(100% - 4px); } @@ -271,48 +291,51 @@ </div> </template> </customize-chrome-combobox> - <customize-chrome-combobox id="descriptorComboboxB" label="Descriptor B" - value="{{selectedDescriptorB_}}"> - <template is="dom-repeat" items="[[descriptors_.descriptorB]]"> - <div class="dropdown-item" role="option" value="[[item.label]]"> - <img is="cr-auto-img" auto-src="[[item.imagePath]]"></img> - <span>[[item.label]]</span> - </div> - </template> - </customize-chrome-combobox> - <customize-chrome-combobox id="descriptorComboboxC" label="Descriptor C" - value="{{selectedDescriptorC_}}"> - <template is="dom-repeat" items="[[descriptors_.descriptorC]]"> - <div class="dropdown-item" role="option" value="[[item]]"> - <iron-icon icon="cr:check"></iron-icon> - <span>[[item]]</span> - </div> - </template> - </customize-chrome-combobox> - <div id="descriptorMenuD"> - <template is="dom-repeat" items="[[descriptorD_]]"> - <cr-button class="default-color" on-click="onDefaultColorClick_"> - <customize-chrome-check-mark-wrapper class="color-check-mark-wrapper" - checked="[[isDefaultColorSelected_(item, selectedDefaultColor_)]]" - checkmark-border-hidden> - <span class="descriptor-d" style$="background-color: [[item]];"> - </span> + <div id="optionalDetails"> + <div id="optionalDetailsLabel">$i18n{optionalDetailsLabel}</div> + <customize-chrome-combobox id="descriptorComboboxB" label="Descriptor B" + value="{{selectedDescriptorB_}}"> + <template is="dom-repeat" items="[[descriptors_.descriptorB]]"> + <div class="dropdown-item" role="option" value="[[item.label]]"> + <img is="cr-auto-img" auto-src="[[item.imagePath]]"></img> + <span>[[item.label]]</span> + </div> + </template> + </customize-chrome-combobox> + <customize-chrome-combobox id="descriptorComboboxC" label="Descriptor C" + value="{{selectedDescriptorC_}}" right-align-dropbox> + <template is="dom-repeat" items="[[descriptors_.descriptorC]]"> + <div class="dropdown-item" role="option" value="[[item]]"> + <iron-icon icon="cr:check"></iron-icon> + <span>[[item]]</span> + </div> + </template> + </customize-chrome-combobox> + <div id="descriptorMenuD"> + <template is="dom-repeat" items="[[descriptorD_]]"> + <cr-button class="default-color" on-click="onDefaultColorClick_"> + <customize-chrome-check-mark-wrapper class="color-check-mark" + checked="[[isColorSelected_(item, selectedDefaultColor_)]]" + checkmark-border-hidden> + <span class="descriptor-d" style$="background-color: [[item]];"> + </span> + </customize-chrome-check-mark-wrapper> + </cr-button> + </template> + <cr-button id="customColorContainer" on-click="onCustomColorClick_"> + <customize-chrome-check-mark-wrapper class="color-check-mark" + checked="[[selectedHue_]]" checkmark-border-hidden> + <div class="descriptor-d" + style$="background: hsl([[selectedHue_]], 100%, 50%);"> + <div id="colorPickerIcon"></div> + </div> </customize-chrome-check-mark-wrapper> </cr-button> - </template> - <cr-button id="customColorContainer" on-click="onCustomColorClick_"> - <customize-chrome-check-mark-wrapper class="color-check-mark-wrapper" - checked="[[selectedHue_]]" checkmark-border-hidden> - <div class="descriptor-d" - style$="background: hsl([[selectedHue_]], 100%, 50%);"> - <div id="colorPickerIcon"></div> - </div> - </customize-chrome-check-mark-wrapper> - </cr-button> - <cr-theme-hue-slider-dialog id="hueSlider" - on-selected-hue-changed="onSelectedHueChanged_"> - </cr-theme-hue-slider-dialog> + </div> </div> + <cr-theme-hue-slider-dialog id="hueSlider" + on-selected-hue-changed="onSelectedHueChanged_"> + </cr-theme-hue-slider-dialog> <div id="btnContainer"> <cr-button id="submitButton" @@ -342,7 +365,7 @@ <template is="dom-repeat" id="resultsRepeat" items="[[results_]]"> <div class="tile result" tabindex="0" role="button" on-click="onResultClick_"> - <customize-chrome-check-mark-wrapper class="image-check-mark-wrapper" + <customize-chrome-check-mark-wrapper class="image-check-mark" checked="[[isBackgroundSelected_(item.id, theme_)]]"> <div class="image-container"> <img src="data:image/png;base64,[[item.image]]">
diff --git a/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/wallpaper_search.ts b/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/wallpaper_search.ts index 0c2db64d..5ba23a8 100644 --- a/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/wallpaper_search.ts +++ b/chrome/browser/resources/side_panel/customize_chrome/wallpaper_search/wallpaper_search.ts
@@ -275,8 +275,8 @@ return this.expandedCategories_[category]; } - private isDefaultColorSelected_(color: string): boolean { - return color === this.selectedDefaultColor_; + private isColorSelected_(defaultColor: string): boolean { + return defaultColor === this.selectedDefaultColor_; } private async onBackClick_() {
diff --git a/chrome/browser/resources/tab_search/tab_organization_not_started.ts b/chrome/browser/resources/tab_search/tab_organization_not_started.ts index 4485b08a..b16a6f5 100644 --- a/chrome/browser/resources/tab_search/tab_organization_not_started.ts +++ b/chrome/browser/resources/tab_search/tab_organization_not_started.ts
@@ -65,6 +65,8 @@ private setSync_(sync: SyncInfo) { this.sync_ = sync; + this.dispatchEvent( + new CustomEvent('sync-change', {bubbles: true, composed: true})); } private getSyncState_(): SyncState {
diff --git a/chrome/browser/resources/tab_search/tab_organization_page.html b/chrome/browser/resources/tab_search/tab_organization_page.html index cc32a5dd..9f43e27 100644 --- a/chrome/browser/resources/tab_search/tab_organization_page.html +++ b/chrome/browser/resources/tab_search/tab_organization_page.html
@@ -90,6 +90,7 @@ <div id="body"> <tab-organization-not-started id="notStarted" shown$="[[isState_(tabOrganizationStateEnum_.kNotStarted, state_)]]" + on-sync-change="updateContentsHeight_" on-sync-click="onSyncClick_" on-sign-in-click="onSignInClick_" on-settings-click="onSettingsClick_"
diff --git a/chrome/browser/resources/tab_search/tab_organization_page.ts b/chrome/browser/resources/tab_search/tab_organization_page.ts index 772527c..aacffd80 100644 --- a/chrome/browser/resources/tab_search/tab_organization_page.ts +++ b/chrome/browser/resources/tab_search/tab_organization_page.ts
@@ -74,6 +74,7 @@ override connectedCallback() { super.connectedCallback(); + this.updateContentsHeight_(); this.apiProxy_.getTabOrganizationSession().then( ({session}) => this.setSession_(session)); const callbackRouter = this.apiProxy_.getCallbackRouter(); @@ -120,9 +121,12 @@ this.classList.toggle( 'from-failure', this.state_ === TabOrganizationState.kFailure); this.state_ = state; + this.updateContentsHeight_(); + } + private updateContentsHeight_() { let contentsHeight = 0; - switch (state) { + switch (this.state_) { case TabOrganizationState.kNotStarted: contentsHeight = this.$.notStarted.scrollHeight + TRAILING_BODY_SPACING; break;
diff --git a/chrome/browser/ssl/daily_navigation_counter.cc b/chrome/browser/ssl/daily_navigation_counter.cc new file mode 100644 index 0000000..6891f1b --- /dev/null +++ b/chrome/browser/ssl/daily_navigation_counter.cc
@@ -0,0 +1,97 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ssl/daily_navigation_counter.h" + +#include "base/i18n/time_formatting.h" +#include "base/time/clock.h" +#include "third_party/icu/source/i18n/unicode/timezone.h" + +namespace { + +// Returns the given time in yyyy-MM-dd format. +std::string GetDateString(base::Time now) { + return base::UnlocalizedTimeFormatWithPattern(now.UTCMidnight(), "yyyy-MM-dd", + icu::TimeZone::getGMT()); +} + +} // namespace + +DailyNavigationCounter::DailyNavigationCounter( + base::Value::Dict* dict, + base::Clock* clock, + size_t rolling_window_duration_in_days, + size_t save_interval) + : dict_(dict), + clock_(clock), + rolling_window_duration_in_days_(rolling_window_duration_in_days), + save_interval_(save_interval) { + DCHECK(save_interval_ > 0); + + // Load from the saved dict into the current map, discarding old entries. + base::Time now = clock_->Now(); + base::Time cutoff = + now.UTCMidnight() - base::Days(rolling_window_duration_in_days_); + + for (auto [key, value] : *dict_) { + base::Time timestamp; + if (!base::Time::FromUTCString(key.c_str(), ×tamp)) { + // Not a valid bucket. + continue; + } + if (timestamp < cutoff) { + // Old bucket. + continue; + } + absl::optional<int> count = dict->FindInt(key); + if (!count.has_value()) { + continue; + } + counts_map_[key] = count.value(); + } +} + +DailyNavigationCounter::~DailyNavigationCounter() = default; + +size_t DailyNavigationCounter::GetTotal() const { + size_t total = 0; + for (auto [key, value] : counts_map_) { + total += value; + } + return total; +} + +bool DailyNavigationCounter::Increment() { + base::Time now = clock_->Now(); + std::string today = GetDateString(now); + counts_map_[today]++; + unsaved_count_++; + if (unsaved_count_ < save_interval_) { + // Not stale. + return false; + } + + // Otherwise, discard old buckets and save the current map to the backing + // dict. + base::Time cutoff = + now.UTCMidnight() - base::Days(rolling_window_duration_in_days_); + base::flat_map<std::string, int> new_map_; + dict_->clear(); + for (auto [key, value] : counts_map_) { + base::Time timestamp; + if (!base::Time::FromUTCString(key.c_str(), ×tamp)) { + // Not a valid bucket. + continue; + } + if (timestamp < cutoff) { + // Old bucket. + continue; + } + new_map_[key] = value; + dict_->Set(key, value); + } + counts_map_ = new_map_; + unsaved_count_ = 0; + return true; +}
diff --git a/chrome/browser/ssl/daily_navigation_counter.h b/chrome/browser/ssl/daily_navigation_counter.h new file mode 100644 index 0000000..6be7724 --- /dev/null +++ b/chrome/browser/ssl/daily_navigation_counter.h
@@ -0,0 +1,76 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_SSL_DAILY_NAVIGATION_COUNTER_H_ +#define CHROME_BROWSER_SSL_DAILY_NAVIGATION_COUNTER_H_ + +#include "base/containers/flat_map.h" +#include "base/memory/raw_ptr.h" +#include "base/time/time.h" +#include "base/values.h" + +namespace base { +class Clock; +} + +// This class records the number of navigations inside a rolling window. Each +// navigation is counted in its day's bucket. Counts are regularly saved to +// a dictionary which can be backed by a pref, so that the counts are persisted. +// Counts belonging to the days outside the rolling window are discarded. +// This class is only intended to count an approximate the number of +// navigations for HTTPS-First Mode related heuristics. Browser restarts or +// crashes may lose some counts which shouldn't affect the heuristics +// significantly. +class DailyNavigationCounter { + public: + // `dict` is the backing dictionary where counts are read from and saved to. + // `clock` is the clock used to get time. + // `rolling_window_duration_in_days` is the size of the rolling window during + // which navigations are recorded. Counts outside this window will be + // discarded. E.g. rolling_window_duration_in_days=1 means counts added two + // days ago will be discarded today. + // `save_interval` is the number of navigations after which the counts are + // saved to `dict`. + DailyNavigationCounter(base::Value::Dict* dict, + base::Clock* clock, + size_t rolling_window_duration_in_days, + size_t save_interval); + virtual ~DailyNavigationCounter(); + + // Returns the total number of navigations. + size_t GetTotal() const; + // Increments the number of navigations for this day. Returns true if the + // counts are written to `dict`. + bool Increment(); + + // Returns the number of navigations that are in memory but not yet saved + // to the dict. + size_t unsaved_count_for_testing() const { return unsaved_count_; } + + private: + raw_ptr<base::Value::Dict> dict_; + raw_ptr<base::Clock> clock_; + // Number of navigations that haven't been saved in the pref yet. + int unsaved_count_ = 0; + // Age of the oldest navigation to be counted. Anything older than this will + // be discarded. + size_t rolling_window_duration_in_days_; + // If the number of unsaved navigations is larger than this, counts will be + // saved to the dict. + int save_interval_ = 10; + // The map that counts the navigations. Keys are dates formatted as + // yyyy-MM-DD, values are the number of navigations on that day. At any point, + // there will be at most (save_interval_ + rolling_window_duration_in_days) + // different keys in this map. After that, entries will be written into + // dict_, discarding old entries. + // + // This could be a simple integer, but that would would prevent us from + // discarding very old counts when the profile wasn't used for a long time. + // E.g. 99 navigations made 20 days ago, then zero for 20 days, then one + // navigation next day would return 100 navigations in total instead of one, + // if save_interval_=100. + base::flat_map<std::string, int> counts_map_; +}; + +#endif // CHROME_BROWSER_SSL_DAILY_NAVIGATION_COUNTER_H_
diff --git a/chrome/browser/ssl/daily_navigation_counter_unittest.cc b/chrome/browser/ssl/daily_navigation_counter_unittest.cc new file mode 100644 index 0000000..e9d857e --- /dev/null +++ b/chrome/browser/ssl/daily_navigation_counter_unittest.cc
@@ -0,0 +1,388 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ssl/daily_navigation_counter.h" + +#include "base/test/simple_test_clock.h" +#include "base/values.h" +#include "testing/gtest/include/gtest/gtest.h" + +constexpr char kStartTime[] = "2023-10-15T06:00:00Z"; + +// Navigation counter should be able to load the counts from a dict. +TEST(DailyNavigationCounterTest, ShouldLoadFromDict) { + base::SimpleTestClock clock; + base::Time now; + EXPECT_TRUE(base::Time::FromUTCString(kStartTime, &now)); + clock.SetNow(now); + + base::Value::Dict dict; + DailyNavigationCounter counter1(&dict, &clock, + /*rolling_window_duration_in_days=*/1u, + /*save_interval=*/1); + + EXPECT_EQ(0u, counter1.GetTotal()); + EXPECT_EQ(0u, counter1.unsaved_count_for_testing()); + + EXPECT_TRUE(counter1.Increment()); + EXPECT_EQ(1u, counter1.GetTotal()); + EXPECT_EQ(0u, counter1.unsaved_count_for_testing()); + + EXPECT_TRUE(counter1.Increment()); + EXPECT_EQ(2u, counter1.GetTotal()); + EXPECT_EQ(0u, counter1.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Hours(13)); + EXPECT_TRUE(counter1.Increment()); + EXPECT_EQ(3u, counter1.GetTotal()); + EXPECT_EQ(0u, counter1.unsaved_count_for_testing()); + + DailyNavigationCounter counter2(&dict, &clock, + /*rolling_window_duration_in_days=*/1u, + /*save_interval=*/1); + EXPECT_EQ(3u, counter1.GetTotal()); + EXPECT_EQ(0u, counter1.unsaved_count_for_testing()); + + EXPECT_TRUE(counter2.Increment()); + EXPECT_EQ(4u, counter2.GetTotal()); + EXPECT_EQ(0u, counter2.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Hours(14)); + EXPECT_TRUE(counter2.Increment()); + EXPECT_EQ(5u, counter2.GetTotal()); + EXPECT_EQ(0u, counter2.unsaved_count_for_testing()); + + // Advance the clock a day and record again. This will keep all entries + // because entries added yesterday are within the rolling window. + clock.SetNow(now + base::Hours(25)); + EXPECT_TRUE(counter2.Increment()); + EXPECT_EQ(6u, counter2.GetTotal()); + EXPECT_EQ(0u, counter2.unsaved_count_for_testing()); + + // Advance the clock further and record again. This will drop 5 old entries + // from the first day. + clock.SetNow(now + base::Hours(49)); + EXPECT_TRUE(counter2.Increment()); + EXPECT_EQ(2u, counter2.GetTotal()); + EXPECT_EQ(0u, counter2.unsaved_count_for_testing()); +} + +// Navigation counter should properly handle counts using a small rolling +// window and small saving interval. +TEST(DailyNavigationCounterTest, SmallRollingWindowSmallInterval) { + base::SimpleTestClock clock; + base::Time now; + EXPECT_TRUE(base::Time::FromUTCString(kStartTime, &now)); + clock.SetNow(now); + + base::Value::Dict dict; + DailyNavigationCounter counter(&dict, &clock, + /*rolling_window_duration_in_days=*/1u, + /*save_interval=*/1); + + EXPECT_EQ(0u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(1u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(2u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Hours(13)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(3u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will drop old entries and only + // keep the last entry. + clock.SetNow(now + base::Hours(26)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(4u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will drop 3 old entries from the + // first day. + clock.SetNow(now + base::Hours(49)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(2u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); +} + +// Navigation counter should properly handle counts using a large rolling +// window and small saving interval. +TEST(DailyNavigationCounterTest, LargeRollingWindowSmallInterval) { + base::SimpleTestClock clock; + base::Time now; + EXPECT_TRUE(base::Time::FromUTCString(kStartTime, &now)); + clock.SetNow(now); + + base::Value::Dict dict; + DailyNavigationCounter counter(&dict, &clock, + /*rolling_window_duration_in_days=*/7u, + /*save_interval=*/1); + + EXPECT_EQ(0u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + EXPECT_TRUE(counter.Increment()); + clock.SetNow(now + base::Hours(6)); + EXPECT_TRUE(counter.Increment()); + clock.SetNow(now + base::Hours(12)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(3u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + clock.SetNow(now + base::Days(1)); + EXPECT_TRUE(counter.Increment()); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(5u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(2)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(6u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(3)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(7u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(4)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(8u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(5)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(9u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(6)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(10u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries because they + // are still inside the rolling window. + clock.SetNow(now + base::Days(7)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(11u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will drop the 3 entries from the + // second day. + clock.SetNow(now + base::Days(8)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(9u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock very far and record again. This will drop all entries but + // the last one. + clock.SetNow(now + base::Days(30)); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(1u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); +} + +// Navigation counter should properly handle counts using a small rolling +// window and large saving interval. +TEST(DailyNavigationCounterTest, SmallRollingWindowLargeInterval) { + base::SimpleTestClock clock; + base::Time now; + EXPECT_TRUE(base::Time::FromUTCString(kStartTime, &now)); + clock.SetNow(now); + + base::Value::Dict dict; + DailyNavigationCounter counter(&dict, &clock, + /*rolling_window_duration_in_days=*/1u, + /*save_interval=*/10); + + EXPECT_EQ(0u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + // Recording 9 times won't save the count in the pref. + for (size_t i = 0; i < 9; i++) { + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(i + 1, counter.GetTotal()); + EXPECT_EQ(i + 1, counter.unsaved_count_for_testing()); + } + // ... but the 10th time will. + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(10u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Record another 9 times, this also won't save the count in the pref. + for (size_t i = 0; i < 9; i++) { + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(11u + i, counter.GetTotal()); + EXPECT_EQ(i + 1, counter.unsaved_count_for_testing()); + } + // ... but the 20th time will. + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(20u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Hours(13)); + EXPECT_FALSE(counter.Increment()); + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(22u, counter.GetTotal()); + EXPECT_EQ(2u, counter.unsaved_count_for_testing()); + + // Advance the clock to next day and record 8 times. This will keep all + // entries as they are still inside the rolling window. + clock.SetNow(now + base::Hours(26)); + for (size_t i = 0; i < 7; i++) { + EXPECT_FALSE(counter.Increment()); + } + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(30u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock to another day and record 10 times. The first nine + // increments won't discard anything, but the last increment will discard 22 + // old entries from the first day and only keep the entries from today and + // yesterday. + clock.SetNow(now + base::Hours(49)); + for (size_t i = 0; i < 9; i++) { + EXPECT_FALSE(counter.Increment()); + } + EXPECT_EQ(39u, counter.GetTotal()); + EXPECT_EQ(9u, counter.unsaved_count_for_testing()); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(18u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); +} + +// Navigation counter should properly handle counts using a large rolling +// window and large saving interval. +TEST(DailyNavigationCounterTest, LargeRollingWindowLargeInterval) { + base::SimpleTestClock clock; + base::Time now; + EXPECT_TRUE(base::Time::FromUTCString(kStartTime, &now)); + clock.SetNow(now); + + base::Value::Dict dict; + DailyNavigationCounter counter(&dict, &clock, + /*rolling_window_duration_in_days=*/7u, + /*save_interval=*/10); + + EXPECT_EQ(0u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + // Recording 9 times won't save the count in the pref. + for (size_t i = 0; i < 9; i++) { + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(i + 1, counter.GetTotal()); + EXPECT_EQ(i + 1, counter.unsaved_count_for_testing()); + } + // ... but the 10th time will. + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(10u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Record another 9 times, this also won't save the count in the pref. + for (size_t i = 0; i < 9; i++) { + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(11u + i, counter.GetTotal()); + EXPECT_EQ(i + 1, counter.unsaved_count_for_testing()); + } + // ... but the 20th time will. + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(20u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Hours(13)); + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(21u, counter.GetTotal()); + EXPECT_EQ(1u, counter.unsaved_count_for_testing()); + + // Advance the clock and record twice. This will keep all entries. + clock.SetNow(now + base::Hours(25)); + EXPECT_FALSE(counter.Increment()); + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(23u, counter.GetTotal()); + EXPECT_EQ(3u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(2)); + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(24u, counter.GetTotal()); + EXPECT_EQ(4u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(3)); + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(25u, counter.GetTotal()); + EXPECT_EQ(5u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(4)); + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(26u, counter.GetTotal()); + EXPECT_EQ(6u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(5)); + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(27u, counter.GetTotal()); + EXPECT_EQ(7u, counter.unsaved_count_for_testing()); + + // Advance the clock and record again. This will keep all entries. + clock.SetNow(now + base::Days(6)); + EXPECT_FALSE(counter.Increment()); + EXPECT_EQ(28u, counter.GetTotal()); + EXPECT_EQ(8u, counter.unsaved_count_for_testing()); + + // Advance the clock and record twice. This will keep all entries as they are + // still inside the rolling window. + clock.SetNow(now + base::Days(7)); + EXPECT_FALSE(counter.Increment()); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(30u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record ten times. This will drop the 21 entries from + // the first day. + clock.SetNow(now + base::Days(8)); + for (size_t i = 0; i < 9; i++) { + EXPECT_FALSE(counter.Increment()); + } + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(19u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock and record ten times. This will drop the 2 entries from + // the second day. + clock.SetNow(now + base::Days(9)); + for (size_t i = 0; i < 9; i++) { + EXPECT_FALSE(counter.Increment()); + } + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(27u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); + + // Advance the clock very far and record ten times. This will all entries but + // the last ten. + clock.SetNow(now + base::Days(30)); + for (size_t i = 0; i < 9; i++) { + EXPECT_FALSE(counter.Increment()); + } + EXPECT_EQ(36u, counter.GetTotal()); + EXPECT_EQ(9u, counter.unsaved_count_for_testing()); + EXPECT_TRUE(counter.Increment()); + EXPECT_EQ(10u, counter.GetTotal()); + EXPECT_EQ(0u, counter.unsaved_count_for_testing()); +}
diff --git a/chrome/browser/ssl/https_upgrades_interceptor.cc b/chrome/browser/ssl/https_upgrades_interceptor.cc index f50ac9e..91ed9fa 100644 --- a/chrome/browser/ssl/https_upgrades_interceptor.cc +++ b/chrome/browser/ssl/https_upgrades_interceptor.cc
@@ -337,7 +337,7 @@ auto query_complete_callback = base::BindOnce( &HttpsUpgradesInterceptor::MaybeCreateLoaderOnHstsQueryCompleted, weak_factory_.GetWeakPtr(), tentative_resource_request, - std::move(callback), profile, web_contents, tab_helper); + std::move(callback)); network::mojom::NetworkContext* network_context = profile->GetDefaultStoragePartition()->GetNetworkContext(); network_context->IsHSTSActiveForHost( @@ -350,12 +350,28 @@ void HttpsUpgradesInterceptor::MaybeCreateLoaderOnHstsQueryCompleted( const network::ResourceRequest& tentative_resource_request, content::URLLoaderRequestInterceptor::LoaderCallback callback, - Profile* profile, - content::WebContents* web_contents, - HttpsOnlyModeTabHelper* tab_helper, bool is_hsts_active_for_host) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + // Reconstruct objects here instead of binding them as parameters to this + // callback method. + // + // It's possible for the WebContents to be destroyed during the + // asynchronous HSTS query call, before this callback is run. If it no longer + // exists, don't upgrade and return. (See crbug.com/1499515.) + content::WebContents* web_contents = + content::WebContents::FromFrameTreeNodeId(frame_tree_node_id_); + if (!web_contents) { + std::move(callback).Run({}); + return; + } + Profile* profile = + Profile::FromBrowserContext(web_contents->GetBrowserContext()); + HttpsOnlyModeTabHelper* tab_helper = + HttpsOnlyModeTabHelper::FromWebContents(web_contents); + CHECK(profile); + CHECK(tab_helper); + // Don't upgrade this request if HSTS is active for this host. if (is_hsts_active_for_host) { RecordNavigationRequestSecurityLevel(
diff --git a/chrome/browser/ssl/https_upgrades_interceptor.h b/chrome/browser/ssl/https_upgrades_interceptor.h index 9d3a4a9..930c1ce 100644 --- a/chrome/browser/ssl/https_upgrades_interceptor.h +++ b/chrome/browser/ssl/https_upgrades_interceptor.h
@@ -80,9 +80,6 @@ void MaybeCreateLoaderOnHstsQueryCompleted( const network::ResourceRequest& tentative_resource_request, content::URLLoaderRequestInterceptor::LoaderCallback callback, - Profile* profile, - content::WebContents* web_contents, - HttpsOnlyModeTabHelper* tab_helper, bool is_hsts_active_for_host); // Sets the ports used by the EmbeddedTestServer (which uses random ports)
diff --git a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc index 2d91a8c..110dc6bb 100644 --- a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc +++ b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
@@ -435,10 +435,6 @@ false /* expect cert status error */); } -// TODO(https://crbug.com/1477317): Add an end-to-end test for -// security_state::SECURE_WITH_POLICY_INSTALLED_CERT (currently that depends on -// a cros-specific policy/service). - IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, DevToolsPage) { GURL devtools_url("devtools://devtools/bundled/"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), devtools_url));
diff --git a/chrome/browser/touch_to_fill/password_manager/BUILD.gn b/chrome/browser/touch_to_fill/BUILD.gn similarity index 85% rename from chrome/browser/touch_to_fill/password_manager/BUILD.gn rename to chrome/browser/touch_to_fill/BUILD.gn index b9b64cb9..9a76522 100644 --- a/chrome/browser/touch_to_fill/password_manager/BUILD.gn +++ b/chrome/browser/touch_to_fill/BUILD.gn
@@ -6,7 +6,7 @@ import("//build/config/android/rules.gni") } -group("password_manager") { +group("touch_to_fill") { public_deps = [ ":factory", ":public", @@ -20,7 +20,7 @@ "touch_to_fill_view_factory.h", ] - deps = [ "//chrome/browser/touch_to_fill/password_manager/android" ] + deps = [ "//chrome/browser/touch_to_fill/android" ] } public_deps = [ ":public" ]
diff --git a/chrome/browser/touch_to_fill/password_manager/android/BUILD.gn b/chrome/browser/touch_to_fill/android/BUILD.gn similarity index 88% rename from chrome/browser/touch_to_fill/password_manager/android/BUILD.gn rename to chrome/browser/touch_to_fill/android/BUILD.gn index 2a6220ff..3692cda 100644 --- a/chrome/browser/touch_to_fill/password_manager/android/BUILD.gn +++ b/chrome/browser/touch_to_fill/android/BUILD.gn
@@ -6,7 +6,7 @@ import("//third_party/jni_zero/jni_zero.gni") source_set("android") { - visibility = [ "//chrome/browser/touch_to_fill/password_manager:factory" ] + visibility = [ "//chrome/browser/touch_to_fill:factory" ] sources = [ "touch_to_fill_view_impl.cc", @@ -17,8 +17,8 @@ deps = [ ":jni_headers", - "//chrome/browser/touch_to_fill/password_manager:public", - "//chrome/browser/touch_to_fill/password_manager/android/internal:jni", + "//chrome/browser/touch_to_fill:public", + "//chrome/browser/touch_to_fill/android/internal:jni", "//chrome/browser/ui", "//components/password_manager/core/browser", "//components/strings:components_strings_grit", @@ -70,8 +70,8 @@ "//chrome/android:chrome_test_util_java", "//chrome/browser/flags:java", "//chrome/browser/password_manager/android:public_impl_java", - "//chrome/browser/touch_to_fill/password_manager/android:public_java", - "//chrome/browser/touch_to_fill/password_manager/android/internal:java", + "//chrome/browser/touch_to_fill/android:public_java", + "//chrome/browser/touch_to_fill/android/internal:java", "//chrome/browser/touch_to_fill/common/android:java", "//chrome/browser/ui/android/favicon:java", "//chrome/test/android:chrome_java_unit_test_support", @@ -112,9 +112,9 @@ "//chrome/browser/flags:java", "//chrome/browser/password_manager/android:password_manager_resource_provider_java", "//chrome/browser/password_manager/android:public_impl_java", - "//chrome/browser/touch_to_fill/password_manager/android/internal:java", - "//chrome/browser/touch_to_fill/password_manager/android/internal:java_resources", - "//chrome/browser/touch_to_fill/password_manager/android/internal:resource_provider_public_impl_java", + "//chrome/browser/touch_to_fill/android/internal:java", + "//chrome/browser/touch_to_fill/android/internal:java_resources", + "//chrome/browser/touch_to_fill/android/internal:resource_provider_public_impl_java", "//chrome/browser/touch_to_fill/common/android:java", "//chrome/browser/touch_to_fill/common/android:java_resources", "//chrome/browser/ui/android/night_mode:night_mode_java_test_support",
diff --git a/chrome/browser/touch_to_fill/password_manager/android/OWNERS b/chrome/browser/touch_to_fill/android/OWNERS similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/OWNERS rename to chrome/browser/touch_to_fill/android/OWNERS
diff --git a/chrome/browser/touch_to_fill/password_manager/android/README.md b/chrome/browser/touch_to_fill/android/README.md similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/README.md rename to chrome/browser/touch_to_fill/android/README.md
diff --git a/chrome/browser/touch_to_fill/android/internal/BUILD.gn b/chrome/browser/touch_to_fill/android/internal/BUILD.gn index 1259426..b850c657 100644 --- a/chrome/browser/touch_to_fill/android/internal/BUILD.gn +++ b/chrome/browser/touch_to_fill/android/internal/BUILD.gn
@@ -3,11 +3,103 @@ # found in the LICENSE file. import("//build/config/android/rules.gni") +import("//build/config/locales.gni") +import("//chrome/common/features.gni") +import("//third_party/jni_zero/jni_zero.gni") +import("//tools/grit/grit_rule.gni") + +generate_jni("jni") { + sources = [ + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java", + ] +} android_library("java") { - sources = [ "java/src/StubForTouchToFillReorg.java" ] + deps = [ + ":java_resources", + "//base:base_java", + "//build/android:build_java", + "//chrome/android:chrome_java", + "//chrome/browser/flags:java", + "//chrome/browser/password_manager/android:java", + "//chrome/browser/profiles/android:java", + "//chrome/browser/touch_to_fill/android:public_java", + "//chrome/browser/touch_to_fill/common/android:java", + "//chrome/browser/touch_to_fill/common/android:java_resources", + "//chrome/browser/ui/android/favicon:java", + "//chrome/browser/util:java", + "//components/browser_ui/bottomsheet/android:java", + "//components/browser_ui/widget/android:java", + "//components/embedder_support/android:util_java", + "//components/favicon/android:java", + "//components/password_manager/core/browser:password_manager_java_enums", + "//components/url_formatter/android:url_formatter_java", + "//content/public/android:content_java", + "//content/public/common:common_java", + "//third_party/androidx:androidx_annotation_annotation_java", + "//third_party/androidx:androidx_appcompat_appcompat_resources_java", + "//third_party/androidx:androidx_core_core_java", + "//third_party/androidx:androidx_recyclerview_recyclerview_java", + "//third_party/jni_zero:jni_zero_java", + "//ui/android:ui_java", + "//url:gurl_java", + ] + + srcjar_deps = [ ":jni" ] + sources = [ + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java", + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillCoordinator.java", + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillMediator.java", + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillProperties.java", + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProvider.java", + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProviderImpl.java", + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillView.java", + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java", + "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewHolder.java", + ] + + # Add the actual implementation where necessary so that downstream targets + # can provide their own implementations. + jar_excluded_patterns = [ "*/TouchToFillResourceProviderImpl.class" ] + + resources_package = "org.chromium.chrome.browser.touch_to_fill" } android_resources("java_resources") { - sources = [] + deps = [ + ":java_strings_grd", + "//ui/android:ui_java_resources", + ] + sources = [ + "java/res/drawable-night/touch_to_fill_header_image.xml", + "java/res/drawable/touch_to_fill_header_image.xml", + "java/res/drawable/touch_to_fill_more_passkeys_icon.xml", + "java/res/layout/touch_to_fill_footer_item.xml", + "java/res/layout/touch_to_fill_header_item.xml", + "java/res/layout/touch_to_fill_list_item.xml", + "java/res/layout/touch_to_fill_more_passkeys_item.xml", + "java/res/values/dimens.xml", + ] +} + +java_strings_grd("java_strings_grd") { + defines = chrome_grit_defines + grd_file = "java/strings/android_touch_to_fill_strings.grd" + outputs = + [ "values/android_touch_to_fill_strings.xml" ] + + process_file_template( + android_bundle_locales_as_resources, + [ "values-{{source_name_part}}/android_touch_to_fill_strings.xml" ]) +} + +android_library("resource_provider_public_impl_java") { + sources = [ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProviderImpl.java" ] + + deps = [ + ":java", + ":java_resources", + "//third_party/androidx:androidx_annotation_annotation_java", + ] + + resources_package = "org.chromium.chrome.browser.touch_to_fill" }
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/README.md b/chrome/browser/touch_to_fill/android/internal/README.md similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/README.md rename to chrome/browser/touch_to_fill/android/internal/README.md
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/res/drawable-night/touch_to_fill_header_image.xml b/chrome/browser/touch_to_fill/android/internal/java/res/drawable-night/touch_to_fill_header_image.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/res/drawable-night/touch_to_fill_header_image.xml rename to chrome/browser/touch_to_fill/android/internal/java/res/drawable-night/touch_to_fill_header_image.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/res/drawable/touch_to_fill_header_image.xml b/chrome/browser/touch_to_fill/android/internal/java/res/drawable/touch_to_fill_header_image.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/res/drawable/touch_to_fill_header_image.xml rename to chrome/browser/touch_to_fill/android/internal/java/res/drawable/touch_to_fill_header_image.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/res/drawable/touch_to_fill_more_passkeys_icon.xml b/chrome/browser/touch_to_fill/android/internal/java/res/drawable/touch_to_fill_more_passkeys_icon.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/res/drawable/touch_to_fill_more_passkeys_icon.xml rename to chrome/browser/touch_to_fill/android/internal/java/res/drawable/touch_to_fill_more_passkeys_icon.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_footer_item.xml b/chrome/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_footer_item.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_footer_item.xml rename to chrome/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_footer_item.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_header_item.xml b/chrome/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_header_item.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_header_item.xml rename to chrome/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_header_item.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_list_item.xml b/chrome/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_list_item.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_list_item.xml rename to chrome/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_list_item.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_more_passkeys_item.xml b/chrome/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_more_passkeys_item.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/res/layout/touch_to_fill_more_passkeys_item.xml rename to chrome/browser/touch_to_fill/android/internal/java/res/layout/touch_to_fill_more_passkeys_item.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/res/values/dimens.xml b/chrome/browser/touch_to_fill/android/internal/java/res/values/dimens.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/res/values/dimens.xml rename to chrome/browser/touch_to_fill/android/internal/java/res/values/dimens.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillCoordinator.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillCoordinator.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillCoordinator.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillCoordinator.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillMediator.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillMediator.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillMediator.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillMediator.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillProperties.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillProperties.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillProperties.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillProperties.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProvider.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProvider.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProvider.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProvider.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProviderImpl.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProviderImpl.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProviderImpl.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProviderImpl.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillView.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillView.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillView.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillView.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewHolder.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewHolder.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewHolder.java rename to chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewHolder.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings.grd b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings.grd rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSKEYS.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSKEYS.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSKEYS.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSKEYS.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSWORDS.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSWORDS.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSWORDS.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSWORDS.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSWORDS_AND_PASSKEYS.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSWORDS_AND_PASSKEYS.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSWORDS_AND_PASSKEYS.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_MANAGE_PASSWORDS_AND_PASSKEYS.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_A11Y_ITEM_COLLECTION_INFO.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_A11Y_ITEM_COLLECTION_INFO.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_A11Y_ITEM_COLLECTION_INFO.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_A11Y_ITEM_COLLECTION_INFO.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_CONTENT_DESCRIPTION.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_CONTENT_DESCRIPTION.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_CONTENT_DESCRIPTION.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_CONTENT_DESCRIPTION.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_CONTINUE.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_CONTINUE.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_CONTINUE.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_CONTINUE.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_MORE_PASSKEYS.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_MORE_PASSKEYS.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_MORE_PASSKEYS.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_MORE_PASSKEYS.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_PASSKEY_CREDENTIAL_ACCESSIBILITY_DESCRIPTION.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_PASSKEY_CREDENTIAL_ACCESSIBILITY_DESCRIPTION.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_PASSKEY_CREDENTIAL_ACCESSIBILITY_DESCRIPTION.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_PASSKEY_CREDENTIAL_ACCESSIBILITY_DESCRIPTION.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_PASSWORD_CREDENTIAL_ACCESSIBILITY_DESCRIPTION.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_PASSWORD_CREDENTIAL_ACCESSIBILITY_DESCRIPTION.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_PASSWORD_CREDENTIAL_ACCESSIBILITY_DESCRIPTION.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_PASSWORD_CREDENTIAL_ACCESSIBILITY_DESCRIPTION.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SELECT_PASSKEY.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SELECT_PASSKEY.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SELECT_PASSKEY.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SELECT_PASSKEY.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_CLOSED.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_CLOSED.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_CLOSED.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_CLOSED.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_FULL_HEIGHT.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_FULL_HEIGHT.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_FULL_HEIGHT.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_FULL_HEIGHT.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_INSECURE_SUBMISSION.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_INSECURE_SUBMISSION.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_INSECURE_SUBMISSION.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_INSECURE_SUBMISSION.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_NOT_SECURE.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_NOT_SECURE.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_NOT_SECURE.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_NOT_SECURE.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_SUBMISSION.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_SUBMISSION.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_SUBMISSION.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_SUBTITLE_SUBMISSION.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_TITLE_PASSKEY.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_TITLE_PASSKEY.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_TITLE_PASSKEY.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_TITLE_PASSKEY.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_TITLE_PASSWORD_OR_PASSKEY.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_TITLE_PASSWORD_OR_PASSKEY.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_TITLE_PASSWORD_OR_PASSKEY.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_TITLE_PASSWORD_OR_PASSKEY.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_UNIFORM_TITLE.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_UNIFORM_TITLE.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_UNIFORM_TITLE.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_UNIFORM_TITLE.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_WEBAUTHN_CREDENTIAL_CONTEXT.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_WEBAUTHN_CREDENTIAL_CONTEXT.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_WEBAUTHN_CREDENTIAL_CONTEXT.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SHEET_WEBAUTHN_CREDENTIAL_CONTEXT.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SIGNIN.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SIGNIN.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SIGNIN.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_SIGNIN.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_USE_DEVICE_PASSKEY.png.sha1 b/chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_USE_DEVICE_PASSKEY.png.sha1 similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_USE_DEVICE_PASSKEY.png.sha1 rename to chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings_grd/IDS_TOUCH_TO_FILL_USE_DEVICE_PASSKEY.png.sha1
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_af.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_af.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_af.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_af.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_am.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_am.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_am.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_am.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ar.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ar.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ar.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ar.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_as.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_as.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_as.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_as.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_az.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_az.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_az.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_az.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_be.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_be.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_be.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_be.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_bg.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_bg.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_bg.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_bg.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_bn.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_bn.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_bn.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_bn.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_bs.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_bs.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_bs.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_bs.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ca.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ca.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ca.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ca.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_cs.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_cs.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_cs.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_cs.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_cy.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_cy.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_cy.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_cy.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_da.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_da.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_da.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_da.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_de.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_de.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_de.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_de.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_el.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_el.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_el.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_el.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_en-GB.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_en-GB.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_en-GB.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_en-GB.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_es-419.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_es-419.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_es-419.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_es-419.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_es.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_es.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_es.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_es.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_et.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_et.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_et.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_et.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_eu.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_eu.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_eu.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_eu.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fa.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fa.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fa.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fa.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fi.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fi.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fi.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fi.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fil.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fil.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fil.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fil.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fr-CA.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fr-CA.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fr-CA.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fr-CA.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fr.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fr.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_fr.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_fr.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_gl.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_gl.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_gl.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_gl.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_gu.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_gu.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_gu.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_gu.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_hi.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_hi.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_hi.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_hi.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_hr.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_hr.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_hr.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_hr.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_hu.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_hu.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_hu.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_hu.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_hy.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_hy.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_hy.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_hy.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_id.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_id.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_id.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_id.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_is.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_is.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_is.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_is.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_it.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_it.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_it.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_it.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_iw.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_iw.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_iw.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_iw.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ja.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ja.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ja.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ja.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ka.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ka.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ka.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ka.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_kk.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_kk.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_kk.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_kk.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_km.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_km.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_km.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_km.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_kn.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_kn.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_kn.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_kn.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ko.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ko.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ko.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ko.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ky.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ky.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ky.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ky.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_lo.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_lo.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_lo.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_lo.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_lt.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_lt.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_lt.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_lt.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_lv.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_lv.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_lv.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_lv.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_mk.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_mk.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_mk.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_mk.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ml.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ml.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ml.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ml.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_mn.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_mn.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_mn.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_mn.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_mr.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_mr.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_mr.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_mr.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ms.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ms.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ms.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ms.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_my.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_my.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_my.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_my.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ne.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ne.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ne.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ne.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_nl.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_nl.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_nl.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_nl.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_no.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_no.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_no.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_no.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_or.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_or.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_or.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_or.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_pa.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_pa.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_pa.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_pa.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_pl.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_pl.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_pl.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_pl.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_pt-BR.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_pt-BR.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_pt-BR.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_pt-BR.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_pt-PT.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_pt-PT.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_pt-PT.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_pt-PT.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ro.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ro.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ro.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ro.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ru.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ru.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ru.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ru.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_si.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_si.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_si.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_si.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sk.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sk.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sk.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sk.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sl.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sl.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sl.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sl.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sq.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sq.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sq.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sq.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sr-Latn.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sr-Latn.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sr-Latn.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sr-Latn.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sr.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sr.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sr.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sr.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sv.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sv.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sv.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sv.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sw.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sw.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_sw.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_sw.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ta.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ta.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ta.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ta.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_te.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_te.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_te.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_te.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_th.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_th.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_th.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_th.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_tr.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_tr.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_tr.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_tr.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_uk.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_uk.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_uk.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_uk.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ur.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ur.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_ur.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_ur.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_uz.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_uz.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_uz.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_uz.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_vi.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_vi.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_vi.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_vi.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-CN.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-CN.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-CN.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-CN.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-HK.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-HK.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-HK.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-HK.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-TW.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-TW.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-TW.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_zh-TW.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_zu.xtb b/chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_zu.xtb similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/translations/android_touch_to_fill_strings_zu.xtb rename to chrome/browser/touch_to_fill/android/internal/java/strings/translations/android_touch_to_fill_strings_zu.xtb
diff --git a/chrome/browser/touch_to_fill/password_manager/android/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillComponent.java b/chrome/browser/touch_to_fill/android/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillComponent.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillComponent.java rename to chrome/browser/touch_to_fill/android/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillComponent.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/java/src/org/chromium/chrome/browser/touch_to_fill/data/Credential.java b/chrome/browser/touch_to_fill/android/java/src/org/chromium/chrome/browser/touch_to_fill/data/Credential.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/java/src/org/chromium/chrome/browser/touch_to_fill/data/Credential.java rename to chrome/browser/touch_to_fill/android/java/src/org/chromium/chrome/browser/touch_to_fill/data/Credential.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/java/src/org/chromium/chrome/browser/touch_to_fill/data/WebAuthnCredential.java b/chrome/browser/touch_to_fill/android/java/src/org/chromium/chrome/browser/touch_to_fill/data/WebAuthnCredential.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/java/src/org/chromium/chrome/browser/touch_to_fill/data/WebAuthnCredential.java rename to chrome/browser/touch_to_fill/android/java/src/org/chromium/chrome/browser/touch_to_fill/data/WebAuthnCredential.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillIntegrationTest.java b/chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillIntegrationTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillIntegrationTest.java rename to chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillIntegrationTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillRenderTest.java b/chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillRenderTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillRenderTest.java rename to chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillRenderTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java b/chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java rename to chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/junit/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillControllerTest.java b/chrome/browser/touch_to_fill/android/junit/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillControllerTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/android/junit/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillControllerTest.java rename to chrome/browser/touch_to_fill/android/junit/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillControllerTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/android/touch_to_fill_view_impl.cc b/chrome/browser/touch_to_fill/android/touch_to_fill_view_impl.cc similarity index 93% rename from chrome/browser/touch_to_fill/password_manager/android/touch_to_fill_view_impl.cc rename to chrome/browser/touch_to_fill/android/touch_to_fill_view_impl.cc index ae23190..93b6038 100644 --- a/chrome/browser/touch_to_fill/password_manager/android/touch_to_fill_view_impl.cc +++ b/chrome/browser/touch_to_fill/android/touch_to_fill_view_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/android/touch_to_fill_view_impl.h" +#include "chrome/browser/touch_to_fill/android/touch_to_fill_view_impl.h" #include <jni.h> #include <memory> @@ -12,10 +12,10 @@ #include "base/android/jni_array.h" #include "base/android/jni_string.h" #include "base/time/time.h" -#include "chrome/browser/touch_to_fill/password_manager/android/internal/jni/TouchToFillBridge_jni.h" -#include "chrome/browser/touch_to_fill/password_manager/android/jni_headers/Credential_jni.h" -#include "chrome/browser/touch_to_fill/password_manager/android/jni_headers/WebAuthnCredential_jni.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h" // nogncheck +#include "chrome/browser/touch_to_fill/android/internal/jni/TouchToFillBridge_jni.h" +#include "chrome/browser/touch_to_fill/android/jni_headers/Credential_jni.h" +#include "chrome/browser/touch_to_fill/android/jni_headers/WebAuthnCredential_jni.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller.h" // nogncheck #include "chrome/browser/ui/passwords/ui_utils.h" #include "components/password_manager/core/browser/origin_credential_store.h" #include "components/password_manager/core/browser/passkey_credential.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/android/touch_to_fill_view_impl.h b/chrome/browser/touch_to_fill/android/touch_to_fill_view_impl.h similarity index 84% rename from chrome/browser/touch_to_fill/password_manager/android/touch_to_fill_view_impl.h rename to chrome/browser/touch_to_fill/android/touch_to_fill_view_impl.h index b717c84f..2e2dd80 100644 --- a/chrome/browser/touch_to_fill/password_manager/android/touch_to_fill_view_impl.h +++ b/chrome/browser/touch_to_fill/android/touch_to_fill_view_impl.h
@@ -2,12 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_ANDROID_TOUCH_TO_FILL_VIEW_IMPL_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_ANDROID_TOUCH_TO_FILL_VIEW_IMPL_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_ANDROID_TOUCH_TO_FILL_VIEW_IMPL_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_ANDROID_TOUCH_TO_FILL_VIEW_IMPL_H_ #include "base/android/scoped_java_ref.h" #include "base/memory/raw_ptr.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_view.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_view.h" + +namespace gfx { +class Image; +} namespace password_manager { class PasskeyCredential; @@ -55,4 +59,4 @@ base::android::ScopedJavaGlobalRef<jobject> java_object_internal_; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_ANDROID_TOUCH_TO_FILL_VIEW_IMPL_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_ANDROID_TOUCH_TO_FILL_VIEW_IMPL_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/android/BUILD.gn b/chrome/browser/touch_to_fill/no_passkeys/android/BUILD.gn similarity index 87% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/android/BUILD.gn rename to chrome/browser/touch_to_fill/no_passkeys/android/BUILD.gn index cfb9297..4f40ef3 100644 --- a/chrome/browser/touch_to_fill/password_manager/no_passkeys/android/BUILD.gn +++ b/chrome/browser/touch_to_fill/no_passkeys/android/BUILD.gn
@@ -12,7 +12,7 @@ deps = [ "//base", - "//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:jni", + "//chrome/browser/touch_to_fill/no_passkeys/internal/android:jni", "//ui/android:android", ] }
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.cc b/chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.cc similarity index 93% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.cc rename to chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.cc index 8b67d2a..1f68e600 100644 --- a/chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.cc +++ b/chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.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 "chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h" +#include "chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h" #include "base/android/jni_string.h" -#include "chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/jni/NoPasskeysBottomSheetBridge_jni.h" +#include "chrome/browser/touch_to_fill/no_passkeys/internal/android/jni/NoPasskeysBottomSheetBridge_jni.h" #include "ui/android/window_android.h" namespace {
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h b/chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h similarity index 88% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h rename to chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h index efc6e50..90ddca0 100644 --- a/chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h +++ b/chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_NO_PASSKEYS_ANDROID_NO_PASSKEYS_BOTTOM_SHEET_BRIDGE_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_NO_PASSKEYS_ANDROID_NO_PASSKEYS_BOTTOM_SHEET_BRIDGE_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_NO_PASSKEYS_ANDROID_NO_PASSKEYS_BOTTOM_SHEET_BRIDGE_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_NO_PASSKEYS_ANDROID_NO_PASSKEYS_BOTTOM_SHEET_BRIDGE_H_ #include <jni.h> #include <memory> @@ -76,4 +76,4 @@ base::OnceClosure on_click_use_another_device_callback_; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_NO_PASSKEYS_ANDROID_NO_PASSKEYS_BOTTOM_SHEET_BRIDGE_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_NO_PASSKEYS_ANDROID_NO_PASSKEYS_BOTTOM_SHEET_BRIDGE_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge_unittest.cc b/chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge_unittest.cc similarity index 96% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge_unittest.cc rename to chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge_unittest.cc index ab05bb1..f8339223 100644 --- a/chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge_unittest.cc +++ b/chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge_unittest.cc
@@ -1,8 +1,7 @@ // Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - -#include "chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h" +#include "chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h" #include <jni.h>
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/BUILD.gn b/chrome/browser/touch_to_fill/no_passkeys/internal/android/BUILD.gn similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/BUILD.gn rename to chrome/browser/touch_to_fill/no_passkeys/internal/android/BUILD.gn
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/res/layout/no_passkeys_bottom_sheet.xml b/chrome/browser/touch_to_fill/no_passkeys/internal/android/java/res/layout/no_passkeys_bottom_sheet.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/res/layout/no_passkeys_bottom_sheet.xml rename to chrome/browser/touch_to_fill/no_passkeys/internal/android/java/res/layout/no_passkeys_bottom_sheet.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetBridge.java b/chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetBridge.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetBridge.java rename to chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetBridge.java
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetContent.java b/chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetContent.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetContent.java rename to chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetContent.java
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetCoordinator.java b/chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetCoordinator.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetCoordinator.java rename to chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetCoordinator.java
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetMediator.java b/chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetMediator.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetMediator.java rename to chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetMediator.java
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetModuleTest.java b/chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetModuleTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetModuleTest.java rename to chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetModuleTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetRenderTest.java b/chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetRenderTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetRenderTest.java rename to chrome/browser/touch_to_fill/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetRenderTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/OWNERS b/chrome/browser/touch_to_fill/password_generation/OWNERS similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/OWNERS rename to chrome/browser/touch_to_fill/password_generation/OWNERS
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/BUILD.gn b/chrome/browser/touch_to_fill/password_generation/android/BUILD.gn similarity index 91% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/BUILD.gn rename to chrome/browser/touch_to_fill/password_generation/android/BUILD.gn index 9dbdb4a5..6a7b56c 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/BUILD.gn +++ b/chrome/browser/touch_to_fill/password_generation/android/BUILD.gn
@@ -31,7 +31,7 @@ ] deps = [ - "//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:jni", + "//chrome/browser/touch_to_fill/password_generation/android/internal:jni", "//components/password_manager/core/common:features", "//components/prefs:prefs", "//content/public/browser", @@ -84,7 +84,7 @@ deps = [ "//base:base_java", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:java_resources", + "//chrome/browser/touch_to_fill/password_generation/android/internal:java_resources", "//third_party/android_deps:espresso_java", "//third_party/hamcrest:hamcrest_java", ]
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/fake_touch_to_fill_password_generation_bridge.cc b/chrome/browser/touch_to_fill/password_generation/android/fake_touch_to_fill_password_generation_bridge.cc similarity index 81% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/fake_touch_to_fill_password_generation_bridge.cc rename to chrome/browser/touch_to_fill/password_generation/android/fake_touch_to_fill_password_generation_bridge.cc index e616e4df..6c642a2f 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/fake_touch_to_fill_password_generation_bridge.cc +++ b/chrome/browser/touch_to_fill/password_generation/android/fake_touch_to_fill_password_generation_bridge.cc
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/fake_touch_to_fill_password_generation_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_delegate.h" +#include "chrome/browser/touch_to_fill/password_generation/android/fake_touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_delegate.h" FakeTouchToFillPasswordGenerationBridge:: FakeTouchToFillPasswordGenerationBridge() = default;
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/fake_touch_to_fill_password_generation_bridge.h b/chrome/browser/touch_to_fill/password_generation/android/fake_touch_to_fill_password_generation_bridge.h similarity index 65% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/fake_touch_to_fill_password_generation_bridge.h rename to chrome/browser/touch_to_fill/password_generation/android/fake_touch_to_fill_password_generation_bridge.h index 9c2e812..bb240df 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/fake_touch_to_fill_password_generation_bridge.h +++ b/chrome/browser/touch_to_fill/password_generation/android/fake_touch_to_fill_password_generation_bridge.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_FAKE_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_FAKE_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_FAKE_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_FAKE_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ #include <jni.h> -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h" #include "content/public/browser/web_contents.h" class FakeTouchToFillPasswordGenerationBridge @@ -32,4 +32,4 @@ raw_ptr<TouchToFillPasswordGenerationDelegate> delegate_; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_FAKE_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_FAKE_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/BUILD.gn b/chrome/browser/touch_to_fill/password_generation/android/internal/BUILD.gn similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/BUILD.gn rename to chrome/browser/touch_to_fill/password_generation/android/internal/BUILD.gn
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/res/layout/touch_to_fill_password_generation.xml b/chrome/browser/touch_to_fill/password_generation/android/internal/java/res/layout/touch_to_fill_password_generation.xml similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/res/layout/touch_to_fill_password_generation.xml rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/res/layout/touch_to_fill_password_generation.xml
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationBridge.java b/chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationBridge.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationBridge.java rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationBridge.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationBridgeTest.java b/chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationBridgeTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationBridgeTest.java rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationBridgeTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationCoordinator.java b/chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationCoordinator.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationCoordinator.java rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationCoordinator.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationModuleTest.java b/chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationModuleTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationModuleTest.java rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationModuleTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationProperties.java b/chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationProperties.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationProperties.java rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationProperties.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationRenderTest.java b/chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationRenderTest.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationRenderTest.java rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationRenderTest.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationView.java b/chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationView.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationView.java rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationView.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationViewBinder.java b/chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationViewBinder.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationViewBinder.java rename to chrome/browser/touch_to_fill/password_generation/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationViewBinder.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationTestHelper.java b/chrome/browser/touch_to_fill/password_generation/android/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationTestHelper.java similarity index 100% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationTestHelper.java rename to chrome/browser/touch_to_fill/password_generation/android/java/src/org/chromium/chrome/browser/touch_to_fill/password_generation/TouchToFillPasswordGenerationTestHelper.java
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.cc b/chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.cc similarity index 76% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.cc rename to chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.cc index 0e51e10..0c3f6e5 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.cc +++ b/chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.h b/chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.h similarity index 66% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.h rename to chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.h index 6ba72a5b..c74c890 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.h +++ b/chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_MOCK_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_MOCK_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_MOCK_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_MOCK_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ #include <jni.h> -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h" #include "content/public/browser/web_contents.h" #include "testing/gmock/include/gmock/gmock.h" @@ -34,4 +34,4 @@ MOCK_METHOD(void, OnGeneratedPasswordRejected, (JNIEnv*), (override)); }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_MOCK_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_MOCK_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h similarity index 72% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h rename to chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h index b932cc4..875681f65a 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h +++ b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ #include <string> @@ -31,4 +31,4 @@ virtual void OnGeneratedPasswordRejected(JNIEnv* env) = 0; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge_impl.cc b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge_impl.cc similarity index 91% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge_impl.cc rename to chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge_impl.cc index fda15b82..c29b625f 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge_impl.cc +++ b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge_impl.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge_impl.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge_impl.h" #include "base/android/jni_string.h" #include "base/android/scoped_java_ref.h" #include "base/check.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/internal/jni/TouchToFillPasswordGenerationBridge_jni.h" +#include "chrome/browser/touch_to_fill/password_generation/android/internal/jni/TouchToFillPasswordGenerationBridge_jni.h" #include "components/password_manager/core/common/password_manager_features.h" #include "content/public/browser/web_contents.h" #include "ui/android/view_android.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge_impl.h b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge_impl.h similarity index 70% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge_impl.h rename to chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge_impl.h index 34b3655..ae3d2f4 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge_impl.h +++ b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge_impl.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_IMPL_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_IMPL_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_IMPL_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_IMPL_H_ #include "base/memory/raw_ptr.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_delegate.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_delegate.h" #include "components/prefs/pref_service.h" #include "content/public/browser/web_contents.h" @@ -45,4 +45,4 @@ raw_ptr<TouchToFillPasswordGenerationDelegate> delegate_ = nullptr; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_IMPL_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_BRIDGE_IMPL_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.cc b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.cc similarity index 91% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.cc rename to chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.cc index e292fd5..77af105a 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.cc +++ b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h" #include <memory> #include <string> @@ -10,8 +10,8 @@ #include "base/check.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/autofill/manual_filling_controller.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h" #include "components/autofill/core/common/password_generation_util.h" #include "components/password_manager/content/browser/content_password_manager_driver.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h similarity index 83% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h rename to chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h index 1d03075b..569e7397 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h +++ b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_CONTROLLER_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_CONTROLLER_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_CONTROLLER_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_CONTROLLER_H_ #include <string> #include "base/memory/raw_ptr.h" #include "chrome/browser/autofill/manual_filling_controller.h" #include "chrome/browser/password_manager/android/password_generation_element_data.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_delegate.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_delegate.h" #include "components/autofill/core/common/password_generation_util.h" #include "components/prefs/pref_service.h" #include "content/public/browser/render_widget_host.h" @@ -85,4 +85,4 @@ password_generation_type_; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_CONTROLLER_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_CONTROLLER_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller_unittest.cc b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller_unittest.cc similarity index 96% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller_unittest.cc rename to chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller_unittest.cc index e22d15e..ab2cf1a 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller_unittest.cc +++ b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller_unittest.cc
@@ -11,8 +11,8 @@ #include "base/test/mock_callback.h" #include "chrome/browser/autofill/mock_manual_filling_controller.h" #include "chrome/browser/password_manager/android/password_generation_element_data.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/mock_touch_to_fill_password_generation_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_controller.h" +#include "chrome/browser/touch_to_fill/password_generation/android/mock_touch_to_fill_password_generation_bridge.h" +#include "chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_controller.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "components/autofill/core/common/password_generation_util.h" #include "components/password_manager/content/browser/content_password_manager_driver.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_delegate.h b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_delegate.h similarity index 73% rename from chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_delegate.h rename to chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_delegate.h index 59ccfd3..bb56a43 100644 --- a/chrome/browser/touch_to_fill/password_manager/password_generation/android/touch_to_fill_password_generation_delegate.h +++ b/chrome/browser/touch_to_fill/password_generation/android/touch_to_fill_password_generation_delegate.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_DELEGATE_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_DELEGATE_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_DELEGATE_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_DELEGATE_H_ #include <string> @@ -28,4 +28,4 @@ virtual void OnGeneratedPasswordRejected() = 0; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_DELEGATE_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_GENERATION_ANDROID_TOUCH_TO_FILL_PASSWORD_GENERATION_DELEGATE_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/android/internal/BUILD.gn b/chrome/browser/touch_to_fill/password_manager/android/internal/BUILD.gn index 9ac9c23f..9086a0d 100644 --- a/chrome/browser/touch_to_fill/password_manager/android/internal/BUILD.gn +++ b/chrome/browser/touch_to_fill/password_manager/android/internal/BUILD.gn
@@ -3,103 +3,11 @@ # found in the LICENSE file. import("//build/config/android/rules.gni") -import("//build/config/locales.gni") -import("//chrome/common/features.gni") -import("//third_party/jni_zero/jni_zero.gni") -import("//tools/grit/grit_rule.gni") - -generate_jni("jni") { - sources = [ - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java", - ] -} android_library("java") { - deps = [ - ":java_resources", - "//base:base_java", - "//build/android:build_java", - "//chrome/android:chrome_java", - "//chrome/browser/flags:java", - "//chrome/browser/password_manager/android:java", - "//chrome/browser/profiles/android:java", - "//chrome/browser/touch_to_fill/common/android:java", - "//chrome/browser/touch_to_fill/common/android:java_resources", - "//chrome/browser/touch_to_fill/password_manager/android:public_java", - "//chrome/browser/ui/android/favicon:java", - "//chrome/browser/util:java", - "//components/browser_ui/bottomsheet/android:java", - "//components/browser_ui/widget/android:java", - "//components/embedder_support/android:util_java", - "//components/favicon/android:java", - "//components/password_manager/core/browser:password_manager_java_enums", - "//components/url_formatter/android:url_formatter_java", - "//content/public/android:content_java", - "//content/public/common:common_java", - "//third_party/androidx:androidx_annotation_annotation_java", - "//third_party/androidx:androidx_appcompat_appcompat_resources_java", - "//third_party/androidx:androidx_core_core_java", - "//third_party/androidx:androidx_recyclerview_recyclerview_java", - "//third_party/jni_zero:jni_zero_java", - "//ui/android:ui_java", - "//url:gurl_java", - ] - - srcjar_deps = [ ":jni" ] - sources = [ - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillBridge.java", - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillCoordinator.java", - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillMediator.java", - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillProperties.java", - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProvider.java", - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProviderImpl.java", - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillView.java", - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java", - "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewHolder.java", - ] - - # Add the actual implementation where necessary so that downstream targets - # can provide their own implementations. - jar_excluded_patterns = [ "*/TouchToFillResourceProviderImpl.class" ] - - resources_package = "org.chromium.chrome.browser.touch_to_fill" + sources = [ "java/src/StubForTouchToFillReorg.java" ] } android_resources("java_resources") { - deps = [ - ":java_strings_grd", - "//ui/android:ui_java_resources", - ] - sources = [ - "java/res/drawable-night/touch_to_fill_header_image.xml", - "java/res/drawable/touch_to_fill_header_image.xml", - "java/res/drawable/touch_to_fill_more_passkeys_icon.xml", - "java/res/layout/touch_to_fill_footer_item.xml", - "java/res/layout/touch_to_fill_header_item.xml", - "java/res/layout/touch_to_fill_list_item.xml", - "java/res/layout/touch_to_fill_more_passkeys_item.xml", - "java/res/values/dimens.xml", - ] -} - -java_strings_grd("java_strings_grd") { - defines = chrome_grit_defines - grd_file = "java/strings/android_touch_to_fill_strings.grd" - outputs = - [ "values/android_touch_to_fill_strings.xml" ] + - process_file_template( - android_bundle_locales_as_resources, - [ "values-{{source_name_part}}/android_touch_to_fill_strings.xml" ]) -} - -android_library("resource_provider_public_impl_java") { - sources = [ "java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillResourceProviderImpl.java" ] - - deps = [ - ":java", - ":java_resources", - "//third_party/androidx:androidx_annotation_annotation_java", - ] - - resources_package = "org.chromium.chrome.browser.touch_to_fill" + sources = [] }
diff --git a/chrome/browser/touch_to_fill/android/internal/java/src/StubForTouchToFillReorg.java b/chrome/browser/touch_to_fill/password_manager/android/internal/java/src/StubForTouchToFillReorg.java similarity index 100% rename from chrome/browser/touch_to_fill/android/internal/java/src/StubForTouchToFillReorg.java rename to chrome/browser/touch_to_fill/password_manager/android/internal/java/src/StubForTouchToFillReorg.java
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.h b/chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.h deleted file mode 100644 index 478ac3c..0000000 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.h +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright 2019 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_VIEW_FACTORY_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_VIEW_FACTORY_H_ - -#include <memory> - -class TouchToFillView; -class TouchToFillController; - -class TouchToFillViewFactory { - public: - static std::unique_ptr<TouchToFillView> Create( - TouchToFillController* controller); -}; - -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_VIEW_FACTORY_H_
diff --git a/chrome/browser/touch_to_fill/autofill/DIR_METADATA b/chrome/browser/touch_to_fill/payments/DIR_METADATA similarity index 100% rename from chrome/browser/touch_to_fill/autofill/DIR_METADATA rename to chrome/browser/touch_to_fill/payments/DIR_METADATA
diff --git a/chrome/browser/touch_to_fill/autofill/OWNERS b/chrome/browser/touch_to_fill/payments/OWNERS similarity index 100% rename from chrome/browser/touch_to_fill/autofill/OWNERS rename to chrome/browser/touch_to_fill/payments/OWNERS
diff --git a/chrome/browser/touch_to_fill/autofill/android/BUILD.gn b/chrome/browser/touch_to_fill/payments/android/BUILD.gn similarity index 95% rename from chrome/browser/touch_to_fill/autofill/android/BUILD.gn rename to chrome/browser/touch_to_fill/payments/android/BUILD.gn index fb15a8ee..43d87b0 100644 --- a/chrome/browser/touch_to_fill/autofill/android/BUILD.gn +++ b/chrome/browser/touch_to_fill/payments/android/BUILD.gn
@@ -37,7 +37,7 @@ group("jni_headers") { public_deps = - [ "//chrome/browser/touch_to_fill/autofill/android/internal:jni" ] + [ "//chrome/browser/touch_to_fill/payments/android/internal:jni" ] } android_library("public_java") {
diff --git a/chrome/browser/touch_to_fill/autofill/android/OWNERS b/chrome/browser/touch_to_fill/payments/android/OWNERS similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/OWNERS rename to chrome/browser/touch_to_fill/payments/android/OWNERS
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/BUILD.gn b/chrome/browser/touch_to_fill/payments/android/internal/BUILD.gn similarity index 95% rename from chrome/browser/touch_to_fill/autofill/android/internal/BUILD.gn rename to chrome/browser/touch_to_fill/payments/android/internal/BUILD.gn index 649c9aef..64d55f1e 100644 --- a/chrome/browser/touch_to_fill/autofill/android/internal/BUILD.gn +++ b/chrome/browser/touch_to_fill/payments/android/internal/BUILD.gn
@@ -21,10 +21,10 @@ "//chrome/browser/autofill/android:java", "//chrome/browser/autofill/android:java", "//chrome/browser/flags:java", - "//chrome/browser/touch_to_fill/password_manager/android/internal:java", + "//chrome/browser/touch_to_fill/android/internal:java", "//chrome/browser/touch_to_fill/common/android:java", "//chrome/browser/touch_to_fill/common/android:java_resources", - "//chrome/browser/touch_to_fill/autofill/android:public_java", + "//chrome/browser/touch_to_fill/payments/android:public_java", "//components/browser_ui/bottomsheet/android:java", "//components/payments/content/android:java", "//components/payments/content/android:minimal_java_resources", @@ -78,7 +78,7 @@ "//chrome/browser/autofill/test:test_support_java", "//chrome/browser/touch_to_fill/common/android:java", "//chrome/browser/touch_to_fill/common/android:java_resources", - "//chrome/browser/touch_to_fill/autofill/android:public_java", + "//chrome/browser/touch_to_fill/payments/android:public_java", "//chrome/test/android:chrome_java_unit_test_support", "//components/autofill/android:autofill_features_java", "//components/browser_ui/bottomsheet/android:java", @@ -115,7 +115,7 @@ "//chrome/browser/flags:java", "//chrome/browser/touch_to_fill/common/android:java", "//chrome/browser/touch_to_fill/common/android:java_resources", - "//chrome/browser/touch_to_fill/autofill/android:public_java", + "//chrome/browser/touch_to_fill/payments/android:public_java", "//chrome/browser/ui/android/night_mode:night_mode_java_test_support", "//chrome/browser/util:java", "//chrome/test/android:chrome_java_integration_test_support",
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/res/layout/touch_to_fill_credit_card_footer_item.xml b/chrome/browser/touch_to_fill/payments/android/internal/java/res/layout/touch_to_fill_credit_card_footer_item.xml similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/res/layout/touch_to_fill_credit_card_footer_item.xml rename to chrome/browser/touch_to_fill/payments/android/internal/java/res/layout/touch_to_fill_credit_card_footer_item.xml
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/res/layout/touch_to_fill_credit_card_header_item.xml b/chrome/browser/touch_to_fill/payments/android/internal/java/res/layout/touch_to_fill_credit_card_header_item.xml similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/res/layout/touch_to_fill_credit_card_header_item.xml rename to chrome/browser/touch_to_fill/payments/android/internal/java/res/layout/touch_to_fill_credit_card_header_item.xml
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/res/layout/touch_to_fill_credit_card_sheet_item.xml b/chrome/browser/touch_to_fill/payments/android/internal/java/res/layout/touch_to_fill_credit_card_sheet_item.xml similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/res/layout/touch_to_fill_credit_card_sheet_item.xml rename to chrome/browser/touch_to_fill/payments/android/internal/java/res/layout/touch_to_fill_credit_card_sheet_item.xml
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/res/values/dimens.xml b/chrome/browser/touch_to_fill/payments/android/internal/java/res/values/dimens.xml similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/res/values/dimens.xml rename to chrome/browser/touch_to_fill/payments/android/internal/java/res/values/dimens.xml
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardControllerBridge.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardControllerBridge.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardControllerBridge.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardControllerBridge.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardControllerRobolectricTest.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardControllerRobolectricTest.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardControllerRobolectricTest.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardControllerRobolectricTest.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardCoordinator.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardCoordinator.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardCoordinator.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardCoordinator.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardMediator.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardMediator.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardMediator.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardMediator.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardProperties.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardProperties.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardProperties.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardProperties.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardRenderTest.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardRenderTest.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardRenderTest.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardRenderTest.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardView.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardView.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardView.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardView.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewBinder.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewBinder.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewBinder.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewBinder.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewBridge.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewBridge.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewBridge.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewBridge.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewTest.java b/chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewTest.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewTest.java rename to chrome/browser/touch_to_fill/payments/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardViewTest.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardComponent.java b/chrome/browser/touch_to_fill/payments/android/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardComponent.java similarity index 100% rename from chrome/browser/touch_to_fill/autofill/android/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardComponent.java rename to chrome/browser/touch_to_fill/payments/android/java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillCreditCardComponent.java
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.cc b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.cc similarity index 94% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.cc rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.cc index c171ec6..eb357aa 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.cc +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.h" #include <memory> #include "base/android/jni_android.h" #include "base/android/jni_string.h" -#include "chrome/browser/touch_to_fill/autofill/android/internal/jni/TouchToFillCreditCardControllerBridge_jni.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.h" +#include "chrome/browser/touch_to_fill/payments/android/internal/jni/TouchToFillCreditCardControllerBridge_jni.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.h" #include "components/autofill/content/browser/content_autofill_client.h" #include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/core/browser/autofill_manager.h"
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.h b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.h similarity index 90% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.h rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.h index c9d87b4..1c013a9 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.h +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_CONTROLLER_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_CONTROLLER_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_CONTROLLER_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_CONTROLLER_H_ #include <memory> #include "base/android/scoped_java_ref.h" #include "base/containers/span.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_controller.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_controller.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.h" #include "components/autofill/content/browser/content_autofill_driver_factory.h" namespace autofill { @@ -88,4 +88,4 @@ } // namespace autofill -#endif // CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_CONTROLLER_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_CONTROLLER_H_
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller_unittest.cc b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller_unittest.cc similarity index 95% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller_unittest.cc rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller_unittest.cc index 3cf420b..617f073 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller_unittest.cc +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller_unittest.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.h" #include <memory> -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_controller.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_controller.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "components/autofill/content/browser/test_autofill_client_injector.h" #include "components/autofill/content/browser/test_autofill_manager_injector.h"
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_quality_metrics_unittest.cc b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_quality_metrics_unittest.cc similarity index 98% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_quality_metrics_unittest.cc rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_quality_metrics_unittest.cc index d649d09..eaf8e98 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_quality_metrics_unittest.cc +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_quality_metrics_unittest.cc
@@ -6,7 +6,7 @@ #include <vector> #include "base/test/metrics/histogram_tester.h" -#include "chrome/browser/touch_to_fill/autofill//android/touch_to_fill_delegate_android_impl.h" +#include "chrome/browser/touch_to_fill/payments//android/touch_to_fill_delegate_android_impl.h" #include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/metrics/autofill_metrics.h" #include "components/autofill/core/browser/metrics/autofill_metrics_test_base.h"
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view.h b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view.h similarity index 80% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view.h rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view.h index 9fd96d7..8c05f2e 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view.h +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_H_ #include "base/containers/span.h" @@ -26,4 +26,4 @@ } // namespace autofill -#endif // CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_H_
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_controller.h b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_controller.h similarity index 86% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_controller.h rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_controller.h index a0a5fc81..e3758d3 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_controller.h +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_controller.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_CONTROLLER_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_CONTROLLER_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_CONTROLLER_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_CONTROLLER_H_ #include <jni.h> @@ -32,4 +32,4 @@ } // namespace autofill -#endif // CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_CONTROLLER_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_CONTROLLER_H_
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_impl.cc b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_impl.cc similarity index 92% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_impl.cc rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_impl.cc index 63a24d9..d5aedca 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_impl.cc +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_impl.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_impl.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_impl.h" #include "chrome/browser/autofill/android/personal_data_manager_android.h" -#include "chrome/browser/touch_to_fill/autofill/android/internal/jni/TouchToFillCreditCardViewBridge_jni.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_controller.h" +#include "chrome/browser/touch_to_fill/payments/android/internal/jni/TouchToFillCreditCardViewBridge_jni.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_controller.h" #include "components/autofill/core/common/autofill_features.h" #include "content/public/browser/web_contents.h" #include "ui/android/view_android.h"
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_impl.h b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_impl.h similarity index 84% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_impl.h rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_impl.h index f414392..c07f87f 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_impl.h +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_impl.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_IMPL_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_IMPL_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_IMPL_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_IMPL_H_ -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view.h" #include "base/android/scoped_java_ref.h" #include "base/memory/raw_ptr.h" @@ -43,4 +43,4 @@ } // namespace autofill -#endif // CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_IMPL_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_CREDIT_CARD_VIEW_IMPL_H_
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.cc b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.cc similarity index 99% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.cc rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.cc index 2520347..076791a 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.cc +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.h" #include "base/feature_list.h" #include "base/metrics/histogram_functions.h"
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.h b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.h similarity index 96% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.h rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.h index 80b9da0..a28c39ce 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.h +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_DELEGATE_ANDROID_IMPL_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_DELEGATE_ANDROID_IMPL_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_DELEGATE_ANDROID_IMPL_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_DELEGATE_ANDROID_IMPL_H_ #include "base/memory/weak_ptr.h" #include "components/autofill/core/browser/autofill_manager.h" @@ -65,7 +65,7 @@ kMaxValue = kFormAlreadyFilled }; -inline constexpr const char kUmaTouchToFillCreditCardTriggerOutcome[] = +constexpr const char kUmaTouchToFillCreditCardTriggerOutcome[] = "Autofill.TouchToFill.CreditCard.TriggerOutcome"; class BrowserAutofillManager; @@ -192,4 +192,4 @@ } // namespace autofill -#endif // CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_DELEGATE_ANDROID_IMPL_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_PAYMENTS_ANDROID_TOUCH_TO_FILL_DELEGATE_ANDROID_IMPL_H_
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl_unittest.cc b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl_unittest.cc similarity index 99% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl_unittest.cc rename to chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl_unittest.cc index cae735c..043e018 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl_unittest.cc +++ b/chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl_unittest.cc
@@ -1,7 +1,7 @@ // Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.cc b/chrome/browser/touch_to_fill/touch_to_fill_controller.cc similarity index 95% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.cc rename to chrome/browser/touch_to_fill/touch_to_fill_controller.cc index f636516..5e6d4a9 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller.h" #include "base/check_op.h" #include "base/functional/bind.h" #include "base/ranges/algorithm.h" #include "chrome/browser/password_manager/android/password_manager_launcher_android.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_view.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_view.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_view_factory.h" #include "components/password_manager/content/browser/keyboard_replacing_surface_visibility_controller.h" #include "components/password_manager/core/browser/origin_credential_store.h" #include "components/password_manager/core/browser/passkey_credential.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h b/chrome/browser/touch_to_fill/touch_to_fill_controller.h similarity index 90% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h rename to chrome/browser/touch_to_fill/touch_to_fill_controller.h index 9def84c24..68f7206 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller.h
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_H_ #include <memory> #include "base/containers/span.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_view.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.h" +#include "chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_view.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_view_factory.h" #include "ui/gfx/native_widget_types.h" namespace password_manager { @@ -139,4 +139,4 @@ visibility_controller_; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.cc b/chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.cc similarity index 97% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.cc rename to chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.cc index 49e882ef..22453fc 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.h" #include "base/base64.h" #include "base/check.h" @@ -13,7 +13,7 @@ #include "chrome/browser/password_manager/android/local_passwords_migration_warning_util.h" #include "chrome/browser/password_manager/chrome_password_manager_client.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller.h" #include "components/device_reauth/device_authenticator.h" #include "components/password_manager/core/browser/origin_credential_store.h" #include "components/password_manager/core/browser/passkey_credential.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.h b/chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.h similarity index 94% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.h rename to chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.h index df0c405..b014692 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.h +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_AUTOFILL_DELEGATE_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_AUTOFILL_DELEGATE_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_AUTOFILL_DELEGATE_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_AUTOFILL_DELEGATE_H_ #include "base/containers/span.h" #include "base/functional/callback_forward.h" @@ -11,7 +11,7 @@ #include "base/memory/weak_ptr.h" #include "base/types/pass_key.h" #include "base/types/strong_alias.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.h" #include "components/device_reauth/device_authenticator.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "services/metrics/public/cpp/ukm_source_id.h" @@ -167,4 +167,4 @@ ukm::SourceId source_id_ = ukm::kInvalidSourceId; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_AUTOFILL_DELEGATE_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_AUTOFILL_DELEGATE_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate_unittest.cc b/chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate_unittest.cc similarity index 99% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate_unittest.cc rename to chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate_unittest.cc index 9fece31..fbe8a06 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate_unittest.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_autofill_delegate.h" #include <memory> @@ -21,7 +21,7 @@ #include "chrome/browser/password_manager/android/password_manager_launcher_android.h" #include "chrome/browser/password_manager/chrome_password_manager_client.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "components/device_reauth/mock_device_authenticator.h" #include "components/password_manager/content/browser/mock_keyboard_replacing_surface_visibility_controller.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.cc b/chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.cc similarity index 70% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.cc rename to chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.cc index 5c6f433..5fc590ee 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.cc
@@ -2,6 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.h" TouchToFillControllerDelegate::~TouchToFillControllerDelegate() = default;
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.h b/chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.h similarity index 90% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.h rename to chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.h index 1d20756b..575b0bb 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.h +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_DELEGATE_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_DELEGATE_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_DELEGATE_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_DELEGATE_H_ #include "base/containers/span.h" #include "base/functional/callback_forward.h" @@ -73,4 +73,4 @@ virtual gfx::NativeView GetNativeView() = 0; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_DELEGATE_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_DELEGATE_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.cc b/chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.cc similarity index 96% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.cc rename to chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.cc index 922423f..b6016bf 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.h" #include <vector>
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.h b/chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.h similarity index 86% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.h rename to chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.h index 7140f1b..974fa17 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.h +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.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 CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_WEBAUTHN_DELEGATE_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_WEBAUTHN_DELEGATE_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_WEBAUTHN_DELEGATE_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_WEBAUTHN_DELEGATE_H_ #include "base/containers/span.h" #include "base/functional/callback_forward.h" #include "base/memory/raw_ptr.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_delegate.h" #include "ui/gfx/native_widget_types.h" namespace password_manager { @@ -63,4 +63,4 @@ bool should_show_hybrid_option_; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_CONTROLLER_WEBAUTHN_DELEGATE_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_CONTROLLER_WEBAUTHN_DELEGATE_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate_unittest.cc b/chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate_unittest.cc similarity index 96% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate_unittest.cc rename to chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate_unittest.cc index 4299567b..9f500ad 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate_unittest.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate_unittest.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.h" #include <memory> #include <string> #include "base/types/pass_key.h" #include "chrome/browser/password_manager/android/password_manager_launcher_android.h" -#include "chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h" +#include "chrome/browser/touch_to_fill/no_passkeys/android/no_passkeys_bottom_sheet_bridge.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller.h" #include "chrome/browser/webauthn/android/webauthn_request_delegate_android.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "components/password_manager/content/browser/mock_keyboard_replacing_surface_visibility_controller.h"
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.cc b/chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.cc similarity index 97% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.cc rename to chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.cc index d73a2b4..e8bc1ffe 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.cc
@@ -1,7 +1,7 @@ // Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.h" #include "base/check_op.h" #include "components/autofill/content/browser/content_autofill_client.h"
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.h b/chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.h similarity index 95% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.h rename to chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.h index a957275..787b3cf8 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.h +++ b/chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.h
@@ -1,8 +1,8 @@ // Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_KEYBOARD_SUPPRESSOR_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_KEYBOARD_SUPPRESSOR_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_KEYBOARD_SUPPRESSOR_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_KEYBOARD_SUPPRESSOR_H_ #include "base/memory/weak_ptr.h" #include "base/scoped_multi_source_observation.h" @@ -139,4 +139,4 @@ } // namespace autofill -#endif // CHROME_BROWSER_TOUCH_TO_FILL_AUTOFILL_ANDROID_TOUCH_TO_FILL_KEYBOARD_SUPPRESSOR_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_KEYBOARD_SUPPRESSOR_H_
diff --git a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor_unittest.cc b/chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor_unittest.cc similarity index 98% rename from chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor_unittest.cc rename to chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor_unittest.cc index 0bdd6a9..7581be52 100644 --- a/chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor_unittest.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor_unittest.cc
@@ -1,7 +1,7 @@ // Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_keyboard_suppressor.h" #include "base/memory/raw_ptr.h" #include "base/test/task_environment.h"
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_view.h b/chrome/browser/touch_to_fill/touch_to_fill_view.h similarity index 90% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_view.h rename to chrome/browser/touch_to_fill/touch_to_fill_view.h index 1dec274d..d081a488 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_view.h +++ b/chrome/browser/touch_to_fill/touch_to_fill_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_VIEW_H_ -#define CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_VIEW_H_ +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_VIEW_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_VIEW_H_ #include "base/containers/span.h" #include "base/types/strong_alias.h" @@ -67,4 +67,4 @@ virtual void OnDismiss() = 0; }; -#endif // CHROME_BROWSER_TOUCH_TO_FILL_PASSWORD_MANAGER_TOUCH_TO_FILL_VIEW_H_ +#endif // CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_VIEW_H_
diff --git a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.cc b/chrome/browser/touch_to_fill/touch_to_fill_view_factory.cc similarity index 64% rename from chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.cc rename to chrome/browser/touch_to_fill/touch_to_fill_view_factory.cc index 83da802d0..f4f63fe 100644 --- a/chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_view_factory.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_view_factory.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_view_factory.h" -#include "chrome/browser/touch_to_fill/password_manager/android/touch_to_fill_view_impl.h" +#include "chrome/browser/touch_to_fill/android/touch_to_fill_view_impl.h" // static std::unique_ptr<TouchToFillView> TouchToFillViewFactory::Create(
diff --git a/chrome/browser/touch_to_fill/touch_to_fill_view_factory.h b/chrome/browser/touch_to_fill/touch_to_fill_view_factory.h new file mode 100644 index 0000000..504c422 --- /dev/null +++ b/chrome/browser/touch_to_fill/touch_to_fill_view_factory.h
@@ -0,0 +1,19 @@ +// Copyright 2019 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_VIEW_FACTORY_H_ +#define CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_VIEW_FACTORY_H_ + +#include <memory> + +class TouchToFillView; +class TouchToFillController; + +class TouchToFillViewFactory { + public: + static std::unique_ptr<TouchToFillView> Create( + TouchToFillController* controller); +}; + +#endif // CHROME_BROWSER_TOUCH_TO_FILL_TOUCH_TO_FILL_VIEW_FACTORY_H_
diff --git a/chrome/browser/tpcd/experiment/eligibility_service.cc b/chrome/browser/tpcd/experiment/eligibility_service.cc index 888b13b8a..a811864d 100644 --- a/chrome/browser/tpcd/experiment/eligibility_service.cc +++ b/chrome/browser/tpcd/experiment/eligibility_service.cc
@@ -57,8 +57,12 @@ features::kCookieDeprecationFacilitatedTesting)); CHECK(experiment_manager_); - if (onboarding_service_ && experiment_manager->DidVersionChange()) { - onboarding_service_->MaybeResetOnboardingPrefs(); + if (onboarding_service_) { + onboarding_observation_.Observe(onboarding_service_); + + if (experiment_manager_->DidVersionChange()) { + onboarding_service_->MaybeResetOnboardingPrefs(); + } } profile_eligibility_ = ProfileEligibility(); @@ -106,16 +110,7 @@ "ReasonForComputedEligibilityForProfile", profile_eligibility_->reason()); - // For each storage partition, update the cookie deprecation label to the - // updated value from the CookieDeprecationLabelManager. - profile_->ForEachLoadedStoragePartition( - base::BindRepeating([](content::StoragePartition* storage_partition) { - if (auto* cookie_deprecation_label_manager = - storage_partition->GetCookieDeprecationLabelManager()) { - storage_partition->GetNetworkContext()->SetCookieDeprecationLabel( - cookie_deprecation_label_manager->GetValue()); - } - })); + UpdateCookieDeprecationLabel(); // Update the eligibility for the onboarding UX flow. Check that the user is // in Mode B (kDisable3PCookies is true). @@ -138,4 +133,26 @@ ->GetCookieDeprecationExperimentCurrentEligibility(); } +void EligibilityService::UpdateCookieDeprecationLabel() { + // For each storage partition, update the cookie deprecation label to the + // updated value from the CookieDeprecationLabelManager. + profile_->ForEachLoadedStoragePartition( + base::BindRepeating([](content::StoragePartition* storage_partition) { + if (auto* cookie_deprecation_label_manager = + storage_partition->GetCookieDeprecationLabelManager()) { + storage_partition->GetNetworkContext()->SetCookieDeprecationLabel( + cookie_deprecation_label_manager->GetValue()); + } + })); +} + +void EligibilityService::OnTrackingProtectionOnboardingUpdated( + privacy_sandbox::TrackingProtectionOnboarding::OnboardingStatus + onboarding_status) { + if (!kDisable3PCookies.Get()) { + return; + } + UpdateCookieDeprecationLabel(); +} + } // namespace tpcd::experiment
diff --git a/chrome/browser/tpcd/experiment/eligibility_service.h b/chrome/browser/tpcd/experiment/eligibility_service.h index 500a6c81..589f1e7 100644 --- a/chrome/browser/tpcd/experiment/eligibility_service.h +++ b/chrome/browser/tpcd/experiment/eligibility_service.h
@@ -6,10 +6,12 @@ #define CHROME_BROWSER_TPCD_EXPERIMENT_ELIGIBILITY_SERVICE_H_ #include "base/memory/weak_ptr.h" +#include "base/scoped_observation.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tpcd/experiment/eligibility_service_factory.h" #include "components/keyed_service/core/keyed_service.h" #include "components/privacy_sandbox/tpcd_experiment_eligibility.h" +#include "components/privacy_sandbox/tracking_protection_onboarding.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace privacy_sandbox { @@ -31,7 +33,9 @@ const char ProfileEligibilityMismatchHistogramName[] = "Privacy.3pcd.ProfileEligibilityMismatch"; -class EligibilityService : public KeyedService { +class EligibilityService + : public privacy_sandbox::TrackingProtectionOnboarding::Observer, + public KeyedService { public: EligibilityService(Profile* profile, ExperimentManager* experiment_manager); EligibilityService(const EligibilityService&) = delete; @@ -53,6 +57,12 @@ void MarkProfileEligibility(bool is_client_eligible); void BroadcastProfileEligibility(); privacy_sandbox::TpcdExperimentEligibility ProfileEligibility(); + void UpdateCookieDeprecationLabel(); + + // privacy_sandbox::TrackingProtectionOnboarding::Observer: + void OnTrackingProtectionOnboardingUpdated( + privacy_sandbox::TrackingProtectionOnboarding::OnboardingStatus + onboarding_status) override; raw_ptr<Profile> profile_; // onboarding_service_ may be null for OTR and system profiles. @@ -66,6 +76,11 @@ absl::optional<privacy_sandbox::TpcdExperimentEligibility> profile_eligibility_; + base::ScopedObservation< + privacy_sandbox::TrackingProtectionOnboarding, + privacy_sandbox::TrackingProtectionOnboarding::Observer> + onboarding_observation_{this}; + base::WeakPtrFactory<EligibilityService> weak_factory_{this}; };
diff --git a/chrome/browser/tpcd/experiment/eligibility_service_browsertest.cc b/chrome/browser/tpcd/experiment/eligibility_service_browsertest.cc index 8d3c792c..090a77ef 100644 --- a/chrome/browser/tpcd/experiment/eligibility_service_browsertest.cc +++ b/chrome/browser/tpcd/experiment/eligibility_service_browsertest.cc
@@ -114,8 +114,7 @@ PrivacySandboxSettingsFactory::GetForProfile(browser()->profile()); auto privacy_sandbox_delegate = std::make_unique< privacy_sandbox_test_util::MockPrivacySandboxSettingsDelegate>(); - EXPECT_CALL(*privacy_sandbox_delegate, IsCookieDeprecationExperimentEligible) - .Times(4) + EXPECT_CALL(*privacy_sandbox_delegate, IsCookieDeprecationLabelAllowed) .WillOnce(testing::Return(false)) .WillOnce(testing::Return(false)) .WillOnce(testing::Return(true)) @@ -125,7 +124,8 @@ ASSERT_FALSE(privacy_sandbox_settings->IsCookieDeprecationLabelAllowed()); - MarkProfileEligibility(/*is_eligible=*/false); + // `is_eligible` only affects onboarding and is irrelevant to this test. + MarkProfileEligibility(/*is_eligible=*/true); // Ensures the cookie deprecation label is updated in the network context. FlushNetworkInterface(); @@ -202,6 +202,95 @@ OnboardingStatus::kIneligible); } +IN_PROC_BROWSER_TEST_P(EligibilityServiceBrowserTest, + OnboardingChanged_NetworkContextUpdated) { + // Onboarding change should only update network context when 3PC is disabled. + const bool disable_3p_cookies = GetParam(); + + auto response_b_a = + std::make_unique<net::test_server::ControllableHttpResponse>( + &https_server_, "/b_a"); + auto response_b_b = + std::make_unique<net::test_server::ControllableHttpResponse>( + &https_server_, "/b_b"); + auto response_b_c = + std::make_unique<net::test_server::ControllableHttpResponse>( + &https_server_, "/b_c"); + ASSERT_TRUE(https_server_.Start()); + + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), https_server_.GetURL("a.test", "/title1.html"))); + + auto* privacy_sandbox_settings = + PrivacySandboxSettingsFactory::GetForProfile(browser()->profile()); + auto privacy_sandbox_delegate = std::make_unique< + privacy_sandbox_test_util::MockPrivacySandboxSettingsDelegate>(); + if (disable_3p_cookies) { + EXPECT_CALL(*privacy_sandbox_delegate, IsCookieDeprecationLabelAllowed) + .WillOnce(testing::Return(false)) + .WillOnce(testing::Return(true)); + } else { + EXPECT_CALL(*privacy_sandbox_delegate, IsCookieDeprecationLabelAllowed) + .Times(0); + } + privacy_sandbox_settings->SetDelegateForTesting( + std::move(privacy_sandbox_delegate)); + + auto* onboarding_service = + TrackingProtectionOnboardingFactory::GetForProfile(browser()->profile()); + onboarding_service->MaybeMarkIneligible(); + + // Ensures the cookie deprecation label is updated in the network context. + FlushNetworkInterface(); + + AddImageToDocument(https_server_.GetURL("b.test", "/b_a")); + + // [b.test/a] - Non opted-in request should not receive a label header. + response_b_a->WaitForRequest(); + ASSERT_FALSE(base::Contains(response_b_a->http_request()->headers, + "Sec-Cookie-Deprecation")); + auto http_response_b_a = + std::make_unique<net::test_server::BasicHttpResponse>(); + http_response_b_a->set_code(net::HTTP_MOVED_PERMANENTLY); + http_response_b_a->AddCustomHeader( + "Location", https_server_.GetURL("b.test", "/b_b").spec()); + // b.test opts in to receiving the label. + http_response_b_a->AddCustomHeader( + "Set-Cookie", + "receive-cookie-deprecation=any-value; Secure; HttpOnly; " + "Path=/; SameSite=None; Partitioned"); + response_b_a->Send(http_response_b_a->ToResponseString()); + response_b_a->Done(); + + // [b.test/b] - Opted-in request should receive a label header if + // allowed. + response_b_b->WaitForRequest(); + if (disable_3p_cookies) { + ASSERT_FALSE(base::Contains(response_b_b->http_request()->headers, + "Sec-Cookie-Deprecation")); + } else { + ASSERT_TRUE(base::Contains(response_b_b->http_request()->headers, + "Sec-Cookie-Deprecation")); + EXPECT_EQ( + response_b_b->http_request()->headers.at("Sec-Cookie-Deprecation"), + "label_test"); + } + + onboarding_service->MaybeMarkEligible(); + + // Ensures the cookie deprecation label is updated in the network context. + FlushNetworkInterface(); + + AddImageToDocument(https_server_.GetURL("b.test", "/b_c")); + + // [b.test/c] - Opted-in request should receive a label header if allowed. + response_b_c->WaitForRequest(); + ASSERT_TRUE(base::Contains(response_b_c->http_request()->headers, + "Sec-Cookie-Deprecation")); + EXPECT_EQ(response_b_c->http_request()->headers.at("Sec-Cookie-Deprecation"), + "label_test"); +} + INSTANTIATE_TEST_SUITE_P(All, EligibilityServiceBrowserTest, testing::Bool()); } // namespace tpcd::experiment
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index b76a3e8..5b388222 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -965,7 +965,7 @@ "//chrome/browser/image_decoder", "//chrome/browser/notifications/scheduler/public", "//chrome/browser/password_manager/android:backend", - "//chrome/browser/touch_to_fill/autofill/android", + "//chrome/browser/touch_to_fill/payments/android", "//chrome/browser/ui/android/autofill/internal:jni_headers", "//chrome/browser/ui/android/toolbar:jni_headers", "//chrome/browser/ui/webui/feed_internals:mojo_bindings",
diff --git a/chrome/browser/ui/android/omnibox/BUILD.gn b/chrome/browser/ui/android/omnibox/BUILD.gn index 4b1bb52..ed01dbf1 100644 --- a/chrome/browser/ui/android/omnibox/BUILD.gn +++ b/chrome/browser/ui/android/omnibox/BUILD.gn
@@ -353,6 +353,7 @@ "java/res/layout/omnibox_results_container.xml", "java/res/layout/suggestions_tile_view.xml", "java/res/layout/url_action_container.xml", + "java/res/values-night/colors.xml", "java/res/values-night/dimens.xml", "java/res/values-night/drawables.xml", "java/res/values-sw600dp/dimens.xml",
diff --git a/chrome/browser/ui/android/omnibox/java/res/values-night/colors.xml b/chrome/browser/ui/android/omnibox/java/res/values-night/colors.xml new file mode 100644 index 0000000..0a014a2 --- /dev/null +++ b/chrome/browser/ui/android/omnibox/java/res/values-night/colors.xml
@@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright 2023 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<resources xmlns:tools="http://schemas.android.com/tools"> + <color name="omnibox_dropdown_bg_incognito">@color/default_bg_color_dark_elev_3_baseline</color> +</resources> +
diff --git a/chrome/browser/ui/android/omnibox/java/res/values-night/dimens.xml b/chrome/browser/ui/android/omnibox/java/res/values-night/dimens.xml index 05b3da0..782551a 100644 --- a/chrome/browser/ui/android/omnibox/java/res/values-night/dimens.xml +++ b/chrome/browser/ui/android/omnibox/java/res/values-night/dimens.xml
@@ -9,5 +9,5 @@ <!-- Omnibox suggestions --> <dimen name="omnibox_suggestion_bg_elevation">@dimen/default_elevation_0</dimen> <dimen name="omnibox_suggestion_bg_elevation_modern">@dimen/default_elevation_1</dimen> - <dimen name="omnibox_suggestion_dropdown_bg_elevation">@dimen/default_elevation_0</dimen> + <dimen name="omnibox_suggestion_dropdown_bg_elevation">@dimen/default_elevation_3</dimen> </resources>
diff --git a/chrome/browser/ui/android/page_insights/java/src/org/chromium/chrome/browser/page_insights/PageInsightsMediator.java b/chrome/browser/ui/android/page_insights/java/src/org/chromium/chrome/browser/page_insights/PageInsightsMediator.java index ae49e65..92d4c42 100644 --- a/chrome/browser/ui/android/page_insights/java/src/org/chromium/chrome/browser/page_insights/PageInsightsMediator.java +++ b/chrome/browser/ui/android/page_insights/java/src/org/chromium/chrome/browser/page_insights/PageInsightsMediator.java
@@ -565,7 +565,7 @@ public void onSheetOffsetChanged(float heightFraction, float offsetPx) { float peekHeightRatio = getPeekHeightRatio(); if (mSheetController.getSheetState() == SheetState.SCROLLING - && heightFraction + 0.01f < peekHeightRatio) { + && heightFraction < peekHeightRatio) { // Set the content height to zero in advance when user drags/scrolls the sheet down // below the peeking state. This helps hide the white patch (blank bottom controls). setBottomControlsHeight(0); @@ -581,7 +581,7 @@ } private float getPeekHeightRatio() { - float fullHeight = mSheetContent.getActualFullHeightRatio() * mSheetContainer.getHeight(); + float fullHeight = mSheetContent.getContentView().getMeasuredHeight(); return mSheetContent.getPeekHeight() / fullHeight; }
diff --git a/chrome/browser/ui/android/page_insights/java/src/org/chromium/chrome/browser/page_insights/PageInsightsSheetContent.java b/chrome/browser/ui/android/page_insights/java/src/org/chromium/chrome/browser/page_insights/PageInsightsSheetContent.java index 91ade06..049aa0e 100644 --- a/chrome/browser/ui/android/page_insights/java/src/org/chromium/chrome/browser/page_insights/PageInsightsSheetContent.java +++ b/chrome/browser/ui/android/page_insights/java/src/org/chromium/chrome/browser/page_insights/PageInsightsSheetContent.java
@@ -278,14 +278,6 @@ mOnBackPressHandler.handle(); } - /** - * Returns the actual height of the fully expanded bottom sheet, as a ratio of the screen - * height. - */ - public float getActualFullHeightRatio() { - return mFullHeightRatio; - } - void showLoadingIndicator() { setVisibilityById(mSheetContentView, R.id.page_insights_loading_indicator, View.VISIBLE); setVisibilityById(mToolbarView, R.id.page_insights_feed_header, View.VISIBLE);
diff --git a/chrome/browser/ui/ash/cast_config_controller_media_router.cc b/chrome/browser/ui/ash/cast_config_controller_media_router.cc index e26d622..15ef6bbb 100644 --- a/chrome/browser/ui/ash/cast_config_controller_media_router.cc +++ b/chrome/browser/ui/ash/cast_config_controller_media_router.cc
@@ -17,6 +17,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h" #include "chrome/browser/media/router/media_router_feature.h" #include "chrome/browser/profiles/profile.h" @@ -29,6 +30,8 @@ #include "components/media_router/common/media_sink.h" #include "components/media_router/common/media_source.h" #include "components/user_manager/user_manager.h" +#include "third_party/icu/source/common/unicode/uversion.h" +#include "third_party/icu/source/i18n/unicode/coll.h" namespace { @@ -95,9 +98,13 @@ // media_router::MediaRoutesObserver: void OnRoutesUpdated(const MediaRoutes& routes) override; + // Sorts `sinks_` alphabetically. + void SortSinks(); + MediaSinks sinks_; MediaRoutes routes_; + std::unique_ptr<icu::Collator> collator_; base::RepeatingClosure update_devices_callback_; }; @@ -126,7 +133,7 @@ sinks_.push_back(sink); } - + SortSinks(); update_devices_callback_.Run(); } @@ -135,6 +142,28 @@ update_devices_callback_.Run(); } +void CastDeviceCache::SortSinks() { + if (sinks_.size() <= 1) { + return; + } + if (!collator_) { + UErrorCode error = U_ZERO_ERROR; + const std::string& locale = g_browser_process->GetApplicationLocale(); + collator_.reset( + icu::Collator::createInstance(icu::Locale(locale.c_str()), error)); + if (U_FAILURE(error)) { + collator_.reset(); + return; + } + } + const icu::Collator* collator_ptr = collator_.get(); + std::sort(sinks_.begin(), sinks_.end(), + [collator_ptr](const media_router::MediaSink& sink1, + const media_router::MediaSink& sink2) { + return sink1.CompareUsingCollator(sink2, collator_ptr); + }); +} + //////////////////////////////////////////////////////////////////////////////// // CastConfigControllerMediaRouter: @@ -312,7 +341,6 @@ AddFakeCastDevices(); } #endif - for (const media_router::MediaSink& sink : device_cache()->sinks()) { ash::SinkAndRoute device; device.sink.id = sink.id();
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc index 4b40ae0..ae055124 100644 --- a/chrome/browser/ui/autofill/chrome_autofill_client.cc +++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -120,7 +120,7 @@ #include "chrome/browser/android/signin/signin_bridge.h" #include "chrome/browser/android/tab_android.h" #include "chrome/browser/flags/android/chrome_feature_list.h" -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_view_impl.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_view_impl.h" #include "chrome/browser/ui/android/autofill/autofill_accessibility_utils.h" #include "chrome/browser/ui/android/autofill/autofill_cvc_save_message_delegate.h" #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" @@ -693,28 +693,6 @@ delete_local_card_callback); } -void ChromeAutofillClient::ConfirmSaveIbanLocally( - const Iban& iban, - bool should_show_prompt, - SaveIbanPromptCallback callback) { - // Do lazy initialization of IbanBubbleControllerImpl. - IbanBubbleControllerImpl::CreateForWebContents(web_contents()); - IbanBubbleControllerImpl::FromWebContents(web_contents()) - ->OfferLocalSave(iban, should_show_prompt, std::move(callback)); -} - -void ChromeAutofillClient::ConfirmUploadIbanToCloud( - const Iban& iban, - const LegalMessageLines& legal_message_lines, - bool should_show_prompt, - SaveIbanPromptCallback callback) { - // Do lazy initialization of IbanBubbleControllerImpl. - IbanBubbleControllerImpl::CreateForWebContents(web_contents()); - IbanBubbleControllerImpl::FromWebContents(web_contents()) - ->OfferUploadSave(iban, legal_message_lines, should_show_prompt, - std::move(callback)); -} - void ChromeAutofillClient::ShowWebauthnOfferDialog( WebauthnDialogCallback offer_dialog_callback) { WebauthnDialogControllerImpl::GetOrCreateForPage( @@ -876,6 +854,32 @@ #endif } +void ChromeAutofillClient::ConfirmSaveIbanLocally( + const Iban& iban, + bool should_show_prompt, + SaveIbanPromptCallback callback) { +#if !BUILDFLAG(IS_ANDROID) + // Do lazy initialization of IbanBubbleControllerImpl. + IbanBubbleControllerImpl::CreateForWebContents(web_contents()); + IbanBubbleControllerImpl::FromWebContents(web_contents()) + ->OfferLocalSave(iban, should_show_prompt, std::move(callback)); +#endif +} + +void ChromeAutofillClient::ConfirmUploadIbanToCloud( + const Iban& iban, + const LegalMessageLines& legal_message_lines, + bool should_show_prompt, + SaveIbanPromptCallback callback) { +#if !BUILDFLAG(IS_ANDROID) + // Do lazy initialization of IbanBubbleControllerImpl. + IbanBubbleControllerImpl::CreateForWebContents(web_contents()); + IbanBubbleControllerImpl::FromWebContents(web_contents()) + ->OfferUploadSave(iban, legal_message_lines, should_show_prompt, + std::move(callback)); +#endif +} + void ChromeAutofillClient::CreditCardUploadCompleted(bool card_saved) {} void ChromeAutofillClient::ConfirmCreditCardFillAssist(
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.h b/chrome/browser/ui/autofill/chrome_autofill_client.h index 42ade812..3264516 100644 --- a/chrome/browser/ui/autofill/chrome_autofill_client.h +++ b/chrome/browser/ui/autofill/chrome_autofill_client.h
@@ -32,7 +32,7 @@ #include "content/public/browser/web_contents_observer.h" #if BUILDFLAG(IS_ANDROID) -#include "chrome/browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller.h" +#include "chrome/browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller.h" #include "chrome/browser/ui/android/autofill/save_update_address_profile_flow_manager.h" #include "components/autofill/core/browser/ui/fast_checkout_client.h" #include "components/autofill/core/browser/ui/payments/card_expiration_date_fix_flow_controller_impl.h" @@ -186,13 +186,6 @@ const std::u16string& tip_message, const std::vector<MigratableCreditCard>& migratable_credit_cards, MigrationDeleteCardCallback delete_local_card_callback) override; - void ConfirmSaveIbanLocally(const Iban& iban, - bool should_show_prompt, - SaveIbanPromptCallback callback) override; - void ConfirmUploadIbanToCloud(const Iban& iban, - const LegalMessageLines& legal_message_lines, - bool should_show_prompt, - SaveIbanPromptCallback callback) override; void ShowWebauthnOfferDialog( WebauthnDialogCallback offer_dialog_callback) override; void ShowWebauthnVerifyPendingDialog( @@ -219,6 +212,13 @@ const LegalMessageLines& legal_message_lines, SaveCreditCardOptions options, UploadSaveCardPromptCallback callback) override; + void ConfirmSaveIbanLocally(const Iban& iban, + bool should_show_prompt, + SaveIbanPromptCallback callback) override; + void ConfirmUploadIbanToCloud(const Iban& iban, + const LegalMessageLines& legal_message_lines, + bool should_show_prompt, + SaveIbanPromptCallback callback) override; void CreditCardUploadCompleted(bool card_saved) override; void ConfirmCreditCardFillAssist(const CreditCard& card, base::OnceClosure callback) override;
diff --git a/chrome/browser/ui/cocoa/accelerators_cocoa.mm b/chrome/browser/ui/cocoa/accelerators_cocoa.mm index a02d8ae..243f90e6 100644 --- a/chrome/browser/ui/cocoa/accelerators_cocoa.mm +++ b/chrome/browser/ui/cocoa/accelerators_cocoa.mm
@@ -69,7 +69,7 @@ // The key combinations for IDC_CLOSE_WINDOW and IDC_CLOSE_TAB are context // dependent. A static mapping doesn't make sense. :( {IDC_CLOSE_TAB, ui::EF_COMMAND_DOWN, ui::VKEY_W}, - {IDC_CLOSE_WINDOW, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN, ui::VKEY_W}, + {IDC_CLOSE_WINDOW, ui::EF_COMMAND_DOWN, ui::VKEY_W}, {IDC_EMAIL_PAGE_LOCATION, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN, ui::VKEY_I},
diff --git a/chrome/browser/ui/commerce/price_tracking/shopping_list_ui_tab_helper.cc b/chrome/browser/ui/commerce/price_tracking/shopping_list_ui_tab_helper.cc index 047d4e9..549188ec 100644 --- a/chrome/browser/ui/commerce/price_tracking/shopping_list_ui_tab_helper.cc +++ b/chrome/browser/ui/commerce/price_tracking/shopping_list_ui_tab_helper.cc
@@ -804,7 +804,7 @@ // interaction was to track a product, otherwise we would have been blocked // above. if (from_icon_use) { - if (price_tracking_expanded) { + if (!price_tracking_expanded) { base::UmaHistogramEnumeration(histogram_name, PageActionIconInteractionState::kClicked); } else { @@ -813,7 +813,7 @@ } } else { - if (price_tracking_expanded) { + if (!price_tracking_expanded) { base::UmaHistogramEnumeration( histogram_name, PageActionIconInteractionState::kNotClicked); } else {
diff --git a/chrome/browser/ui/tabs/organization/tab_organization_session.cc b/chrome/browser/ui/tabs/organization/tab_organization_session.cc index 4b1b440..fa426855 100644 --- a/chrome/browser/ui/tabs/organization/tab_organization_session.cc +++ b/chrome/browser/ui/tabs/organization/tab_organization_session.cc
@@ -181,7 +181,7 @@ std::unique_ptr<TabOrganization> organization = std::make_unique<TabOrganization>(std::move(tab_datas_for_org), - std::move(names), 0, absl::nullopt); + std::move(names), 0u, absl::nullopt); tab_organizations_.emplace_back(std::move(organization)); }
diff --git a/chrome/browser/ui/views/autofill/popup/popup_cell_view.h b/chrome/browser/ui/views/autofill/popup/popup_cell_view.h index 12aa95e..e834abe 100644 --- a/chrome/browser/ui/views/autofill/popup/popup_cell_view.h +++ b/chrome/browser/ui/views/autofill/popup/popup_cell_view.h
@@ -15,7 +15,6 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/accessibility/ax_action_data.h" #include "ui/base/metadata/metadata_header_macros.h" -#include "ui/events/event.h" #include "ui/views/controls/label.h" #include "ui/views/metadata/view_factory.h" #include "ui/views/view.h" @@ -56,10 +55,6 @@ bool selected_ = false; private: - // Computes the actual `TimeTicks` at which the event occurred (taking latency - // into account) and runs the OnAccepted callback. - void RunOnAcceptedForEvent(const ui::Event& event); - // The labels whose style is updated when the cell's selection status changes. std::vector<raw_ptr<views::Label>> tracked_labels_;
diff --git a/chrome/browser/ui/webui/BUILD.gn b/chrome/browser/ui/webui/BUILD.gn index 61350ca2..75e5ebf 100644 --- a/chrome/browser/ui/webui/BUILD.gn +++ b/chrome/browser/ui/webui/BUILD.gn
@@ -18,6 +18,7 @@ "//chrome/browser/ui:ui", "//components/lens:buildflags", "//content/public/browser", + "//extensions/buildflags:buildflags", "//printing/buildflags", "//skia", "//third_party/abseil-cpp:absl",
diff --git a/chrome/browser/ui/webui/ash/chrome_web_ui_configs_chromeos.cc b/chrome/browser/ui/webui/ash/chrome_web_ui_configs_chromeos.cc index cde31aa7..b29dc86 100644 --- a/chrome/browser/ui/webui/ash/chrome_web_ui_configs_chromeos.cc +++ b/chrome/browser/ui/webui/ash/chrome_web_ui_configs_chromeos.cc
@@ -105,7 +105,6 @@ #include "chrome/browser/ui/webui/ash/web_app_install/web_app_install_ui.h" #include "chrome/browser/ui/webui/nearby_internals/nearby_internals_ui.h" #include "chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.h" -#include "chromeos/constants/chromeos_features.h" #if !defined(OFFICIAL_BUILD) #include "ash/webui/sample_system_web_app_ui/sample_system_web_app_ui.h" #if !defined(USE_REAL_DBUS_CLIENTS) @@ -321,11 +320,8 @@ std::make_unique<UrgentPasswordExpiryNotificationUIConfig>()); map.AddWebUIConfig(std::make_unique<VcTrayTesterUIConfig>()); map.AddWebUIConfig(std::make_unique<VmUIConfig>()); - if (base::FeatureList::IsEnabled( - chromeos::features::kCrosWebAppInstallDialog)) { - map.AddWebUIConfig( - std::make_unique<web_app_install::WebAppInstallDialogUIConfig>()); - } + map.AddWebUIConfig( + std::make_unique<web_app_install::WebAppInstallDialogUIConfig>()); #if !defined(OFFICIAL_BUILD) map.AddWebUIConfig(std::make_unique<SampleSystemWebAppUIConfig>()); map.AddWebUIConfig(std::make_unique<StatusAreaInternalsUIConfig>());
diff --git a/chrome/browser/ui/webui/ash/emoji/emoji_page_handler.cc b/chrome/browser/ui/webui/ash/emoji/emoji_page_handler.cc index 4d13488b..1ccdaf734 100644 --- a/chrome/browser/ui/webui/ash/emoji/emoji_page_handler.cc +++ b/chrome/browser/ui/webui/ash/emoji/emoji_page_handler.cc
@@ -34,7 +34,9 @@ // smaller entries only used by Chrome OS VK kEmojiPickerBase = 4, kEmojiPickerVariant = 5, - kMaxValue = kEmojiPickerVariant, + kEmojiPickerGifInserted = 6, + kEmojiPickerGifCopied = 7, + kMaxValue = kEmojiPickerGifCopied, }; void LogInsertEmoji(bool is_variant, int16_t search_length) { @@ -47,6 +49,14 @@ search_length); } +void LogInsertGif(bool is_inserted) { + EmojiVariantType insert_value = is_inserted + ? EmojiVariantType::kEmojiPickerGifInserted + : EmojiVariantType::kEmojiPickerGifCopied; + base::UmaHistogramEnumeration("InputMethod.SystemEmojiPicker.TriggerType", + insert_value); +} + void LogInsertEmojiDelay(base::TimeDelta delay) { base::UmaHistogramMediumTimes("InputMethod.SystemEmojiPicker.Delay", delay); } @@ -204,10 +214,14 @@ if (input_client->CanInsertImage()) { input_client->InsertImage(gif_to_insert_); MarkInserted(); + LogInsertGif(/*is_inserted=*/true); } } - void PerformCopy() override { CopyGifToClipboard(gif_to_insert_); } + void PerformCopy() override { + CopyGifToClipboard(gif_to_insert_); + LogInsertGif(/*is_inserted=*/false); + } private: GURL gif_to_insert_; @@ -347,11 +361,13 @@ if (!input_method) { DLOG(WARNING) << "no input_method found"; CopyGifToClipboard(gif); + LogInsertGif(/*is_inserted=*/false); return; } if (no_text_field_) { CopyGifToClipboard(gif); + LogInsertGif(/*is_inserted=*/false); return; }
diff --git a/chrome/browser/ui/webui/chrome_web_ui_configs.cc b/chrome/browser/ui/webui/chrome_web_ui_configs.cc index 906faef4..7a4366d 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_configs.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_configs.cc
@@ -7,6 +7,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "content/public/browser/webui_config_map.h" +#include "extensions/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h" #if !BUILDFLAG(IS_ANDROID) @@ -14,6 +15,10 @@ #include "chrome/browser/ui/webui/downloads/downloads_ui.h" #endif // !BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "chrome/browser/ui/webui/extensions/extensions_ui.h" +#endif // !BUILDFLAG(ENABLE_EXTENSIONS) + #if BUILDFLAG(ENABLE_PRINT_PREVIEW) #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) @@ -38,6 +43,10 @@ map.AddWebUIConfig(std::make_unique<DownloadsUIConfig>()); #endif // !BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(ENABLE_EXTENSIONS) + map.AddWebUIConfig(std::make_unique<extensions::ExtensionsUIConfig>()); +#endif // !BUILDFLAG(ENABLE_EXTENSIONS) + #if BUILDFLAG(ENABLE_PRINT_PREVIEW) map.AddWebUIConfig(std::make_unique<printing::PrintPreviewUIConfig>()); #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index c45bbb17..d64af41 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -542,7 +542,6 @@ if (profile->IsGuestSession() && (url.host_piece() == chrome::kChromeUIAppLauncherPageHost || url.host_piece() == chrome::kChromeUIHistoryHost || - url.host_piece() == chrome::kChromeUIExtensionsHost || url.host_piece() == chrome::kChromeUINewTabPageHost || url.host_piece() == chrome::kChromeUINewTabPageThirdPartyHost || url.host_piece() == password_manager::kChromeUIPasswordManagerHost)) { @@ -620,8 +619,6 @@ return &NewWebUI<settings::SettingsUI>; if (url.host_piece() == chrome::kChromeUITabSearchHost) return &NewWebUI<TabSearchUI>; - if (url.host_piece() == chrome::kChromeUIExtensionsHost) - return &NewWebUI<extensions::ExtensionsUI>; if (url.host_piece() == chrome::kChromeUIHistoryHost) return &NewWebUI<HistoryUI>; if (url.host_piece() == chrome::kChromeUIProfileInternalsHost)
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc index ac0c7fa2..a8ac9fd 100644 --- a/chrome/browser/ui/webui/extensions/extensions_ui.cc +++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -23,6 +23,7 @@ #include "chrome/browser/ui/webui/favicon_source.h" #include "chrome/browser/ui/webui/managed_ui_handler.h" #include "chrome/browser/ui/webui/metrics_handler.h" +#include "chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.h" #include "chrome/browser/ui/webui/plural_string_handler.h" #include "chrome/browser/ui/webui/webui_util.h" #include "chrome/common/chrome_features.h" @@ -446,6 +447,22 @@ } // namespace +ExtensionsUIConfig::ExtensionsUIConfig() + : WebUIConfig(content::kChromeUIScheme, chrome::kChromeUIExtensionsHost) {} + +ExtensionsUIConfig::~ExtensionsUIConfig() = default; + +std::unique_ptr<content::WebUIController> +ExtensionsUIConfig::CreateWebUIController(content::WebUI* web_ui, + const GURL& url) { + Profile* profile = Profile::FromWebUI(web_ui); + if (profile->IsGuestSession()) { + return std::make_unique<PageNotAvailableForGuestUI>( + web_ui, chrome::kChromeUIExtensionsHost); + } + return std::make_unique<ExtensionsUI>(web_ui); +} + ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui), webui_load_timer_(web_ui->GetWebContents(),
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.h b/chrome/browser/ui/webui/extensions/extensions_ui.h index 1e3eae5c..aafaf75 100644 --- a/chrome/browser/ui/webui/extensions/extensions_ui.h +++ b/chrome/browser/ui/webui/extensions/extensions_ui.h
@@ -8,6 +8,7 @@ #include "chrome/browser/ui/webui/webui_load_timer.h" #include "components/prefs/pref_member.h" #include "content/public/browser/web_ui_controller.h" +#include "content/public/browser/webui_config.h" #include "ui/base/resource/resource_scale_factor.h" namespace base { @@ -20,6 +21,17 @@ namespace extensions { +class ExtensionsUIConfig : public content::WebUIConfig { + public: + ExtensionsUIConfig(); + ~ExtensionsUIConfig() override; + + // content::WebUIConfig: + std::unique_ptr<content::WebUIController> CreateWebUIController( + content::WebUI* web_ui, + const GURL& url) override; +}; + class ExtensionsUI : public content::WebUIController { public: explicit ExtensionsUI(content::WebUI* web_ui);
diff --git a/chrome/browser/ui/webui/settings/hats_handler_unittest.cc b/chrome/browser/ui/webui/settings/hats_handler_unittest.cc index 345c70f0..56524e1 100644 --- a/chrome/browser/ui/webui/settings/hats_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/hats_handler_unittest.cc
@@ -9,6 +9,7 @@ #include "base/memory/raw_ptr.h" #include "base/values.h" +#include "build/branding_buildflags.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" #include "chrome/browser/ui/hats/hats_service.h" #include "chrome/browser/ui/hats/hats_service_factory.h" @@ -137,10 +138,14 @@ TEST_F(HatsHandlerTest, SecurityPageInteractions) { SurveyStringData expected_product_specific_data = { - {"Security Page User Action", "enhanced_protection_radio_button_clicked"}, - {"Safe Browsing Setting Before Trigger", "standard_protection"}, - {"Safe Browsing Setting After Trigger", "standard_protection"}, - {"Client Channel", "unknown"}, + {"Security Page User Action", "enhanced_protection_radio_button_clicked"}, + {"Safe Browsing Setting Before Trigger", "standard_protection"}, + {"Safe Browsing Setting After Trigger", "standard_protection"}, +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) + {"Client Channel", "stable"}, +#else + {"Client Channel", "unknown"}, +#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) }; // Check that triggering the security page handler function will trigger HaTS
diff --git a/chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_ui.cc b/chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_ui.cc index 09fd529..a7393ae 100644 --- a/chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_ui.cc +++ b/chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_ui.cc
@@ -132,6 +132,7 @@ {"genericErrorTitle", IDS_NTP_WALLPAPER_SEARCH_GENERIC_ERROR_TITLE}, {"offlineDescription", IDS_NTP_WALLPAPER_SEARCH_OFFLINE_DESCRIPTION}, {"offlineTitle", IDS_NTP_WALLPAPER_SEARCH_OFFLINE_TITLE}, + {"optionalDetailsLabel", IDS_NTP_WALLPAPER_SEARCH_OPTIONAL_DETAILS_LABEL}, {"requestThrottledDescription", IDS_NTP_WALLPAPER_SEARCH_REQUEST_THROTTLED_DESCRIPTION}, {"requestThrottledTitle",
diff --git a/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller.cc b/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller.cc index 22f15d96..1327bc4 100644 --- a/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller.cc +++ b/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller.cc
@@ -70,11 +70,35 @@ provider_->on_registry_ready().Post( FROM_HERE, base::BindOnce( - &LacrosBrowserShortcutsController::InitializeOnRegistryReady, + &LacrosBrowserShortcutsController::RegisterControllerOnRegistryReady, weak_ptr_factory_.GetWeakPtr())); } -void LacrosBrowserShortcutsController::InitializeOnRegistryReady() { +void LacrosBrowserShortcutsController::RegisterControllerOnRegistryReady() { + auto* service = chromeos::LacrosService::Get(); + if (service->GetInterfaceVersion<crosapi::mojom::AppShortcutPublisher>() < + int{crosapi::mojom::AppShortcutPublisher::MethodMinVersions:: + kRegisterAppShortcutControllerMinVersion} && + !chromeos::BrowserParamsProxy::Get()->IsCrosapiDisabledForTesting()) { + LOG(WARNING) + << "Ash AppShortcutPublisher version " + << service->GetInterfaceVersion<crosapi::mojom::AppShortcutPublisher>() + << " does not support RegisterAppShortcutController()."; + return; + } + service->GetRemote<crosapi::mojom::AppShortcutPublisher>() + ->RegisterAppShortcutController( + receiver_.BindNewPipeAndPassRemoteWithVersion(), + base::BindOnce( + &LacrosBrowserShortcutsController::InitializeOnControllerReady, + weak_ptr_factory_.GetWeakPtr())); +} + +void LacrosBrowserShortcutsController::InitializeOnControllerReady( + crosapi::mojom::ControllerRegistrationResult result) { + if (result != crosapi::mojom::ControllerRegistrationResult::kSuccess) { + return; + } MaybePublishBrowserShortcuts( provider_->registrar_unsafe().GetAppIds(), false, base::BindOnce(&OnInitialBrowserShortcutsPublished));
diff --git a/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller.h b/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller.h index 60fe299..182c5a1d 100644 --- a/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller.h +++ b/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller.h
@@ -14,6 +14,7 @@ #include "chrome/browser/web_applications/web_app_registrar.h" #include "chromeos/crosapi/mojom/app_service.mojom.h" #include "components/webapps/common/web_app_id.h" +#include "mojo/public/cpp/bindings/receiver.h" static_assert(BUILDFLAG(IS_CHROMEOS_LACROS), "For LACROS only"); @@ -25,7 +26,9 @@ // A shortcut publisher (in the App Service sense) of web app system backed // shortcuts where the parent app is the browser. -class LacrosBrowserShortcutsController : public WebAppInstallManagerObserver { +class LacrosBrowserShortcutsController + : public crosapi::mojom::AppShortcutController, + public WebAppInstallManagerObserver { public: explicit LacrosBrowserShortcutsController(Profile* profile); LacrosBrowserShortcutsController(const LacrosBrowserShortcutsController&) = @@ -39,7 +42,9 @@ void Initialize(); private: - void InitializeOnRegistryReady(); + void RegisterControllerOnRegistryReady(); + void InitializeOnControllerReady( + crosapi::mojom::ControllerRegistrationResult result); // Publish web app identified by `app_id` as browser shortcut to the // AppService if the web app is considered as shortcut in ChromeOS. @@ -63,6 +68,8 @@ base::ScopedObservation<WebAppInstallManager, WebAppInstallManagerObserver> install_manager_observation_{this}; + mojo::Receiver<crosapi::mojom::AppShortcutController> receiver_{this}; + base::WeakPtrFactory<LacrosBrowserShortcutsController> weak_ptr_factory_{ this}; };
diff --git a/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller_unittest.cc b/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller_unittest.cc index f0fd267..06e4c12 100644 --- a/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller_unittest.cc +++ b/chrome/browser/web_applications/app_service/lacros_browser_shortcuts_controller_unittest.cc
@@ -39,6 +39,8 @@ void clear_deltas() { shortcut_deltas_.clear(); } + bool controller_registered() { return controller_registered_; } + mojo::Receiver<crosapi::mojom::AppShortcutPublisher> receiver_{this}; private: @@ -52,7 +54,16 @@ std::move(callback).Run(); } + void RegisterAppShortcutController( + mojo::PendingRemote<crosapi::mojom::AppShortcutController> controller, + RegisterAppShortcutControllerCallback callback) override { + controller_registered_ = true; + std::move(callback).Run( + crosapi::mojom::ControllerRegistrationResult::kSuccess); + } + std::vector<apps::ShortcutPtr> shortcut_deltas_; + bool controller_registered_ = false; }; class LacrosBrowserShortcutsControllerTest : public testing::Test, @@ -122,6 +133,7 @@ GURL("https://www.example.com/"), u"shortcut name"); InitializeLacrosBrowserShortcutsController(); + ASSERT_TRUE(fake_publisher()->controller_registered()); ASSERT_EQ(fake_publisher()->get_deltas().size(), 1U); EXPECT_EQ(fake_publisher()->get_deltas().back()->shortcut_id, shortcut_id_1);
diff --git a/chrome/browser/webauthn/android/webauthn_request_delegate_android.cc b/chrome/browser/webauthn/android/webauthn_request_delegate_android.cc index 01a2285..1d38437 100644 --- a/chrome/browser/webauthn/android/webauthn_request_delegate_android.cc +++ b/chrome/browser/webauthn/android/webauthn_request_delegate_android.cc
@@ -13,8 +13,8 @@ #include "base/ranges/algorithm.h" #include "chrome/browser/password_manager/chrome_webauthn_credentials_delegate.h" #include "chrome/browser/password_manager/chrome_webauthn_credentials_delegate_factory.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h" -#include "chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller.h" +#include "chrome/browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate.h" #include "chrome/browser/webauthn/webauthn_metrics_util.h" #include "components/password_manager/content/browser/content_password_manager_driver.h" #include "components/password_manager/content/browser/keyboard_replacing_surface_visibility_controller_impl.h"
diff --git a/chrome/browser/xsurface/android/java/src/org/chromium/chrome/browser/xsurface/feed/FeedNetworkRequestReliabilityLogger.java b/chrome/browser/xsurface/android/java/src/org/chromium/chrome/browser/xsurface/feed/FeedNetworkRequestReliabilityLogger.java index 2a7bb345..894e841 100644 --- a/chrome/browser/xsurface/android/java/src/org/chromium/chrome/browser/xsurface/feed/FeedNetworkRequestReliabilityLogger.java +++ b/chrome/browser/xsurface/android/java/src/org/chromium/chrome/browser/xsurface/feed/FeedNetworkRequestReliabilityLogger.java
@@ -17,8 +17,55 @@ * Log before filling out and serializing a * feed query request. Starts the network * request flow. + */ + default void logFeedQueryRequestStart() {} + + /** + * Log before filling out and serializing a feed actions upload request. Starts the network + * request flow. + */ + default void logActionsUploadRequestStart() {} + + /** + * Log before filling out and serializing a web feed request for all followed web feeds. Starts + * the network request flow. + */ + default void logWebFeedRequestStart() {} + + /** + * Log before filling out and serializing a web feed request for a single web feed, used by the + * cormorant surface. Starts the network request flow. + */ + default void logSingleWebFeedRequestStart() {} + + /** + * Log after the request has been sent. + */ + default void logRequestSent() {} + + /** + * Log after the response is received and before it is parsed. + * @param serverRecvTimestamp Server-reported time (nanoseconds) at which the request arrived. + * @param serverSendTimestamp Server-reported time (nanoseconds) at which the response was sent. + */ + default void logResponseReceived( + long serverRecvTimestamp, long serverSendTimestamp) {} + + /** + * Log after logResponseReceived() if there's a network error, or after parsing the response + * otherwise. Ends the network request flow. + * @param canonicalStatus Network request status code. See + * //third_party/abseil-cpp/absl/status/status.h. + */ + default void logRequestFinished(int canonicalStatus) {} + + /** + * Log before filling out and serializing a + * feed query request. Starts the network + * request flow. * @param timestamp Event time. */ + @Deprecated default void logFeedQueryRequestStart(long timestamp) {} /** @@ -26,24 +73,28 @@ * request flow. * @param timestamp Event time. */ + @Deprecated default void logActionsUploadRequestStart(long timestamp) {} /** * Log before filling out and serializing a web feed request for all followed web feeds. Starts * the network request flow. */ + @Deprecated default void logWebFeedRequestStart(long timestamp) {} /** * Log before filling out and serializing a web feed request for a single web feed, used by the * cormorant surface. Starts the network request flow. */ + @Deprecated default void logSingleWebFeedRequestStart(long timestamp) {} /** * Log after the request has been sent. * @param timestamp Event time. */ + @Deprecated default void logRequestSent(long timestamp) {} /** @@ -52,6 +103,7 @@ * @param serverSendTimestamp Server-reported time (nanoseconds) at which the response was sent. * @param clientRecvTimestamp Client time at which the response was received. */ + @Deprecated default void logResponseReceived( long serverRecvTimestamp, long serverSendTimestamp, long clientRecvTimestamp) {} @@ -62,5 +114,6 @@ * @param canonicalStatus Network request status code. See * //third_party/abseil-cpp/absl/status/status.h. */ + @Deprecated default void logRequestFinished(long timestamp, int canonicalStatus) {} }
diff --git a/chrome/build/android-arm32.pgo.txt b/chrome/build/android-arm32.pgo.txt index 0d8fa74..cd192db 100644 --- a/chrome/build/android-arm32.pgo.txt +++ b/chrome/build/android-arm32.pgo.txt
@@ -1 +1 @@ -chrome-android32-main-1699444736-d8f227f31f49d55e743dd70db618cd9d75fde52a.profdata +chrome-android32-main-1699487787-2cff3626782b07da59f9d25c73cb54da6fb382f4.profdata
diff --git a/chrome/build/android-arm64.pgo.txt b/chrome/build/android-arm64.pgo.txt index 3b0da32..c5f6e938 100644 --- a/chrome/build/android-arm64.pgo.txt +++ b/chrome/build/android-arm64.pgo.txt
@@ -1 +1 @@ -chrome-android64-main-1699465564-3513bf1d51d615a7f87cbd98d67882726dcfb373.profdata +chrome-android64-main-1699487787-82c342cb87e4ef313df7ecc0ed30a47ffdfe91c3.profdata
diff --git a/chrome/build/lacros64.pgo.txt b/chrome/build/lacros64.pgo.txt index ba52e09..307af1e 100644 --- a/chrome/build/lacros64.pgo.txt +++ b/chrome/build/lacros64.pgo.txt
@@ -1 +1 @@ -chrome-chromeos-amd64-generic-main-1699444736-1a4fefbc353eb8b960cbb4c8f3f6a003858242cf.profdata +chrome-chromeos-amd64-generic-main-1699488478-10625b83ffae30229d4921d35bc57f0f03b192c1.profdata
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index e7a97ac..c41fc18 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1699465564-fd832a282a2ad9f7f89d22dc3a2cfc626afe0460.profdata +chrome-linux-main-1699487787-27c17c8e8a6f128028a7dd5e17e982d052bba7c5.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 2ba2e20..1d1821bf 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1699459190-a753e74486fba2f02b1495991cb705dab96c3c25.profdata +chrome-mac-arm-main-1699495161-ae0d859d8ba8573283c1be3b0522f27ddb342793.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 2ce0763..264c7d34f 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1699444736-2b0b85fdcb4491c1ba95828339d54fb0e37f314e.profdata +chrome-mac-main-1699487787-c30db14ac95f16066857c2bc6baf046d18446559.profdata
diff --git a/chrome/build/win-arm64.pgo.txt b/chrome/build/win-arm64.pgo.txt index 49dc93c..3b902c77 100644 --- a/chrome/build/win-arm64.pgo.txt +++ b/chrome/build/win-arm64.pgo.txt
@@ -1 +1 @@ -chrome-win-arm64-main-1699444736-bd4f29a985bc51d57078d5ba3e4679c70211f7c4.profdata +chrome-win-arm64-main-1699487787-49e29b8c8f888cbc1b8154921a96f2086cc01fe0.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index bc21fde..dd61b2e 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1699444736-7aa0ca73583e44135205f13c9be4737444986fdd.profdata +chrome-win32-main-1699477168-11d520bac9dd4753d708a0feeb858d62ed6dbad3.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 8d3d395..012c43ea 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1699444736-975775f6da95501919e9b9fbfab7069219f51c69.profdata +chrome-win64-main-1699477168-d7a525809075b20b9ef590db58ca5dff1907a14c.profdata
diff --git a/chrome/common/companion/visual_search/features.cc b/chrome/common/companion/visual_search/features.cc index 6eb9c1b..14c6d32 100644 --- a/chrome/common/companion/visual_search/features.cc +++ b/chrome/common/companion/visual_search/features.cc
@@ -11,7 +11,7 @@ BASE_FEATURE(kVisualSearchSuggestions, "VisualSearchSuggestions", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kVisualSearchSuggestionsAgent, "VisualSearchSuggestionsAgent",
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index a35b84a..8c6818f 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1250,6 +1250,9 @@ "../browser/android/webapk/webapk_icon_hasher_browsertest.cc", "../browser/android/webapk/webapk_installer_browsertest.cc", "../browser/banners/android/ambient_badge_manager_browsertest.cc", + "../browser/banners/app_banner_manager_browsertest.cc", + "../browser/banners/app_banner_manager_browsertest_base.cc", + "../browser/banners/app_banner_manager_browsertest_base.h", "../browser/browsing_data/access_context_audit_browsertest.cc", "../browser/browsing_data/browsing_data_remover_browsertest_base.cc", "../browser/browsing_data/browsing_data_remover_browsertest_base.h", @@ -6347,6 +6350,7 @@ "../browser/ssl/certificate_error_reporter_unittest.cc", "../browser/ssl/certificate_reporting_test_utils.cc", "../browser/ssl/certificate_reporting_test_utils.h", + "../browser/ssl/daily_navigation_counter_unittest.cc", "../browser/ssl/https_first_mode_settings_tracker_unittest.cc", "../browser/ssl/security_state_tab_helper_unittest.cc", "../browser/ssl/ssl_config_service_manager_unittest.cc", @@ -6806,6 +6810,7 @@ "//components/policy/test_support:unittests", "//components/privacy_sandbox:privacy_sandbox", "//components/privacy_sandbox:privacy_sandbox_prefs", + "//components/privacy_sandbox:tracking_protection_onboarding", "//components/privacy_sandbox:tracking_protection_prefs", "//components/privacy_sandbox:tracking_protection_settings", "//components/privacy_sandbox/privacy_sandbox_attestations", @@ -7392,12 +7397,12 @@ "../browser/sharing/optimization_guide/optimization_guide_message_handler_unittest.cc", "../browser/sharing/sms/sms_fetch_request_handler_unittest.cc", "../browser/supervised_user/android/favicon_fetcher_unittest.cc", - "../browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_controller_unittest.cc", - "../browser/touch_to_fill/autofill/android/touch_to_fill_credit_card_quality_metrics_unittest.cc", - "../browser/touch_to_fill/autofill/android/touch_to_fill_delegate_android_impl_unittest.cc", - "../browser/touch_to_fill/autofill/android/touch_to_fill_keyboard_suppressor_unittest.cc", - "../browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate_unittest.cc", - "../browser/touch_to_fill/password_manager/touch_to_fill_controller_webauthn_delegate_unittest.cc", + "../browser/touch_to_fill/payments/android/touch_to_fill_credit_card_controller_unittest.cc", + "../browser/touch_to_fill/payments/android/touch_to_fill_credit_card_quality_metrics_unittest.cc", + "../browser/touch_to_fill/payments/android/touch_to_fill_delegate_android_impl_unittest.cc", + "../browser/touch_to_fill/touch_to_fill_controller_autofill_delegate_unittest.cc", + "../browser/touch_to_fill/touch_to_fill_controller_webauthn_delegate_unittest.cc", + "../browser/touch_to_fill/touch_to_fill_keyboard_suppressor_unittest.cc", "../browser/translate/android/translate_bridge_unittest.cc", "../browser/translate/translate_manager_render_view_host_android_unittest.cc", "../browser/ui/android/autofill/autofill_cvc_save_message_delegate_unittest.cc", @@ -7447,10 +7452,10 @@ "//chrome/browser/reading_list/android:unit_tests", "//chrome/browser/share", "//chrome/browser/thumbnail:unit_tests", - "//chrome/browser/touch_to_fill/autofill/android:public", - "//chrome/browser/touch_to_fill/password_manager/no_passkeys/android:public", - "//chrome/browser/touch_to_fill/password_manager/no_passkeys/android:unit_tests", - "//chrome/browser/touch_to_fill/password_manager/password_generation/android:unit_tests", + "//chrome/browser/touch_to_fill/no_passkeys/android:public", + "//chrome/browser/touch_to_fill/no_passkeys/android:unit_tests", + "//chrome/browser/touch_to_fill/password_generation/android:unit_tests", + "//chrome/browser/touch_to_fill/payments/android:public", "//chrome/browser/translate/android:unit_tests", "//chrome/browser/ui/android/hats/test:test_support", "//chrome/services/media_gallery_util:unit_tests",
diff --git a/chrome/test/chromedriver/client/chromedriver.py b/chrome/test/chromedriver/client/chromedriver.py index f1494e7..2783ff05 100644 --- a/chrome/test/chromedriver/client/chromedriver.py +++ b/chrome/test/chromedriver/client/chromedriver.py
@@ -746,9 +746,9 @@ params = {'accountIndex': index} return self.ExecuteCommand(Command.SELECT_ACCOUNT, params) - def ConfirmIdpLogin(self, vendorId): - params = {'vendorId': vendorId} - return self.ExecuteCommand(Command.CONFIRM_IDP_LOGIN, params) + def ClickFedCmDialogButton(self, vendorId, dialogButton): + params = {'vendorId': vendorId, 'dialogButton': dialogButton} + return self.ExecuteCommand(Command.CLICK_FEDCM_DIALOG_BUTTON, params) def GetAccounts(self): return self.ExecuteCommand(Command.GET_ACCOUNTS, {})
diff --git a/chrome/test/chromedriver/client/command_executor.py b/chrome/test/chromedriver/client/command_executor.py index 28744c42..e7551aa 100644 --- a/chrome/test/chromedriver/client/command_executor.py +++ b/chrome/test/chromedriver/client/command_executor.py
@@ -235,9 +235,9 @@ SELECT_ACCOUNT = ( _Method.POST, '/session/:sessionId/fedcm/selectaccount') - CONFIRM_IDP_LOGIN = ( + CLICK_FEDCM_DIALOG_BUTTON = ( _Method.POST, - '/session/:sessionId/:vendorId/fedcm/confirmidplogin') + '/session/:sessionId/:vendorId/fedcm/clickdialogbutton') GET_ACCOUNTS = ( _Method.GET, '/session/:sessionId/fedcm/accountlist')
diff --git a/chrome/test/chromedriver/fedcm_commands.cc b/chrome/test/chromedriver/fedcm_commands.cc index 0cbc3b2..de5e59aa 100644 --- a/chrome/test/chromedriver/fedcm_commands.cc +++ b/chrome/test/chromedriver/fedcm_commands.cc
@@ -62,11 +62,11 @@ return status; } -Status ExecuteConfirmIdpLogin(Session* session, - WebView* web_view, - const base::Value::Dict& params, - std::unique_ptr<base::Value>* value, - Timeout* timeout) { +Status ExecuteClickDialogButton(Session* session, + WebView* web_view, + const base::Value::Dict& params, + std::unique_ptr<base::Value>* value, + Timeout* timeout) { FedCmTracker* tracker = nullptr; Status status = web_view->GetFedCmTracker(&tracker); if (!status.IsOk()) { @@ -75,12 +75,16 @@ if (!tracker->HasDialog()) { return Status(kNoSuchAlert); } + if (!params.FindString("dialogButton")) { + return Status(kInvalidArgument, "dialogButton must be specified"); + } base::Value::Dict command_params; command_params.Set("dialogId", tracker->GetLastDialogId()); + command_params.Set("dialogButton", *params.FindString("dialogButton")); std::unique_ptr<base::Value> result; - status = web_view->SendCommandAndGetResult("FedCm.confirmIdpLogin", + status = web_view->SendCommandAndGetResult("FedCm.clickDialogButton", command_params, &result); tracker->DialogClosed(); return status;
diff --git a/chrome/test/chromedriver/fedcm_commands.h b/chrome/test/chromedriver/fedcm_commands.h index 7f721bd..ae287e8 100644 --- a/chrome/test/chromedriver/fedcm_commands.h +++ b/chrome/test/chromedriver/fedcm_commands.h
@@ -27,11 +27,11 @@ std::unique_ptr<base::Value>* value, Timeout* timeout); -Status ExecuteConfirmIdpLogin(Session* session, - WebView* web_view, - const base::Value::Dict& params, - std::unique_ptr<base::Value>* value, - Timeout* timeout); +Status ExecuteClickDialogButton(Session* session, + WebView* web_view, + const base::Value::Dict& params, + std::unique_ptr<base::Value>* value, + Timeout* timeout); Status ExecuteGetAccounts(Session* session, WebView* web_view,
diff --git a/chrome/test/chromedriver/server/http_handler.cc b/chrome/test/chromedriver/server/http_handler.cc index 075410f1..e054af3 100644 --- a/chrome/test/chromedriver/server/http_handler.cc +++ b/chrome/test/chromedriver/server/http_handler.cc
@@ -970,9 +970,9 @@ // This command is prefixed because standardization is still pending: // https://github.com/fedidcg/FedCM/pull/436/files VendorPrefixedCommandMapping( - kPost, "session/:sessionId/%s/fedcm/confirmidplogin", - WrapToCommand("ConfirmIdpLogin", - base::BindRepeating(&ExecuteConfirmIdpLogin))), + kPost, "session/:sessionId/%s/fedcm/clickdialogbutton", + WrapToCommand("ClickDialogButton", + base::BindRepeating(&ExecuteClickDialogButton))), CommandMapping(kGet, "session/:sessionId/fedcm/accountlist", WrapToCommand("GetAccounts",
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py index a5e3b10..abcae56 100755 --- a/chrome/test/chromedriver/test/run_py_tests.py +++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -7626,7 +7626,8 @@ self._accounts = self._default_accounts - self._driver.ConfirmIdpLogin(self._vendor_id) + self._driver.ClickFedCmDialogButton(self._vendor_id, + "ConfirmIdpLoginContinue") self.assertTrue(self.WaitForCondition(self.FedCmDialogCondition)) accounts = self._driver.GetAccounts()
diff --git a/chrome/test/data/extensions/back_forward_cache/content_script_all_frames/manifest.json b/chrome/test/data/extensions/back_forward_cache/content_script_all_frames/manifest.json index 0178cc1..b8a292c 100644 --- a/chrome/test/data/extensions/back_forward_cache/content_script_all_frames/manifest.json +++ b/chrome/test/data/extensions/back_forward_cache/content_script_all_frames/manifest.json
@@ -1,8 +1,8 @@ { - "name": "no caching", + "name": "BFCache test extension", "version": "0.1", "manifest_version": 2, - "description": "Checks that content scripts do prevent back forward cache.", + "description": "A test extension that can be injected into all frames.", "permissions": [ "http://*/*", "https://*/*"
diff --git a/chrome/test/data/extensions/settings_override/manifest.json b/chrome/test/data/extensions/settings_override/manifest.json index bbad04b..0c612d81 100644 --- a/chrome/test/data/extensions/settings_override/manifest.json +++ b/chrome/test/data/extensions/settings_override/manifest.json
@@ -22,7 +22,7 @@ "http://www.noo.__MSG_url_domain__/s?q={searchTerms}&id=__PARAM__" ], "encoding": "UTF-8", - "prepopulated_id": 3, + "prepopulated_id": 83, "is_default": true }, "startup_pages": ["http://www.startup.__MSG_url_domain__/?param=__PARAM__"]
diff --git a/chrome/test/data/webui/chromeos/firmware_update/firmware_update_test.ts b/chrome/test/data/webui/chromeos/firmware_update/firmware_update_test.ts index 031e808..8e1fc50 100644 --- a/chrome/test/data/webui/chromeos/firmware_update/firmware_update_test.ts +++ b/chrome/test/data/webui/chromeos/firmware_update/firmware_update_test.ts
@@ -158,6 +158,58 @@ fwConfirmDialog.shadowRoot!.querySelector('#confirmationDialog'))); }); + test('ConfirmationDialogShowsDisclaimerWhenFlagEnabled', async () => { + // Enable the v2 flag. + loadTimeData.overrideValues({ + isFirmwareUpdateUIV2Enabled: true, + }); + + // Setup the app. + initializePage(); + await flushTasks(); + assert(page); + + // Open dialog for first firmware update card. + let whenFired = eventToPromise('cr-dialog-open', page); + let button = strictQuery( + `#updateButton`, getUpdateCards()[0]!.shadowRoot, CrButtonElement); + button.click(); + await flushTasks(); + await whenFired; + let fwConfirmDialog = strictQuery( + 'firmware-confirmation-dialog', page.shadowRoot, HTMLElement); + + // The disclaimer should be displayed. + assertTrue(!!fwConfirmDialog.shadowRoot!.querySelector('#disclaimer')); + + // Clear app element to reset the test. + page?.remove(); + await flushTasks(); + + // Disable the v2 flag. + loadTimeData.overrideValues({ + isFirmwareUpdateUIV2Enabled: false, + }); + + // Setup the app. + initializePage(); + await flushTasks(); + assert(page); + + // Open dialog for first firmware update card. + whenFired = eventToPromise('cr-dialog-open', page); + button = strictQuery( + `#updateButton`, getUpdateCards()[0]!.shadowRoot, CrButtonElement); + button.click(); + await flushTasks(); + await whenFired; + fwConfirmDialog = strictQuery( + 'firmware-confirmation-dialog', page.shadowRoot, HTMLElement); + + // The disclaimer should not be displayed. + assertFalse(!!fwConfirmDialog.shadowRoot!.querySelector('#disclaimer')); + }); + test('OpenUpdateDialog', async () => { initializePage(); await flushTasks();
diff --git a/chrome/test/data/webui/settings/autofill_fake_data.ts b/chrome/test/data/webui/settings/autofill_fake_data.ts index fce8a5d..ca645fa 100644 --- a/chrome/test/data/webui/settings/autofill_fake_data.ts +++ b/chrome/test/data/webui/settings/autofill_fake_data.ts
@@ -262,6 +262,7 @@ isValidIban: number = 0; authenticateUserAndFlipMandatoryAuthToggle: number = 0; getLocalCard: number = 0; + bulkDeleteAllCvcs: number = 0; } /** @@ -284,17 +285,18 @@ constructor() { super([ - 'setPersonalDataManagerListener', - 'removePersonalDataManagerListener', + 'addVirtualCard', + 'authenticateUserAndFlipMandatoryAuthToggle', + 'bulkDeleteAllCvcs', + 'clearCachedCreditCard', 'getCreditCardList', 'getIbanList', - 'clearCachedCreditCard', + 'getLocalCard', + 'isValidIban', 'removeCreditCard', 'removeIban', - 'addVirtualCard', - 'isValidIban', - 'authenticateUserAndFlipMandatoryAuthToggle', - 'getLocalCard', + 'removePersonalDataManagerListener', + 'setPersonalDataManagerListener', ]); // Set these to have non-empty data. @@ -393,6 +395,10 @@ } // </if> + bulkDeleteAllCvcs() { + this.methodCalled('bulkDeleteAllCvcs'); + } + /** * Verifies expectations. */ @@ -428,5 +434,8 @@ assertEquals( expected.getLocalCard, this.getCallCount('getLocalCard'), 'getLocalCard mismatch'); + assertEquals( + expected.bulkDeleteAllCvcs, this.getCallCount('bulkDeleteAllCvcs'), + 'bulkDeleteAllCvcs mismatch'); } }
diff --git a/chrome/test/data/webui/settings/chromeos/internet_page/hotspot_summary_item_test.ts b/chrome/test/data/webui/settings/chromeos/internet_page/hotspot_summary_item_test.ts index 06f09d1..35d3858 100644 --- a/chrome/test/data/webui/settings/chromeos/internet_page/hotspot_summary_item_test.ts +++ b/chrome/test/data/webui/settings/chromeos/internet_page/hotspot_summary_item_test.ts
@@ -312,6 +312,26 @@ hotspotDisabledSublabelLink.localizedString); }); + test('UI state when no mobile data connection and enabling', async () => { + hotspotConfig.setFakeHotspotAllowStatus( + HotspotAllowStatus.kDisallowedNoMobileData); + hotspotConfig.setFakeHotspotState(HotspotState.kEnabling); + await flushAsync(); + + const subpageArrow = queryHotspotSummaryItemRowArrowIcon(); + const enableToggle = queryEnableHotspotToggle(); + assertTrue(!!enableToggle); + // Toggle should be enabled, subpage arrow should show. + assertFalse(enableToggle.disabled, 'Toggle should not be disabled'); + assertTrue(!!subpageArrow, 'Subpage arrow should exist'); + + const hotspotStateSublabel = queryHotspotStateSublabel(); + assertTrue(!!hotspotStateSublabel); + assertEquals( + hotspotSummaryItem.i18n('hotspotSummaryStateTurningOn'), + hotspotStateSublabel.textContent!.trim()); + }); + test('Toggle button state', async () => { const enableHotspotToggle = queryEnableHotspotToggle(); assertTrue(!!enableHotspotToggle, 'Hotspot enable toggl should exist');
diff --git a/chrome/test/data/webui/settings/payments_section_test.ts b/chrome/test/data/webui/settings/payments_section_test.ts index 2f21ae8..e60ffb5 100644 --- a/chrome/test/data/webui/settings/payments_section_test.ts +++ b/chrome/test/data/webui/settings/payments_section_test.ts
@@ -4,7 +4,7 @@ // clang-format off import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {PaymentsManagerImpl} from 'chrome://settings/lazy_load.js'; +import {PaymentsManagerImpl, SettingsSimpleConfirmationDialogElement} from 'chrome://settings/lazy_load.js'; import {CrButtonElement, loadTimeData, MetricsBrowserProxyImpl, PrivacyElementInteractions, SettingsToggleButtonElement} from 'chrome://settings/settings.js'; import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; @@ -12,7 +12,7 @@ import {createPaymentsSection, getLocalAndServerCreditCardListItems, getDefaultExpectations, getCardRowShadowRoot} from './payments_section_utils.js'; import {TestMetricsBrowserProxy} from './test_metrics_browser_proxy.js'; -import {isVisible} from 'chrome://webui-test/test_util.js'; +import {eventToPromise, isVisible, whenAttributeIs} from 'chrome://webui-test/test_util.js'; // clang-format on @@ -565,7 +565,7 @@ }); const creditCard = createCreditCardEntry(); - creditCard.cvc = '***'; + creditCard.cvc = '•••'; const section = await createPaymentsSection( /*creditCards=*/[creditCard], /*ibans=*/[], { credit_card_enabled: {value: true}, @@ -597,7 +597,68 @@ assertTrue(!!cvcStorageToggle); assertEquals( - cvcStorageToggle.subLabelWithLink.toString(), - loadTimeData.getString('enableCvcStorageSublabel')); + loadTimeData.getString('enableCvcStorageSublabel'), + cvcStorageToggle.subLabelWithLink.toString()); }); + + // Test to verify if bulk delete is triggered or not based on how user + // interacts with the deletion dialog window. + [true, false].forEach(shouldTriggerBulkDelete => { + test( + `verifyBulkDeleteCvcIsTriggered_${shouldTriggerBulkDelete}`, + async function() { + loadTimeData.overrideValues({ + cvcStorageAvailable: true, + }); + + const creditCard = createCreditCardEntry(); + creditCard.cvc = '•••'; + const section = await createPaymentsSection( + /*creditCards=*/[creditCard], /*ibans=*/[], { + credit_card_enabled: {value: true}, + }); + + const cvcStorageToggle = + section.shadowRoot!.querySelector<SettingsToggleButtonElement>( + '#cvcStorageToggle'); + assertTrue(!!cvcStorageToggle); + assertEquals( + loadTimeData.getString('enableCvcStorageDeleteDataSublabel'), + cvcStorageToggle.subLabelWithLink.toString()); + + const cvcStorageToggleSublabelLink = + cvcStorageToggle.$.labelWrapper + .querySelector('#sub-label-text-with-link')!.querySelector( + 'a'); + assertTrue(isVisible(cvcStorageToggleSublabelLink)); + cvcStorageToggleSublabelLink!.click(); + flush(); + + const bulkDeletionDialog = + section.shadowRoot! + .querySelector<SettingsSimpleConfirmationDialogElement>( + '#bulkDeleteCvcConfirmDialog'); + assertTrue(!!bulkDeletionDialog); + await whenAttributeIs(bulkDeletionDialog.$.dialog, 'open', ''); + + if (shouldTriggerBulkDelete) { + bulkDeletionDialog.$.confirm.click(); + } else { + bulkDeletionDialog.$.cancel.click(); + } + flush(); + + // Wait for the dialog close event to propagate to the PaymentManager. + await eventToPromise('close', bulkDeletionDialog); + + const paymentsManagerProxy = + PaymentsManagerImpl.getInstance() as TestPaymentsManager; + const expectations = getDefaultExpectations(); + + if (shouldTriggerBulkDelete) { + expectations.bulkDeleteAllCvcs = 1; + } + paymentsManagerProxy.assertExpectations(expectations); + }); + }); });
diff --git a/chrome/test/data/webui/settings/payments_section_utils.ts b/chrome/test/data/webui/settings/payments_section_utils.ts index fda7517..d673f0d 100644 --- a/chrome/test/data/webui/settings/payments_section_utils.ts +++ b/chrome/test/data/webui/settings/payments_section_utils.ts
@@ -60,6 +60,7 @@ expected.isValidIban = 0; expected.authenticateUserAndFlipMandatoryAuthToggle = 0; expected.getLocalCard = 0; + expected.bulkDeleteAllCvcs = 0; return expected; }
diff --git a/chrome/test/data/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_test.ts b/chrome/test/data/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_test.ts index 0a30067..f5f8f2f0 100644 --- a/chrome/test/data/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_test.ts +++ b/chrome/test/data/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_test.ts
@@ -155,8 +155,7 @@ assertEquals(1, checkedMarkedColors.length); assertEquals( checkedMarkedColors[0], - $$(wallpaperSearchElement, - '.default-color .color-check-mark-wrapper')); + $$(wallpaperSearchElement, '.default-color .color-check-mark')); wallpaperSearchElement.$.hueSlider.dispatchEvent( new Event('selected-hue-changed')); @@ -479,8 +478,7 @@ await waitAfterNextRender(wallpaperSearchElement); // The first result should be checked and be the only one checked. - const firstResult = - $$(wallpaperSearchElement, '.tile .image-check-mark-wrapper'); + const firstResult = $$(wallpaperSearchElement, '.tile .image-check-mark'); const checkedResults = wallpaperSearchElement.shadowRoot!.querySelectorAll( '.tile [checked]');
diff --git a/chrome/updater/mac/BUILD.gn b/chrome/updater/mac/BUILD.gn index f5a8d03..5b0a9e2 100644 --- a/chrome/updater/mac/BUILD.gn +++ b/chrome/updater/mac/BUILD.gn
@@ -604,6 +604,7 @@ "$root_build_dir/Updater Packaging/sign_updater.py", "$root_build_dir/Updater Packaging/signing/build_props_config.py", "$root_build_dir/Updater Packaging/signing/pkg-dmg", + "$root_build_dir/Updater Packaging/signing/postinstall", "$root_build_dir/chrome/updater/.install", "$root_build_dir/UpdaterSetup", "$root_build_dir/qualification_app",
diff --git a/chrome/updater/mac/signing/BUILD.gn b/chrome/updater/mac/signing/BUILD.gn index 42370f95..947acd4a 100644 --- a/chrome/updater/mac/signing/BUILD.gn +++ b/chrome/updater/mac/signing/BUILD.gn
@@ -10,7 +10,10 @@ import("//chrome/version.gni") group("signing") { - public_deps = [ ":copies" ] + public_deps = [ + ":copies", + ":postinstall", + ] } _packaging_dir = "$root_out_dir/Updater Packaging" @@ -38,14 +41,21 @@ "KEYSTONE_APP_NAME=\"" + keystone_app_name + "\"", "-e", "MAC_TEAM_ID=\"" + mac_team_identifier + "\"", - ] - - extra_args += [ "-e", "$extra_args_is_chrome_branded", ] } +process_version("postinstall") { + extra_args = [ + "-e", + "PRODUCT_FULLNAME=\"$updater_product_full_name\"", + ] + process_only = true + template_file = "postinstall.in" + output = "$_packaging_dir/signing/postinstall" +} + copy("copy_signing") { visibility = [ ":copies" ]
diff --git a/chrome/updater/mac/signing/pipeline.py b/chrome/updater/mac/signing/pipeline.py index d301b6fa..4404789 100644 --- a/chrome/updater/mac/signing/pipeline.py +++ b/chrome/updater/mac/signing/pipeline.py
@@ -89,6 +89,34 @@ return dmg_path +def _package_and_sign_pkg(paths, config): + """Packages, signs, and verifies a PKG. + + Args: + paths: A |model.Paths| object. + config: The |config.CodeSignConfig| object. + + Returns: + The path to the signed PKG file. + """ + pkg_path = os.path.join(paths.output, + '{}.pkg'.format(config.packaging_basename)) + commands.run_command([ + 'pkgbuild', + '--component', + os.path.join(paths.work, config.app_dir), + '--install-location', + '/tmp' + '--scripts', + os.path.join(paths.input, config.packaging_dir, 'signing'), + '--sign', + config.installer_identity, + '--timestamp', + pkg_path, + ]) + return pkg_path + + def _package_zip(paths, config): """Packages an Updater application bundle into a ZIP. @@ -163,11 +191,11 @@ os.path.join(notary_paths.work, config.packaging_basename)) _package_zip(package_paths, config) dmg_path = _package_and_sign_dmg(package_paths, config) + pkg_path = _package_and_sign_pkg(package_paths, config) - # Notarize the package, then staple. - if config.notarize.should_wait(): - for _ in notarize.wait_for_results( - [notarize.submit(dmg_path, config)], config): - pass # We are only waiting for a single notarization. - if config.notarize.should_staple(): - notarize.staple(dmg_path) + # Notarize the packages, then staple. + uuid_to_path = {} + uuid_to_path[notarize.submit(pkg_path, config)] = pkg_path + uuid_to_path[notarize.submit(dmg_path, config)] = dmg_path + for uuid in notarize.wait_for_results(uuid_to_path.keys(), config): + notarize.staple(uuid_to_path[uuid])
diff --git a/chrome/updater/mac/signing/postinstall.in b/chrome/updater/mac/signing/postinstall.in new file mode 100755 index 0000000..9ef3b977 --- /dev/null +++ b/chrome/updater/mac/signing/postinstall.in
@@ -0,0 +1,23 @@ +#!/bin/bash -p + +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -eu + +# Parameters: +# $1 is the top-level package path +# $2 is the target (installation) location +# $3 is the target (installation) volume +# $4 is the startup disk root + +if [ "$EUID" -ne 0 ] +then readonly SYSTEM="" +else readonly SYSTEM="--system" +fi + +"${2}/@PRODUCT_FULLNAME@.app/Contents/MacOS/@PRODUCT_FULLNAME@" "--install" "$SYSTEM" "--enable-logging" "--vmodule=*/updater/*=2" + +# We don't need the .app in /tmp anymore. +rm -rf "${2}/@PRODUCT_FULLNAME@.app"
diff --git a/chromeos/ash/components/memory/swap_configuration.cc b/chromeos/ash/components/memory/swap_configuration.cc index 302f5b09..50667f3 100644 --- a/chromeos/ash/components/memory/swap_configuration.cc +++ b/chromeos/ash/components/memory/swap_configuration.cc
@@ -16,11 +16,11 @@ // for ARC enabled users and one for ARC disabled users. BASE_FEATURE(kCrOSMemoryPressureSignalStudyNonArc, "ChromeOSMemoryPressureSignalStudyNonArc", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); const base::FeatureParam<int> kCrOSMemoryPressureSignalStudyNonArcCriticalBps{ &kCrOSMemoryPressureSignalStudyNonArc, "critical_threshold_percentage", - 520}; + 1500}; const base::FeatureParam<int> kCrOSMemoryPressureSignalStudyNonArcModerateBps{ &kCrOSMemoryPressureSignalStudyNonArc, "moderate_threshold_percentage",
diff --git a/chromeos/ash/components/memory/swap_configuration_unittest.cc b/chromeos/ash/components/memory/swap_configuration_unittest.cc index 62e8fd4..7dfc683 100644 --- a/chromeos/ash/components/memory/swap_configuration_unittest.cc +++ b/chromeos/ash/components/memory/swap_configuration_unittest.cc
@@ -36,7 +36,7 @@ feature_list_.InitAndEnableFeature(kCrOSMemoryPressureSignalStudyNonArc); ConfigureSwap(/*arc_enabled=*/false); - EXPECT_EQ(resourced_client_->get_critical_margin_bps(), 520u); + EXPECT_EQ(resourced_client_->get_critical_margin_bps(), 1500u); EXPECT_EQ(resourced_client_->get_moderate_margin_bps(), 4000u); }
diff --git a/chromeos/ash/components/phonehub/fake_phone_hub_manager.h b/chromeos/ash/components/phonehub/fake_phone_hub_manager.h index 6e35bc5..55c24da8 100644 --- a/chromeos/ash/components/phonehub/fake_phone_hub_manager.h +++ b/chromeos/ash/components/phonehub/fake_phone_hub_manager.h
@@ -103,6 +103,8 @@ FakePingManager* fake_ping_manager() { return &fake_ping_manager_; } + FakeIconDecoder* fake_icon_decoder() { return &fake_icon_decoder_; } + void set_host_last_seen_timestamp(absl::optional<base::Time> timestamp) { host_last_seen_timestamp_ = timestamp; }
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index 5f6d83c..0f74f88 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -3905,6 +3905,9 @@ <message name="IDS_FIRMWARE_PROCEED_UPDATE_CONFIRMATION" desc="Information text to users that to proceed with the firmware update that they need to click on the Next button."> To proceed with the update, click Next. </message> + <message name="IDS_FIRMWARE_CONFIRMATION_DISCLAIMER_TEXT" desc="Information text to users that the chosen update comes from the device manufacturer and hasn't been verified by Google." translateable="false"> + This update is provided by the external device manufacturer and hasn't been verified by Google. + </message> <!-- Search Page --> <message name="IDS_FEEDBACK_TOOL_CONTINUE_BUTTON_LABEL" desc="Label of the continue button."> Continue
diff --git a/chromeos/crosapi/mojom/app_service.mojom b/chromeos/crosapi/mojom/app_service.mojom index 3decb2a..f9fddd86 100644 --- a/chromeos/crosapi/mojom/app_service.mojom +++ b/chromeos/crosapi/mojom/app_service.mojom
@@ -251,4 +251,16 @@ // |deltas| holds a sparse data structure that includes the update // AppShortcut data from the existing shortcut state in app service. PublishShortcuts@0(array<AppShortcut> deltas) => (); + + // Lacros exposes an AppShortcutController interface to Ash. This allows + // Ash to launch, or otherwise interact with shortcuts that run in Lacros. + [MinVersion=1] + RegisterAppShortcutController@1( + pending_remote<AppShortcutController> controller) => + (ControllerRegistrationResult result); }; + +// Interacts with shortcuts that run in Lacros. Implemented in lacros-chrome +// and called in ash-chrome. +[Stable, Uuid="aa20b7ea-e177-4e14-b30e-cf54d9cde94c"] +interface AppShortcutController {};
diff --git a/chromeos/crosapi/mojom/app_service_types.mojom b/chromeos/crosapi/mojom/app_service_types.mojom index 1bd3f46..0fa1ed0 100644 --- a/chromeos/crosapi/mojom/app_service_types.mojom +++ b/chromeos/crosapi/mojom/app_service_types.mojom
@@ -597,3 +597,10 @@ // DEPRECATED uint8 position@2; }; + +// Controller registration result in App Service. +[Stable, Extensible] +enum ControllerRegistrationResult { + [Default] kSuccess = 0, + kFailed = 1, +};
diff --git a/chromeos/services/tts/BUILD.gn b/chromeos/services/tts/BUILD.gn index 548e0f1..418f77a 100644 --- a/chromeos/services/tts/BUILD.gn +++ b/chromeos/services/tts/BUILD.gn
@@ -73,5 +73,10 @@ "//mojo/public/cpp/bindings", "//testing/gtest", ] - sources = [ "tts_service_unittest.cc" ] + sources = [ + "tts_player_unittest.cc", + "tts_service_unittest.cc", + "tts_test_utils.cc", + "tts_test_utils.h", + ] }
diff --git a/chromeos/services/tts/tts_player.cc b/chromeos/services/tts/tts_player.cc index 6002856..f28c1db2 100644 --- a/chromeos/services/tts/tts_player.cc +++ b/chromeos/services/tts/tts_player.cc
@@ -58,34 +58,37 @@ base::TimeTicks delay_timestamp, const media::AudioGlitchInfo& glitch_info, media::AudioBus* dest) { - size_t frames_in_buf = 0; + size_t frame_count = dest->frames(); + { base::AutoLock al(state_lock_); if (buffers_.empty()) return 0; - const AudioBuffer& buf = buffers_.front(); - - frames_in_buf = buf.frames.size(); - const float* frames = nullptr; - if (!buf.frames.empty()) - frames = &buf.frames[0]; float* channel = dest->channel(0); - for (size_t i = 0; i < frames_in_buf; i++) - channel[i] = frames[i]; - rendered_buffers_.push(std::move(buffers_.front())); - buffers_.pop(); + AudioBuffer* buffer = &buffers_.front(); + for (size_t output_index = 0; output_index < frame_count; + output_index++, buffer->current_frame_index++) { + while (buffer->current_frame_index == buffer->frames.size()) { + // Buffer empty or exhausted, continue to next buffer. + PostTaskProcessRenderedBuffersLocked(buffer); - if (!process_rendered_buffers_posted_) { - process_rendered_buffers_posted_ = true; - task_runner_->PostTask(FROM_HERE, - base::BindOnce(&TtsPlayer::ProcessRenderedBuffers, - weak_factory_.GetWeakPtr())); + if (buffers_.empty()) { + return output_index; + } + buffer = &buffers_.front(); + } + channel[output_index] = buffer->frames[buffer->current_frame_index]; + } + + CHECK(!buffer->frames.empty()); + if (buffer->current_frame_index == buffer->frames.size()) { + PostTaskProcessRenderedBuffersLocked(buffer); } } - return frames_in_buf; + return frame_count; } void TtsPlayer::OnRenderError() {} @@ -143,6 +146,21 @@ status = other.status; char_index = other.char_index; is_first_buffer = other.is_first_buffer; + current_frame_index = other.current_frame_index; +} + +void TtsPlayer::PostTaskProcessRenderedBuffersLocked(AudioBuffer* buffer) { + CHECK_EQ(buffer, &buffers_.front()); + rendered_buffers_.push(std::move(*buffer)); + buffers_.pop(); + + if (process_rendered_buffers_posted_) { + return; + } + process_rendered_buffers_posted_ = true; + task_runner_->PostTask(FROM_HERE, + base::BindOnce(&TtsPlayer::ProcessRenderedBuffers, + weak_factory_.GetWeakPtr())); } } // namespace tts
diff --git a/chromeos/services/tts/tts_player.h b/chromeos/services/tts/tts_player.h index 128c6c4a..1c266a7 100644 --- a/chromeos/services/tts/tts_player.h +++ b/chromeos/services/tts/tts_player.h
@@ -12,9 +12,9 @@ #include "base/thread_annotations.h" #include "base/time/time.h" #include "chromeos/services/tts/public/mojom/tts_service.mojom.h" +#include "media/base/audio_glitch_info.h" #include "media/base/audio_renderer_sink.h" #include "mojo/public/cpp/bindings/pending_receiver.h" -#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/audio/public/cpp/output_device.h" @@ -31,11 +31,16 @@ ~AudioBuffer(); AudioBuffer(const AudioBuffer& other) = delete; AudioBuffer(AudioBuffer&& other); + AudioBuffer& operator=(AudioBuffer&& other) = default; std::vector<float> frames; int char_index = -1; int status = 0; bool is_first_buffer = false; + + // Internal bookkeeping if only a partial buffer has been read during + // TtsPlayer::Render. + size_t current_frame_index = 0; }; TtsPlayer(mojo::PendingRemote<media::mojom::AudioStreamFactory> factory, @@ -69,6 +74,10 @@ // been rendered on the audio thread. void ProcessRenderedBuffers(); + // Post task on the main thread to call ProcessRenderedBuffers. + void PostTaskProcessRenderedBuffersLocked(AudioBuffer* buffer) + EXCLUSIVE_LOCKS_REQUIRED(state_lock_); + // Protects access to state from main thread and audio thread. base::Lock state_lock_;
diff --git a/chromeos/services/tts/tts_player_unittest.cc b/chromeos/services/tts/tts_player_unittest.cc new file mode 100644 index 0000000..c772115 --- /dev/null +++ b/chromeos/services/tts/tts_player_unittest.cc
@@ -0,0 +1,241 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/tts/tts_player.h" + +#include "chromeos/services/tts/constants.h" +#include "chromeos/services/tts/tts_test_utils.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace chromeos { +namespace tts { +namespace { + +// Tests TtsPlayer, which is used to render TTS audio bytes for +// playback via a media::AudioBus. +class TtsPlayerTest : public TtsTestBase { + public: + TtsPlayerTest() + : tts_player_(audio_stream_factory_.BindNewPipeAndPassRemote(), + std::move(media::AudioParameters( + media::AudioParameters::AUDIO_PCM_LOW_LATENCY, + media::ChannelLayoutConfig::Mono(), + kDefaultSampleRate, + kDefaultBufferSize))), + observer_(&backing_observer_) {} + + TtsPlayerTest(const TtsPlayerTest&) = delete; + TtsPlayerTest& operator=(const TtsPlayerTest&) = delete; + ~TtsPlayerTest() override = default; + + protected: + void AddAudioBuffer(const std::vector<float>& frames, + int32_t char_index, + int32_t status) { + TtsPlayer::AudioBuffer buffer; + buffer.frames = frames; + buffer.char_index = char_index; + buffer.status = status; + tts_player_.AddAudioBuffer(std::move(buffer)); + } + + // testing::Test: + void SetUp() override { + tts_player_.Play(base::BindOnce( + [](mojo::Receiver<mojom::TtsEventObserver>* receiver, + mojo::PendingReceiver<mojom::TtsEventObserver> pending_receiver) { + receiver->Bind(std::move(pending_receiver)); + }, + &observer_)); + } + + TtsPlayer tts_player_; + MockTtsEventObserver backing_observer_; + mojo::Receiver<mojom::TtsEventObserver> observer_; +}; + +TEST_F(TtsPlayerTest, RenderNoFramesFromEmptyBuffer) { + auto bus = media::AudioBus::Create(/*channels=*/1, /*frames=*/512); + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, bus.get()); + + // The playback stream pushes an empty buffer to trigger a start event. + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + EXPECT_TRUE(backing_observer_.char_indices.empty()); + EXPECT_EQ(0, backing_observer_.end_count); + + // Push an empty buffer. + AddAudioBuffer(std::vector<float>(), 0 /* char_index */, 1 /* status */); + int frames_rendered = + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, bus.get()); + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + ASSERT_EQ(1U, backing_observer_.char_indices.size()); + EXPECT_EQ(0, backing_observer_.char_indices[0]); + EXPECT_EQ(0, backing_observer_.end_count); + + EXPECT_EQ(0, frames_rendered); +} + +TEST_F(TtsPlayerTest, RenderSingleFrame) { + auto bus = media::AudioBus::Create(/*channels=*/1, /*frames=*/512); + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, bus.get()); + + // The playback stream pushes an empty buffer to trigger a start event. + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + EXPECT_TRUE(backing_observer_.char_indices.empty()); + EXPECT_EQ(0, backing_observer_.end_count); + + // Renders a single frame. + AddAudioBuffer(std::vector<float>({0.7}), 1 /* char_index */, + 0 /* last buffer */); + int frames_rendered = + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, bus.get()); + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + EXPECT_TRUE(backing_observer_.char_indices.empty()); + EXPECT_EQ(1, backing_observer_.end_count); + + EXPECT_EQ(1, frames_rendered); + std::vector<float> actual(bus->channel(0), bus->channel(0) + 1); + std::vector<float> expected = {0.7}; + EXPECT_THAT(actual, testing::ElementsAreArray(expected)); +} + +TEST_F(TtsPlayerTest, RenderFramesFromPartialBuffers) { + auto bus = media::AudioBus::Create(/*channels=*/1, /*frames=*/5); + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, bus.get()); + + // The playback stream pushes an empty buffer to trigger a start event. + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + EXPECT_TRUE(backing_observer_.char_indices.empty()); + EXPECT_EQ(0, backing_observer_.end_count); + + // Renders a full frame from two partial buffers. + AddAudioBuffer(std::vector<float>({0.1, 0.2, 0.3}), 1 /* char_index */, + 1 /* status */); + AddAudioBuffer(std::vector<float>({0.4, 0.5}), 2 /* char_index */, + 0 /* last buffer */); + int frames_rendered = + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, bus.get()); + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + ASSERT_EQ(1U, backing_observer_.char_indices.size()); + EXPECT_EQ(1, backing_observer_.char_indices[0]); + EXPECT_EQ(1, backing_observer_.end_count); + + EXPECT_EQ(5, frames_rendered); + std::vector<float> actual(bus->channel(0), bus->channel(0) + 5); + std::vector<float> expected = {0.1, 0.2, 0.3, 0.4, 0.5}; + EXPECT_THAT(actual, testing::ElementsAreArray(expected)); +} + +TEST_F(TtsPlayerTest, RenderBusWithFramesFromEmptyAndPartialBuffers) { + auto bus = media::AudioBus::Create(/*channels=*/1, /*frames=*/5); + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, bus.get()); + + // The playback stream pushes an empty buffer to trigger a start event. + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + EXPECT_TRUE(backing_observer_.char_indices.empty()); + EXPECT_EQ(0, backing_observer_.end_count); + + // Renders a full frame from four empty and three partial buffers. + AddAudioBuffer(std::vector<float>({}), 0 /* char_index */, 1 /* status */); + AddAudioBuffer(std::vector<float>({0.1, 0.2, 0.3}), 1 /* char_index */, + 1 /* status */); + AddAudioBuffer(std::vector<float>({0.4}), 2 /* char_index */, 1 /* status */); + AddAudioBuffer(std::vector<float>({}), 3 /* char_index */, 1 /* status */); + AddAudioBuffer(std::vector<float>({}), 4 /* char_index */, 1 /* status */); + AddAudioBuffer(std::vector<float>({0.5}), 5 /* char_index */, 1 /* status */); + AddAudioBuffer(std::vector<float>({}), 6 /* char_index */, + 0 /* last buffer */); + int frames_rendered = + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, bus.get()); + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + ASSERT_EQ(6U, backing_observer_.char_indices.size()); + EXPECT_EQ(0, backing_observer_.char_indices[0]); + EXPECT_EQ(1, backing_observer_.char_indices[1]); + EXPECT_EQ(2, backing_observer_.char_indices[2]); + EXPECT_EQ(3, backing_observer_.char_indices[3]); + EXPECT_EQ(4, backing_observer_.char_indices[4]); + EXPECT_EQ(5, backing_observer_.char_indices[5]); + EXPECT_EQ(0, backing_observer_.end_count); + + EXPECT_EQ(5, frames_rendered); + std::vector<float> actual(bus->channel(0), bus->channel(0) + 5); + std::vector<float> expected = {0.1, 0.2, 0.3, 0.4, 0.5}; + EXPECT_THAT(actual, testing::ElementsAreArray(expected)); +} + +TEST_F(TtsPlayerTest, RenderMultiBusFromMultiBuffers) { + auto first_bus = media::AudioBus::Create(/*channels=*/1, /*frames=*/5); + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, first_bus.get()); + + // The playback stream pushes an empty buffer to trigger a start event. + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + EXPECT_TRUE(backing_observer_.char_indices.empty()); + EXPECT_EQ(0, backing_observer_.end_count); + + // Renders two busses of frames from two empty and two partial buffers. Wrap + // the buffers around the busses, so each bus holds as many frames as it can. + AddAudioBuffer(std::vector<float>({}), 0 /* char_index */, 1 /* status */); + AddAudioBuffer(std::vector<float>({0.1, 0.2, 0.3}), 1 /* char_index */, + 1 /* status */); + AddAudioBuffer(std::vector<float>({0.4, 0.5, 0.6, 0.7}), 2 /* char_index */, + 1 /* status */); + AddAudioBuffer(std::vector<float>({}), 3 /* char_index */, + 0 /* last buffer */); + + // Render five frames to first bus. + int frames_rendered = + tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, first_bus.get()); + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + ASSERT_EQ(2U, backing_observer_.char_indices.size()); + EXPECT_EQ(0, backing_observer_.char_indices[0]); + EXPECT_EQ(1, backing_observer_.char_indices[1]); + EXPECT_EQ(0, backing_observer_.end_count); + + EXPECT_EQ(5, frames_rendered); + std::vector<float> actual(first_bus->channel(0), first_bus->channel(0) + 5); + std::vector<float> expected = {0.1, 0.2, 0.3, 0.4, 0.5}; + EXPECT_THAT(actual, testing::ElementsAreArray(expected)); + + // Render two frames to second bus. + auto second_bus = media::AudioBus::Create(/*channels=*/1, /*frames=*/5); + frames_rendered = tts_player_.Render(base::Seconds(0), base::TimeTicks::Now(), + {} /* glitch info */, second_bus.get()); + observer_.FlushForTesting(); + EXPECT_EQ(0, backing_observer_.start_count); + ASSERT_EQ(3U, backing_observer_.char_indices.size()); + EXPECT_EQ(0, backing_observer_.char_indices[0]); + EXPECT_EQ(1, backing_observer_.char_indices[1]); + EXPECT_EQ(2, backing_observer_.char_indices[2]); + EXPECT_EQ(1, backing_observer_.end_count); + + EXPECT_EQ(2, frames_rendered); + actual = + std::vector<float>(second_bus->channel(0), second_bus->channel(0) + 2); + expected = {0.6, 0.7}; + EXPECT_THAT(actual, testing::ElementsAreArray(expected)); +} + +} // namespace +} // namespace tts +} // namespace chromeos
diff --git a/chromeos/services/tts/tts_service_unittest.cc b/chromeos/services/tts/tts_service_unittest.cc index aeacc64..4b9f375 100644 --- a/chromeos/services/tts/tts_service_unittest.cc +++ b/chromeos/services/tts/tts_service_unittest.cc
@@ -4,100 +4,21 @@ #include "chromeos/services/tts/tts_service.h" -#include "base/functional/bind.h" -#include "base/strings/utf_string_conversions.h" -#include "base/test/task_environment.h" #include "chromeos/services/tts/public/mojom/tts_service.mojom.h" -#include "media/base/audio_glitch_info.h" -#include "media/mojo/mojom/audio_data_pipe.mojom.h" -#include "media/mojo/mojom/audio_stream_factory.mojom.h" -#include "mojo/public/cpp/bindings/pending_receiver.h" -#include "mojo/public/cpp/bindings/pending_remote.h" -#include "mojo/public/cpp/bindings/receiver.h" -#include "mojo/public/cpp/bindings/remote.h" -#include "testing/gtest/include/gtest/gtest.h" - -using mojo::PendingReceiver; -using mojo::PendingRemote; +#include "chromeos/services/tts/tts_test_utils.h" namespace chromeos { namespace tts { namespace { -using CreateOutputStreamCallback = - base::OnceCallback<void(media::mojom::ReadWriteAudioDataPipePtr)>; -using CreateLoopbackStreamCallback = - base::OnceCallback<void(media::mojom::ReadOnlyAudioDataPipePtr)>; - -class MockAudioStreamFactory : public media::mojom::AudioStreamFactory { +// Tests the TtsService interface, the main interface that handles TTS +// requests from clients on ChromeOS. For more info, please see +// chromeos/services/tts/public/mojom/tts_service.mojom. +class TtsServiceTest : public TtsTestBase { public: - void CreateInputStream( - PendingReceiver<media::mojom::AudioInputStream> stream, - PendingRemote<media::mojom::AudioInputStreamClient> client, - PendingRemote<media::mojom::AudioInputStreamObserver> observer, - PendingRemote<media::mojom::AudioLog> log, - const std::string& device_id, - const media::AudioParameters& params, - uint32_t shared_memory_count, - bool enable_agc, - base::ReadOnlySharedMemoryRegion key_press_count_buffer, - media::mojom::AudioProcessingConfigPtr processing_config, - CreateInputStreamCallback callback) override {} - void AssociateInputAndOutputForAec( - const base::UnguessableToken& input_stream_id, - const std::string& output_device_id) override {} - - void CreateOutputStream( - PendingReceiver<media::mojom::AudioOutputStream> stream, - mojo::PendingAssociatedRemote<media::mojom::AudioOutputStreamObserver> - observer, - PendingRemote<media::mojom::AudioLog> log, - const std::string& device_id, - const media::AudioParameters& params, - const base::UnguessableToken& group_id, - CreateOutputStreamCallback callback) override { - audio_output_stream_ = std::move(stream); - std::move(callback).Run(nullptr); - } - void BindMuter( - mojo::PendingAssociatedReceiver<media::mojom::LocalMuter> receiver, - const base::UnguessableToken& group_id) override {} - - void CreateLoopbackStream( - PendingReceiver<media::mojom::AudioInputStream> receiver, - PendingRemote<media::mojom::AudioInputStreamClient> client, - PendingRemote<media::mojom::AudioInputStreamObserver> observer, - const media::AudioParameters& params, - uint32_t shared_memory_count, - const base::UnguessableToken& group_id, - CreateLoopbackStreamCallback callback) override {} - - PendingReceiver<media::mojom::AudioOutputStream> audio_output_stream_; -}; - -class MockTtsEventObserver : public mojom::TtsEventObserver { - public: - // mojom::TtsEventObserver: - void OnStart() override { start_count++; } - - void OnTimepoint(int32_t char_index) override { - char_indices.push_back(char_index); - } - - void OnEnd() override { end_count++; } - - void OnError() override {} - - int start_count = 0; - std::vector<int> char_indices; - int end_count = 0; -}; - -class TtsServiceTest : public testing::Test { - public: - TtsServiceTest() - : service_(remote_service_.BindNewPipeAndPassReceiver()), - audio_stream_factory_(&mock_audio_stream_factory_) {} + TtsServiceTest() : service_(remote_service_.BindNewPipeAndPassReceiver()) {} + TtsServiceTest(const TtsServiceTest&) = delete; + TtsServiceTest& operator=(const TtsServiceTest&) = delete; ~TtsServiceTest() override = default; protected: @@ -124,11 +45,8 @@ // testing::Test: void SetUp() override { service_.set_keep_process_alive_for_testing(true); } - base::test::TaskEnvironment task_environment_; mojo::Remote<mojom::TtsService> remote_service_; TtsService service_; - MockAudioStreamFactory mock_audio_stream_factory_; - mojo::Receiver<media::mojom::AudioStreamFactory> audio_stream_factory_; }; TEST_F(TtsServiceTest, DisconnectPlaybackStream) {
diff --git a/chromeos/services/tts/tts_test_utils.cc b/chromeos/services/tts/tts_test_utils.cc new file mode 100644 index 0000000..e079424 --- /dev/null +++ b/chromeos/services/tts/tts_test_utils.cc
@@ -0,0 +1,50 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/tts/tts_test_utils.h" + +namespace chromeos { +namespace tts { + +using CreateOutputStreamCallback = + base::OnceCallback<void(media::mojom::ReadWriteAudioDataPipePtr)>; +using CreateLoopbackStreamCallback = + base::OnceCallback<void(media::mojom::ReadOnlyAudioDataPipePtr)>; + +MockAudioStreamFactory::MockAudioStreamFactory() = default; +MockAudioStreamFactory::~MockAudioStreamFactory() = default; + +void MockAudioStreamFactory::CreateOutputStream( + mojo::PendingReceiver<media::mojom::AudioOutputStream> stream, + mojo::PendingAssociatedRemote<media::mojom::AudioOutputStreamObserver> + observer, + mojo::PendingRemote<media::mojom::AudioLog> log, + const std::string& device_id, + const media::AudioParameters& params, + const base::UnguessableToken& group_id, + CreateOutputStreamCallback callback) { + audio_output_stream_ = std::move(stream); + std::move(callback).Run(nullptr); +} + +MockTtsEventObserver::MockTtsEventObserver() = default; +MockTtsEventObserver::~MockTtsEventObserver() = default; +void MockTtsEventObserver::OnStart() { + start_count++; +} + +void MockTtsEventObserver::OnTimepoint(int32_t char_index) { + char_indices.push_back(char_index); +} + +void MockTtsEventObserver::OnEnd() { + end_count++; +} + +TtsTestBase::TtsTestBase() + : audio_stream_factory_(&mock_audio_stream_factory_) {} +TtsTestBase::~TtsTestBase() = default; + +} // namespace tts +} // namespace chromeos
diff --git a/chromeos/services/tts/tts_test_utils.h b/chromeos/services/tts/tts_test_utils.h new file mode 100644 index 0000000..8a79e4f --- /dev/null +++ b/chromeos/services/tts/tts_test_utils.h
@@ -0,0 +1,106 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_TTS_TTS_TEST_UTILS_H_ +#define CHROMEOS_SERVICES_TTS_TTS_TEST_UTILS_H_ + +#include "base/test/task_environment.h" +#include "chromeos/services/tts/public/mojom/tts_service.mojom.h" +#include "media/mojo/mojom/audio_data_pipe.mojom.h" +#include "media/mojo/mojom/audio_stream_factory.mojom.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { +namespace tts { + +// Mock implementation of the AudioStreamFactory mojo interface. +class MockAudioStreamFactory : public media::mojom::AudioStreamFactory { + public: + MockAudioStreamFactory(); + MockAudioStreamFactory(const MockAudioStreamFactory&) = delete; + MockAudioStreamFactory& operator=(const MockAudioStreamFactory&) = delete; + ~MockAudioStreamFactory() override; + + void CreateInputStream( + mojo::PendingReceiver<media::mojom::AudioInputStream> stream, + mojo::PendingRemote<media::mojom::AudioInputStreamClient> client, + mojo::PendingRemote<media::mojom::AudioInputStreamObserver> observer, + mojo::PendingRemote<media::mojom::AudioLog> log, + const std::string& device_id, + const media::AudioParameters& params, + uint32_t shared_memory_count, + bool enable_agc, + base::ReadOnlySharedMemoryRegion key_press_count_buffer, + media::mojom::AudioProcessingConfigPtr processing_config, + CreateInputStreamCallback callback) override {} + void AssociateInputAndOutputForAec( + const base::UnguessableToken& input_stream_id, + const std::string& output_device_id) override {} + void CreateOutputStream( + mojo::PendingReceiver<media::mojom::AudioOutputStream> stream, + mojo::PendingAssociatedRemote<media::mojom::AudioOutputStreamObserver> + observer, + mojo::PendingRemote<media::mojom::AudioLog> log, + const std::string& device_id, + const media::AudioParameters& params, + const base::UnguessableToken& group_id, + base::OnceCallback<void(media::mojom::ReadWriteAudioDataPipePtr)> + callback) override; + void BindMuter( + mojo::PendingAssociatedReceiver<media::mojom::LocalMuter> receiver, + const base::UnguessableToken& group_id) override {} + void CreateLoopbackStream( + mojo::PendingReceiver<media::mojom::AudioInputStream> receiver, + mojo::PendingRemote<media::mojom::AudioInputStreamClient> client, + mojo::PendingRemote<media::mojom::AudioInputStreamObserver> observer, + const media::AudioParameters& params, + uint32_t shared_memory_count, + const base::UnguessableToken& group_id, + base::OnceCallback<void(media::mojom::ReadOnlyAudioDataPipePtr)> callback) + override {} + + mojo::PendingReceiver<media::mojom::AudioOutputStream> audio_output_stream_; +}; + +// Mock implementation of the TtsEventObserver mojo interface. Tests can use +// this to check how many times TTS event callbacks have been invoked. +class MockTtsEventObserver : public mojom::TtsEventObserver { + public: + MockTtsEventObserver(); + MockTtsEventObserver(const MockTtsEventObserver&) = delete; + MockTtsEventObserver& operator=(const MockTtsEventObserver&) = delete; + ~MockTtsEventObserver() override; + + // mojom::TtsEventObserver: + void OnStart() override; + void OnTimepoint(int32_t char_index) override; + void OnEnd() override; + void OnError() override {} + + int start_count = 0; + std::vector<int> char_indices; + int end_count = 0; +}; + +// Base class for TTS service tests. Constructs a MockAudioStreamFactory and all +// its dependencies, and provides a TaskEnvironment. +class TtsTestBase : public testing::Test { + public: + TtsTestBase(); + TtsTestBase(const TtsTestBase&) = delete; + TtsTestBase& operator=(const TtsTestBase&) = delete; + ~TtsTestBase() override; + + base::test::TaskEnvironment task_environment_; + MockAudioStreamFactory mock_audio_stream_factory_; + mojo::Receiver<media::mojom::AudioStreamFactory> audio_stream_factory_; +}; + +} // namespace tts +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_TTS_TTS_TEST_UTILS_H_
diff --git a/clank b/clank index 20d5912..b108590 160000 --- a/clank +++ b/clank
@@ -1 +1 @@ -Subproject commit 20d5912ad65aa985382a75f6883945a2bb40c79a +Subproject commit b108590d728e5b8403a3e3c4c6957f037c13fdad
diff --git a/components/BUILD.gn b/components/BUILD.gn index 75a4fc67..aa8877f 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -494,7 +494,7 @@ ] } - if (is_linux || is_win || is_mac || is_android) { + if (is_linux || is_win || is_mac || is_android || is_ios) { deps += [ "//components/enterprise/idle:unit_tests" ] }
diff --git a/components/autofill/content/renderer/autofill_agent_browsertest.cc b/components/autofill/content/renderer/autofill_agent_browsertest.cc index 2a21bc0..c939e05 100644 --- a/components/autofill/content/renderer/autofill_agent_browsertest.cc +++ b/components/autofill/content/renderer/autofill_agent_browsertest.cc
@@ -234,7 +234,7 @@ TEST_F(AutofillAgentTestWithFeatures, FormsSeen_NewFormUnowned) { EXPECT_CALL(autofill_driver_, - FormsSeen(HasSingleElementWhich(HasFormId(0), HasNumFields(1), + FormsSeen(HasSingleElementWhich(HasFormId(0u), HasNumFields(1), HasNumChildFrames(0)), SizeIs(0))); LoadHTML(R"(<body> <input> </body>)");
diff --git a/components/autofill/core/browser/BUILD.gn b/components/autofill/core/browser/BUILD.gn index 47081d96..503bc20 100644 --- a/components/autofill/core/browser/BUILD.gn +++ b/components/autofill/core/browser/BUILD.gn
@@ -809,6 +809,8 @@ "mock_merchant_promo_code_manager.h", "mock_single_field_form_fill_router.cc", "mock_single_field_form_fill_router.h", + "payments/mock_test_payments_client.cc", + "payments/mock_test_payments_client.h", "payments/test/mock_mandatory_reauth_manager.cc", "payments/test/mock_mandatory_reauth_manager.h", "payments/test/test_credit_card_otp_authenticator.cc",
diff --git a/components/autofill/core/browser/autofill_client.cc b/components/autofill/core/browser/autofill_client.cc index 8a0ba67..31e1820d 100644 --- a/components/autofill/core/browser/autofill_client.cc +++ b/components/autofill/core/browser/autofill_client.cc
@@ -195,20 +195,6 @@ // This is overridden by platform subclasses. } -void AutofillClient::ConfirmSaveIbanLocally(const Iban& iban, - bool should_show_prompt, - SaveIbanPromptCallback callback) { - // This is overridden by platform subclasses. -} - -void AutofillClient::ConfirmUploadIbanToCloud( - const Iban& iban, - const LegalMessageLines& legal_message_lines, - bool should_show_prompt, - SaveIbanPromptCallback callback) { - // This is overridden by platform subclasses. -} - void AutofillClient::ShowWebauthnOfferDialog( WebauthnDialogCallback offer_dialog_callback) { // This is overridden by platform subclasses. @@ -282,6 +268,16 @@ // This is overridden by platform subclasses. } +void AutofillClient::ConfirmSaveIbanLocally(const Iban& iban, + bool should_show_prompt, + SaveIbanPromptCallback callback) {} + +void AutofillClient::ConfirmUploadIbanToCloud( + const Iban& iban, + const LegalMessageLines& legal_message_lines, + bool should_show_prompt, + SaveIbanPromptCallback callback) {} + void AutofillClient::CreditCardUploadCompleted(bool card_saved) { // This is overridden by platform subclasses. }
diff --git a/components/autofill/core/browser/autofill_client.h b/components/autofill/core/browser/autofill_client.h index 11d6811..d4edeb8 100644 --- a/components/autofill/core/browser/autofill_client.h +++ b/components/autofill/core/browser/autofill_client.h
@@ -630,22 +630,6 @@ const std::vector<MigratableCreditCard>& migratable_credit_cards, MigrationDeleteCardCallback delete_local_card_callback); - // Runs `callback` once the user makes a decision with respect to the - // offer-to-save prompt. On desktop, shows the offer-to-save bubble if - // `should_show_prompt` is true; otherwise only shows the omnibox icon. - virtual void ConfirmSaveIbanLocally(const Iban& iban, - bool should_show_prompt, - SaveIbanPromptCallback callback); - - // Runs `callback` once the user makes a decision with respect to the - // offer-to-upload prompt. On desktop, shows the offer-to-upload bubble if - // `should_show_prompt` is true; otherwise only shows the omnibox icon. - virtual void ConfirmUploadIbanToCloud( - const Iban& iban, - const LegalMessageLines& legal_message_lines, - bool should_show_prompt, - SaveIbanPromptCallback callback); - // TODO(crbug.com/991037): Find a way to merge these two functions. Shouldn't // use WebauthnDialogState as that state is a purely UI state (should not be // accessible for managers?), and some of the states |KInactive| may be @@ -723,6 +707,22 @@ SaveCreditCardOptions options, UploadSaveCardPromptCallback callback); + // Runs `callback` once the user makes a decision with respect to the + // offer-to-save prompt. On desktop, shows the offer-to-save bubble if + // `should_show_prompt` is true; otherwise only shows the omnibox icon. + virtual void ConfirmSaveIbanLocally(const Iban& iban, + bool should_show_prompt, + SaveIbanPromptCallback callback); + + // Runs `callback` once the user makes a decision with respect to the + // offer-to-upload prompt. On desktop, shows the offer-to-upload bubble if + // `should_show_prompt` is true; otherwise only shows the omnibox icon. + virtual void ConfirmUploadIbanToCloud( + const Iban& iban, + const LegalMessageLines& legal_message_lines, + bool should_show_prompt, + SaveIbanPromptCallback callback); + // Called after credit card upload is finished. Will show upload result to // users. |card_saved| indicates if the card is successfully saved. // TODO(crbug.com/932818): This function is overridden in iOS codebase.
diff --git a/components/autofill/core/browser/autofill_field.cc b/components/autofill/core/browser/autofill_field.cc index c7d89d7..89f8730f 100644 --- a/components/autofill/core/browser/autofill_field.cc +++ b/components/autofill/core/browser/autofill_field.cc
@@ -572,29 +572,4 @@ } } -DeprecatedFormControlType AutofillField::FormControlType() const { - // Keep in sync with https://html.spec.whatwg.org/#attr-input-type. - if (form_control_type == FormControlType::kInputText || - form_control_type == FormControlType::kInputSearch || - form_control_type == FormControlType::kInputTelephone || - form_control_type == FormControlType::kInputUrl || - form_control_type == FormControlType::kInputEmail || - form_control_type == FormControlType::kInputPassword || - form_control_type == FormControlType::kInputNumber) { - return DeprecatedFormControlType::kText; - } else if (form_control_type == FormControlType::kTextArea) { - return DeprecatedFormControlType::kTextarea; - } else if (form_control_type == FormControlType::kInputCheckbox) { - return DeprecatedFormControlType::kCheckbox; - } else if (form_control_type == FormControlType::kInputRadio) { - return DeprecatedFormControlType::kRadio; - } else if (form_control_type == FormControlType::kSelectOne) { - return DeprecatedFormControlType::kSelectOne; - } else if (form_control_type == FormControlType::kSelectList) { - return DeprecatedFormControlType::kSelectlist; - } else { - return DeprecatedFormControlType::kOther; - } -} - } // namespace autofill
diff --git a/components/autofill/core/browser/autofill_field.h b/components/autofill/core/browser/autofill_field.h index c46d020..b691695f 100644 --- a/components/autofill/core/browser/autofill_field.h +++ b/components/autofill/core/browser/autofill_field.h
@@ -32,18 +32,6 @@ typedef std::map<ServerFieldType, AutofillDataModel::ValidityState> ServerFieldTypeValidityStateMap; -enum class DeprecatedFormControlType { - kEmpty = 0, - kOther = 1, - kText = 2, - kTextarea = 3, - kCheckbox = 4, - kRadio = 5, - kSelectOne = 6, - kSelectlist = 7, - kMaxValue = kSelectlist, -}; - // Specifies if the Username First Flow vote has intermediate values. enum class IsMostRecentSingleUsernameCandidate { // Field is not part of Username First Flow. @@ -351,9 +339,6 @@ return autofill_source_profile_guid_; } - // Use FormFieldData::form_control_type instead (crbug.com/1482526). - enum DeprecatedFormControlType FormControlType() const; - private: explicit AutofillField(FieldSignature field_signature);
diff --git a/components/autofill/core/browser/form_data_importer.cc b/components/autofill/core/browser/form_data_importer.cc index 7e8215f..e1c225f2 100644 --- a/components/autofill/core/browser/form_data_importer.cc +++ b/components/autofill/core/browser/form_data_importer.cc
@@ -784,7 +784,7 @@ bool FormDataImporter::ProcessIbanImportCandidate( const Iban& iban_import_candidate) { - return iban_save_manager_->AttemptToOfferIbanLocalSave(iban_import_candidate); + return iban_save_manager_->AttemptToOfferSave(iban_import_candidate); } absl::optional<CreditCard> FormDataImporter::ExtractCreditCard(
diff --git a/components/autofill/core/browser/form_structure_rationalizer.cc b/components/autofill/core/browser/form_structure_rationalizer.cc index 5c4e3fb..91e69f7 100644 --- a/components/autofill/core/browser/form_structure_rationalizer.cc +++ b/components/autofill/core/browser/form_structure_rationalizer.cc
@@ -101,9 +101,8 @@ field->SetHtmlType(type, field->html_mode()); }; // Some of the following rationalization operates only on text fields. - bool is_text_field = - field->FormControlType() == DeprecatedFormControlType::kText || - field->FormControlType() == DeprecatedFormControlType::kTextarea; + bool is_text_field = field->IsTextInputElement() || + field->form_control_type == FormControlType::kTextArea; switch (field->html_type()) { case HtmlFieldType::kAdditionalName: if (!is_text_field) {
diff --git a/components/autofill/core/browser/metrics/autofill_metrics.cc b/components/autofill/core/browser/metrics/autofill_metrics.cc index 27493a9..b8b32d9 100644 --- a/components/autofill/core/browser/metrics/autofill_metrics.cc +++ b/components/autofill/core/browser/metrics/autofill_metrics.cc
@@ -2531,7 +2531,6 @@ .SetFieldSessionIdentifier( AutofillMetrics::FieldGlobalIdToHash64Bit(field.global_id())) .SetFieldSignature(HashFieldSignature(field.GetFieldSignature())) - .SetFormControlType(base::to_underlying(field.FormControlType())) .SetFormControlType2(base::to_underlying(field.form_control_type)) .SetAutocompleteState(base::to_underlying(autocomplete_state));
diff --git a/components/autofill/core/browser/metrics/autofill_metrics_unittest.cc b/components/autofill/core/browser/metrics/autofill_metrics_unittest.cc index c5fddbb..a719d27a 100644 --- a/components/autofill/core/browser/metrics/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/metrics/autofill_metrics_unittest.cc
@@ -8323,8 +8323,6 @@ form.fields[i].global_id())}, {UFIT::kFieldSignatureName, Collapse(CalculateFieldSignatureForField(form.fields[i])).value()}, - {UFIT::kFormControlTypeName, - base::to_underlying(DeprecatedFormControlType::kText)}, {UFIT::kFormControlType2Name, base::to_underlying(FormControlType::kInputText)}, {UFIT::kAutocompleteStateName, @@ -8442,8 +8440,6 @@ Collapse(CalculateFieldSignatureForField(form.fields[i])).value()}, {UFIT::kAutofillSkippedStatusName, DenseSet<FieldFillingSkipReason>{status}.data()[0]}, - {UFIT::kFormControlTypeName, - base::to_underlying(DeprecatedFormControlType::kText)}, {UFIT::kFormControlType2Name, base::to_underlying(FormControlType::kInputText)}, {UFIT::kAutocompleteStateName, @@ -8685,8 +8681,6 @@ {UFIT::kSectionIdName, 1}, {UFIT::kTypeChangedByRationalizationName, false}, {UFIT::kRankInFieldSignatureGroupName, 1}, - {UFIT::kFormControlTypeName, - base::to_underlying(DeprecatedFormControlType::kText)}, {UFIT::kFormControlType2Name, base::to_underlying(FormControlType::kInputText)}, {UFIT::kAutocompleteStateName, @@ -8847,8 +8841,6 @@ AutofillMetrics::FieldGlobalIdToHash64Bit(form.fields[i].global_id())}, {UFIT::kFieldSignatureName, Collapse(CalculateFieldSignatureForField(form.fields[i])).value()}, - {UFIT::kFormControlTypeName, - base::to_underlying(DeprecatedFormControlType::kText)}, {UFIT::kFormControlType2Name, base::to_underlying(FormControlType::kInputText)}, {UFIT::kAutocompleteStateName, @@ -9130,9 +9122,6 @@ auto entries = test_ukm_recorder().GetEntriesByName(UkmFieldInfoType::kEntryName); ASSERT_EQ(4u, entries.size()); - std::vector<DeprecatedFormControlType> deprecated_form_control_types = { - DeprecatedFormControlType::kText, DeprecatedFormControlType::kText, - DeprecatedFormControlType::kRadio, DeprecatedFormControlType::kRadio}; std::vector<FormControlType> form_control_types = { FormControlType::kInputText, FormControlType::kInputText, FormControlType::kInputRadio, FormControlType::kInputRadio}; @@ -9152,8 +9141,6 @@ {UFIT::kOverallTypeName, field_types[i]}, {UFIT::kSectionIdName, 1}, {UFIT::kTypeChangedByRationalizationName, false}, - {UFIT::kFormControlTypeName, - base::to_underlying(deprecated_form_control_types[i])}, {UFIT::kFormControlType2Name, base::to_underlying(form_control_types[i])}, {UFIT::kAutocompleteStateName, @@ -9257,15 +9244,6 @@ test_ukm_recorder().GetEntriesByName(UkmFieldInfoType::kEntryName); ASSERT_EQ(3u, entries.size()); test_ukm_recorder().ExpectEntryMetric( - entries[0], UkmFieldInfoType::kFormControlTypeName, - base::to_underlying(DeprecatedFormControlType::kText)); - test_ukm_recorder().ExpectEntryMetric( - entries[1], UkmFieldInfoType::kFormControlTypeName, - base::to_underlying(DeprecatedFormControlType::kText)); - test_ukm_recorder().ExpectEntryMetric( - entries[2], UkmFieldInfoType::kFormControlTypeName, - base::to_underlying(DeprecatedFormControlType::kSelectlist)); - test_ukm_recorder().ExpectEntryMetric( entries[0], UkmFieldInfoType::kFormControlType2Name, base::to_underlying(FormControlType::kInputText)); test_ukm_recorder().ExpectEntryMetric( @@ -9328,9 +9306,6 @@ auto entries = test_ukm_recorder().GetEntriesByName(UkmFieldInfoType::kEntryName); ASSERT_EQ(3u, entries.size()); - std::vector<DeprecatedFormControlType> deprecated_form_control_types = { - DeprecatedFormControlType::kText, DeprecatedFormControlType::kText, - DeprecatedFormControlType::kText}; std::vector<FormControlType> form_control_types = { FormControlType::kInputText, FormControlType::kInputText, FormControlType::kInputText}; @@ -9356,8 +9331,6 @@ {UFIT::kOverallTypeName, field_types[i]}, {UFIT::kSectionIdName, 1}, {UFIT::kTypeChangedByRationalizationName, false}, - {UFIT::kFormControlTypeName, - base::to_underlying(deprecated_form_control_types[i])}, {UFIT::kFormControlType2Name, base::to_underlying(form_control_types[i])}, {UFIT::kAutocompleteStateName, base::to_underlying(AutofillMetrics::AutocompleteState::kNone)},
diff --git a/components/autofill/core/browser/payments/credit_card_access_manager.cc b/components/autofill/core/browser/payments/credit_card_access_manager.cc index 7bf2ae16..5bb8baa 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager.cc +++ b/components/autofill/core/browser/payments/credit_card_access_manager.cc
@@ -1158,7 +1158,7 @@ // `StartDeviceAuthenticationForFilling()` will asynchronously trigger // the re-authentication flow, so we should avoid calling `Reset()` // until the re-authentication flow is complete. - StartDeviceAuthenticationForFilling(accessor_, card_.get(), /*cvc=*/u""); + StartDeviceAuthenticationForFilling(accessor_, card_.get(), card_->cvc()); } else { // Fill immediately if local card or full server card, as we do not need to // authenticate the user.
diff --git a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc index 99ee8fa4..4621bdb 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc
@@ -719,6 +719,7 @@ base::HistogramTester histogram_tester; CreateLocalCard(kTestGUID, kTestNumber); CreditCard* card = personal_data().GetCreditCardByGUID(kTestGUID); + card->set_cvc(kTestCvc16); credit_card_access_manager().PrepareToFetchCreditCard(); WaitForCallbacks(); @@ -735,7 +736,8 @@ EXPECT_TRUE(accessor_->number().empty()); } else { EXPECT_EQ(accessor_->result(), CreditCardFetchResult::kSuccess); - EXPECT_EQ(kTestNumber16, accessor_->number()); + EXPECT_EQ(accessor_->number(), kTestNumber16); + EXPECT_EQ(accessor_->cvc(), kTestCvc16); } std::string histogram_name = "Autofill.PaymentMethods.CheckoutFlow.ReauthUsage.LocalCard";
diff --git a/components/autofill/core/browser/payments/iban_save_manager.cc b/components/autofill/core/browser/payments/iban_save_manager.cc index 37ee1d0..b4c8146 100644 --- a/components/autofill/core/browser/payments/iban_save_manager.cc +++ b/components/autofill/core/browser/payments/iban_save_manager.cc
@@ -73,13 +73,65 @@ return true; } -bool IbanSaveManager::AttemptToOfferIbanLocalSave( - const Iban& iban_import_candidate) { +bool IbanSaveManager::AttemptToOfferSave(const Iban& import_candidate) { #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) - if (!ShouldOfferLocalSave(iban_import_candidate)) { - return false; + switch (DetermineHowToSaveIban(import_candidate)) { + case TypeOfOfferToSave::kDoNotOfferToSave: + return false; + case TypeOfOfferToSave::kOfferServerSave: + return AttemptToOfferUploadSave(import_candidate); + case TypeOfOfferToSave::kOfferLocalSave: + return AttemptToOfferLocalSave(import_candidate); } - iban_save_candidate_ = iban_import_candidate; +#else + // IBAN save prompts do not currently exist on mobile. + return false; +#endif +} + +IbanSaveManager::TypeOfOfferToSave IbanSaveManager::DetermineHowToSaveIban( + const Iban& import_candidate) const { + // Server IBANs are ideal and should not offer to resave to the server or + // locally. + if (MatchesExistingServerIban(import_candidate)) { + return TypeOfOfferToSave::kDoNotOfferToSave; + } + + // Trigger server save if available, otherwise local save as long as the IBAN + // isn't already saved locally. + if (base::FeatureList::IsEnabled(features::kAutofillEnableServerIban) && + IsIbanUploadEnabled(client_->GetSyncService())) { + return TypeOfOfferToSave::kOfferServerSave; + } else if (!MatchesExistingLocalIban(import_candidate)) { + return TypeOfOfferToSave::kOfferLocalSave; + } + return TypeOfOfferToSave::kDoNotOfferToSave; +} + +bool IbanSaveManager::MatchesExistingLocalIban( + const Iban& import_candidate) const { + return base::ranges::any_of( + personal_data_manager_->GetLocalIbans(), [&](const Iban* iban) { + return iban->value() == import_candidate.value(); + }); +} + +bool IbanSaveManager::MatchesExistingServerIban( + const Iban& import_candidate) const { + return std::ranges::any_of( + personal_data_manager_->GetServerIbans(), + [&import_candidate](const auto& iban) { + return iban->MatchesPrefixSuffixAndLength(import_candidate); + }); +} + +bool IbanSaveManager::AttemptToOfferLocalSave(const Iban& import_candidate) { + iban_save_candidate_ = import_candidate; + + if (observer_for_testing_) { + observer_for_testing_->OnOfferLocalSave(); + } + // If the max strikes limit has been reached, do not show the IBAN save // prompt. bool show_save_prompt = @@ -90,50 +142,14 @@ AutofillMetrics::SaveTypeMetric::LOCAL); } - if (observer_for_testing_) { - observer_for_testing_->OnOfferLocalSave(); - } - - // If `show_save_prompt`'s value is false, desktop builds will still offer - // save in the omnibox without popping-up the bubble. client_->ConfirmSaveIbanLocally( iban_save_candidate_, show_save_prompt, base::BindOnce(&IbanSaveManager::OnUserDidDecideOnLocalSave, weak_ptr_factory_.GetWeakPtr())); return show_save_prompt; -#else - // IBAN save prompts do not currently exist on mobile. - return false; -#endif } -bool IbanSaveManager::ShouldOfferLocalSave( - const Iban& iban_import_candidate) const { - // Only offer to save new IBANs. Users can go to the payment methods settings - // page to update existing IBANs if desired. - return base::ranges::none_of( - personal_data_manager_->GetLocalIbans(), [&](const auto& iban) { - return iban->value() == iban_import_candidate.value(); - }); -} - -bool IbanSaveManager::ShouldOfferUploadSave( - const Iban& iban_import_candidate) const { - if (!base::FeatureList::IsEnabled(features::kAutofillEnableServerIban) || - !IsIbanUploadEnabled(client_->GetSyncService())) { - return false; - } - - // Offer server save for this IBAN if it doesn't already match an existing - // server IBAN. - return std::ranges::none_of( - personal_data_manager_->GetServerIbans(), - [&iban_import_candidate](const auto& iban) { - return iban->MatchesPrefixSuffixAndLength(iban_import_candidate); - }); -} - -bool IbanSaveManager::OfferUploadSave(const Iban& import_candidate) { +bool IbanSaveManager::AttemptToOfferUploadSave(const Iban& import_candidate) { iban_save_candidate_ = import_candidate; // If the max strikes limit has been reached, do not show the save prompt. bool show_save_prompt = @@ -213,7 +229,9 @@ } // If the upload details request failed, attempt to offer local save. - AttemptToOfferIbanLocalSave(iban_save_candidate_); + if (!MatchesExistingLocalIban(iban_save_candidate_)) { + AttemptToOfferLocalSave(iban_save_candidate_); + } } } // namespace autofill
diff --git a/components/autofill/core/browser/payments/iban_save_manager.h b/components/autofill/core/browser/payments/iban_save_manager.h index f4e5b70..dc97c851 100644 --- a/components/autofill/core/browser/payments/iban_save_manager.h +++ b/components/autofill/core/browser/payments/iban_save_manager.h
@@ -30,6 +30,14 @@ virtual void OnDeclineSaveIbanComplete() {} }; + // The type of save that should be offered for the IBAN candidate. + enum class TypeOfOfferToSave { + kDoNotOfferToSave = 0, + kOfferServerSave = 1, + kOfferLocalSave = 2, + kMaxValue = kOfferLocalSave + }; + IbanSaveManager(PersonalDataManager* personal_data_manager, AutofillClient* client); IbanSaveManager(const IbanSaveManager&) = delete; @@ -43,16 +51,14 @@ // requires the appropriate flags and user settings to be set. static bool IsIbanUploadEnabled(const syncer::SyncService* sync_service); - // Checks that all requirements for offering local IBAN save are fulfilled. - // Returns true if the save prompt was shown, and false otherwise. - // Note that on desktop if this returns false, the show save prompt will not - // be popped up but the omnibox icon still will be shown so the user can - // trigger the save prompt manually. - // TODO(b/296651801): Refactor to make only an `AttemptToOfferIbanSave` - // method public, so that FormDataImporter remains unaware of the internal - // logic managed by this class. Once possible, add `[[nodiscard]]` to the - // method exposed to FormDataImporter. - bool AttemptToOfferIbanLocalSave(const Iban& iban_import_candidate); + // Checks that all requirements for offering local/server IBAN save are + // fulfilled, and if they are, offers save. Returns true if a save prompt was + // likely shown, and false if a save prompt was definitely not shown. + // Note that on Clank, the save prompt is *only* shown if this returns true. + // While on desktop if this returns false, the show save prompt will not be + // popped up but the omnibox icon still will be shown so the user can trigger + // the save prompt manually. + [[nodiscard]] bool AttemptToOfferSave(const Iban& import_candidate); void OnUserDidDecideOnLocalSaveForTesting( AutofillClient::SaveIbanOfferUserDecision user_decision, @@ -69,31 +75,37 @@ observer_for_testing_ = observer; } - bool ShouldOfferUploadSaveForTesting( - const Iban& iban_import_candidate) const { - return ShouldOfferUploadSave(iban_import_candidate); + bool AttemptToOfferLocalSaveForTesting(const Iban& iban) { + return AttemptToOfferLocalSave(iban); } - bool OfferUploadSaveForTesting(const Iban& iban) { - return OfferUploadSave(iban); + bool AttemptToOfferUploadSaveForTesting(const Iban& iban) { + return AttemptToOfferUploadSave(iban); + } + + TypeOfOfferToSave DetermineHowToSaveIbanForTesting( + const Iban& import_candidate) const { + return DetermineHowToSaveIban(import_candidate); } bool HasContextTokenForTesting() const { return !context_token_.empty(); } private: - // Returns true if local save should be offered for the - // `iban_import_candidate`. - bool ShouldOfferLocalSave(const Iban& iban_import_candidate) const; + // Returns whether the given `import_candidate` should be offered to be saved + // to GPay, locally, or not at all. + TypeOfOfferToSave DetermineHowToSaveIban(const Iban& import_candidate) const; - // Returns true if upload save should be offered for the - // `iban_import_candidate`. - bool ShouldOfferUploadSave(const Iban& iban_import_candidate) const; + bool MatchesExistingLocalIban(const Iban& import_candidate) const; + bool MatchesExistingServerIban(const Iban& import_candidate) const; + + // Returns true if the local save prompt was shown, and false otherwise. + bool AttemptToOfferLocalSave(const Iban& import_candidate); // Asynchronously attempts to offer an upload save prompt to the user. Will // fall back to a local save prompt if unable to offer server save. // Returns true if there will likely be a save prompt shown, and false if we // will definitely not be showing one. - bool OfferUploadSave(const Iban& import_candidate); + bool AttemptToOfferUploadSave(const Iban& import_candidate); // Returns the IbanSaveStrikeDatabase for `client_`; IbanSaveStrikeDatabase* GetIbanSaveStrikeDatabase();
diff --git a/components/autofill/core/browser/payments/iban_save_manager_unittest.cc b/components/autofill/core/browser/payments/iban_save_manager_unittest.cc index 7e8c883..4ee70ea 100644 --- a/components/autofill/core/browser/payments/iban_save_manager_unittest.cc +++ b/components/autofill/core/browser/payments/iban_save_manager_unittest.cc
@@ -11,6 +11,7 @@ #include "base/uuid.h" #include "components/autofill/core/browser/autofill_test_utils.h" #include "components/autofill/core/browser/data_model/iban.h" +#include "components/autofill/core/browser/payments/mock_test_payments_client.h" #include "components/autofill/core/browser/payments/payments_client.h" #include "components/autofill/core/browser/strike_databases/payments/iban_save_strike_database.h" #include "components/autofill/core/browser/test_autofill_client.h" @@ -52,27 +53,6 @@ } // namespace -class MockTestPaymentsClient : public payments::TestPaymentsClient { - public: - MockTestPaymentsClient() - : payments::TestPaymentsClient( - /*url_loader_factory=*/nullptr, - /*identity_manager=*/nullptr, - /*personal_data_manager=*/nullptr) {} - MockTestPaymentsClient(const MockTestPaymentsClient&) = delete; - MockTestPaymentsClient& operator=(const MockTestPaymentsClient&) = delete; - - MOCK_METHOD(void, - GetIbanUploadDetails, - (const std::string&, - int64_t, - int, - (base::OnceCallback<void(AutofillClient::PaymentsRpcResult, - const std::u16string&, - std::unique_ptr<base::Value::Dict>)>)), - (override)); -}; - class IbanSaveManagerTest : public testing::Test { public: IbanSaveManagerTest() { @@ -150,22 +130,20 @@ features::kAutofillEnableServerIban}; }; -TEST_F(IbanSaveManagerTest, - AttemptToOfferIbanLocalSave_NewIban_ShouldOfferSave) { +TEST_F(IbanSaveManagerTest, AttemptToOfferSave_NewIban_ShouldOfferSave) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); - EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferSave(iban)); } -TEST_F(IbanSaveManagerTest, - AttemptToOfferIbanLocalSave_LocalIban_ShouldNotOfferLocalSave) { +TEST_F(IbanSaveManagerTest, AttemptToOfferSave_LocalIban_ShouldOfferSave) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); personal_data().AddIban(iban); Iban another_iban; another_iban.set_value(iban.value()); - EXPECT_FALSE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferSave(iban)); } // Test that new IBANs should not be offered upload save to Google Payments if @@ -175,14 +153,16 @@ feature_list_.InitAndDisableFeature(features::kAutofillEnableServerIban); Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); - EXPECT_FALSE(GetIbanSaveManager().ShouldOfferUploadSaveForTesting(iban)); + EXPECT_EQ(IbanSaveManager::TypeOfOfferToSave::kOfferLocalSave, + GetIbanSaveManager().DetermineHowToSaveIbanForTesting(iban)); } // Test that new IBANs should be offered upload save to Google Payments. TEST_F(IbanSaveManagerTest, ShouldOfferUploadSave_NewIban) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); - EXPECT_TRUE(GetIbanSaveManager().ShouldOfferUploadSaveForTesting(iban)); + EXPECT_EQ(IbanSaveManager::TypeOfOfferToSave::kOfferServerSave, + GetIbanSaveManager().DetermineHowToSaveIbanForTesting(iban)); } // Test that an existing local IBAN should still be offered upload save to @@ -194,11 +174,11 @@ Iban another_iban; another_iban.set_value(iban.value()); - EXPECT_TRUE(GetIbanSaveManager().ShouldOfferUploadSaveForTesting(iban)); + EXPECT_EQ(IbanSaveManager::TypeOfOfferToSave::kOfferServerSave, + GetIbanSaveManager().DetermineHowToSaveIbanForTesting(iban)); } -// Test that an existing server IBAN should not be offered upload save to Google -// Payments. +// Test that an existing server IBAN should not be offered save at all. TEST_F(IbanSaveManagerTest, ShouldOfferUploadSave_ServerIban) { Iban iban(Iban::InstrumentId("1234567")); iban.set_prefix(u"DE91"); @@ -210,13 +190,14 @@ // above server IBAN. Iban another_iban; another_iban.set_value(u"DE91100000000123456789"); - EXPECT_FALSE(GetIbanSaveManager().ShouldOfferUploadSaveForTesting(iban)); + EXPECT_EQ(IbanSaveManager::TypeOfOfferToSave::kDoNotOfferToSave, + GetIbanSaveManager().DetermineHowToSaveIbanForTesting(iban)); } TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Accepted) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); - EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); GetIbanSaveManager().OnUserDidDecideOnLocalSaveForTesting( AutofillClient::SaveIbanOfferUserDecision::kAccepted, @@ -234,7 +215,7 @@ TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Declined) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); - EXPECT_TRUE(iban_save_manager_->AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(iban_save_manager_->AttemptToOfferLocalSaveForTesting(iban)); EXPECT_TRUE(personal_data().GetLocalIbans().empty()); GetIbanSaveManager().OnUserDidDecideOnLocalSaveForTesting( @@ -247,7 +228,7 @@ TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Ignored) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); - EXPECT_TRUE(iban_save_manager_->AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(iban_save_manager_->AttemptToOfferLocalSaveForTesting(iban)); EXPECT_TRUE(personal_data().GetLocalIbans().empty()); GetIbanSaveManager().OnUserDidDecideOnLocalSaveForTesting( @@ -269,7 +250,7 @@ // Verify `kIbanValue` has been successfully added to the strike database. EXPECT_EQ(1, iban_save_strike_database.GetStrikes(partial_iban_hash)); - EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); } TEST_F(IbanSaveManagerTest, LocallySaveIban_MaxStrikesShouldNotOfferToSave) { @@ -284,7 +265,7 @@ EXPECT_EQ(iban_save_strike_database.GetMaxStrikesLimit(), iban_save_strike_database.GetStrikes(partial_iban_hash)); - EXPECT_FALSE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_FALSE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); } TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Accepted_ClearsStrikes) { @@ -294,7 +275,7 @@ IbanSaveManager::GetPartialIbanHashString( base::UTF16ToUTF8(iban.value())); - EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); IbanSaveStrikeDatabase iban_save_strike_database(strike_database_); iban_save_strike_database.AddStrike(partial_iban_hash); @@ -318,7 +299,7 @@ IbanSaveManager::GetPartialIbanHashString( base::UTF16ToUTF8(iban.value())); - EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); IbanSaveStrikeDatabase iban_save_strike_database(strike_database_); @@ -340,7 +321,7 @@ IbanSaveManager::GetPartialIbanHashString( base::UTF16ToUTF8(iban.value())); - EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); IbanSaveStrikeDatabase iban_save_strike_database(strike_database_); @@ -355,10 +336,10 @@ EXPECT_EQ(1, iban_save_strike_database.GetStrikes(partial_iban_hash)); } -TEST_F(IbanSaveManagerTest, LocallySaveIban_AttemptToOfferIbanLocalSave) { +TEST_F(IbanSaveManagerTest, LocallySaveIban_OfferIbanSave) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); - EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); EXPECT_TRUE(autofill_client_.ConfirmSaveIbanLocallyWasCalled()); } @@ -377,7 +358,7 @@ iban_save_strike_database.GetStrikes( IbanSaveManager::GetPartialIbanHashString( test::GetStrippedValue(test::kIbanValue)))); - EXPECT_FALSE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_FALSE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); histogram_tester.ExpectBucketCount( "Autofill.StrikeDatabase.IbanSaveNotOfferedDueToMaxStrikes", AutofillMetrics::SaveTypeMetric::LOCAL, 1); @@ -391,7 +372,7 @@ iban_save_strike_database.AddStrike(IbanSaveManager::GetPartialIbanHashString( test::GetStrippedValue(test::kIbanValue))); - EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferIbanLocalSave(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferLocalSaveForTesting(iban)); GetIbanSaveManager().OnUserDidDecideOnLocalSaveForTesting( AutofillClient::SaveIbanOfferUserDecision::kAccepted, u"My teacher's IBAN"); @@ -441,7 +422,7 @@ iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); SetUpGetIbanUploadDetailsResponse(/*is_successful=*/true); - EXPECT_TRUE(GetIbanSaveManager().OfferUploadSaveForTesting(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferUploadSaveForTesting(iban)); EXPECT_TRUE(GetIbanSaveManager().HasContextTokenForTesting()); EXPECT_FALSE(autofill_client_.ConfirmSaveIbanLocallyWasCalled()); } @@ -450,13 +431,13 @@ // In this case, local save should be offered because the extracted IBAN is a // new IBAN. TEST_F(IbanSaveManagerTest, - OfferUploadSave_NewIban_Failure_ThenOfferLocalSave) { + OfferUploadSave_NewIban_Failure_ThenAttemptToOfferLocalSave) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); SetUpGetIbanUploadDetailsResponse(/*is_successful=*/false); - EXPECT_TRUE(GetIbanSaveManager().OfferUploadSaveForTesting(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferUploadSaveForTesting(iban)); EXPECT_FALSE(GetIbanSaveManager().HasContextTokenForTesting()); EXPECT_TRUE(autofill_client_.ConfirmSaveIbanLocallyWasCalled()); } @@ -464,15 +445,16 @@ // Test that upload save should not be offered when the preflight call succeeded // but the `legal_message` is not parsed successfully. In this case, local save // should be offered because the extracted IBAN is a new IBAN. -TEST_F(IbanSaveManagerTest, - OfferUploadSave_NewIban_InvalidLegalMessage_ThenOfferLocalSave) { +TEST_F( + IbanSaveManagerTest, + OfferUploadSave_NewIban_InvalidLegalMessage_ThenAttemptToOfferLocalSave) { Iban iban; iban.set_value(base::UTF8ToUTF16(std::string(test::kIbanValue))); SetUpGetIbanUploadDetailsResponse(/*is_successful=*/true, /*includes_invalid_legal_message=*/true); - EXPECT_TRUE(GetIbanSaveManager().OfferUploadSaveForTesting(iban)); + EXPECT_TRUE(GetIbanSaveManager().AttemptToOfferUploadSaveForTesting(iban)); EXPECT_FALSE(GetIbanSaveManager().HasContextTokenForTesting()); EXPECT_TRUE(autofill_client_.ConfirmSaveIbanLocallyWasCalled()); } @@ -488,7 +470,8 @@ SetUpGetIbanUploadDetailsResponse(/*is_successful=*/true); - EXPECT_TRUE(GetIbanSaveManager().OfferUploadSaveForTesting(another_iban)); + EXPECT_TRUE( + GetIbanSaveManager().AttemptToOfferUploadSaveForTesting(another_iban)); EXPECT_TRUE(GetIbanSaveManager().HasContextTokenForTesting()); EXPECT_FALSE(autofill_client_.ConfirmSaveIbanLocallyWasCalled()); } @@ -506,7 +489,8 @@ SetUpGetIbanUploadDetailsResponse(/*is_successful=*/false); - EXPECT_TRUE(GetIbanSaveManager().OfferUploadSaveForTesting(another_iban)); + EXPECT_TRUE( + GetIbanSaveManager().AttemptToOfferUploadSaveForTesting(another_iban)); EXPECT_FALSE(GetIbanSaveManager().HasContextTokenForTesting()); EXPECT_FALSE(autofill_client_.ConfirmSaveIbanLocallyWasCalled()); }
diff --git a/components/autofill/core/browser/payments/mock_test_payments_client.cc b/components/autofill/core/browser/payments/mock_test_payments_client.cc new file mode 100644 index 0000000..a2a731b5 --- /dev/null +++ b/components/autofill/core/browser/payments/mock_test_payments_client.cc
@@ -0,0 +1,17 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/autofill/core/browser/payments/mock_test_payments_client.h" + +namespace autofill { + +MockTestPaymentsClient::MockTestPaymentsClient() + : payments::TestPaymentsClient( + /*url_loader_factory=*/nullptr, + /*identity_manager=*/nullptr, + /*personal_data_manager=*/nullptr) {} + +MockTestPaymentsClient::~MockTestPaymentsClient() = default; + +} // namespace autofill
diff --git a/components/autofill/core/browser/payments/mock_test_payments_client.h b/components/autofill/core/browser/payments/mock_test_payments_client.h new file mode 100644 index 0000000..5043b968 --- /dev/null +++ b/components/autofill/core/browser/payments/mock_test_payments_client.h
@@ -0,0 +1,34 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_MOCK_TEST_PAYMENTS_CLIENT_H_ +#define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_MOCK_TEST_PAYMENTS_CLIENT_H_ + +#include "components/autofill/core/browser/payments/payments_client.h" +#include "components/autofill/core/browser/payments/test_payments_client.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace autofill { + +class MockTestPaymentsClient : public payments::TestPaymentsClient { + public: + MockTestPaymentsClient(); + MockTestPaymentsClient(const MockTestPaymentsClient&) = delete; + MockTestPaymentsClient& operator=(const MockTestPaymentsClient&) = delete; + ~MockTestPaymentsClient() override; + + MOCK_METHOD(void, + GetIbanUploadDetails, + (const std::string&, + int64_t, + int, + (base::OnceCallback<void(AutofillClient::PaymentsRpcResult, + const std::u16string&, + std::unique_ptr<base::Value::Dict>)>)), + (override)); +}; + +} // namespace autofill + +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_MOCK_TEST_PAYMENTS_CLIENT_H_
diff --git a/components/autofill/core/browser/payments/payments_client.h b/components/autofill/core/browser/payments/payments_client.h index c3aa31b..a48110c 100644 --- a/components/autofill/core/browser/payments/payments_client.h +++ b/components/autofill/core/browser/payments/payments_client.h
@@ -486,9 +486,10 @@ // Triggers a request to the Payments server to unmask an IBAN. `callback` is // the callback function that is triggered when a response is received from // the server and the full IBAN value is returned via callback. - void UnmaskIban(const UnmaskIbanRequestDetails& request_details, - base::OnceCallback<void(AutofillClient::PaymentsRpcResult, - const std::u16string&)> callback); + void UnmaskIban( + const UnmaskIbanRequestDetails& request_details, + base::OnceCallback<void(AutofillClient::PaymentsRpcResult, + const std::u16string&)> callback); // Opts-in or opts-out the user to use FIDO authentication for card unmasking // on this device.
diff --git a/components/autofill/core/browser/test_personal_data_manager.cc b/components/autofill/core/browser/test_personal_data_manager.cc index 552ef02..249f308 100644 --- a/components/autofill/core/browser/test_personal_data_manager.cc +++ b/components/autofill/core/browser/test_personal_data_manager.cc
@@ -384,6 +384,7 @@ } void TestPersonalDataManager::AddServerIban(const Iban& iban) { + CHECK(iban.value().empty()); server_ibans_.push_back(std::make_unique<Iban>(iban)); NotifyPersonalDataObserver(); }
diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp index 83d1770da..d29672e 100644 --- a/components/autofill_payments_strings.grdp +++ b/components/autofill_payments_strings.grdp
@@ -957,6 +957,16 @@ Cancel </message> + <!-- Autofill credit card delete dialog --> + <if expr="is_android"> + <message name="IDS_AUTOFILL_CREDIT_CARD_DELETE_CONFIRMATION_TITLE" desc="Title for the confirmation dialog displayed when the user clicks on the delete button while editing card information." formatter_data="android_java"> + Delete card + </message> + <message name="IDS_AUTOFILL_CREDIT_CARD_DELETE_CONFIRMATION_DESCRIPTION" desc="Description for the confirmation dialog displayed when the user clicks on the delete button while editing card information." formatter_data="android_java"> + This payment method will be deleted from this device + </message> + </if> + <!-- Autofill credit card preferences --> <if expr="is_android"> <message name="IDS_AUTOFILL_EDIT_CREDIT_CARD" desc="Button that allows the user to edit a card that can be automatically filled into web page forms. This can be either credit, debit, or prepaid card. [CHAR_LIMIT=32]" formatter_data="android_java">
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_CREDIT_CARD_DELETE_CONFIRMATION_DESCRIPTION.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_CREDIT_CARD_DELETE_CONFIRMATION_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..8eccaa5 --- /dev/null +++ b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_CREDIT_CARD_DELETE_CONFIRMATION_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +d2dc62ba3b34f4901fdaf0e67c5c36aef1dca3c6 \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_CREDIT_CARD_DELETE_CONFIRMATION_TITLE.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_CREDIT_CARD_DELETE_CONFIRMATION_TITLE.png.sha1 new file mode 100644 index 0000000..8eccaa5 --- /dev/null +++ b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_CREDIT_CARD_DELETE_CONFIRMATION_TITLE.png.sha1
@@ -0,0 +1 @@ +d2dc62ba3b34f4901fdaf0e67c5c36aef1dca3c6 \ No newline at end of file
diff --git a/components/browser_ui/styles/android/java/res/values/themes.xml b/components/browser_ui/styles/android/java/res/values/themes.xml index f0f02fc..af05442c 100644 --- a/components/browser_ui/styles/android/java/res/values/themes.xml +++ b/components/browser_ui/styles/android/java/res/values/themes.xml
@@ -74,5 +74,6 @@ <item name="colorOnPrimary">@color/baseline_primary_20</item> <item name="colorPrimaryContainer">@color/baseline_primary_30</item> <item name="colorOutline">@color/baseline_neutral_variant_60</item> + <item name="colorSurfaceContainerHighest">@color/default_bg_color_dark_elev_5_baseline</item> </style> </resources>
diff --git a/components/browser_ui/theme/android/java/res/values/themes.xml b/components/browser_ui/theme/android/java/res/values/themes.xml index d1e58f19..5988e099f 100644 --- a/components/browser_ui/theme/android/java/res/values/themes.xml +++ b/components/browser_ui/theme/android/java/res/values/themes.xml
@@ -26,6 +26,7 @@ <item name="colorSurface">@color/baseline_neutral_100</item> <item name="colorOnSurface">@color/baseline_neutral_10</item> <item name="colorSurfaceVariant">@color/baseline_neutral_variant_90</item> + <item name="colorSurfaceContainerHighest">@color/default_bg_color_elev_5_baseline</item> <item name="colorOnSurfaceVariant">@color/baseline_neutral_variant_30</item> <item name="colorOnSurfaceInverse">@color/baseline_neutral_95</item> <item name="colorOutline">@color/baseline_neutral_variant_50</item> @@ -127,6 +128,7 @@ <item name="colorSurfaceVariant">@color/baseline_neutral_variant_90</item> <item name="colorOnSurfaceVariant">@color/baseline_neutral_variant_30</item> <item name="colorOnSurfaceInverse">@color/baseline_neutral_95</item> + <item name="colorSurfaceContainerHighest">@color/default_bg_color_elev_5_baseline</item> <item name="colorOutline">@color/baseline_neutral_variant_50</item> <item name="colorError">@color/baseline_error_40</item> @@ -191,6 +193,7 @@ <item name="colorSurface">@color/baseline_neutral_100</item> <item name="colorOnSurface">@color/baseline_neutral_10</item> <item name="colorSurfaceVariant">@color/baseline_neutral_variant_90</item> + <item name="colorSurfaceContainerHighest">@color/default_bg_color_elev_5_baseline</item> <item name="colorOnSurfaceVariant">@color/baseline_neutral_variant_30</item> <item name="colorOnSurfaceInverse">@color/baseline_neutral_95</item> <item name="colorOutline">@color/baseline_neutral_variant_50</item>
diff --git a/components/compose/core/browser/compose_features.cc b/components/compose/core/browser/compose_features.cc index 1f807d55..10dabf0 100644 --- a/components/compose/core/browser/compose_features.cc +++ b/components/compose/core/browser/compose_features.cc
@@ -18,10 +18,6 @@ "ComposeNudge", base::FEATURE_DISABLED_BY_DEFAULT); -BASE_FEATURE(kFillMultiLine, - "FillMultiLine", - base::FEATURE_DISABLED_BY_DEFAULT); - BASE_FEATURE(kEnableComposeLanguageBypass, "ComposeLanguageBypass", base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/components/compose/core/browser/compose_features.h b/components/compose/core/browser/compose_features.h index e74ef6f..e97a019 100644 --- a/components/compose/core/browser/compose_features.h +++ b/components/compose/core/browser/compose_features.h
@@ -22,9 +22,6 @@ // Controls whether or not the Nudge UI entrypoint is enabled for Compose. BASE_DECLARE_FEATURE(kEnableComposeNudge); -// chrome:flags switch for the multi line fill feature. -BASE_DECLARE_FEATURE(kFillMultiLine); - // Controls whether the language check is bypassed for Compose. BASE_DECLARE_FEATURE(kEnableComposeLanguageBypass); } // namespace compose::features
diff --git a/components/compose/core/browser/compose_metrics.cc b/components/compose/core/browser/compose_metrics.cc index 78e0b14f..c04c48bc 100644 --- a/components/compose/core/browser/compose_metrics.cc +++ b/components/compose/core/browser/compose_metrics.cc
@@ -14,6 +14,7 @@ const char kComposeResponseDurationError[] = "Compose.Response.Duration.Error"; const char kComposeResponseStatus[] = "Compose.Response.Status"; const char kComposeShowStatus[] = "Compose.ContextMenu.ShowStatus"; +const char kComposeDialogOpenLatency[] = "Compose.Dialog.OpenLatency"; void LogComposeContextMenuCtr(ComposeContextMenuCtrEvent event) { UMA_HISTOGRAM_ENUMERATION("Compose.ContextMenu.CTR", event); @@ -32,4 +33,8 @@ void LogComposeSessionCloseReason(ComposeSessionCloseReason reason) { UMA_HISTOGRAM_ENUMERATION("Compose.SessionCloseReason", reason); } + +void LogComposeDialogOpenLatency(base::TimeDelta duration) { + base::UmaHistogramMediumTimes(kComposeDialogOpenLatency, duration); +} } // namespace compose
diff --git a/components/compose/core/browser/compose_metrics.h b/components/compose/core/browser/compose_metrics.h index d1c4e48..ee3b5c3 100644 --- a/components/compose/core/browser/compose_metrics.h +++ b/components/compose/core/browser/compose_metrics.h
@@ -16,6 +16,7 @@ extern const char kComposeResponseDurationError[]; extern const char kComposeResponseStatus[]; extern const char kComposeShowStatus[]; +extern const char kComposeDialogOpenLatency[]; // Enum for calculating the CTR of the Compose context menu item. // These values are persisted to logs. Entries should not be renumbered and @@ -62,6 +63,8 @@ void LogComposeSessionCloseReason(ComposeSessionCloseReason reason); +// Log the time taken for the dialog to be fully shown and interactable. +void LogComposeDialogOpenLatency(base::TimeDelta duration); } // namespace compose #endif // COMPONENTS_COMPOSE_CORE_BROWSER_COMPOSE_METRICS_H_
diff --git a/components/enterprise/idle/idle_features.cc b/components/enterprise/idle/idle_features.cc index 28d8381..f61b23ad 100644 --- a/components/enterprise/idle/idle_features.cc +++ b/components/enterprise/idle/idle_features.cc
@@ -5,7 +5,9 @@ #include "components/enterprise/idle/idle_features.h" namespace enterprise_idle { - +#if BUILDFLAG(IS_IOS) +BASE_FEATURE(kIdleTimeout, "IdleTimeout", base::FEATURE_DISABLED_BY_DEFAULT); +#else BASE_FEATURE(kIdleTimeout, "IdleTimeout", base::FEATURE_ENABLED_BY_DEFAULT); - +#endif // BUILDFLAG(IS_IOS) } // namespace enterprise_idle
diff --git a/components/enterprise/idle/idle_pref_names.cc b/components/enterprise/idle/idle_pref_names.cc index a55045d3..1f862dee 100644 --- a/components/enterprise/idle/idle_pref_names.cc +++ b/components/enterprise/idle/idle_pref_names.cc
@@ -16,4 +16,11 @@ // If true, show the IdleTimeout bubble when Chrome starts. const char kIdleTimeoutShowBubbleOnStartup[] = "idle_timeout_show_bubble_on_startup"; + +// The last active time updated based on taps registered in +// `browser_view_controller.cc` +const char kLastActiveTimestamp[] = "idle_timeout_last_active_timestamp"; +// The time when the browser was last marked as idle. Used with +// `kLastActiveTimestamp` to calculate the idle time on start-up. +const char kLastIdleTimestamp[] = "idle_timeout_last_idle_timestamp"; } // namespace enterprise_idle::prefs
diff --git a/components/enterprise/idle/idle_pref_names.h b/components/enterprise/idle/idle_pref_names.h index 463251e..3ee606d 100644 --- a/components/enterprise/idle/idle_pref_names.h +++ b/components/enterprise/idle/idle_pref_names.h
@@ -9,6 +9,9 @@ extern const char kIdleTimeout[]; extern const char kIdleTimeoutActions[]; extern const char kIdleTimeoutShowBubbleOnStartup[]; + +extern const char kLastActiveTimestamp[]; +extern const char kLastIdleTimestamp[]; } // namespace enterprise_idle::prefs #endif // COMPONENTS_ENTERPRISE_IDLE_IDLE_PREF_NAMES_H_
diff --git a/components/exo/wayland/zcr_ui_controls.cc b/components/exo/wayland/zcr_ui_controls.cc index 15646ee..28bc364 100644 --- a/components/exo/wayland/zcr_ui_controls.cc +++ b/components/exo/wayland/zcr_ui_controls.cc
@@ -295,7 +295,8 @@ uint32_t version, uint32_t id) { wl_resource* resource = - wl_resource_create(client, &zcr_ui_controls_v1_interface, version, id); + wl_resource_create(client, &zcr_ui_controls_v1_interface, + std::min(version, kUiControlsVersion), id); wl_resource_set_implementation(resource, &ui_controls_implementation, data, destroy_ui_controls_resource);
diff --git a/components/media_message_center/media_squiggly_progress_view.cc b/components/media_message_center/media_squiggly_progress_view.cc index 9b5ae88..8c00c8d 100644 --- a/components/media_message_center/media_squiggly_progress_view.cc +++ b/components/media_message_center/media_squiggly_progress_view.cc
@@ -27,7 +27,7 @@ // The height of squiggly progress that user can click to seek to a new media // position. This is slightly larger than the painted progress height. -constexpr int kProgressClickHeight = 14; +constexpr int kProgressClickHeight = 16; // Defines the x of where the painting of squiggly progress should start since // we own the OnPaint() function. @@ -42,8 +42,7 @@ // The size of the rounded rectangle indicator at the end of the foreground // squiggly progress. -constexpr gfx::SizeF kProgressIndicatorSize = - gfx::SizeF(6, kProgressClickHeight); +constexpr gfx::SizeF kProgressIndicatorSize = gfx::SizeF(6, 14); // The radius of the rounded rectangle indicator. constexpr float kProgressIndicatorRadius = 3.0; @@ -246,15 +245,8 @@ return false; } + OnProgressDragStarted(); HandleSeeking(event.x()); - - // Pause the media if it is playing when the user starts dragging the progress - // line. - if (!is_paused_) { - dragging_callback_.Run(/*pause=*/true); - paused_for_dragging_ = true; - } - return true; } @@ -265,13 +257,7 @@ void MediaSquigglyProgressView::OnMouseReleased(const ui::MouseEvent& event) { HandleSeeking(event.x()); - - // Un-pause the media when the user finishes dragging the progress line if the - // media was playing before dragging. - if (paused_for_dragging_) { - dragging_callback_.Run(/*pause=*/false); - paused_for_dragging_ = false; - } + OnProgressDragEnded(); } bool MediaSquigglyProgressView::OnKeyPressed(const ui::KeyEvent& event) { @@ -305,13 +291,29 @@ } void MediaSquigglyProgressView::OnGestureEvent(ui::GestureEvent* event) { - if (is_live_ || event->type() != ui::ET_GESTURE_TAP || - !IsValidSeekPosition(event->x(), event->y())) { + if (is_live_ || !IsValidSeekPosition(event->x(), event->y())) { return; } - HandleSeeking(event->x()); - event->SetHandled(); + switch (event->type()) { + case ui::ET_GESTURE_TAP_DOWN: + OnProgressDragStarted(); + [[fallthrough]]; + case ui::ET_GESTURE_SCROLL_BEGIN: + case ui::ET_GESTURE_SCROLL_UPDATE: + HandleSeeking(event->x()); + event->SetHandled(); + break; + case ui::ET_GESTURE_END: + HandleSeeking(event->x()); + event->SetHandled(); + if (event->details().touch_points() <= 1) { + OnProgressDragEnded(); + } + break; + default: + break; + } } /////////////////////////////////////////////////////////////////////////////// @@ -374,6 +376,24 @@ NotifyAccessibilityEvent(ax::mojom::Event::kValueChanged, true); } +void MediaSquigglyProgressView::OnProgressDragStarted() { + // Pause the media only once if it is playing when the user starts dragging + // the progress line. + if (!is_paused_ && !paused_for_dragging_) { + dragging_callback_.Run(/*pause=*/true); + paused_for_dragging_ = true; + } +} + +void MediaSquigglyProgressView::OnProgressDragEnded() { + // Un-pause the media when the user finishes dragging the progress line if the + // media was playing before dragging. + if (paused_for_dragging_) { + dragging_callback_.Run(/*pause=*/false); + paused_for_dragging_ = false; + } +} + void MediaSquigglyProgressView::HandleSeeking(double location) { double view_width = GetContentsBounds().width() - kWidthInset * 2; double seek_to_progress =
diff --git a/components/media_message_center/media_squiggly_progress_view.h b/components/media_message_center/media_squiggly_progress_view.h index b6a7f8c..5dcf07c5 100644 --- a/components/media_message_center/media_squiggly_progress_view.h +++ b/components/media_message_center/media_squiggly_progress_view.h
@@ -67,6 +67,11 @@ // Fires an accessibility event if the progress has changed. void MaybeNotifyAccessibilityValueChanged(); + // Handles the event when user drags the progress line using a mouse or + // gesture on a tablet. + void OnProgressDragStarted(); + void OnProgressDragEnded(); + // Handles the event when user seeks to a new location on the progress view. void HandleSeeking(double location);
diff --git a/components/media_message_center/media_squiggly_progress_view_unittest.cc b/components/media_message_center/media_squiggly_progress_view_unittest.cc index 9ccdfa3..b51b06d 100644 --- a/components/media_message_center/media_squiggly_progress_view_unittest.cc +++ b/components/media_message_center/media_squiggly_progress_view_unittest.cc
@@ -25,7 +25,9 @@ void SetUp() override { ViewsTestBase::SetUp(); widget_ = CreateTestWidget(); - ui::ColorId id; + // This test just needs to construct a progress view, without caring about + // what specific color IDs are used, so just use an arbitrary value. + ui::ColorId id = ui::kUiColorsStart; view_ = widget_->SetContentsView(std::make_unique<MediaSquigglyProgressView>( id, id, id, id, id, @@ -79,7 +81,7 @@ EXPECT_FALSE(view()->is_live_for_testing()); } -TEST_F(MediaSquigglyProgressViewTest, SeekTo) { +TEST_F(MediaSquigglyProgressViewTest, MouseEventSeekTo) { media_session::MediaPosition media_position( /*playback_rate=*/1, /*duration=*/base::Seconds(600), /*position=*/base::Seconds(100), /*end_of_media=*/false); @@ -101,12 +103,6 @@ EXPECT_CALL(*this, OnProgressDragging(false)); view()->OnMouseReleased(released_event); - // Simulate a gesture tap event and SeekTo() should be called. - ui::GestureEvent tapped_event(point.x(), point.y(), 0, ui::EventTimeForNow(), - ui::GestureEventDetails(ui::ET_GESTURE_TAP)); - EXPECT_CALL(*this, SeekTo(0.5)); - view()->OnGestureEvent(&tapped_event); - // Simulate a position change with infinite duration. i.e. a live media. media_session::MediaPosition media_position_live( /*playback_rate=*/1, /*duration=*/base::TimeDelta::Max(), @@ -120,6 +116,29 @@ EXPECT_TRUE(view()->is_live_for_testing()); } +TEST_F(MediaSquigglyProgressViewTest, GestureEventSeekTo) { + media_session::MediaPosition media_position( + /*playback_rate=*/1, /*duration=*/base::Seconds(600), + /*position=*/base::Seconds(100), /*end_of_media=*/false); + view()->UpdateProgress(media_position); + + // Simulate gesture tap events and SeekTo() should be called. + gfx::Point point(view()->width() / 2, view()->height() / 2); + ui::GestureEvent tapped_event( + point.x(), point.y(), 0, ui::EventTimeForNow(), + ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); + EXPECT_CALL(*this, SeekTo(0.5)); + EXPECT_CALL(*this, OnProgressDragging(true)); + view()->OnGestureEvent(&tapped_event); + + ui::GestureEvent released_event(point.x(), point.y(), 0, + ui::EventTimeForNow(), + ui::GestureEventDetails(ui::ET_GESTURE_END)); + EXPECT_CALL(*this, SeekTo(0.5)); + EXPECT_CALL(*this, OnProgressDragging(false)); + view()->OnGestureEvent(&released_event); +} + TEST_F(MediaSquigglyProgressViewTest, KeyEventSeekBackward) { media_session::MediaPosition media_position( /*playback_rate=*/1, /*duration=*/base::Seconds(60),
diff --git a/components/metrics/generate_expired_histograms_array.gni b/components/metrics/generate_expired_histograms_array.gni index e4cabc6b..71684e6 100644 --- a/components/metrics/generate_expired_histograms_array.gni +++ b/components/metrics/generate_expired_histograms_array.gni
@@ -113,6 +113,7 @@ "//tools/metrics/histograms/metadata/input/histograms.xml", "//tools/metrics/histograms/metadata/installer/histograms.xml", "//tools/metrics/histograms/metadata/interstitial/histograms.xml", + "//tools/metrics/histograms/metadata/ios/enums.xml", "//tools/metrics/histograms/metadata/ios/histograms.xml", "//tools/metrics/histograms/metadata/kerberos/histograms.xml", "//tools/metrics/histograms/metadata/kiosk/histograms.xml",
diff --git a/components/metrics/metrics_log.cc b/components/metrics/metrics_log.cc index 4ef1209..20a1151 100644 --- a/components/metrics/metrics_log.cc +++ b/components/metrics/metrics_log.cc
@@ -606,8 +606,6 @@ } if (uma_proto_.omnibox_event_size() > internal::kOmniboxEventLimit) { - UMA_HISTOGRAM_COUNTS_100000("UMA.TruncatedEvents.Omnibox", - uma_proto_.omnibox_event_size()); uma_proto_.mutable_omnibox_event()->DeleteSubrange( internal::kOmniboxEventLimit, uma_proto_.omnibox_event_size() - internal::kOmniboxEventLimit);
diff --git a/components/optimization_guide/core/BUILD.gn b/components/optimization_guide/core/BUILD.gn index 796b000..6fcf10cc 100644 --- a/components/optimization_guide/core/BUILD.gn +++ b/components/optimization_guide/core/BUILD.gn
@@ -163,6 +163,9 @@ configs += [ "//build/config/compiler:wexit_time_destructors" ] } +input_proto_descriptor_file = "$root_gen_dir/components/optimization_guide/proto/compose.descriptor" +output_proto_descriptors_cc_file = "$root_gen_dir/components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.cc" + static_library("core") { sources = [ "access_token_helper.cc", @@ -194,12 +197,17 @@ "model_execution/model_execution_manager.h", "model_execution/on_device_model_execution_config_interpreter.cc", "model_execution/on_device_model_execution_config_interpreter.h", + "model_execution/on_device_model_execution_proto_descriptors.h", + "model_execution/on_device_model_execution_proto_value_utils.cc", + "model_execution/on_device_model_execution_proto_value_utils.h", "model_execution/on_device_model_service_controller.cc", "model_execution/on_device_model_service_controller.h", "model_execution/on_device_model_stream_receiver.cc", "model_execution/on_device_model_stream_receiver.h", "model_execution/optimization_guide_model_execution_error.cc", "model_execution/optimization_guide_model_execution_error.h", + "model_execution/settings_enabled_observer.cc", + "model_execution/settings_enabled_observer.h", "model_handler.h", "model_quality/feature_type_map.h", "model_quality/model_quality_log_entry.cc", @@ -245,6 +253,7 @@ "top_host_provider.h", "url_pattern_with_wildcards.cc", "url_pattern_with_wildcards.h", + output_proto_descriptors_cc_file, ] if (build_with_tflite_lib) { sources += [ @@ -295,6 +304,7 @@ deps = [ ":bloomfilter", + ":on_device_model_execution_proto_generator", "//base", "//components/prefs", "//components/signin/public/identity_manager:identity_manager", @@ -435,6 +445,7 @@ "model_execution/model_execution_fetcher_unittest.cc", "model_execution/model_execution_manager_unittest.cc", "model_execution/on_device_model_execution_config_interpreter_unittest.cc", + "model_execution/on_device_model_execution_proto_value_utils_unittest.cc", "model_execution/on_device_model_service_controller_unittest.cc", "model_handler_unittest.cc", "model_quality/model_quality_log_entry_unittest.cc", @@ -581,3 +592,23 @@ ] } } + +action("on_device_model_execution_proto_generator") { + script = + "//components/optimization_guide/tools/gen_on_device_proto_descriptors.py" + + inputs = [ input_proto_descriptor_file ] + outputs = [ output_proto_descriptors_cc_file ] + + args = [ + "--input_file=" + rebase_path(input_proto_descriptor_file, root_build_dir), + "--output_cc=" + + rebase_path(output_proto_descriptors_cc_file, root_build_dir), + "--include=\"components/optimization_guide/proto/features/compose.pb.h\"", + ] + + deps = [ + "//components/optimization_guide/proto:compose_proto_descriptor", + "//third_party/protobuf:py_proto_runtime", + ] +}
diff --git a/components/optimization_guide/core/model_execution/model_execution_features_controller.cc b/components/optimization_guide/core/model_execution/model_execution_features_controller.cc index 7361ade..3c555f7 100644 --- a/components/optimization_guide/core/model_execution/model_execution_features_controller.cc +++ b/components/optimization_guide/core/model_execution/model_execution_features_controller.cc
@@ -11,39 +11,72 @@ namespace optimization_guide { -namespace internal { - -OptimizationGuideModelExecutionFeaturesController:: - OptimizationGuideModelExecutionFeaturesController( - PrefService* browser_context_profile_service) - : browser_context_profile_service_(browser_context_profile_service) { +ModelExecutionFeaturesController::ModelExecutionFeaturesController( + PrefService* browser_context_profile_service, + signin::IdentityManager* identity_manager) + : browser_context_profile_service_(browser_context_profile_service), + identity_manager_(identity_manager) { CHECK(browser_context_profile_service_); + + pref_change_registrar_.Init(browser_context_profile_service_); + + RecordFeatureSettingsAtStartup(); + InitializePrefListener(); + + is_signed_in_ = identity_manager && identity_manager->HasPrimaryAccount( + signin::ConsentLevel::kSignin); + + StartObservingAccountChanges(identity_manager); } -bool OptimizationGuideModelExecutionFeaturesController::IsSettingEnabled( +ModelExecutionFeaturesController::~ModelExecutionFeaturesController() = default; + +bool ModelExecutionFeaturesController::ShouldFeatureBeCurrentlyEnabledForUser( + proto::ModelExecutionFeature feature) const { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (!IsCurrentlyAValidUser()) { + return false; + } + + return features_enabled_at_startup_.find(static_cast<int>(feature)) != + features_enabled_at_startup_.end(); +} + +prefs::FeatureOptInState ModelExecutionFeaturesController::GetPrefState( proto::ModelExecutionFeature feature) const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); switch (feature) { case proto::ModelExecutionFeature::MODEL_EXECUTION_FEATURE_UNSPECIFIED: NOTREACHED(); - return false; + return prefs::FeatureOptInState::kNotInitialized; default: - return browser_context_profile_service_->GetInteger( - prefs::GetSettingEnabledPrefName(feature)) == - static_cast<int>(prefs::FeatureOptInState::kEnabled); + return static_cast<prefs::FeatureOptInState>( + browser_context_profile_service_->GetInteger( + prefs::GetSettingEnabledPrefName(feature))); } NOTREACHED(); - return false; + return prefs::FeatureOptInState::kNotInitialized; } -bool OptimizationGuideModelExecutionFeaturesController::IsSettingVisible( +bool ModelExecutionFeaturesController::IsCurrentlyAValidUser() const { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + return is_signed_in_; +} + +bool ModelExecutionFeaturesController::IsSettingVisible( proto::ModelExecutionFeature feature) const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (!IsCurrentlyAValidUser()) { + return false; + } + // If the setting is currently enabled by user, then we should show the // setting to the user regardless of any other checks. - if (IsSettingEnabled(feature)) { + if (ShouldFeatureBeCurrentlyEnabledForUser(feature)) { return true; } @@ -57,6 +90,181 @@ } } -} // namespace internal +void ModelExecutionFeaturesController::AddObserver( + SettingsEnabledObserver* observer) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + observers_.AddObserver(observer); +} + +void ModelExecutionFeaturesController::RemoveObserver( + SettingsEnabledObserver* observer) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + observers_.RemoveObserver(observer); +} + +void ModelExecutionFeaturesController::OnIdentityManagerShutdown( + signin::IdentityManager* identity_manager) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (identity_manager) { + identity_manager->RemoveObserver(this); + } + identity_manager_ = nullptr; +} + +void ModelExecutionFeaturesController::OnFeatureSettingPrefChanged( + proto::ModelExecutionFeature feature) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (!IsCurrentlyAValidUser()) { + return; + } + + for (SettingsEnabledObserver& obs : observers_) { + if (obs.feature() != feature) { + continue; + } + + if (GetPrefState(feature) == prefs::FeatureOptInState::kEnabled) { + obs.PrepareToEnableOnRestart(); + } + } +} + +void ModelExecutionFeaturesController::RecordFeatureSettingsAtStartup() { + features_enabled_at_startup_.clear(); + for (int i = 0; i < proto::ModelExecutionFeature_ARRAYSIZE; ++i) { + proto::ModelExecutionFeature feature = proto::ModelExecutionFeature(i); + switch (feature) { + case proto::ModelExecutionFeature::MODEL_EXECUTION_FEATURE_UNSPECIFIED: + continue; + default: + if (GetPrefState(feature) == prefs::FeatureOptInState::kEnabled) { + features_enabled_at_startup_.insert(static_cast<int>(feature)); + } + continue; + } + } +} + +void ModelExecutionFeaturesController::StartObservingAccountChanges( + signin::IdentityManager* identity_manager) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (!identity_manager) { + return; + } + + identity_manager->AddObserver(this); +} + +void ModelExecutionFeaturesController::OnPrimaryAccountChanged( + const signin::PrimaryAccountChangeEvent& event_details) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + bool was_signed_in = is_signed_in_; + + is_signed_in_ = (identity_manager_ && identity_manager_->HasPrimaryAccount( + signin::ConsentLevel::kSignin)); + + if (was_signed_in == is_signed_in_) { + return; + } + + if (is_signed_in_) { + return; + } + + // Reset prefs to `kNotInitialized`. + browser_context_profile_service_->SetInteger( + optimization_guide::prefs::kModelExecutionMainToggleSettingState, + static_cast<int>(prefs::FeatureOptInState::kNotInitialized)); + for (int i = proto::ModelExecutionFeature_MIN; + i <= proto::ModelExecutionFeature_MAX; ++i) { + proto::ModelExecutionFeature feature = + static_cast<proto::ModelExecutionFeature>(i); + switch (feature) { + case proto::ModelExecutionFeature::MODEL_EXECUTION_FEATURE_UNSPECIFIED: + continue; + default: + browser_context_profile_service_->SetInteger( + optimization_guide::prefs::GetSettingEnabledPrefName(feature), + static_cast<int>(prefs::FeatureOptInState::kNotInitialized)); + } + } +} + +void ModelExecutionFeaturesController::OnMainToggleSettingStatePrefChanged() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (!IsCurrentlyAValidUser()) { + return; + } + + bool is_now_enabled = (browser_context_profile_service_->GetInteger( + prefs::kModelExecutionMainToggleSettingState) == + static_cast<int>(prefs::FeatureOptInState::kEnabled)); + + prefs::FeatureOptInState feature_optin_state = + is_now_enabled ? prefs::FeatureOptInState::kEnabled + : prefs::FeatureOptInState::kDisabled; + + for (int i = proto::ModelExecutionFeature_MIN; + i <= proto::ModelExecutionFeature_MAX; ++i) { + proto::ModelExecutionFeature feature = + static_cast<proto::ModelExecutionFeature>(i); + if (feature == + proto::ModelExecutionFeature::MODEL_EXECUTION_FEATURE_UNSPECIFIED) { + continue; + } + + // If the main toggle has been switched from on to off, disable all the + // features. + if (feature_optin_state == prefs::FeatureOptInState::kDisabled) { + browser_context_profile_service_->SetInteger( + prefs::GetSettingEnabledPrefName(feature), + static_cast<int>(feature_optin_state)); + continue; + } + // If the main toggle has been switched from off to on, then turn on + // only the features that are actually visible to the user. + if (IsSettingVisible(feature)) { + browser_context_profile_service_->SetInteger( + prefs::GetSettingEnabledPrefName(feature), + static_cast<int>(feature_optin_state)); + continue; + } + } +} + +void ModelExecutionFeaturesController::InitializePrefListener() { + pref_change_registrar_.Add( + optimization_guide::prefs::kModelExecutionMainToggleSettingState, + base::BindRepeating(&ModelExecutionFeaturesController:: + OnMainToggleSettingStatePrefChanged, + base::Unretained(this))); + + for (int i = proto::ModelExecutionFeature_MIN; + i <= proto::ModelExecutionFeature_MAX; ++i) { + proto::ModelExecutionFeature feature = + static_cast<proto::ModelExecutionFeature>(i); + if (feature == + proto::ModelExecutionFeature::MODEL_EXECUTION_FEATURE_UNSPECIFIED) { + continue; + } + + pref_change_registrar_.Add( + optimization_guide::prefs::GetSettingEnabledPrefName(feature), + base::BindRepeating( + &ModelExecutionFeaturesController::OnFeatureSettingPrefChanged, + base::Unretained(this), feature)); + } +} + +void ModelExecutionFeaturesController::SimulateBrowserRestartForTesting() { + RecordFeatureSettingsAtStartup(); +} } // namespace optimization_guide
diff --git a/components/optimization_guide/core/model_execution/model_execution_features_controller.h b/components/optimization_guide/core/model_execution/model_execution_features_controller.h index b14f9eb..9cda9fa2 100644 --- a/components/optimization_guide/core/model_execution/model_execution_features_controller.h +++ b/components/optimization_guide/core/model_execution/model_execution_features_controller.h
@@ -5,43 +5,102 @@ #ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_MODEL_EXECUTION_FEATURES_CONTROLLER_H_ #define COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_MODEL_EXECUTION_FEATURES_CONTROLLER_H_ +#include <unordered_set> + #include "base/memory/raw_ptr.h" +#include "base/observer_list.h" +#include "base/observer_list_types.h" #include "base/threading/thread_checker.h" +#include "components/optimization_guide/core/model_execution/settings_enabled_observer.h" +#include "components/optimization_guide/core/optimization_guide_prefs.h" #include "components/optimization_guide/proto/model_execution.pb.h" +#include "components/prefs/pref_change_registrar.h" +#include "components/signin/public/identity_manager/identity_manager.h" +#include "components/signin/public/identity_manager/primary_account_change_event.h" class PrefService; namespace optimization_guide { -namespace internal { - // Class that keeps track of user opt-in settings, including the visibility of // settings and the user's opt-in state. -class OptimizationGuideModelExecutionFeaturesController { +class ModelExecutionFeaturesController + : public signin::IdentityManager::Observer { public: // Must be created only for non-incognito browser contexts. - explicit OptimizationGuideModelExecutionFeaturesController( - PrefService* browser_context_profile_service); + ModelExecutionFeaturesController(PrefService* browser_context_profile_service, + signin::IdentityManager* identity_manager); - OptimizationGuideModelExecutionFeaturesController( - const OptimizationGuideModelExecutionFeaturesController&) = delete; - OptimizationGuideModelExecutionFeaturesController& operator=( - const OptimizationGuideModelExecutionFeaturesController&) = delete; + ~ModelExecutionFeaturesController() override; + + ModelExecutionFeaturesController(const ModelExecutionFeaturesController&) = + delete; + ModelExecutionFeaturesController& operator=( + const ModelExecutionFeaturesController&) = delete; // Returns true if the opt-in setting should be shown for this profile for - // given `feature`. + // given `feature`. This should only be called by settings UX. bool IsSettingVisible(proto::ModelExecutionFeature feature) const; - // Returns true if the opt-in setting has been enabled by the user for this - // profile for given `feature`. - bool IsSettingEnabled(proto::ModelExecutionFeature feature) const; + // Returns true if the `feature` should be currently enabled for this user. + // Note that the return value here may not match the feature enable state on + // chrome settings page since the latter takes effect on browser restart. + bool ShouldFeatureBeCurrentlyEnabledForUser( + proto::ModelExecutionFeature feature) const; + + // Adds `observer` which can observe the change in feature settings. + void AddObserver(SettingsEnabledObserver* observer); + + // Removes `observer`. + void RemoveObserver(SettingsEnabledObserver* observer); + + void SimulateBrowserRestartForTesting(); private: + // Called when the main setting toggle pref is changed. + void OnMainToggleSettingStatePrefChanged(); + + // Called when the feature-specific toggle pref is changed. + void OnFeatureSettingPrefChanged(proto::ModelExecutionFeature feature); + + void StartObservingAccountChanges(signin::IdentityManager* identity_manager); + + void OnPrimaryAccountChanged( + const signin::PrimaryAccountChangeEvent& event_details) override; + + void OnIdentityManagerShutdown( + signin::IdentityManager* identity_manager) override; + + prefs::FeatureOptInState GetPrefState( + proto::ModelExecutionFeature feature) const; + + // Returns true if the user is an eligible user to be shown any of the feature + // settings. + bool IsCurrentlyAValidUser() const; + + // Records state of the different features at startup. + void RecordFeatureSettingsAtStartup(); + + // Initializes pref listener to listen to changes to relevant prefs and set up + // callbacks. + void InitializePrefListener(); + + // Computed at the time `this` is constructed. Stores the set of features + // that were enabled at the time when browser started. + std::unordered_set<int> features_enabled_at_startup_; + raw_ptr<PrefService> browser_context_profile_service_ = nullptr; + raw_ptr<signin::IdentityManager> identity_manager_ = nullptr; + + PrefChangeRegistrar pref_change_registrar_; + + bool is_signed_in_ = false; + + base::ObserverList<SettingsEnabledObserver> observers_; + THREAD_CHECKER(thread_checker_); }; -} // namespace internal } // namespace optimization_guide
diff --git a/components/optimization_guide/core/model_execution/on_device_model_execution_config_interpreter.cc b/components/optimization_guide/core/model_execution/on_device_model_execution_config_interpreter.cc index 6a7ae79..5f3d21e 100644 --- a/components/optimization_guide/core/model_execution/on_device_model_execution_config_interpreter.cc +++ b/components/optimization_guide/core/model_execution/on_device_model_execution_config_interpreter.cc
@@ -11,6 +11,8 @@ #include "base/strings/stringprintf.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" +#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h" +#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.h" namespace optimization_guide { @@ -125,8 +127,6 @@ return absl::nullopt; } - // TODO(b/302402959): Make sure we have the type mapping? - // Construct string. std::vector<std::string> substitutions; for (const auto& substitution : input_config.execute_substitutions()) { @@ -138,8 +138,14 @@ if (arg.has_raw_string()) { args.push_back(arg.raw_string()); + } else if (arg.has_proto_field()) { + absl::optional<proto::Value> value = + GetProtoValue(request, arg.proto_field()); + if (!value) { + return absl::nullopt; + } + args.push_back(GetStringFromValue(*value)); } - // TODO(b/302402959): Add support for proto field. } if (static_cast<size_t>(substitution.expected_num_args()) != args.size()) { return absl::nullopt;
diff --git a/components/optimization_guide/core/model_execution/on_device_model_execution_config_interpreter_unittest.cc b/components/optimization_guide/core/model_execution/on_device_model_execution_config_interpreter_unittest.cc index 8f3090a7..b3d2f89e 100644 --- a/components/optimization_guide/core/model_execution/on_device_model_execution_config_interpreter_unittest.cc +++ b/components/optimization_guide/core/model_execution/on_device_model_execution_config_interpreter_unittest.cc
@@ -8,6 +8,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/test/task_environment.h" #include "base/test/test.pb.h" +#include "components/optimization_guide/proto/features/compose.pb.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -225,6 +226,58 @@ EXPECT_EQ(*maybe_string, "hello this is a test"); } +TEST_F(OnDeviceModelExecutionConfigInterpeterTest, + ConstructInputStringFeatureWithProtoField) { + proto::OnDeviceModelExecutionConfig config; + auto* fc = config.add_feature_configs(); + fc->set_feature(proto::MODEL_EXECUTION_FEATURE_COMPOSE); + auto* input_config = fc->mutable_input_config(); + input_config->set_request_base_name( + "optimization_guide.proto.ComposeRequest"); + auto* substitution = input_config->add_execute_substitutions(); + substitution->set_string_template("hello this is a test: %s %s"); + substitution->set_expected_num_args(2); + auto* proto_field = substitution->add_args()->mutable_proto_field(); + proto_field->add_proto_descriptors()->set_tag_number(2); + auto* proto_field2 = substitution->add_args()->mutable_proto_field(); + proto_field2->add_proto_descriptors()->set_tag_number(3); + proto_field2->add_proto_descriptors()->set_tag_number(2); + UpdateInterpreterWithConfig(config); + + proto::ComposeRequest request; + request.set_user_input("this is my input"); + request.mutable_page_metadata()->set_page_title("nested"); + auto maybe_string = interpreter()->ConstructInputString( + proto::MODEL_EXECUTION_FEATURE_COMPOSE, request); + + ASSERT_TRUE(maybe_string); + EXPECT_EQ(*maybe_string, "hello this is a test: this is my input nested"); +} + +TEST_F(OnDeviceModelExecutionConfigInterpeterTest, + ConstructInputStringFeatureWithBadProtoField) { + proto::OnDeviceModelExecutionConfig config; + auto* fc = config.add_feature_configs(); + fc->set_feature(proto::MODEL_EXECUTION_FEATURE_COMPOSE); + auto* input_config = fc->mutable_input_config(); + input_config->set_request_base_name( + "optimization_guide.proto.ComposeRequest"); + auto* substitution = input_config->add_execute_substitutions(); + substitution->set_string_template("hello this is a test: %s"); + substitution->set_expected_num_args(1); + auto* proto_field = substitution->add_args()->mutable_proto_field(); + proto_field->add_proto_descriptors()->set_tag_number(10000); + UpdateInterpreterWithConfig(config); + + proto::ComposeRequest request; + request.set_user_input("this is my input"); + request.mutable_page_metadata()->set_page_title("nested"); + auto maybe_string = interpreter()->ConstructInputString( + proto::MODEL_EXECUTION_FEATURE_COMPOSE, request); + + EXPECT_FALSE(maybe_string.has_value()); +} + } // namespace } // namespace optimization_guide
diff --git a/components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h b/components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h new file mode 100644 index 0000000..3b5be10 --- /dev/null +++ b/components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h
@@ -0,0 +1,20 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_ON_DEVICE_MODEL_EXECUTION_PROTO_DESCRIPTORS_H_ +#define COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_ON_DEVICE_MODEL_EXECUTION_PROTO_DESCRIPTORS_H_ + +#include <optional> + +#include "components/optimization_guide/proto/model_execution.pb.h" + +namespace optimization_guide { + +// Returns the value of `proto_field` from `msg`. +std::optional<proto::Value> GetProtoValue( + const google::protobuf::MessageLite& msg, + const optimization_guide::proto::ProtoField& proto_field); + +} // namespace optimization_guide + +#endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_ON_DEVICE_MODEL_EXECUTION_PROTO_DESCRIPTORS_H_
diff --git a/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.cc b/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.cc new file mode 100644 index 0000000..2bdc04ce --- /dev/null +++ b/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.cc
@@ -0,0 +1,30 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.h" + +#include "base/notreached.h" +#include "base/strings/string_number_conversions.h" + +namespace optimization_guide { + +std::string GetStringFromValue(const proto::Value& value) { + switch (value.type_case()) { + case proto::Value::kStringValue: + return value.string_value(); + case proto::Value::kBooleanValue: + return value.boolean_value() ? "true" : "false"; + case proto::Value::kInt32Value: + return base::NumberToString(value.int32_value()); + case proto::Value::kInt64Value: + return base::NumberToString(value.int64_value()); + case proto::Value::kFloatValue: + return base::NumberToString(value.float_value()); + case proto::Value::TYPE_NOT_SET: + NOTREACHED(); + return std::string(); + } +} + +} // namespace optimization_guide
diff --git a/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.h b/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.h new file mode 100644 index 0000000..2a6f39e5 --- /dev/null +++ b/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.h
@@ -0,0 +1,18 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_ON_DEVICE_MODEL_EXECUTION_PROTO_VALUE_UTILS_H_ +#define COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_ON_DEVICE_MODEL_EXECUTION_PROTO_VALUE_UTILS_H_ + +#include <string> + +#include "components/optimization_guide/proto/model_execution.pb.h" + +namespace optimization_guide { + +// Returns the string for `val`. +std::string GetStringFromValue(const proto::Value& val); + +} // namespace optimization_guide + +#endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_ON_DEVICE_MODEL_EXECUTION_PROTO_VALUE_UTILS_H_
diff --git a/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils_unittest.cc b/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils_unittest.cc new file mode 100644 index 0000000..92c1acc --- /dev/null +++ b/components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils_unittest.cc
@@ -0,0 +1,48 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.h" + +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace optimization_guide { +namespace { + +using OnDeviceModelExecutionProtoValueUtilsTest = testing::Test; + +TEST(OnDeviceModelExecutionProtoValueUtilsTest, GetStringFromValue) { + { + proto::Value value; + value.set_string_value("hello"); + EXPECT_EQ(GetStringFromValue(value), "hello"); + } + + { + proto::Value value; + value.set_boolean_value(true); + EXPECT_EQ(GetStringFromValue(value), "true"); + } + + { + proto::Value value; + value.set_int32_value(123); + EXPECT_EQ(GetStringFromValue(value), "123"); + } + + { + proto::Value value; + value.set_int64_value(12345); + EXPECT_EQ(GetStringFromValue(value), "12345"); + } + + { + proto::Value value; + value.set_float_value(0.5); + EXPECT_EQ(GetStringFromValue(value), "0.5"); + } +} + +} // namespace +} // namespace optimization_guide
diff --git a/components/optimization_guide/core/model_execution/settings_enabled_observer.cc b/components/optimization_guide/core/model_execution/settings_enabled_observer.cc new file mode 100644 index 0000000..ae08ae4 --- /dev/null +++ b/components/optimization_guide/core/model_execution/settings_enabled_observer.cc
@@ -0,0 +1,15 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/optimization_guide/core/model_execution/model_execution_features_controller.h" + +namespace optimization_guide { + +SettingsEnabledObserver::SettingsEnabledObserver( + proto::ModelExecutionFeature feature) + : feature_(feature) {} + +SettingsEnabledObserver::~SettingsEnabledObserver() = default; + +} // namespace optimization_guide
diff --git a/components/optimization_guide/core/model_execution/settings_enabled_observer.h b/components/optimization_guide/core/model_execution/settings_enabled_observer.h new file mode 100644 index 0000000..b012ad94 --- /dev/null +++ b/components/optimization_guide/core/model_execution/settings_enabled_observer.h
@@ -0,0 +1,37 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_SETTINGS_ENABLED_OBSERVER_H_ +#define COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_SETTINGS_ENABLED_OBSERVER_H_ + +#include "base/observer_list_types.h" +#include "components/optimization_guide/proto/model_execution.pb.h" + +namespace optimization_guide { + +// Observer to listen to changes in the user opt-in state for a given +// `feature`. +class SettingsEnabledObserver : public base::CheckedObserver { + public: + explicit SettingsEnabledObserver(proto::ModelExecutionFeature feature); + ~SettingsEnabledObserver() override; + + // Notifies `this` that the consumer feature team should prepare to enable + // their feature when browser restarts. After browser restart, the feature + // team should call `ShouldFeatureBeCurrentlyEnabledForUser` before + // displaying any feature functionality. + virtual void PrepareToEnableOnRestart() = 0; + + SettingsEnabledObserver(const SettingsEnabledObserver&) = delete; + SettingsEnabledObserver& operator=(const SettingsEnabledObserver&) = delete; + + proto::ModelExecutionFeature feature() const { return feature_; } + + private: + const proto::ModelExecutionFeature feature_; +}; + +} // namespace optimization_guide + +#endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_MODEL_EXECUTION_SETTINGS_ENABLED_OBSERVER_H_
diff --git a/components/optimization_guide/proto/BUILD.gn b/components/optimization_guide/proto/BUILD.gn index 5b1f20f..4b5e994 100644 --- a/components/optimization_guide/proto/BUILD.gn +++ b/components/optimization_guide/proto/BUILD.gn
@@ -50,3 +50,13 @@ ] } } + +proto_library("compose_proto_descriptor") { + proto_in_dir = "//" + proto_out_dir = "components/optimization_guide/proto" + sources = [ "features/compose.proto" ] + generate_cc = false + generate_python = false + generate_descriptor = "compose.descriptor" + proto_deps = [ ":optimization_guide_proto" ] +}
diff --git a/components/optimization_guide/proto/model_execution.proto b/components/optimization_guide/proto/model_execution.proto index 0ed0f639f..f231512f 100644 --- a/components/optimization_guide/proto/model_execution.proto +++ b/components/optimization_guide/proto/model_execution.proto
@@ -86,6 +86,7 @@ message StringArg { oneof arg { string raw_string = 1; + ProtoField proto_field = 2; } // TODO(b/302402959): Add support for max number of characters to apply. @@ -93,3 +94,31 @@ // TODO(b/302402959): Add support for conditions for which this should be // applied. } + +message ProtoDescriptor { + // The tag number of the proto field. + optional int32 tag_number = 1; +} + +message ProtoField { + // The descriptors to get to the desired field. + // + // If more than one entry, it is expected that all entries prior to the last + // one are message types. + repeated ProtoDescriptor proto_descriptors = 1; +} + +message Value { + oneof type { + // int64 type. + int64 int64_value = 1; + // int32 type. Enums are int32s. + int32 int32_value = 2; + // float type. + double float_value = 3; + // string type. + string string_value = 4; + // boolean type. + bool boolean_value = 5; + } +}
diff --git a/components/optimization_guide/tools/gen_on_device_proto_descriptors.py b/components/optimization_guide/tools/gen_on_device_proto_descriptors.py new file mode 100755 index 0000000..b1aa619 --- /dev/null +++ b/components/optimization_guide/tools/gen_on_device_proto_descriptors.py
@@ -0,0 +1,141 @@ +#!/usr/bin/env python +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Code generator for proto descriptors used for on-device model execution. + +This script generates a C++ source file containing the proto descriptors. +""" + +try: + from StringIO import StringIO # for Python 2 +except ImportError: + from io import StringIO # for Python 3 +import optparse +import os +import collections +import re +import sys + +_HERE_PATH = os.path.dirname(__file__) +_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..')) +sys.path.insert(0, os.path.join(_SRC_PATH, 'third_party', 'protobuf', + 'python')) + +class Error(Exception): + pass + + +def GenerateProtoDescriptors(out, includes, message_data): + """Generate static array containing a list of constructors.""" + + out.write('// DO NOT MODIFY. GENERATED BY gen_on_device_proto_descriptors.py\n') + out.write('\n') + + out.write('#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h"') + out.write('\n\n') + + for include in includes: + out.write('#include %(include)s\n' % {'include': include}) + out.write('\n') + + out.write('namespace optimization_guide {\n') + out.write('\n') + out.write('namespace {\n') + + out.write("""std::optional<proto::Value> GetProtoValue(const google::protobuf::MessageLite& msg, const proto::ProtoField& proto_field, int32_t index) { + if (index >= proto_field.proto_descriptors_size()) { + return std::nullopt; + } + int32_t tag_number = proto_field.proto_descriptors(index).tag_number(); + """); + + for type_name, data in message_data.items(): + out.write('if (msg.GetTypeName() == "%s") {\n' % type_name) + out.write('const %s casted_msg = static_cast<const %s&>(msg);\n' % (data['cpp_class_name'], data['cpp_class_name'])) + out.write('switch (tag_number) {\n') + for f in data['fields']: + if f['is_repeated']: + continue + out.write('case %d: {\n' % f['tag_number']) + if f['type'] == 11: + out.write('return GetProtoValue(casted_msg.%s(), proto_field, index+1);\n' % f['name']) + else: + out.write('proto::Value value;\n'); + if f['type'] in {1, 2}: + out.write('value.set_float_value(static_cast<double>(casted_msg.%s()));\n' % f['name']) + elif f['type'] in {3, 4}: + out.write('value.set_int64_value(static_cast<int64_t>(casted_msg.%s()));\n' % f['name']) + elif f['type'] in {5, 13, 14}: + out.write('value.set_int32_value(static_cast<int32_t>(casted_msg.%s()));\n' % f['name']) + elif f['type'] in {8}: + out.write('value.set_boolean_value(casted_msg.%s());\n' % f['name']) + elif f['type'] in {9}: + out.write('value.set_string_value(casted_msg.%s());\n' % f['name']) + else: + raise Error() + out.write('return value;\n') + out.write('}\n') # End case + out.write('}\n') # End switch + out.write('}\n\n') # End if statement + out.write('return std::nullopt;\n') + out.write('}\n\n') # End function + out.write('} // namespace\n\n') + out.write(""" + std::optional<proto::Value> GetProtoValue(const google::protobuf::MessageLite& msg, const proto::ProtoField& proto_field) { + return GetProtoValue(msg, proto_field, /*index=*/0); + } + """) + out.write('} // namespace optimization_guide\n') + out.write('\n') + + +def main(argv): + parser = optparse.OptionParser() + parser.add_option('--input_file') + parser.add_option('--output_cc') + parser.add_option('--include', action='append', default=[]) + options, _ = parser.parse_args(argv) + + from google.protobuf import descriptor_pb2 + + includes = list(options.include) + + # Write to standard output or file specified by --output_cc. + out_cc = getattr(sys.stdout, 'buffer', sys.stdout) + if options.output_cc: + out_cc = open(options.output_cc, 'wb') + + fds = descriptor_pb2.FileDescriptorSet() + with open(options.input_file, 'rb') as fp: + fds.ParseFromString(fp.read()) + + msg_data = {} + for f in fds.file: + for m in f.message_type: + name = f.package + '.' + m.name + msg_data[name] = { + 'cpp_class_name': name.replace('.', '::'), + 'fields': [], + } + for field in m.field: + msg_data[name]['fields'].append({ + 'tag_number': field.number, + 'name': field.name, + 'type': field.type, + 'is_repeated': field.label == 3, + }) + + out_cc_str = StringIO() + GenerateProtoDescriptors(out_cc_str, includes, msg_data) + out_cc.write(out_cc_str.getvalue().encode('utf-8')) + + if options.output_cc: + out_cc.close() + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) \ No newline at end of file
diff --git a/components/page_load_metrics/browser/observers/use_counter/ukm_features.cc b/components/page_load_metrics/browser/observers/use_counter/ukm_features.cc index 068b52e..f4fdd49 100644 --- a/components/page_load_metrics/browser/observers/use_counter/ukm_features.cc +++ b/components/page_load_metrics/browser/observers/use_counter/ukm_features.cc
@@ -350,6 +350,14 @@ kStorageAccessAPI_requestStorageAccess_BeyondCookies_estimate, WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_estimate_Use, + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL, + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL_Use, + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL, + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL_Use, })); return *opt_in_features; }
diff --git a/components/paint_preview/DEPS b/components/paint_preview/DEPS index 7d5a29d..b5536d6 100644 --- a/components/paint_preview/DEPS +++ b/components/paint_preview/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+components/crash/core/common/crash_key.h", "+components/memory_pressure", + "+components/version_info", "+mojo/public/cpp", "+skia/ext", "+third_party/harfbuzz-ng/src/src",
diff --git a/components/paint_preview/browser/BUILD.gn b/components/paint_preview/browser/BUILD.gn index 4333a583..62659b7 100644 --- a/components/paint_preview/browser/BUILD.gn +++ b/components/paint_preview/browser/BUILD.gn
@@ -4,7 +4,6 @@ import("//build/config/chromeos/ui_mode.gni") import("//build/config/features.gni") -import("//chrome/version.gni") import("//testing/test.gni") assert(use_blink, "Paint Previews are only supported for blink.") @@ -41,6 +40,7 @@ "//components/keyed_service/core", "//components/strings:components_strings_grit", "//components/ukm/content", + "//components/version_info", "//content/public/browser", "//mojo/public/cpp/base", "//mojo/public/cpp/bindings", @@ -62,13 +62,6 @@ "//components/paint_preview/public", "//components/services/paint_preview_compositor/public/mojom", ] - - defines = [ - "CHROME_VERSION_MAJOR=" + chrome_version_major, - "CHROME_VERSION_MINOR=" + chrome_version_minor, - "CHROME_VERSION_BUILD=" + chrome_version_build, - "CHROME_VERSION_PATCH=" + chrome_version_patch, - ] } source_set("test_support") { @@ -106,6 +99,7 @@ "//base/test:test_support", "//build:chromeos_buildflags", "//components/paint_preview/common:test_utils", + "//components/version_info", "//content/public/browser", "//content/test:test_support", "//testing/gmock", @@ -117,13 +111,6 @@ if (is_chromeos_lacros) { deps += [ "//chromeos/lacros:test_support" ] } - - defines = [ - "CHROME_VERSION_MAJOR=" + chrome_version_major, - "CHROME_VERSION_MINOR=" + chrome_version_minor, - "CHROME_VERSION_BUILD=" + chrome_version_build, - "CHROME_VERSION_PATCH=" + chrome_version_patch, - ] } test("paint_preview_browser_unit_tests") {
diff --git a/components/paint_preview/browser/paint_preview_client.cc b/components/paint_preview/browser/paint_preview_client.cc index bdf3335..9f1d05b 100644 --- a/components/paint_preview/browser/paint_preview_client.cc +++ b/components/paint_preview/browser/paint_preview_client.cc
@@ -18,10 +18,12 @@ #include "base/threading/scoped_blocking_call.h" #include "base/trace_event/trace_event.h" #include "base/unguessable_token.h" +#include "base/version.h" #include "components/paint_preview/common/capture_result.h" #include "components/paint_preview/common/mojom/paint_preview_recorder.mojom-forward.h" #include "components/paint_preview/common/proto_validator.h" #include "components/paint_preview/common/version.h" +#include "components/version_info/version_info.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/global_routing_id.h" @@ -310,10 +312,11 @@ metadata->set_url(url.spec()); metadata->set_version(kPaintPreviewVersion); auto* chromeVersion = metadata->mutable_chrome_version(); - chromeVersion->set_major(CHROME_VERSION_MAJOR); - chromeVersion->set_minor(CHROME_VERSION_MINOR); - chromeVersion->set_build(CHROME_VERSION_BUILD); - chromeVersion->set_patch(CHROME_VERSION_PATCH); + const auto& current_chrome_version = version_info::GetVersion(); + chromeVersion->set_major(current_chrome_version.components()[0]); + chromeVersion->set_minor(current_chrome_version.components()[1]); + chromeVersion->set_build(current_chrome_version.components()[2]); + chromeVersion->set_patch(current_chrome_version.components()[3]); document_data.callback = std::move(callback); // Ensure the frame is not under prerendering state as the UKM cannot be
diff --git a/components/paint_preview/browser/paint_preview_client_unittest.cc b/components/paint_preview/browser/paint_preview_client_unittest.cc index 8f09a870..7b93a9f 100644 --- a/components/paint_preview/browser/paint_preview_client_unittest.cc +++ b/components/paint_preview/browser/paint_preview_client_unittest.cc
@@ -11,6 +11,7 @@ #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "base/unguessable_token.h" +#include "base/version.h" #include "build/build_config.h" #include "components/paint_preview/common/capture_result.h" #include "components/paint_preview/common/mojom/paint_preview_recorder.mojom-forward.h" @@ -19,6 +20,7 @@ #include "components/paint_preview/common/proto/paint_preview.pb.h" #include "components/paint_preview/common/test_utils.h" #include "components/paint_preview/common/version.h" +#include "components/version_info/version_info.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" @@ -171,10 +173,11 @@ metadata->set_url(expected_url.spec()); metadata->set_version(kPaintPreviewVersion); auto* chromeVersion = metadata->mutable_chrome_version(); - chromeVersion->set_major(CHROME_VERSION_MAJOR); - chromeVersion->set_minor(CHROME_VERSION_MINOR); - chromeVersion->set_build(CHROME_VERSION_BUILD); - chromeVersion->set_patch(CHROME_VERSION_PATCH); + const auto& current_chrome_version = version_info::GetVersion(); + chromeVersion->set_major(current_chrome_version.components()[0]); + chromeVersion->set_minor(current_chrome_version.components()[1]); + chromeVersion->set_build(current_chrome_version.components()[2]); + chromeVersion->set_patch(current_chrome_version.components()[3]); PaintPreviewFrameProto* main_frame = expected_proto.mutable_root_frame(); main_frame->set_is_main_frame(true); main_frame->set_scroll_offset_x(5);
diff --git a/components/paint_preview/player/BUILD.gn b/components/paint_preview/player/BUILD.gn index a79cf50..800b975 100644 --- a/components/paint_preview/player/BUILD.gn +++ b/components/paint_preview/player/BUILD.gn
@@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//chrome/version.gni") - source_set("player") { sources = [ "bitmap_request.cc", @@ -19,6 +17,7 @@ "//components/paint_preview/common", "//components/paint_preview/common/proto", "//components/paint_preview/public", + "//components/version_info", "//mojo/public/cpp/bindings", "//ui/accessibility", "//ui/gfx/geometry", @@ -27,13 +26,6 @@ public_deps = [ "//components/services/paint_preview_compositor/public/mojom" ] - - defines = [ - "CHROME_VERSION_MAJOR=" + chrome_version_major, - "CHROME_VERSION_MINOR=" + chrome_version_minor, - "CHROME_VERSION_BUILD=" + chrome_version_build, - "CHROME_VERSION_PATCH=" + chrome_version_patch, - ] } source_set("unit_tests") {
diff --git a/components/paint_preview/player/player_compositor_delegate.cc b/components/paint_preview/player/player_compositor_delegate.cc index b5a6acbf..4351412 100644 --- a/components/paint_preview/player/player_compositor_delegate.cc +++ b/components/paint_preview/player/player_compositor_delegate.cc
@@ -21,6 +21,7 @@ #include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/trace_event.h" #include "base/unguessable_token.h" +#include "base/version.h" #include "components/paint_preview/browser/paint_preview_base_service.h" #include "components/paint_preview/browser/warm_compositor.h" #include "components/paint_preview/common/proto/paint_preview.pb.h" @@ -30,6 +31,7 @@ #include "components/paint_preview/public/paint_preview_compositor_client.h" #include "components/paint_preview/public/paint_preview_compositor_service.h" #include "components/services/paint_preview_compositor/public/mojom/paint_preview_compositor.mojom.h" +#include "components/version_info/version_info.h" #include "mojo/public/cpp/bindings/remote.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -451,11 +453,12 @@ // If the current Chrome version doesn't match the one in proto, we can't // use the AXTreeUpdate. auto chrome_version = capture_result_->proto.metadata().chrome_version(); + const auto& current_chrome_version = version_info::GetVersion(); if (capture_result_->proto.metadata().has_chrome_version() && - chrome_version.major() == CHROME_VERSION_MAJOR && - chrome_version.minor() == CHROME_VERSION_MINOR && - chrome_version.build() == CHROME_VERSION_BUILD && - chrome_version.patch() == CHROME_VERSION_PATCH) { + chrome_version.major() == current_chrome_version.components()[0] && + chrome_version.minor() == current_chrome_version.components()[1] && + chrome_version.build() == current_chrome_version.components()[2] && + chrome_version.patch() == current_chrome_version.components()[3]) { paint_preview_service_->GetFileMixin()->GetAXTreeUpdate( key_, base::BindOnce(&PlayerCompositorDelegate::OnAXTreeUpdateAvailable, weak_factory_.GetWeakPtr()));
diff --git a/components/privacy_sandbox/privacy_sandbox_settings.h b/components/privacy_sandbox/privacy_sandbox_settings.h index 7284e3a5..74eb39f 100644 --- a/components/privacy_sandbox/privacy_sandbox_settings.h +++ b/components/privacy_sandbox/privacy_sandbox_settings.h
@@ -97,6 +97,9 @@ // eligibility. virtual TpcdExperimentEligibility GetCookieDeprecationExperimentCurrentEligibility() const = 0; + + // Whether cookie deprecation label is allowed. + virtual bool IsCookieDeprecationLabelAllowed() const = 0; }; // Returns whether the Topics API is allowed at all. If false, Topics API
diff --git a/components/privacy_sandbox/privacy_sandbox_settings_impl.cc b/components/privacy_sandbox/privacy_sandbox_settings_impl.cc index ea0bb51..5181179f 100644 --- a/components/privacy_sandbox/privacy_sandbox_settings_impl.cc +++ b/components/privacy_sandbox/privacy_sandbox_settings_impl.cc
@@ -916,7 +916,7 @@ } bool PrivacySandboxSettingsImpl::IsCookieDeprecationLabelAllowed() const { - return delegate_->IsCookieDeprecationExperimentEligible(); + return delegate_->IsCookieDeprecationLabelAllowed(); } bool PrivacySandboxSettingsImpl::IsCookieDeprecationLabelAllowedForContext(
diff --git a/components/privacy_sandbox/privacy_sandbox_settings_impl_unittest.cc b/components/privacy_sandbox/privacy_sandbox_settings_impl_unittest.cc index 7def5ada..bebd124e0 100644 --- a/components/privacy_sandbox/privacy_sandbox_settings_impl_unittest.cc +++ b/components/privacy_sandbox/privacy_sandbox_settings_impl_unittest.cc
@@ -222,6 +222,8 @@ /*eligible=*/true); mock_delegate()->SetUpGetCookieDeprecationExperimentCurrentEligibility( /*eligibility_reason=*/TpcdExperimentEligibility::Reason::kEligible); + mock_delegate()->SetUpIsCookieDeprecationLabelAllowedResponse( + /*allowed=*/true); } privacy_sandbox_test_util::MockPrivacySandboxSettingsDelegate* @@ -1252,12 +1254,12 @@ } TEST_F(PrivacySandboxSettingsTest, IsCookieDeprecationLabelAllowed) { - EXPECT_CALL(*mock_delegate(), IsCookieDeprecationExperimentEligible()) + EXPECT_CALL(*mock_delegate(), IsCookieDeprecationLabelAllowed()) .Times(1) .WillOnce(testing::Return(false)); EXPECT_FALSE(privacy_sandbox_settings()->IsCookieDeprecationLabelAllowed()); - EXPECT_CALL(*mock_delegate(), IsCookieDeprecationExperimentEligible()) + EXPECT_CALL(*mock_delegate(), IsCookieDeprecationLabelAllowed()) .Times(1) .WillOnce(testing::Return(true)); EXPECT_TRUE(privacy_sandbox_settings()->IsCookieDeprecationLabelAllowed());
diff --git a/components/privacy_sandbox/privacy_sandbox_test_util.h b/components/privacy_sandbox/privacy_sandbox_test_util.h index 941ebe9..dc38cf45 100644 --- a/components/privacy_sandbox/privacy_sandbox_test_util.h +++ b/components/privacy_sandbox/privacy_sandbox_test_util.h
@@ -102,6 +102,12 @@ }); } + void SetUpIsCookieDeprecationLabelAllowedResponse(bool allowed) { + ON_CALL(*this, IsCookieDeprecationLabelAllowed).WillByDefault([=]() { + return allowed; + }); + } + MOCK_METHOD(bool, IsPrivacySandboxRestricted, (), (const, override)); MOCK_METHOD(bool, IsPrivacySandboxCurrentlyUnrestricted, @@ -119,6 +125,7 @@ GetCookieDeprecationExperimentCurrentEligibility, (), (const, override)); + MOCK_METHOD(bool, IsCookieDeprecationLabelAllowed, (), (const, override)); }; // A declarative test case is a collection of key value pairs, which each define
diff --git a/components/reporting/util/status_macros.h b/components/reporting/util/status_macros.h index 6741f40..173e898 100644 --- a/components/reporting/util/status_macros.h +++ b/components/reporting/util/status_macros.h
@@ -23,9 +23,9 @@ template <typename T> void ShouldReturnStatus(T) { - static_assert( - base::AlwaysFalse<T>, - "RETURN_IF_ERROR_STATUS only accepts either Status or StatusOr"); + static_assert(base::AlwaysFalse<T>, + "RETURN_IF_ERROR_STATUS only accepts either Status or " + "base::unexpected<Status>"); } } // namespace reporting::internal
diff --git a/components/reporting/util/status_macros_nocompile.nc b/components/reporting/util/status_macros_nocompile.nc index 808ac8f0..94ece84 100644 --- a/components/reporting/util/status_macros_nocompile.nc +++ b/components/reporting/util/status_macros_nocompile.nc
@@ -12,9 +12,9 @@ int ReturnIfOtherTypes(int foo) { // Should fail because foo is not neither Status or StatusOr. RETURN_IF_ERROR_STATUS(foo); // expected-error {{variable has incomplete type 'void'}} - // expected-error@components/reporting/util/status_macros.h:* {{RETURN_IF_ERROR_STATUS only accepts either Status or StatusOr}} + // expected-error@components/reporting/util/status_macros.h:* {{RETURN_IF_ERROR_STATUS only accepts either Status or base::unexpected<Status>}} return 0; } } // namespace -} // namespace reporting \ No newline at end of file +} // namespace reporting
diff --git a/components/safe_browsing/core/browser/safe_browsing_metrics_collector.cc b/components/safe_browsing/core/browser/safe_browsing_metrics_collector.cc index 5435f50..69ef55a 100644 --- a/components/safe_browsing/core/browser/safe_browsing_metrics_collector.cc +++ b/components/safe_browsing/core/browser/safe_browsing_metrics_collector.cc
@@ -122,6 +122,27 @@ "SafeBrowsing.Enhanced.ProtegoRequestSentInLast24Hours", sent_ping_since_last_collector_run ? most_recent_ping_type : ProtegoPingType::kNone); + + auto logged_ping_type = ProtegoPingType::kNone; + + if (base::Time::Now() - last_ping_with_token < base::Hours(24)) { + // If a ping with token was sent within the last 24 hours, + // the most recent ping type is kWithToken. + // If both last_ping_with_token and last_ping_without_token are present, + // we log kWithToken instead of kWithoutToken because if a token has been + // sent before, we are certain that this account is a signed in account + // and the server has received the token. + // The kWithoutToken ping could be sent after the account logged out. + logged_ping_type = ProtegoPingType::kWithToken; + } else if (base::Time::Now() - last_ping_without_token < base::Hours(24)) { + // If no ping with token was sent but a ping without token was sent within + // the last 24 hours, the most recent ping type is kWithoutToken. + // Otherwise, it is the default value, kNone. + logged_ping_type = ProtegoPingType::kWithoutToken; + } + base::UmaHistogramEnumeration( + "SafeBrowsing.Enhanced.ProtegoRequestSentInLast24Hours2", + logged_ping_type); } void SafeBrowsingMetricsCollector::ScheduleNextLoggingAfterInterval(
diff --git a/components/safe_browsing/core/browser/safe_browsing_metrics_collector.h b/components/safe_browsing/core/browser/safe_browsing_metrics_collector.h index cf85a34..cabd836 100644 --- a/components/safe_browsing/core/browser/safe_browsing_metrics_collector.h +++ b/components/safe_browsing/core/browser/safe_browsing_metrics_collector.h
@@ -166,6 +166,15 @@ FRIEND_TEST_ALL_PREFIXES( SafeBrowsingMetricsCollectorTest, ProtegoRequestLogsWithoutTokenWhenPingBeforeCollectorHasEverRun); + FRIEND_TEST_ALL_PREFIXES( + SafeBrowsingMetricsCollectorTest, + NewProtegoRequestLogsWithTokenWhenWithTokenWasSendWithinLast24HRS); + FRIEND_TEST_ALL_PREFIXES( + SafeBrowsingMetricsCollectorTest, + NewProtegoRequestLogsWithoutTokenWhenWithoutTokenWasSendWithinLast24HRS); + FRIEND_TEST_ALL_PREFIXES( + SafeBrowsingMetricsCollectorTest, + NewProtegoRequestLogsWithTokenWhenNoPingWasSendWithinLast24HRS); // The type of Protego ping that was sent by an enhanced protection // user. These values are persisted to logs. Entries should not be renumbered
diff --git a/components/safe_browsing/core/browser/safe_browsing_metrics_collector_unittest.cc b/components/safe_browsing/core/browser/safe_browsing_metrics_collector_unittest.cc index 48ac331f..a208dde3 100644 --- a/components/safe_browsing/core/browser/safe_browsing_metrics_collector_unittest.cc +++ b/components/safe_browsing/core/browser/safe_browsing_metrics_collector_unittest.cc
@@ -932,4 +932,63 @@ /* expected_count */ 1); } +TEST_F(SafeBrowsingMetricsCollectorTest, + NewProtegoRequestLogsWithTokenWhenWithTokenWasSendWithinLast24HRS) { + base::HistogramTester histograms; + SetSafeBrowsingState(&pref_service_, SafeBrowsingState::ENHANCED_PROTECTION); + + pref_service_.SetTime(prefs::kSafeBrowsingEsbProtegoPingWithTokenLastLogTime, + base::Time::Now() - base::Minutes(30)); + pref_service_.SetTime( + prefs::kSafeBrowsingEsbProtegoPingWithoutTokenLastLogTime, + base::Time::Now() - base::Minutes(10)); + + metrics_collector_->StartLogging(); + + histograms.ExpectUniqueSample( + "SafeBrowsing.Enhanced.ProtegoRequestSentInLast24Hours2", + SafeBrowsingMetricsCollector::ProtegoPingType::kWithToken, + /* expected_count */ 1); + histograms.ExpectUniqueSample( + "SafeBrowsing.Enhanced.ProtegoRequestSentInLast24Hours", + SafeBrowsingMetricsCollector::ProtegoPingType::kWithoutToken, + /* expected_count */ 1); +} + +TEST_F( + SafeBrowsingMetricsCollectorTest, + NewProtegoRequestLogsWithoutTokenWhenWithoutTokenWasSendWithinLast24HRS) { + base::HistogramTester histograms; + SetSafeBrowsingState(&pref_service_, SafeBrowsingState::ENHANCED_PROTECTION); + + pref_service_.SetTime( + prefs::kSafeBrowsingEsbProtegoPingWithoutTokenLastLogTime, + base::Time::Now() - base::Minutes(10)); + + metrics_collector_->StartLogging(); + + histograms.ExpectUniqueSample( + "SafeBrowsing.Enhanced.ProtegoRequestSentInLast24Hours2", + SafeBrowsingMetricsCollector::ProtegoPingType::kWithoutToken, + /* expected_count */ 1); +} +TEST_F(SafeBrowsingMetricsCollectorTest, + NewProtegoRequestLogsWithTokenWhenNoPingWasSendWithinLast24HRS) { + base::HistogramTester histograms; + SetSafeBrowsingState(&pref_service_, SafeBrowsingState::ENHANCED_PROTECTION); + + pref_service_.SetTime( + prefs::kSafeBrowsingEsbProtegoPingWithoutTokenLastLogTime, + base::Time::Now() - base::Days(1) - base::Minutes(30)); + pref_service_.SetTime(prefs::kSafeBrowsingEsbProtegoPingWithTokenLastLogTime, + base::Time::Now() - base::Days(1) - base::Minutes(40)); + + metrics_collector_->StartLogging(); + + histograms.ExpectUniqueSample( + "SafeBrowsing.Enhanced.ProtegoRequestSentInLast24Hours2", + SafeBrowsingMetricsCollector::ProtegoPingType::kNone, + /* expected_count */ 1); +} + } // namespace safe_browsing
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc index b8960eb5..bbe0d8ad 100644 --- a/components/search_engines/template_url_prepopulate_data.cc +++ b/components/search_engines/template_url_prepopulate_data.cc
@@ -1819,6 +1819,47 @@ &kAllEngines[0], &kAllEngines[0] + kAllEnginesLength); } +std::unique_ptr<TemplateURLData> GetPrepopulatedEngineFromFullList( + PrefService* prefs, + int prepopulated_id) { + // TODO(crbug.com/1500526): Refactor to better share code with + // `GetPrepopulatedEngine()`. + + // If there is a set of search engines in the preferences file, we look for + // the ID there first. + for (std::unique_ptr<TemplateURLData>& data : + GetOverriddenTemplateURLData(prefs)) { + if (data->prepopulate_id == prepopulated_id) { + return std::move(data); + } + } + + // We look in the profile country's prepopulated set first. This is intended + // to help using the right entry for the case where we have multiple ones in + // the full list that share a same prepopulated id. + const int country = search_engines::GetSearchEngineChoiceCountryId(prefs); + for (const EngineAndTier& engine_and_tier : + GetPrepopulationSetFromCountryID(country)) { + if (engine_and_tier.search_engine->id == prepopulated_id) { + return TemplateURLDataFromPrepopulatedEngine( + *engine_and_tier.search_engine); + } + } + + // Fallback: just grab the first matching entry from the complete list. In + // case of IDs shared across multiple entries, we might be returning the + // wrong one for the profile country. We can look into better heuristics in + // future work. + for (size_t i = 0; i < kAllEnginesLength; ++i) { + const PrepopulatedEngine* engine = kAllEngines[i]; + if (engine->id == prepopulated_id) { + return TemplateURLDataFromPrepopulatedEngine(*engine); + } + } + + return nullptr; +} + void ClearPrepopulatedEnginesInPrefs(PrefService* prefs) { if (!prefs) return;
diff --git a/components/search_engines/template_url_prepopulate_data.h b/components/search_engines/template_url_prepopulate_data.h index 40cecd2..bb88e31 100644 --- a/components/search_engines/template_url_prepopulate_data.h +++ b/components/search_engines/template_url_prepopulate_data.h
@@ -46,10 +46,19 @@ bool include_current_default = false, TemplateURLService* template_url_service = nullptr); -// Returns the prepopulated search engine with the given |prepopulated_id|. +// Returns the prepopulated search engine with the given |prepopulated_id| +// from the profile country's known prepopulated search engines, or `nullptr` +// if it's not known there. std::unique_ptr<TemplateURLData> GetPrepopulatedEngine(PrefService* prefs, int prepopulated_id); +// Returns the prepopulated search engine with the given |prepopulated_id| +// from the full list of known prepopulated search engines, or `nullptr` if +// it's not known there. +std::unique_ptr<TemplateURLData> GetPrepopulatedEngineFromFullList( + PrefService* prefs, + int prepopulated_id); + #if BUILDFLAG(IS_ANDROID) // Returns the prepopulated URLs associated with |locale|. |locale| should be a // two-character uppercase ISO 3166-1 country code.
diff --git a/components/search_engines/template_url_prepopulate_data_unittest.cc b/components/search_engines/template_url_prepopulate_data_unittest.cc index 41c0537..415dfdd 100644 --- a/components/search_engines/template_url_prepopulate_data_unittest.cc +++ b/components/search_engines/template_url_prepopulate_data_unittest.cc
@@ -20,6 +20,7 @@ #include "components/search_engines/prepopulated_engines.h" #include "components/search_engines/search_engine_choice_utils.h" #include "components/search_engines/search_engines_pref_names.h" +#include "components/search_engines/search_engines_test_util.h" #include "components/search_engines/search_terms_data.h" #include "components/search_engines/template_url.h" #include "components/search_engines/template_url_data_util.h" @@ -584,3 +585,28 @@ EXPECT_LT(index, urls.size()); EXPECT_EQ(urls[index]->prepopulate_id, kGoogleId); } + +// Regression test for https://crbug.com/1500526. +TEST_F(TemplateURLPrepopulateDataTest, GetPrepopulatedEngineFromFullList) { + // Ensure that we use the default set of search engines, which is google, + // bing, yahoo. + prefs_.SetInteger(country_codes::kCountryIDAtInstall, + country_codes::kCountryIDUnknown); + ASSERT_EQ(TemplateURLPrepopulateData::GetPrepopulatedEngines(&prefs_, nullptr) + .size(), + 3u); + + // `GetPrepopulatedEngine()` only looks in the profile country's prepopulated + // list. + EXPECT_FALSE(TemplateURLPrepopulateData::GetPrepopulatedEngine( + &prefs_, TemplateURLPrepopulateData::ecosia.id)); + + // Here we look in the full list. + auto found_engine = + TemplateURLPrepopulateData::GetPrepopulatedEngineFromFullList( + &prefs_, TemplateURLPrepopulateData::ecosia.id); + EXPECT_TRUE(found_engine); + auto expected_engine = + TemplateURLDataFromPrepopulatedEngine(TemplateURLPrepopulateData::ecosia); + ExpectSimilar(expected_engine.get(), found_engine.get()); +}
diff --git a/components/security_state/core/security_state.h b/components/security_state/core/security_state.h index 3ba3881..a1399b2 100644 --- a/components/security_state/core/security_state.h +++ b/components/security_state/core/security_state.h
@@ -63,8 +63,6 @@ // a MITM was present. // // Used only on ChromeOS, this status is unreached on other platforms. - // TODO(https://crbug.com/1477317): make this work on all platforms when the - // non-chromeos-specific policies are added. SECURE_WITH_POLICY_INSTALLED_CERT = 4, // Attempted HTTPS and failed, page not authenticated, HTTPS with
diff --git a/components/sessions/core/command_storage_backend.cc b/components/sessions/core/command_storage_backend.cc index 5d963e2..0f71589 100644 --- a/components/sessions/core/command_storage_backend.cc +++ b/components/sessions/core/command_storage_backend.cc
@@ -9,6 +9,8 @@ #include <limits> #include <utility> +#include "base/feature_list.h" +#include "base/features.h" #include "base/files/file.h" #include "base/files/file_enumerator.h" #include "base/files/file_path.h" @@ -46,6 +48,13 @@ // Length (in bytes) of the nonce (used when encrypting). constexpr int kNonceLength = 12; +// Kill switch for the change to stop calling `File::Flush()` when appending +// commands to a file. This can be removed if the change rolls out without +// causing issues. +BASE_FEATURE(kFlushAfterAppending, + "SessionStorageFlushAfterAppendingCommands", + base::FEATURE_DISABLED_BY_DEFAULT); + // The file header is the first bytes written to the file, // and is used to identify the file as one written by us. struct FileHeader { @@ -653,7 +662,9 @@ } commands_written_++; } - file->Flush(); + if (base::FeatureList::IsEnabled(kFlushAfterAppending)) { + file->Flush(); + } return true; }
diff --git a/components/variations/cros_evaluate_seed/evaluate_seed_unittest.cc b/components/variations/cros_evaluate_seed/evaluate_seed_unittest.cc index a3a8999..022d869d 100644 --- a/components/variations/cros_evaluate_seed/evaluate_seed_unittest.cc +++ b/components/variations/cros_evaluate_seed/evaluate_seed_unittest.cc
@@ -106,7 +106,7 @@ // Should ignore data if flag is off. TEST(VariationsCrosEvaluateSeed, GetSafeSeedData_Off) { featured::SeedDetails safe_seed; - safe_seed.set_compressed_data("some text"); + safe_seed.set_b64_compressed_data("some text"); std::string text; safe_seed.SerializeToString(&text); FILE* stream = fmemopen(text.data(), text.size(), "r"); @@ -123,7 +123,7 @@ // Should return specified data via stream if flag is on. TEST(VariationsCrosEvaluateSeed, GetSafeSeedData_On) { featured::SeedDetails safe_seed; - safe_seed.set_compressed_data("some text"); + safe_seed.set_b64_compressed_data("some text"); std::string text; safe_seed.SerializeToString(&text); FILE* stream = fmemopen(text.data(), text.size(), "r"); @@ -140,7 +140,7 @@ // Should not attempt to read stream if flag is not on. TEST(VariationsCrosEvaluateSeed, GetSafeSeedData_Off_FailRead) { featured::SeedDetails safe_seed; - safe_seed.set_compressed_data("some text"); + safe_seed.set_b64_compressed_data("some text"); std::string text; safe_seed.SerializeToString(&text); FILE* stream = fmemopen(text.data(), text.size(), "w"); @@ -157,7 +157,7 @@ // If flag is on and reading fails, should return nullopt. TEST(VariationsCrosEvaluateSeed, GetSafeSeedData_On_FailRead) { featured::SeedDetails safe_seed; - safe_seed.set_compressed_data("some text"); + safe_seed.set_b64_compressed_data("some text"); std::string text; safe_seed.SerializeToString(&text); FILE* stream = fmemopen(text.data(), text.size(), "w");
diff --git a/components/viz/service/display_embedder/skia_output_device_gl.cc b/components/viz/service/display_embedder/skia_output_device_gl.cc index 36a2ef33..323b8b9 100644 --- a/components/viz/service/display_embedder/skia_output_device_gl.cc +++ b/components/viz/service/display_embedder/skia_output_device_gl.cc
@@ -27,6 +27,8 @@ #include "third_party/skia/include/gpu/gl/GrGLTypes.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" +#include "ui/gl/gl_features.h" +#include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface.h" #include "ui/gl/gl_version_info.h" @@ -47,6 +49,50 @@ } // namespace +class SkiaOutputDeviceGL::MultiSurfaceSwapBuffersTracker { + public: + // Returns true if multiple surface swaps detected. + bool TrackSwapBuffers() { + static int next_global_swap_generation = 0; + static int num_swaps_in_current_swap_generation = 0; + static int last_multi_window_swap_generation = 0; + + // This code is a simple way of enforcing that we only vsync if one surface + // is swapping per frame. This provides single window cases a stable refresh + // while allowing multi-window cases to not slow down due to multiple syncs + // on a single thread. A better way to fix this problem would be to have + // each surface present on its own thread. + + // If next global swap generation equals to our surface's next swap + // generation means we start new swap generation and this is first surface + // to swap. + if (next_global_swap_generation == next_surface_swap_generation_) { + // Start new generation. + next_global_swap_generation++; + + // Store number of swaps in the previous generation. + if (num_swaps_in_current_swap_generation > 1) { + last_multi_window_swap_generation = next_global_swap_generation; + } + num_swaps_in_current_swap_generation = 0; + } + + next_surface_swap_generation_ = next_global_swap_generation; + num_swaps_in_current_swap_generation++; + + // Number of swap generations before vsync is re-enabled after we've stopped + // doing multiple swaps per frame. + constexpr int kMultiWindowSwapEnableVSyncDelay = 60; + + return (num_swaps_in_current_swap_generation > 1) || + (next_global_swap_generation - last_multi_window_swap_generation < + kMultiWindowSwapEnableVSyncDelay); + } + + private: + int next_surface_swap_generation_ = 0; +}; + SkiaOutputDeviceGL::SkiaOutputDeviceGL( gpu::SharedContextState* context_state, scoped_refptr<gl::GLSurface> gl_surface, @@ -147,6 +193,19 @@ // scRGB linear capabilities_.sk_color_types[static_cast<int>(gfx::BufferFormat::RGBA_F16)] = kRGBA_F16_SkColorType; + + if (features::UseGpuVsync()) { + // Historically we never disabled vsync on Android and it's very rare + // use-case to have multiple active windows there. On other platforms we + // disable GLSurface's VSync if we're swapping multiple surfaces per frame + // to prevent SwapBuffers from blocking and slowing down other windows. +#if !BUILDFLAG(IS_ANDROID) + multisurface_swapbuffers_tracker_ = + std::make_unique<MultiSurfaceSwapBuffersTracker>(); +#endif + } else { + gl_surface_->SetVSyncEnabled(false); + } } SkiaOutputDeviceGL::~SkiaOutputDeviceGL() { @@ -225,6 +284,12 @@ void SkiaOutputDeviceGL::Present(const absl::optional<gfx::Rect>& update_rect, BufferPresentedCallback feedback, OutputSurfaceFrame frame) { + if (multisurface_swapbuffers_tracker_) { + const bool multiple_surface_swaps = + multisurface_swapbuffers_tracker_->TrackSwapBuffers(); + gl_surface_->SetVSyncEnabled(!multiple_surface_swaps); + } + StartSwapBuffers({}); gfx::Size surface_size =
diff --git a/components/viz/service/display_embedder/skia_output_device_gl.h b/components/viz/service/display_embedder/skia_output_device_gl.h index 50ab8b7..ca3263f 100644 --- a/components/viz/service/display_embedder/skia_output_device_gl.h +++ b/components/viz/service/display_embedder/skia_output_device_gl.h
@@ -58,7 +58,7 @@ void EndPaint() override; private: - class OverlayData; + class MultiSurfaceSwapBuffersTracker; // Use instead of calling FinishSwapBuffers() directly. void DoFinishSwapBuffers(const gfx::Size& size, @@ -80,6 +80,9 @@ sk_sp<SkSurface> sk_surface_; + std::unique_ptr<MultiSurfaceSwapBuffersTracker> + multisurface_swapbuffers_tracker_; + base::WeakPtrFactory<SkiaOutputDeviceGL> weak_ptr_factory_{this}; };
diff --git a/components/viz/service/display_embedder/skia_output_surface_dependency_impl.cc b/components/viz/service/display_embedder/skia_output_surface_dependency_impl.cc index c70f733a..58cec3b 100644 --- a/components/viz/service/display_embedder/skia_output_surface_dependency_impl.cc +++ b/components/viz/service/display_embedder/skia_output_surface_dependency_impl.cc
@@ -17,7 +17,6 @@ #include "gpu/command_buffer/service/scheduler.h" #include "gpu/command_buffer/service/scheduler_sequence.h" #include "gpu/ipc/service/image_transport_surface.h" -#include "ui/gl/gl_features.h" #include "ui/gl/init/gl_factory.h" namespace viz { @@ -119,12 +118,8 @@ base::WeakPtr<gpu::ImageTransportSurfaceDelegate> stub, gl::GLSurfaceFormat format) { CHECK(!IsOffscreen()); - auto surface = gpu::ImageTransportSurface::CreateNativeGLSurface( + return gpu::ImageTransportSurface::CreateNativeGLSurface( GetSharedContextState()->display(), stub, surface_handle_, format); - if (!features::UseGpuVsync()) { - surface->SetVSyncEnabled(false); - } - return surface; } base::ScopedClosureRunner SkiaOutputSurfaceDependencyImpl::CachePresenter(
diff --git a/components/webapps/browser/banners/app_banner_manager.cc b/components/webapps/browser/banners/app_banner_manager.cc index f16a15c8..f3bc0f6 100644 --- a/components/webapps/browser/banners/app_banner_manager.cc +++ b/components/webapps/browser/banners/app_banner_manager.cc
@@ -811,7 +811,8 @@ // directly to sending the banner prompt request. UpdateState(State::ACTIVE); SendBannerPromptRequest(); - } else if (load_finished_ && state_ == State::INACTIVE) { + } else if (load_finished_ && validated_url_ == url && + state_ == State::INACTIVE) { // This performs some simple tests and starts async checks to test // installability. It should be safe to start in response to user input. // Don't call if we're already working on processing a banner request.
diff --git a/content/browser/back_forward_cache_network_request_browsertest.cc b/content/browser/back_forward_cache_network_request_browsertest.cc index e77f6ae..7d09a9e 100644 --- a/content/browser/back_forward_cache_network_request_browsertest.cc +++ b/content/browser/back_forward_cache_network_request_browsertest.cc
@@ -250,8 +250,14 @@ ExpectRestored(FROM_HERE); } +enum class BackgroundResourceFetchTestCase { + kBackgroundResourceFetchEnabled, + kBackgroundResourceFetchDisabled, +}; + class BackForwardCacheNetworkLimitBrowserTest - : public BackForwardCacheBrowserTest { + : public BackForwardCacheBrowserTest, + public testing::WithParamInterface<BackgroundResourceFetchTestCase> { public: const int kMaxBufferedBytesPerProcess = 10000; const base::TimeDelta kGracePeriodToFinishLoading = base::Seconds(5); @@ -265,13 +271,39 @@ {"grace_period_to_finish_loading_in_seconds", base::NumberToString(kGracePeriodToFinishLoading.InSeconds())}}}}, {}); + if (IsBackgroundResourceFetchEnabled()) { + feature_background_resource_fetch_.InitAndEnableFeature( + blink::features::kBackgroundResourceFetch); + } } private: + bool IsBackgroundResourceFetchEnabled() const { + return GetParam() == + BackgroundResourceFetchTestCase::kBackgroundResourceFetchEnabled; + } + base::test::ScopedFeatureList feature_list_; + base::test::ScopedFeatureList feature_background_resource_fetch_; }; -IN_PROC_BROWSER_TEST_F( +INSTANTIATE_TEST_SUITE_P( + All, + BackForwardCacheNetworkLimitBrowserTest, + testing::ValuesIn( + {BackgroundResourceFetchTestCase::kBackgroundResourceFetchEnabled, + BackgroundResourceFetchTestCase::kBackgroundResourceFetchDisabled}), + [](const testing::TestParamInfo<BackgroundResourceFetchTestCase>& info) { + switch (info.param) { + case (BackgroundResourceFetchTestCase::kBackgroundResourceFetchEnabled): + return "BackgroundResourceFetchEnabled"; + case ( + BackgroundResourceFetchTestCase::kBackgroundResourceFetchDisabled): + return "BackgroundResourceFetchDisabled"; + } + }); + +IN_PROC_BROWSER_TEST_P( BackForwardCacheNetworkLimitBrowserTest, PageWithDrainedDatapipeRequestsForScriptStreamerShouldBeEvictedIfStreamedTooMuch) { net::test_server::ControllableHttpResponse response(embedded_test_server(), @@ -321,7 +353,7 @@ {}, FROM_HERE); } -IN_PROC_BROWSER_TEST_F(BackForwardCacheNetworkLimitBrowserTest, +IN_PROC_BROWSER_TEST_P(BackForwardCacheNetworkLimitBrowserTest, ImageStillLoading_ResponseStartedWhileFrozen) { net::test_server::ControllableHttpResponse image_response( embedded_test_server(), "/image.png"); @@ -354,7 +386,7 @@ EXPECT_EQ("error", EvalJs(rfh_1.get(), "image_load_status")); } -IN_PROC_BROWSER_TEST_F( +IN_PROC_BROWSER_TEST_P( BackForwardCacheNetworkLimitBrowserTest, ImageStillLoading_ResponseStartedWhileRestoring_DoNotTriggerEviction) { net::test_server::ControllableHttpResponse image_response( @@ -411,7 +443,7 @@ #define MAYBE_ImageStillLoading_ResponseStartedWhileFrozen_ExceedsPerProcessBytesLimit \ ImageStillLoading_ResponseStartedWhileFrozen_ExceedsPerProcessBytesLimit #endif -IN_PROC_BROWSER_TEST_F( +IN_PROC_BROWSER_TEST_P( BackForwardCacheNetworkLimitBrowserTest, MAYBE_ImageStillLoading_ResponseStartedWhileFrozen_ExceedsPerProcessBytesLimit) { net::test_server::ControllableHttpResponse image1_response( @@ -485,7 +517,7 @@ #define MAYBE_ImageStillLoading_ResponseStartedWhileFrozen_ExceedsPerProcessBytesLimit_SameSiteSubframe \ ImageStillLoading_ResponseStartedWhileFrozen_ExceedsPerProcessBytesLimit_SameSiteSubframe #endif -IN_PROC_BROWSER_TEST_F( +IN_PROC_BROWSER_TEST_P( BackForwardCacheNetworkLimitBrowserTest, MAYBE_ImageStillLoading_ResponseStartedWhileFrozen_ExceedsPerProcessBytesLimit_SameSiteSubframe) { net::test_server::ControllableHttpResponse image1_response( @@ -565,7 +597,7 @@ {}, FROM_HERE); } -IN_PROC_BROWSER_TEST_F( +IN_PROC_BROWSER_TEST_P( BackForwardCacheNetworkLimitBrowserTest, ImageStillLoading_ResponseStartedWhileFrozen_ExceedsPerProcessBytesLimit_ResetOnRestore) { net::test_server::ControllableHttpResponse image1_response( @@ -639,7 +671,7 @@ ExpectRestored(FROM_HERE); } -IN_PROC_BROWSER_TEST_F( +IN_PROC_BROWSER_TEST_P( BackForwardCacheNetworkLimitBrowserTest, ImageStillLoading_ResponseStartedWhileFrozen_ExceedsPerProcessBytesLimit_ResetOnDetach) { net::test_server::ControllableHttpResponse image1_response( @@ -716,7 +748,7 @@ EXPECT_EQ("error", EvalJs(rfh_2.get(), "image2_load_status")); } -IN_PROC_BROWSER_TEST_F(BackForwardCacheNetworkLimitBrowserTest, +IN_PROC_BROWSER_TEST_P(BackForwardCacheNetworkLimitBrowserTest, ImageStillLoading_ResponseStartedWhileFrozen_Timeout) { net::test_server::ControllableHttpResponse image_response( embedded_test_server(), "/image.png"); @@ -756,7 +788,7 @@ #define MAYBE_ImageStillLoading_ResponseStartedBeforeFreezing_ExceedsPerProcessBytesLimit \ ImageStillLoading_ResponseStartedBeforeFreezing_ExceedsPerProcessBytesLimit #endif -IN_PROC_BROWSER_TEST_F( +IN_PROC_BROWSER_TEST_P( BackForwardCacheNetworkLimitBrowserTest, MAYBE_ImageStillLoading_ResponseStartedBeforeFreezing_ExceedsPerProcessBytesLimit) { net::test_server::ControllableHttpResponse image1_response( @@ -829,7 +861,7 @@ {}, FROM_HERE); } -IN_PROC_BROWSER_TEST_F(BackForwardCacheNetworkLimitBrowserTest, +IN_PROC_BROWSER_TEST_P(BackForwardCacheNetworkLimitBrowserTest, TimeoutNotTriggeredAfterDone) { net::test_server::ControllableHttpResponse image_response( embedded_test_server(), "/image.png"); @@ -872,7 +904,7 @@ ExpectRestored(FROM_HERE); } -IN_PROC_BROWSER_TEST_F( +IN_PROC_BROWSER_TEST_P( BackForwardCacheNetworkLimitBrowserTest, TimeoutNotTriggeredAfterDone_ResponseStartedBeforeFreezing) { net::test_server::ControllableHttpResponse image_response(
diff --git a/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc b/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc index 3af4df51..e89347f9 100644 --- a/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc +++ b/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc
@@ -385,6 +385,7 @@ void TearDown() override { mock_policy_ = nullptr; + remover_ = nullptr; // BrowserContext contains a DOMStorageContext. BrowserContext's // destructor posts a message to the WEBKIT thread to delete some of its @@ -438,7 +439,10 @@ BrowserContext* GetBrowserContext() { return browser_context_.get(); } - void DestroyBrowserContext() { browser_context_.reset(); } + void DestroyBrowserContext() { + remover_ = nullptr; + browser_context_.reset(); + } const base::Time& GetBeginTime() { return remover_->GetLastUsedBeginTimeForTesting(); @@ -493,7 +497,7 @@ storage_partition_; // Cached pointer to BrowsingDataRemoverImpl for access to testing methods. - raw_ptr<BrowsingDataRemoverImpl, DanglingUntriaged> remover_; + raw_ptr<BrowsingDataRemoverImpl> remover_; BrowserTaskEnvironment task_environment_; std::unique_ptr<BrowserContext> browser_context_;
diff --git a/content/browser/child_process_host_impl.cc b/content/browser/child_process_host_impl.cc index d476c13..b9dad49 100644 --- a/content/browser/child_process_host_impl.cc +++ b/content/browser/child_process_host_impl.cc
@@ -368,6 +368,10 @@ void ChildProcessHostImpl::OnChannelConnected(int32_t peer_pid) { // Propagate the pseudonymization salt to all the child processes. // + // Doing this as the first step in this method helps to minimize scenarios + // where child process runs code that depends on the pseudonymization salt + // before it has been set. See also https://crbug.com/1479308#c5 + // // TODO(dullweber, lukasza): Figure out if it is possible to reset the salt // at a regular interval (on the order of hours?). The browser would need // to be responsible for 1) deciding when the refresh happens and 2) pushing
diff --git a/content/browser/devtools/protocol/fedcm_handler.cc b/content/browser/devtools/protocol/fedcm_handler.cc index 6884e854..fb071d7 100644 --- a/content/browser/devtools/protocol/fedcm_handler.cc +++ b/content/browser/devtools/protocol/fedcm_handler.cc
@@ -182,7 +182,9 @@ return DispatchResponse::InvalidParams("Invalid account index"); } -DispatchResponse FedCmHandler::ConfirmIdpLogin(const String& in_dialogId) { +DispatchResponse FedCmHandler::ClickDialogButton( + const String& in_dialogId, + const FedCm::DialogButton& in_dialogButton) { if (in_dialogId != dialog_id_) { return DispatchResponse::InvalidParams( "Dialog ID does not match current dialog"); @@ -191,16 +193,21 @@ auto* auth_request = GetFederatedAuthRequest(); if (!auth_request) { return DispatchResponse::ServerError( - "dismissDialog called while no FedCm dialog is shown"); + "clickDialogButton called while no FedCm dialog is shown"); } FederatedAuthRequestImpl::DialogType type = auth_request->GetDialogType(); - if (type != FederatedAuthRequestImpl::kConfirmIdpLogin) { - return DispatchResponse::ServerError( - "dismissDialog called while no confirm IDP login dialog is shown"); + // TODO(crbug.com/1499341): Add support for clicking error dialog buttons. + if (in_dialogButton == FedCm::DialogButtonEnum::ConfirmIdpLoginContinue) { + if (type != FederatedAuthRequestImpl::kConfirmIdpLogin) { + return DispatchResponse::ServerError( + "clickDialogButton called with ConfirmIdpLoginContinue while no " + "confirm IDP login dialog is shown"); + } + auth_request->AcceptConfirmIdpLoginDialogForDevtools(); + return DispatchResponse::Success(); } - auth_request->AcceptConfirmIdpLoginDialogForDevtools(); - return DispatchResponse::Success(); + return DispatchResponse::InvalidParams("Invalid dialog button"); } DispatchResponse FedCmHandler::DismissDialog(const String& in_dialogId,
diff --git a/content/browser/devtools/protocol/fedcm_handler.h b/content/browser/devtools/protocol/fedcm_handler.h index 09b0436..428fb2c03 100644 --- a/content/browser/devtools/protocol/fedcm_handler.h +++ b/content/browser/devtools/protocol/fedcm_handler.h
@@ -55,7 +55,9 @@ DispatchResponse Disable() override; DispatchResponse SelectAccount(const String& in_dialogId, int in_accountIndex) override; - DispatchResponse ConfirmIdpLogin(const String& in_dialogId) override; + DispatchResponse ClickDialogButton( + const String& in_dialogId, + const FedCm::DialogButton& in_dialogButton) override; DispatchResponse DismissDialog(const String& in_dialogId, Maybe<bool> in_triggerCooldown) override; DispatchResponse ResetCooldown() override;
diff --git a/content/browser/media/session/media_session_impl_browsertest.cc b/content/browser/media/session/media_session_impl_browsertest.cc index 42af4a6..c2421f4f 100644 --- a/content/browser/media/session/media_session_impl_browsertest.cc +++ b/content/browser/media/session/media_session_impl_browsertest.cc
@@ -99,8 +99,9 @@ MOCK_METHOD(void, ReleaseRequestId, (), (override)); void ResolveRequest(bool result) { - if (!async_mode_) + if (!async_mode_) { return; + } audio_focus_type_ = requests_.front(); requests_.pop_front(); @@ -119,7 +120,7 @@ AudioFocusDelegate::AudioFocusResult sync_result_ = AudioFocusDelegate::AudioFocusResult::kSuccess; - raw_ptr<content::MediaSessionImpl> media_session_; + raw_ptr<content::MediaSessionImpl> media_session_ = nullptr; const bool async_mode_ = false; std::list<AudioFocusType> requests_; @@ -168,6 +169,7 @@ media_session_->RemoveAllPlayersForTest(); mock_media_session_service_.reset(); + mock_audio_focus_delegate_ = nullptr; media_session_ = nullptr; ContentBrowserTest::TearDownOnMainThread(); @@ -312,8 +314,8 @@ return std::make_unique<net::test_server::BasicHttpResponse>(); } - raw_ptr<MediaSessionImpl, DanglingUntriaged> media_session_; - raw_ptr<MockAudioFocusDelegate, DanglingUntriaged> mock_audio_focus_delegate_; + raw_ptr<MediaSessionImpl> media_session_ = nullptr; + raw_ptr<MockAudioFocusDelegate> mock_audio_focus_delegate_ = nullptr; std::unique_ptr<MockMediaSessionServiceImpl> mock_media_session_service_; net::EmbeddedTestServer favicon_server_; base::AtomicSequenceNumber favicon_calls_; @@ -2813,8 +2815,9 @@ } void Wait() { - if (received_favicon_) + if (received_favicon_) { return; + } run_loop_.Run(); }
diff --git a/content/browser/network/sandboxed_socket_broker_browsertest.cc b/content/browser/network/sandboxed_socket_broker_browsertest.cc index 2984f39..4a42e68 100644 --- a/content/browser/network/sandboxed_socket_broker_browsertest.cc +++ b/content/browser/network/sandboxed_socket_broker_browsertest.cc
@@ -210,7 +210,12 @@ CountingSocketBrokerImpl socket_broker; network::mojom::NetworkContextParamsPtr network_context_params = network::mojom::NetworkContextParams::New(); - network_context_params->socket_broker = socket_broker.BindNewRemote(); + network_context_params->socket_brokers = + network::mojom::SocketBrokerRemotes::New(); + network_context_params->socket_brokers->client = + socket_broker.BindNewRemote(); + network_context_params->socket_brokers->server = + socket_broker.BindNewRemote(); auto file_paths = network::mojom::NetworkContextFilePaths::New(); base::FilePath context_path = shell()->web_contents()->GetBrowserContext()->GetPath().Append(
diff --git a/content/browser/network_service_instance_impl.cc b/content/browser/network_service_instance_impl.cc index 40763514..e51a6075 100644 --- a/content/browser/network_service_instance_impl.cc +++ b/content/browser/network_service_instance_impl.cc
@@ -325,8 +325,10 @@ // down anyway. if (!GetContentClient()->browser()->IsShuttingDown() && GetContentClient()->browser()->ShouldSandboxNetworkService() && - !params->socket_broker) { - params->socket_broker = g_client->BindSocketBroker(); + !params->socket_brokers) { + params->socket_brokers = network::mojom::SocketBrokerRemotes::New(); + params->socket_brokers->client = g_client->BindSocketBroker(); + params->socket_brokers->server = g_client->BindSocketBroker(); } #endif // BUILDFLAG(IS_WIN) @@ -876,19 +878,10 @@ return GetCertVerifierServiceFactoryRemoteStorage(); } + network::mojom::CertVerifierServiceRemoteParamsPtr GetCertVerifierParams( cert_verifier::mojom::CertVerifierCreationParamsPtr cert_verifier_creation_params) { - return GetCertVerifierParamsWithUpdater( - std::move(cert_verifier_creation_params), mojo::NullReceiver()); -} - -network::mojom::CertVerifierServiceRemoteParamsPtr -GetCertVerifierParamsWithUpdater( - cert_verifier::mojom::CertVerifierCreationParamsPtr - cert_verifier_creation_params, - mojo::PendingReceiver<cert_verifier::mojom::CertVerifierServiceUpdater> - cert_verifier_updater_remote) { mojo::PendingRemote<cert_verifier::mojom::CertVerifierService> cert_verifier_remote; mojo::PendingReceiver<cert_verifier::mojom::CertVerifierServiceClient> @@ -896,7 +889,6 @@ GetCertVerifierServiceFactory()->GetNewCertVerifier( cert_verifier_remote.InitWithNewPipeAndPassReceiver(), - std::move(cert_verifier_updater_remote), cert_verifier_client.InitWithNewPipeAndPassRemote(), std::move(cert_verifier_creation_params));
diff --git a/content/browser/network_service_instance_impl.h b/content/browser/network_service_instance_impl.h index c753ee8..ec129b5 100644 --- a/content/browser/network_service_instance_impl.h +++ b/content/browser/network_service_instance_impl.h
@@ -8,10 +8,6 @@ #include "base/callback_list.h" #include "base/functional/callback.h" #include "content/common/content_export.h" -#include "mojo/public/cpp/bindings/remote.h" -#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom-forward.h" -#include "services/network/public/mojom/cert_verifier_service.mojom-forward.h" -#include "services/network/public/mojom/network_context.mojom-forward.h" namespace content { @@ -57,19 +53,6 @@ CONTENT_EXPORT void OnRestartNetworkServiceForTesting( base::RepeatingClosure on_restart); -// Returns a CertVerifierParams that can be placed into a new -// network::mojom::NetworkContextParams. -// -// Like |GetCertVerifierParams| but the |cert_verifier_updater_remote| pipe -// passed in can be used to update the returned CertVerifierService with new -// verification parameters. -CONTENT_EXPORT network::mojom::CertVerifierServiceRemoteParamsPtr -GetCertVerifierParamsWithUpdater( - cert_verifier::mojom::CertVerifierCreationParamsPtr - cert_verifier_creation_params, - mojo::PendingReceiver<cert_verifier::mojom::CertVerifierServiceUpdater> - cert_verifier_updater_remote); - } // namespace content #endif // CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_
diff --git a/content/browser/preloading/prefetch/prefetch_network_context.cc b/content/browser/preloading/prefetch/prefetch_network_context.cc index 4663e5b..29ea76b0 100644 --- a/content/browser/preloading/prefetch/prefetch_network_context.cc +++ b/content/browser/preloading/prefetch/prefetch_network_context.cc
@@ -110,20 +110,6 @@ GetReducedUserAgent(base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kUseMobileUserAgent), delegate ? delegate->GetMajorVersionNumber() : ""); - // The verifier created here does not have the same parameters as used in the - // profile (where additional parameters are added in - // chrome/browser/net/profile_network_context_service.h - // ProfileNetworkContextService::ConfigureNetworkContextParamsInternal, as - // well as updates in ProfileNetworkContextService::UpdateCertificatePolicy). - // - // Currently this does not cause problems as additional parameters only ensure - // more requests validate, so the only harm is that prefetch requests will - // fail and then later succeed when they are actually fetched. In the future - // when additional parameters can cause validations to fail, this will cause - // problems. - // - // TODO(crbug.com/1477317): figure out how to get this verifier in sync with - // the profile verifier. context_params->cert_verifier_params = GetCertVerifierParams( cert_verifier::mojom::CertVerifierCreationParams::New()); context_params->cors_exempt_header_list = {kCorsExemptPurposeHeaderName};
diff --git a/content/browser/preloading/prerender/prerender_browsertest.cc b/content/browser/preloading/prerender/prerender_browsertest.cc index 0b38e5e0..59d6d5af 100644 --- a/content/browser/preloading/prerender/prerender_browsertest.cc +++ b/content/browser/preloading/prerender/prerender_browsertest.cc
@@ -9922,9 +9922,24 @@ EXPECT_FALSE(prerendered_rfh->frame_tree_node()->HasStickyUserActivation()); } +// Used for running tests that should commonly pass regardless of target hints. +class PrerenderTargetAgnosticBrowserTest + : public PrerenderBrowserTest, + public testing::WithParamInterface<std::string> { + protected: + std::string GetTargetHint() { return GetParam(); } +}; + +INSTANTIATE_TEST_SUITE_P(All, + PrerenderTargetAgnosticBrowserTest, + testing::Values("_self", "_blank"), + [](const testing::TestParamInfo<std::string>& info) { + return info.param; + }); + // Tests that prerendering is cancelled when a mixed content subframe is // detected. -IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, MixedContent) { +IN_PROC_BROWSER_TEST_P(PrerenderTargetAgnosticBrowserTest, MixedContent) { const GURL kInitialUrl = GetUrl("/empty.html"); const GURL kPrerenderingUrl = GetUrl("/empty.html?prerendering"); @@ -9932,12 +9947,16 @@ ASSERT_TRUE(NavigateToURL(shell(), kInitialUrl)); // Make a prerendered page. - int host_id = AddPrerender(kPrerenderingUrl); - auto* prerendered_rfh = GetPrerenderedMainFrameHost(host_id); + int host_id = prerender_helper()->AddPrerender( + kPrerenderingUrl, /*eagerness=*/absl::nullopt, GetTargetHint()); + auto* prerender_web_contents = WebContents::FromFrameTreeNodeId(host_id); + auto* prerendered_rfh = + test::PrerenderTestHelper::GetPrerenderedMainFrameHost( + *prerender_web_contents, host_id); CHECK(prerendered_rfh); EXPECT_TRUE(AddTestUtilJS(prerendered_rfh)); - test::PrerenderHostObserver host_observer(*web_contents(), host_id); + test::PrerenderHostObserver host_observer(*prerender_web_contents, host_id); // Make a mixed content iframe. std::ignore = @@ -9946,7 +9965,8 @@ EvalJsOptions::EXECUTE_SCRIPT_NO_RESOLVE_PROMISES); host_observer.WaitForDestroyed(); - EXPECT_EQ(prerender_helper()->GetHostForUrl(kPrerenderingUrl), + EXPECT_EQ(test::PrerenderTestHelper::GetHostForUrl(*prerender_web_contents, + kPrerenderingUrl), RenderFrameHost::kNoFrameTreeNodeId); ExpectFinalStatusForSpeculationRule(PrerenderFinalStatus::kMixedContent);
diff --git a/content/browser/renderer_host/ipc_utils.cc b/content/browser/renderer_host/ipc_utils.cc index 5cb6e64..84a9de1d 100644 --- a/content/browser/renderer_host/ipc_utils.cc +++ b/content/browser/renderer_host/ipc_utils.cc
@@ -73,7 +73,7 @@ navigation_url_key, navigation_url->DeprecatedGetOriginAsURL().spec()); } - if (initiator_frame_token) { + if (initiator_frame_token && initiator_frame_token->has_value()) { if (RenderFrameHostImpl* initiator_render_frame_host = RenderFrameHostImpl::FromFrameToken( process_id, initiator_frame_token->value())) {
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 80686822..0ea34e7 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -3777,6 +3777,18 @@ void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) { channel_connected_ = true; + // Propagate the pseudonymization salt to all the child processes. + // + // Doing this as the first step in this method helps to minimize scenarios + // where child process runs code that depends on the pseudonymization salt + // before it has been set. See also https://crbug.com/1479308#c5 + // + // TODO(dullweber, lukasza): Figure out if it is possible to reset the salt + // at a regular interval (on the order of hours?). The browser would need to + // be responsible for 1) deciding when the refresh happens and 2) pushing the + // updated salt to all the child processes. + child_process_->SetPseudonymizationSalt(GetPseudonymizationSalt()); + #if BUILDFLAG(IS_MAC) ChildProcessTaskPortProvider::GetInstance()->OnChildProcessLaunched( peer_pid, child_process_.get()); @@ -3805,14 +3817,6 @@ #if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX) child_process_->SetProfilingFile(OpenProfilingFile()); #endif - - // Propagate the pseudonymization salt to all the child processes. - // - // TODO(dullweber, lukasza): Figure out if it is possible to reset the salt - // at a regular interval (on the order of hours?). The browser would need to - // be responsible for 1) deciding when the refresh happens and 2) pushing the - // updated salt to all the child processes. - child_process_->SetPseudonymizationSalt(GetPseudonymizationSalt()); } void RenderProcessHostImpl::OnChannelError() {
diff --git a/content/browser/renderer_host/render_widget_host_view_ios.mm b/content/browser/renderer_host/render_widget_host_view_ios.mm index 7f525f6..89a54c4 100644 --- a/content/browser/renderer_host/render_widget_host_view_ios.mm +++ b/content/browser/renderer_host/render_widget_host_view_ios.mm
@@ -8,6 +8,7 @@ #include <cstdint> +#include "base/command_line.h" #include "base/strings/sys_string_conversions.h" #include "components/viz/common/features.h" #include "components/viz/common/surfaces/frame_sink_id_allocator.h" @@ -22,6 +23,7 @@ #include "content/browser/renderer_host/ui_events_helper.h" #include "content/common/content_switches_internal.h" #include "content/public/browser/browser_task_traits.h" +#include "content/public/common/content_switches.h" #include "ui/accelerated_widget_mac/ca_layer_frame_sink_provider.h" #include "ui/accelerated_widget_mac/display_ca_layer_tree.h" #include "ui/base/ime/text_input_mode.h" @@ -30,10 +32,6 @@ #include "ui/events/gesture_detection/gesture_provider_config_helper.h" #include "ui/gfx/geometry/size_conversions.h" -// Used for settng the requested renderer size when testing. -constexpr int kDefaultWidthForTesting = 980; -constexpr int kDefaultHeightForTesting = 735; - static void* kObservingContext = &kObservingContext; @interface UIApplication (Testing) @@ -47,9 +45,23 @@ @end namespace { + +// Used for setting the requested renderer size when testing. +constexpr gfx::Size kDefaultSizeForTesting = gfx::Size(800, 600); +constexpr gfx::Size KDefaultSizeForPreventResizingForTesting = + gfx::Size(980, 735); + bool IsTesting() { return [[UIApplication sharedApplication] isRunningTests]; } + +gfx::Rect GetDefaultSizeForTesting() { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kPreventResizingContentsForTesting) + ? gfx::Rect(KDefaultSizeForPreventResizingForTesting) + : gfx::Rect(kDefaultSizeForTesting); +} + } // namespace // TODO(dtapuska): Change this to be UITextInput and handle the other @@ -350,7 +362,7 @@ host()->GetFrameSinkId()); if (IsTesting()) { - view_bounds_ = gfx::Rect(kDefaultWidthForTesting, kDefaultHeightForTesting); + view_bounds_ = GetDefaultSizeForTesting(); browser_compositor_->UpdateSurfaceFromUIView(GetViewBounds().size()); }
diff --git a/content/browser/storage_access/storage_access_handle.cc b/content/browser/storage_access/storage_access_handle.cc index c657745..2f8c0c9 100644 --- a/content/browser/storage_access/storage_access_handle.cc +++ b/content/browser/storage_access/storage_access_handle.cc
@@ -146,6 +146,16 @@ std::move(callback))); } +void StorageAccessHandle::BindBlobStorage( + mojo::PendingAssociatedReceiver<blink::mojom::BlobURLStore> receiver) { + static_cast<RenderFrameHostImpl&>(render_frame_host()) + .GetStoragePartition() + ->GetBlobUrlRegistry() + ->AddReceiver(blink::StorageKey::CreateFirstParty( + render_frame_host().GetStorageKey().origin()), + std::move(receiver)); +} + StorageAccessHandle::StorageAccessHandle( RenderFrameHost& host, mojo::PendingReceiver<blink::mojom::StorageAccessHandle> receiver)
diff --git a/content/browser/storage_access/storage_access_handle.h b/content/browser/storage_access/storage_access_handle.h index b844b65..806cae2a 100644 --- a/content/browser/storage_access/storage_access_handle.h +++ b/content/browser/storage_access/storage_access_handle.h
@@ -40,6 +40,9 @@ mojo::PendingReceiver<blink::mojom::CacheStorage> receiver) override; void GetDirectory(GetDirectoryCallback callback) override; void Estimate(EstimateCallback callback) override; + void BindBlobStorage( + mojo::PendingAssociatedReceiver<blink::mojom::BlobURLStore> receiver) + override; private: StorageAccessHandle(
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index b814006..5cb7b6a 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -83,7 +83,6 @@ #include "content/browser/navigation_or_document_handle.h" #include "content/browser/network/shared_dictionary_util.h" #include "content/browser/network_context_client_base_impl.h" -#include "content/browser/network_service_instance_impl.h" #include "content/browser/notifications/platform_notification_context_impl.h" #include "content/browser/payments/payment_app_context_impl.h" #include "content/browser/preloading/prerender/prerender_final_status.h" @@ -1668,15 +1667,6 @@ return network_context_.get(); } -cert_verifier::mojom::CertVerifierServiceUpdater* -StoragePartitionImpl::GetCertVerifierServiceUpdater() { - DCHECK(initialized_); - if (!cert_verifier_service_updater_.is_bound()) { - InitNetworkContext(); - } - return cert_verifier_service_updater_.get(); -} - scoped_refptr<network::SharedURLLoaderFactory> StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcess() { DCHECK(initialized_); @@ -3369,10 +3359,8 @@ "NetworkContextParams, as they will be replaced with a new pipe to " "the CertVerifierService."; - cert_verifier_service_updater_.reset(); - context_params->cert_verifier_params = GetCertVerifierParamsWithUpdater( - std::move(cert_verifier_creation_params), - cert_verifier_service_updater_.BindNewPipeAndPassReceiver()); + context_params->cert_verifier_params = + GetCertVerifierParams(std::move(cert_verifier_creation_params)); // This mechanisms should be used only for legacy internal headers. You can // find a recommended alternative approach on URLRequest::cors_exempt_headers
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index 5ca13f5..a1b55ae 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h
@@ -42,7 +42,6 @@ #include "mojo/public/cpp/bindings/unique_receiver_set.h" #include "net/cookies/cookie_setting_override.h" #include "services/network/public/cpp/network_service_buildflags.h" -#include "services/network/public/mojom/cert_verifier_service.mojom.h" #include "services/network/public/mojom/cookie_manager.mojom.h" #include "services/network/public/mojom/network_context.mojom.h" #include "storage/browser/blob/blob_url_registry.h" @@ -165,8 +164,6 @@ const StoragePartitionConfig& GetConfig() override; base::FilePath GetPath() override; network::mojom::NetworkContext* GetNetworkContext() override; - cert_verifier::mojom::CertVerifierServiceUpdater* - GetCertVerifierServiceUpdater() override; network::mojom::URLLoaderFactoryParamsPtr CreateURLLoaderFactoryParams(); scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactoryForBrowserProcess() override; @@ -758,9 +755,6 @@ scoped_refptr<URLLoaderFactoryForBrowserProcess> shared_url_loader_factory_for_browser_process_; - mojo::Remote<cert_verifier::mojom::CertVerifierServiceUpdater> - cert_verifier_service_updater_; - // URLLoaderFactory/CookieManager for use in the browser process only. // See the method comment for // StoragePartition::GetURLLoaderFactoryForBrowserProcess() for
diff --git a/content/browser/webauth/authenticator_common_impl.cc b/content/browser/webauth/authenticator_common_impl.cc index d643bb2..29c2478e 100644 --- a/content/browser/webauth/authenticator_common_impl.cc +++ b/content/browser/webauth/authenticator_common_impl.cc
@@ -1964,7 +1964,6 @@ return; } - DCHECK(req_state_->request_delegate); if (req_state_->get_assertion_response_callback) { req_state_->get_assertion_result = GetAssertionResult::kTimeout; }
diff --git a/content/browser/webauth/webauth_browsertest.cc b/content/browser/webauth/webauth_browsertest.cc index 35a56328..9ac416a 100644 --- a/content/browser/webauth/webauth_browsertest.cc +++ b/content/browser/webauth/webauth_browsertest.cc
@@ -217,7 +217,7 @@ std::string attestation = "none"; std::string exclude_credentials = "[]"; std::string signal = ""; - std::string timeout = "1000"; + std::string timeout = "10000"; }; std::string BuildCreateCallWithParameters(const CreateParameters& parameters) { @@ -274,7 +274,7 @@ " id: new TextEncoder().encode('allowedCredential')," " transports: ['usb', 'nfc', 'ble']}]"; std::string signal = ""; - std::string timeout = "1000"; + std::string timeout = "10000"; std::string rp_id = "acme.com"; }; @@ -1881,14 +1881,7 @@ device::kWebAuthnRelatedOrigin}; }; -// TODO(https://crbug.com/1500554): Enable test when MacOS failure is fixed. -#if BUILDFLAG(IS_MAC) -#define MAYBE_Create DISABLED_Create -#else -#define MAYBE_Create Create -#endif - -IN_PROC_BROWSER_TEST_F(WebAuthCrossDomainTest, MAYBE_Create) { +IN_PROC_BROWSER_TEST_F(WebAuthCrossDomainTest, Create) { CreateParameters parameters; parameters.rp_id = "foo.com"; test_client()->set_webauthn_origins_response( @@ -1912,14 +1905,7 @@ EXPECT_EQ(kRpIdContentTypeMessage, result); } -// TODO(https://crbug.com/1500554): Enable test when MacOS failure is fixed. -#if BUILDFLAG(IS_MAC) -#define MAYBE_CreateBadOrigin DISABLED_CreateBadOrigin -#else -#define MAYBE_CreateBadOrigin CreateBadOrigin -#endif - -IN_PROC_BROWSER_TEST_F(WebAuthCrossDomainTest, MAYBE_CreateBadOrigin) { +IN_PROC_BROWSER_TEST_F(WebAuthCrossDomainTest, CreateBadOrigin) { CreateParameters parameters; parameters.rp_id = "foo.com"; test_client()->set_webauthn_origins_response("application/json", @@ -1944,14 +1930,7 @@ EXPECT_EQ(kNotAllowedErrorMessage, result); } -// TODO(https://crbug.com/1500554): Enable test when MacOS failure is fixed. -#if BUILDFLAG(IS_MAC) -#define MAYBE_Get DISABLED_Get -#else -#define MAYBE_Get Get -#endif - -IN_PROC_BROWSER_TEST_F(WebAuthCrossDomainTest, MAYBE_Get) { +IN_PROC_BROWSER_TEST_F(WebAuthCrossDomainTest, Get) { const uint8_t kCredentialId[] = {0x61, 0x6C, 0x6C, 0x6F, 0x77, 0x65, 0x64, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x61, 0x6C};
diff --git a/content/browser/webid/fedcm_metrics.cc b/content/browser/webid/fedcm_metrics.cc index 75e08e94..472e3fa2 100644 --- a/content/browser/webid/fedcm_metrics.cc +++ b/content/browser/webid/fedcm_metrics.cc
@@ -200,6 +200,10 @@ ukm_builder.SetFedCmSessionID(session_id_); ukm_builder.Record(ukm::UkmRecorder::Get()); }; + + ukm::builders::Blink_FedCm fedcm_builder(page_source_id_); + RecordUkm(fedcm_builder); + ukm::builders::Blink_FedCmIdp fedcm_idp_builder(provider_source_id_); RecordUkm(fedcm_idp_builder);
diff --git a/content/browser/webid/federated_auth_request_impl_unittest.cc b/content/browser/webid/federated_auth_request_impl_unittest.cc index 5c6a636..e0c15a1 100644 --- a/content/browser/webid/federated_auth_request_impl_unittest.cc +++ b/content/browser/webid/federated_auth_request_impl_unittest.cc
@@ -1188,7 +1188,13 @@ } void ExpectSignInStateMatchStatusUKM(SignInStateMatchStatus status) { - auto entries = ukm_recorder()->GetEntriesByName(FedCmIdpEntry::kEntryName); + ExpectSignInStateMatchStatusUKMInternal(status, FedCmEntry::kEntryName); + ExpectSignInStateMatchStatusUKMInternal(status, FedCmIdpEntry::kEntryName); + } + + void ExpectSignInStateMatchStatusUKMInternal(SignInStateMatchStatus status, + const char* entry_name) { + auto entries = ukm_recorder()->GetEntriesByName(entry_name); ASSERT_FALSE(entries.empty()) << "No FedCm entry was recorded";
diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc index 0abcec6..0be4e304 100644 --- a/content/browser/zygote_host/zygote_host_impl_linux.cc +++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
@@ -158,12 +158,13 @@ base::ScopedFD* control_fd, base::FileHandleMappingVector additional_remapped_fds) { int fds[2]; - CHECK_EQ(0, socketpair(AF_UNIX, SOCK_SEQPACKET, 0, fds)); + CHECK_EQ(0, socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, fds)); CHECK(base::UnixDomainSocket::EnableReceiveProcessId(fds[0])); base::LaunchOptions options; options.fds_to_remap = std::move(additional_remapped_fds); options.fds_to_remap.emplace_back(fds[1], kZygoteSocketPairFd); + options.fds_to_remove_cloexec.push_back(fds[1]); const bool is_sandboxed_zygote = !cmd_line->HasSwitch(sandbox::policy::switches::kNoZygoteSandbox);
diff --git a/content/public/browser/network_service_instance.h b/content/public/browser/network_service_instance.h index 7078d37..892b969 100644 --- a/content/public/browser/network_service_instance.h +++ b/content/public/browser/network_service_instance.h
@@ -12,7 +12,6 @@ #include "mojo/public/cpp/bindings/remote.h" #include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom-forward.h" #include "services/network/public/cpp/network_connection_tracker.h" -#include "services/network/public/mojom/cert_verifier_service.mojom-forward.h" #include "services/network/public/mojom/network_context.mojom-forward.h" namespace base { @@ -82,9 +81,13 @@ // Returns a CertVerifierParams that can be placed into a new // network::mojom::NetworkContextParams. // -// The |cert_verifier_creation_params| will be used to configure a new +// If the CertVerifierService feature is enabled, the +// |cert_verifier_creation_params| will be used to configure a new // CertVerifierService, and a pipe to the new CertVerifierService will be placed // in the CertVerifierParams. +// +// Otherwise, |cert_verifier_creation_params| will just be placed directly into +// the CertVerifierParams to configure an in-network-service CertVerifier. CONTENT_EXPORT network::mojom::CertVerifierServiceRemoteParamsPtr GetCertVerifierParams(cert_verifier::mojom::CertVerifierCreationParamsPtr cert_verifier_creation_params);
diff --git a/content/public/browser/prerender_web_contents_delegate.cc b/content/public/browser/prerender_web_contents_delegate.cc index 0e2a8c0..97c7e328 100644 --- a/content/public/browser/prerender_web_contents_delegate.cc +++ b/content/public/browser/prerender_web_contents_delegate.cc
@@ -125,6 +125,16 @@ NOTREACHED_NORETURN(); } +bool PrerenderWebContentsDelegate::ShouldAllowRunningInsecureContent( + WebContents* web_contents, + bool allowed_per_prefs, + const url::Origin& origin, + const GURL& resource_url) { + // MixedContentChecker::ShouldBlockNavigation() should cancel prerendering + // for mixed contents before this is called. + NOTREACHED_NORETURN(); +} + PreloadingEligibility PrerenderWebContentsDelegate::IsPrerender2Supported( WebContents& web_contents) { // This should be checked in the initiator's WebContents.
diff --git a/content/public/browser/prerender_web_contents_delegate.h b/content/public/browser/prerender_web_contents_delegate.h index 9183af1..231b43e 100644 --- a/content/public/browser/prerender_web_contents_delegate.h +++ b/content/public/browser/prerender_web_contents_delegate.h
@@ -56,6 +56,10 @@ const GURL& blocked_url, const GURL& initiator_url, blink::mojom::NavigationBlockedReason reason) override; + bool ShouldAllowRunningInsecureContent(WebContents* web_contents, + bool allowed_per_prefs, + const url::Origin& origin, + const GURL& resource_url) override; PreloadingEligibility IsPrerender2Supported( WebContents& web_contents) override; std::unique_ptr<WebContents> ActivatePortalWebContents(
diff --git a/content/public/browser/storage_partition.h b/content/public/browser/storage_partition.h index 5d6328f..2197f11 100644 --- a/content/public/browser/storage_partition.h +++ b/content/public/browser/storage_partition.h
@@ -18,7 +18,6 @@ #include "components/services/storage/public/mojom/local_storage_control.mojom-forward.h" #include "content/common/content_export.h" #include "services/network/public/cpp/shared_url_loader_factory.h" -#include "services/network/public/mojom/cert_verifier_service.mojom-forward.h" #include "services/network/public/mojom/cookie_manager.mojom-forward.h" #include "services/network/public/mojom/restricted_cookie_manager.mojom-forward.h" #include "services/network/public/mojom/trust_tokens.mojom-forward.h" @@ -105,9 +104,6 @@ // caller should not hold onto this pointer beyond the same message loop task. virtual network::mojom::NetworkContext* GetNetworkContext() = 0; - virtual cert_verifier::mojom::CertVerifierServiceUpdater* - GetCertVerifierServiceUpdater() = 0; - // Returns the SharedStorageManager for the StoragePartition, or nullptr if it // doesn't exist because the feature is disabled. virtual storage::SharedStorageManager* GetSharedStorageManager() = 0;
diff --git a/content/public/browser/webui_config_map.cc b/content/public/browser/webui_config_map.cc index 98af6c7..e8d39732 100644 --- a/content/public/browser/webui_config_map.cc +++ b/content/public/browser/webui_config_map.cc
@@ -8,11 +8,13 @@ #include "base/memory/raw_ref.h" #include "base/no_destructor.h" #include "base/strings/strcat.h" +#include "content/public/browser/content_browser_client.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_controller_factory.h" #include "content/public/browser/webui_config.h" +#include "content/public/common/content_client.h" #include "content/public/common/url_constants.h" #include "url/gurl.h" @@ -49,6 +51,8 @@ if (!config) return nullptr; + GetContentClient()->browser()->LogWebUIUrl(url); + return config->CreateWebUIController(web_ui, url); }
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index a11a817..e5c255b 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc
@@ -992,6 +992,19 @@ // Enable indication that browser is controlled by automation. const char kEnableAutomation[] = "enable-automation"; +#if BUILDFLAG(IS_IOS) +// For mobile devices, tests should include a viewport meta tag to specify page +// dimension adjustments. Omitting the tag can lead to automatic resizing to +// the standard mobile fallback size (980), which results in content shrinking +// as it first expands to 980, then scales down to 800 to fit the screen, as +// observed in the issue at https://crrev.com/c/4615623. +// This flag is intended for use in tests that do not include a viewport meta +// tag. When enabled, it ensures the viewport size matches the standard mobile +// fallback size, thereby helping to prevent content resizing in such tests. +const char kPreventResizingContentsForTesting[] = + "prevent-resizing-contents-for-testing"; +#endif + // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index b8f1c93f..1708337f 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h
@@ -263,6 +263,10 @@ CONTENT_EXPORT extern const char kRendererWaitForJavaDebugger[]; #endif +#if BUILDFLAG(IS_IOS) +CONTENT_EXPORT extern const char kPreventResizingContentsForTesting[]; +#endif + // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/content/public/test/content_browser_test.cc b/content/public/test/content_browser_test.cc index 90106ba..c64f751 100644 --- a/content/public/test/content_browser_test.cc +++ b/content/public/test/content_browser_test.cc
@@ -110,6 +110,12 @@ ui::PlatformEventSource::SetIgnoreNativePlatformEvents(true); +// Enable this switch to prevent undesired viewport resizing for the scaling +// issue addressed in https://crrev.com/c/4615623. +#if BUILDFLAG(IS_IOS) + command_line->AppendSwitch(switches::kPreventResizingContentsForTesting); +#endif + BrowserTestBase::SetUp(); }
diff --git a/content/public/test/prerender_test_util.cc b/content/public/test/prerender_test_util.cc index a9ba89e..590dc2c 100644 --- a/content/public/test/prerender_test_util.cc +++ b/content/public/test/prerender_test_util.cc
@@ -328,13 +328,19 @@ &PrerenderTestHelper::MonitorResourceRequest, base::Unretained(this))); } -int PrerenderTestHelper::GetHostForUrl(const GURL& gurl) { +// static +int PrerenderTestHelper::GetHostForUrl(WebContents& web_contents, + const GURL& gurl) { auto* host = - GetPrerenderHostRegistry(GetWebContents()).FindHostByUrlForTesting(gurl); + GetPrerenderHostRegistry(&web_contents).FindHostByUrlForTesting(gurl); return host ? host->frame_tree_node_id() : RenderFrameHost::kNoFrameTreeNodeId; } +int PrerenderTestHelper::GetHostForUrl(const GURL& gurl) { + return GetHostForUrl(*GetWebContents(), gurl); +} + void PrerenderTestHelper::WaitForPrerenderLoadCompletion(int host_id) { TRACE_EVENT("test", "PrerenderTestHelper::WaitForPrerenderLoadCompletion", "host_id", host_id); @@ -570,12 +576,19 @@ return ::testing::AssertionSuccess(); } -RenderFrameHost* PrerenderTestHelper::GetPrerenderedMainFrameHost(int host_id) { - auto* prerender_host = GetPrerenderHostById(GetWebContents(), host_id); +// static +RenderFrameHost* PrerenderTestHelper::GetPrerenderedMainFrameHost( + WebContents& web_contents, + int host_id) { + auto* prerender_host = GetPrerenderHostById(&web_contents, host_id); EXPECT_NE(prerender_host, nullptr); return prerender_host->GetPrerenderedMainFrameHost(); } +RenderFrameHost* PrerenderTestHelper::GetPrerenderedMainFrameHost(int host_id) { + return GetPrerenderedMainFrameHost(*GetWebContents(), host_id); +} + int PrerenderTestHelper::GetRequestCount(const GURL& url) { EXPECT_TRUE(content::BrowserThread::CurrentlyOn(BrowserThread::UI)); base::AutoLock auto_lock(lock_);
diff --git a/content/public/test/prerender_test_util.h b/content/public/test/prerender_test_util.h index 0ffc627..c70f9db 100644 --- a/content/public/test/prerender_test_util.h +++ b/content/public/test/prerender_test_util.h
@@ -112,6 +112,7 @@ // Attempts to lookup the host for the given |gurl|. Returns // RenderFrameHost::kNoFrameTreeNodeId upon failure. + static int GetHostForUrl(WebContents& web_contents, const GURL& gurl); int GetHostForUrl(const GURL& gurl); // Waits until a prerender has finished loading. Note: this may not be called @@ -177,6 +178,9 @@ [[nodiscard]] ::testing::AssertionResult VerifyPrerenderingState( const GURL& gurl); + // Returns RenderFrameHost corresponding to `host_id`. + static RenderFrameHost* GetPrerenderedMainFrameHost(WebContents& web_contents, + int host_id); RenderFrameHost* GetPrerenderedMainFrameHost(int host_id); int GetRequestCount(const GURL& url);
diff --git a/content/public/test/test_storage_partition.cc b/content/public/test/test_storage_partition.cc index 13bda86a..6199438a 100644 --- a/content/public/test/test_storage_partition.cc +++ b/content/public/test/test_storage_partition.cc
@@ -26,10 +26,6 @@ network::mojom::NetworkContext* TestStoragePartition::GetNetworkContext() { return network_context_; } -cert_verifier::mojom::CertVerifierServiceUpdater* -TestStoragePartition::GetCertVerifierServiceUpdater() { - return nullptr; -} storage::SharedStorageManager* TestStoragePartition::GetSharedStorageManager() { return nullptr;
diff --git a/content/public/test/test_storage_partition.h b/content/public/test/test_storage_partition.h index ecaece3a..959f8ff7 100644 --- a/content/public/test/test_storage_partition.h +++ b/content/public/test/test_storage_partition.h
@@ -16,7 +16,6 @@ #include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition_config.h" #include "mojo/public/cpp/bindings/remote.h" -#include "services/network/public/mojom/cert_verifier_service.mojom.h" #include "services/network/public/mojom/network_context.mojom.h" namespace blink { @@ -63,8 +62,6 @@ network_context_ = context; } network::mojom::NetworkContext* GetNetworkContext() override; - cert_verifier::mojom::CertVerifierServiceUpdater* - GetCertVerifierServiceUpdater() override; storage::SharedStorageManager* GetSharedStorageManager() override;
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index a4822106..cf69488d 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -3538,7 +3538,8 @@ std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> RenderFrameImpl::CreateResourceLoadInfoNotifierWrapper() { return std::make_unique<blink::ResourceLoadInfoNotifierWrapper>( - weak_wrapper_resource_load_info_notifier_->AsWeakPtr()); + weak_wrapper_resource_load_info_notifier_->AsWeakPtr(), + GetTaskRunner(blink::TaskType::kNetworking)); } std::unique_ptr<blink::WebServiceWorkerProvider>
diff --git a/content/web_test/browser/web_test_control_host.cc b/content/web_test/browser/web_test_control_host.cc index a6af12b..26ec7af 100644 --- a/content/web_test/browser/web_test_control_host.cc +++ b/content/web_test/browser/web_test_control_host.cc
@@ -299,6 +299,20 @@ #endif prefs->sans_serif_font_family_map[blink::web_pref::kCommonScript] = u"Helvetica"; + +#if BUILDFLAG(IS_IOS) + // For web platform tests, the viewport should be set to 800x600. + // However, most of web platform tests do not include <meta + // name="viewport"..>, which leads to a scrollbar appearing with an 800x600 + // size due to ViewportStyle::kMobile. To address this, the viewport style is + // changed to kDefault. + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kPreventResizingContentsForTesting)) { + if (prefs->viewport_enabled) { + prefs->viewport_style = blink::mojom::ViewportStyle::kDefault; + } + } +#endif } } // namespace
diff --git a/content/web_test/browser/web_test_fedcm_manager.cc b/content/web_test/browser/web_test_fedcm_manager.cc index 778396c..cc89830 100644 --- a/content/web_test/browser/web_test_fedcm_manager.cc +++ b/content/web_test/browser/web_test_fedcm_manager.cc
@@ -113,19 +113,25 @@ } } -void WebTestFedCmManager::ConfirmIdpLogin(ConfirmIdpLoginCallback callback) { +void WebTestFedCmManager::ClickFedCmDialogButton( + blink::test::mojom::DialogButton button, + ClickFedCmDialogButtonCallback callback) { FederatedAuthRequestImpl* auth_request = GetAuthRequestImpl(); if (!auth_request) { std::move(callback).Run(false); return; } - if (auth_request->GetDialogType() != - FederatedAuthRequestImpl::kConfirmIdpLogin) { + if (button == blink::test::mojom::DialogButton::kConfirmIdpLoginContinue) { + if (auth_request->GetDialogType() != + FederatedAuthRequestImpl::kConfirmIdpLogin) { + std::move(callback).Run(false); + return; + } + auth_request->AcceptConfirmIdpLoginDialogForDevtools(); + std::move(callback).Run(true); + } else { std::move(callback).Run(false); - return; } - auth_request->AcceptConfirmIdpLoginDialogForDevtools(); - std::move(callback).Run(true); } FederatedAuthRequestImpl* WebTestFedCmManager::GetAuthRequestImpl() {
diff --git a/content/web_test/browser/web_test_fedcm_manager.h b/content/web_test/browser/web_test_fedcm_manager.h index dee6f8c..4c047ad 100644 --- a/content/web_test/browser/web_test_fedcm_manager.h +++ b/content/web_test/browser/web_test_fedcm_manager.h
@@ -33,7 +33,8 @@ void SelectFedCmAccount(uint32_t account_index, SelectFedCmAccountCallback) override; void DismissFedCmDialog(DismissFedCmDialogCallback) override; - void ConfirmIdpLogin(ConfirmIdpLoginCallback) override; + void ClickFedCmDialogButton(blink::test::mojom::DialogButton button, + ClickFedCmDialogButtonCallback) override; private: // Returns the active FederatedAuthRequestImpl for the current Page,
diff --git a/device/bluetooth/floss/bluetooth_floss_unittest.cc b/device/bluetooth/floss/bluetooth_floss_unittest.cc index 171953d..d9f552d3 100644 --- a/device/bluetooth/floss/bluetooth_floss_unittest.cc +++ b/device/bluetooth/floss/bluetooth_floss_unittest.cc
@@ -786,7 +786,6 @@ // Initial conditions EXPECT_EQ(0, GetFakeLEScanClient()->scanners_registered_); - // TODO (b/217274013): Filter is currently being ignored auto background_scan_session = adapter_->StartLowEnergyScanSession( /*filter=*/nullptr, /*delegate=*/nullptr); base::RunLoop().RunUntilIdle(); @@ -811,7 +810,6 @@ InitializeAndEnableAdapter(); FakeBluetoothLowEnergyScanSessionDelegate delegate; - // TODO (b/217274013): Filter is currently being ignored GetFakeLEScanClient()->SetNextScannerUUID( device::BluetoothUUID(kTestUuidStr)); auto background_scan_session = adapter_->StartLowEnergyScanSession(
diff --git a/device/bluetooth/floss/fake_floss_lescan_client.cc b/device/bluetooth/floss/fake_floss_lescan_client.cc index 723e3d8..976b6c8 100644 --- a/device/bluetooth/floss/fake_floss_lescan_client.cc +++ b/device/bluetooth/floss/fake_floss_lescan_client.cc
@@ -46,7 +46,6 @@ uint8_t scanner_id, const absl::optional<ScanSettings>& scan_settings, const absl::optional<ScanFilter>& filters) { - // TODO (b/217274013): filters are currently being ignored scanner_ids_.insert(scanner_id); base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), BtifStatus::kSuccess));
diff --git a/device/bluetooth/floss/floss_lescan_client.cc b/device/bluetooth/floss/floss_lescan_client.cc index 6fdecd2..909c6c1 100644 --- a/device/bluetooth/floss/floss_lescan_client.cc +++ b/device/bluetooth/floss/floss_lescan_client.cc
@@ -210,22 +210,28 @@ } } -// TODO(b/217274013): Update these templates when structs in place template <> void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer, const ScanSettings& data) { dbus::MessageWriter array_writer(nullptr); writer->OpenArray("{sv}", &array_writer); - WriteDictEntry(&array_writer, "interval", static_cast<int32_t>(3)); - WriteDictEntry(&array_writer, "window", static_cast<int32_t>(3)); - WriteDictEntry(&array_writer, "scan_type", static_cast<uint32_t>(1)); + WriteDictEntry(&array_writer, "interval", data.interval); + WriteDictEntry(&array_writer, "window", data.window); + WriteDictEntry(&array_writer, "scan_type", data.scan_type); writer->CloseContainer(&array_writer); } template <> void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer, + const ScanType& type) { + int32_t value = static_cast<uint32_t>(type); + WriteDBusParam(writer, value); +} + +template <> +void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer, const ScanFilterPattern& data) { dbus::MessageWriter array_writer(nullptr); writer->OpenArray("{sv}", &array_writer); @@ -298,6 +304,12 @@ } template <> +const DBusTypeInfo& GetDBusTypeInfo(const ScanType*) { + static DBusTypeInfo info{"u", "ScanType"}; + return info; +} + +template <> const DBusTypeInfo& GetDBusTypeInfo(const ScanFilterPattern*) { static DBusTypeInfo info{"a{sv}", "ScanFilterPattern"}; return info;
diff --git a/device/bluetooth/floss/floss_lescan_client.h b/device/bluetooth/floss/floss_lescan_client.h index cd8ab46..b799c93 100644 --- a/device/bluetooth/floss/floss_lescan_client.h +++ b/device/bluetooth/floss/floss_lescan_client.h
@@ -36,8 +36,18 @@ const char kScannerCallbackInterfaceName[] = "org.chromium.bluetooth.ScannerCallback"; -// TODO(b/217274013): Update structs to support filtering -class ScanSettings {}; +// Represents type of a scan. +enum class ScanType { + kActive = 0, + kPassive = 1, +}; + +// Represents scanning configurations. +struct ScanSettings { + int32_t interval; + int32_t window; + ScanType scan_type; +}; struct DEVICE_BLUETOOTH_EXPORT ScanFilterPattern { // Specifies the starting byte position of the pattern immediately following
diff --git a/device/bluetooth/floss/floss_lescan_client_unittest.cc b/device/bluetooth/floss/floss_lescan_client_unittest.cc index b9229cf..f858f5b 100644 --- a/device/bluetooth/floss/floss_lescan_client_unittest.cc +++ b/device/bluetooth/floss/floss_lescan_client_unittest.cc
@@ -252,6 +252,14 @@ base::WeakPtrFactory<FlossLEScanClientTest> weak_ptr_factory_{this}; }; +static bool ReadNullOptDBusParam(dbus::MessageReader* reader) { + absl::optional<int32_t> param; + if (!FlossDBusClient::ReadDBusParam(reader, ¶m)) { + return false; + } + return param == absl::nullopt; +} + TEST_F(FlossLEScanClientTest, TestInitExportRegisterScanner) { scoped_refptr<::dbus::MockExportedObject> exported_callback = base::MakeRefCounted<::dbus::MockExportedObject>(bus_.get(), @@ -400,12 +408,12 @@ .WillOnce([](::dbus::MethodCall* method_call, int timeout_ms, ::dbus::ObjectProxy::ResponseOrErrorCallback* cb) { dbus::MessageReader msg(method_call); - // D-Bus method call should have 3 parameters. - // TODO(b/217274013): ScanSettings and ScanFilter currently being - // ignored uint8_t param1; ASSERT_TRUE(FlossDBusClient::ReadDBusParam(&msg, ¶m1)); EXPECT_EQ(kTestScannerId, param1); + ASSERT_TRUE(ReadNullOptDBusParam(&msg)); // ScanSettings + ASSERT_TRUE(ReadNullOptDBusParam(&msg)); // ScanFilter + // Create a fake response with BtifStatus return value. auto response = ::dbus::Response::CreateEmpty(); dbus::MessageWriter writer(response.get()); @@ -421,7 +429,8 @@ EXPECT_EQ(ret.value(), FlossDBusClient::BtifStatus::kSuccess); }), - kTestScannerId, absl::nullopt, ScanFilter{}); + kTestScannerId, absl::nullopt /* ScanSettings */, + absl::nullopt /* ScanFilter*/); // Method of 1 parameter with no return. EXPECT_CALL(*object_proxy_.get(), DoCallMethodWithErrorResponse(
diff --git a/device/fido/enclave/test/passkey_enclave_client.cc b/device/fido/enclave/test/passkey_enclave_client.cc index 9c9097d..7cd3d77 100644 --- a/device/fido/enclave/test/passkey_enclave_client.cc +++ b/device/fido/enclave/test/passkey_enclave_client.cc
@@ -175,7 +175,6 @@ factory_remote.BindNewPipeAndPassReceiver()); factory_->GetNewCertVerifier( cert_verifier_remote.InitWithNewPipeAndPassReceiver(), - /*updater_receiver=*/mojo::NullReceiver(), cert_verifier_client.InitWithNewPipeAndPassRemote(), cert_verifier::mojom::CertVerifierCreationParams::New());
diff --git a/docs/testing/run_web_platform_tests.md b/docs/testing/run_web_platform_tests.md index 0fca9450..21f724b1 100644 --- a/docs/testing/run_web_platform_tests.md +++ b/docs/testing/run_web_platform_tests.md
@@ -74,7 +74,7 @@ third_party/blink/tools/run_wpt_tests.py --release -p chrome external/wpt/webdriver/tests/classic/find_element/find.py ``` -The `webdriver_tests_suite` step of `linux-blink-rel` runs wdspec tests and can provide results for rebaselining. +The `webdriver_wpt_tests` step of `linux-blink-rel` runs wdspec tests and can provide results for rebaselining. ## Running Web Platform Tests with Chrome Android
diff --git a/extensions/browser/browsertest_util.cc b/extensions/browser/browsertest_util.cc index c94d840b..21b008e 100644 --- a/extensions/browser/browsertest_util.cc +++ b/extensions/browser/browsertest_util.cc
@@ -45,11 +45,13 @@ return value; } -bool ExecuteScriptInBackgroundPageNoWait(content::BrowserContext* context, - const std::string& extension_id, - const std::string& script) { +bool ExecuteScriptInBackgroundPageNoWait( + content::BrowserContext* context, + const std::string& extension_id, + const std::string& script, + ScriptUserActivation script_user_activation) { return BackgroundScriptExecutor::ExecuteScriptAsync( - context, extension_id, script, ScriptUserActivation::kActivate); + context, extension_id, script, script_user_activation); } std::string ExecuteScriptInBackgroundPageDeprecated(
diff --git a/extensions/browser/browsertest_util.h b/extensions/browser/browsertest_util.h index 797b83a..b49a233 100644 --- a/extensions/browser/browsertest_util.h +++ b/extensions/browser/browsertest_util.h
@@ -42,10 +42,14 @@ // Same as ExecuteScriptInBackgroundPage, but doesn't wait for the script // to return a result. Fails the test and returns false if |extension_id| // isn't installed in |context| or doesn't have a background page, or if -// executing the script fails. -bool ExecuteScriptInBackgroundPageNoWait(content::BrowserContext* context, - const std::string& extension_id, - const std::string& script); +// executing the script fails. The argument |script_user_activation| +// determines if the script should be executed after a user activation. +bool ExecuteScriptInBackgroundPageNoWait( + content::BrowserContext* context, + const std::string& extension_id, + const std::string& script, + ScriptUserActivation script_user_activation = + ScriptUserActivation::kDontActivate); // Waits until |script| calls "window.domAutomationController.send(result)", // where |result| is a string, and returns |result|. Fails the test and returns
diff --git a/extensions/browser/event_router.h b/extensions/browser/event_router.h index e47c9a4..8d1761ca 100644 --- a/extensions/browser/event_router.h +++ b/extensions/browser/event_router.h
@@ -69,6 +69,11 @@ kDispatchEventToSender, }; +// The upper bound of time allowed for event dispatch histograms. Also used in +// histograms for determining when an event is "stale" (it has not been acked by +// the renderer to the browser by this time). +inline constexpr base::TimeDelta kEventAckMetricTimeLimit = base::Minutes(5); + // TODO(lazyboy): Document how extension events work, including how listeners // are registered and how listeners are tracked in renderer and browser process. class EventRouter : public KeyedService,
diff --git a/extensions/browser/events/event_ack_data.cc b/extensions/browser/events/event_ack_data.cc index 11acdea..61bd7206 100644 --- a/extensions/browser/events/event_ack_data.cc +++ b/extensions/browser/events/event_ack_data.cc
@@ -17,8 +17,6 @@ #include "content/public/browser/service_worker_external_request_result.h" #include "extensions/browser/event_router.h" -constexpr base::TimeDelta kEventAckMetricTimeLimit = base::Minutes(5); - namespace extensions { EventAckData::EventAckData() = default; @@ -71,7 +69,7 @@ // `EventAckData::DecrementInflightEvent()`. if (unacked_events_.contains(event_id)) { base::UmaHistogramBoolean( - "Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker", + "Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker2", false); } } @@ -101,7 +99,7 @@ kEventAckMetricTimeLimit; if (!late_ack) { base::UmaHistogramBoolean( - "Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker", + "Extensions.Events.DidDispatchToAckSucceed.ExtensionServiceWorker2", true); } }
diff --git a/extensions/browser/extension_host.cc b/extensions/browser/extension_host.cc index 9a4af1b..c3f1c79 100644 --- a/extensions/browser/extension_host.cc +++ b/extensions/browser/extension_host.cc
@@ -179,6 +179,16 @@ int event_id, EventDispatchSource dispatch_source) { CHECK(IsBackgroundPage()); + // See ExtensionHost::OnEventAck() for an explanation on the restriction to + // this event flow. + if (dispatch_source == EventDispatchSource::kDispatchEventToProcess) { + base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask( + FROM_HERE, + base::BindOnce(&ExtensionHost::EmitLateAckedEventTask, + weak_ptr_factory_.GetWeakPtr(), event_id), + kEventAckMetricTimeLimit); + } + unacked_messages_[event_id] = UnackedEventData{event_name, dispatch_start_time, dispatch_source}; for (auto& observer : observer_list_) @@ -317,6 +327,18 @@ } #endif +void ExtensionHost::EmitLateAckedEventTask(int event_id) { + // If the event is still present then we haven't received the ack yet in + // `ExtensionHost::OnEventAck()`. + if (unacked_messages_.contains(event_id)) { + // TODO(crbug.com/1470045): Update this histogram once we have a way to ack + // only for lazy background page events. Until then this could be slightly + // inaccurate and not perfectly comparable to the service worker version. + base::UmaHistogramBoolean( + "Extensions.Events.DidDispatchToAckSucceed.ExtensionPage", false); + } +} + void ExtensionHost::OnEventAck( int event_id, bool event_will_run_in_lazy_background_page_script) { @@ -378,6 +400,22 @@ } } + // `DidDispatchToAckSucceed` is outside of the + // `event_will_run_in_lazy_background_page_script` condition because we + // can't exclude non-script extensions page contexts (e.g. popup scripts) yet + // so we have to emit this for all events to remain proportionate to the + // `false` emits. + bool late_ack = + (base::TimeTicks::Now() - unacked_message_data.dispatch_start_time) > + kEventAckMetricTimeLimit; + if (!late_ack) { + // Emit only if we're within the expected event ack time limit. We'll take + // care of the emit for a late ack via a delayed task we started on event + // dispatch. + base::UmaHistogramBoolean( + "Extensions.Events.DidDispatchToAckSucceed.ExtensionPage", true); + } + EventRouter* router = EventRouter::Get(browser_context_); if (router) router->OnEventAck(browser_context_, extension_id(),
diff --git a/extensions/browser/extension_host.h b/extensions/browser/extension_host.h index 5439ec6b..91e3899e 100644 --- a/extensions/browser/extension_host.h +++ b/extensions/browser/extension_host.h
@@ -207,6 +207,11 @@ EventDispatchSource dispatch_source; }; + // Emits a stale event ack metric if an event with `event_id` is not present + // in `unacked_messages_`. Meaning that the event was not yet acked by the + // renderer to the browser. + void EmitLateAckedEventTask(int event_id); + // DeferredStartRenderHost: void CreateRendererNow() override;
diff --git a/extensions/common/api/scripts_internal/script_serialization.cc b/extensions/common/api/scripts_internal/script_serialization.cc index dec21a2..9bba01b 100644 --- a/extensions/common/api/scripts_internal/script_serialization.cc +++ b/extensions/common/api/scripts_internal/script_serialization.cc
@@ -151,10 +151,7 @@ bool allowed_in_incognito, std::u16string* error_out, bool* wants_file_access_out, - absl::optional<int> index_for_error, - absl::optional<int> custom_schemes, - absl::optional<bool> can_execute_script_everywhere, - bool all_urls_includes_chrome_urls) { + SerializedUserScriptParseOptions parse_options) { bool source_matches_id = true; switch (serialized_script.source) { case api::scripts_internal::Source::kDynamicContentScript: @@ -198,21 +195,19 @@ if (!script_parsing::ParseFileSources( &extension, base::OptionalToPtr(serialized_script.js), base::OptionalToPtr(serialized_script.css), - index_for_error, user_script.get(), error_out)) { + parse_options.index_for_error, user_script.get(), error_out)) { return nullptr; } - const int valid_schemes = - custom_schemes.value_or( - UserScript::ValidUserScriptSchemes( - kScriptsCanExecuteEverywhere)); + const int valid_schemes = parse_options.custom_schemes.value_or( + UserScript::ValidUserScriptSchemes(kScriptsCanExecuteEverywhere)); // `excludeMatches`/`matches`. if (!script_parsing::ParseMatchPatterns( serialized_script.matches, base::OptionalToPtr(serialized_script.exclude_matches), extension.creation_flags(), - can_execute_script_everywhere.value_or(kScriptsCanExecuteEverywhere), - valid_schemes, all_urls_includes_chrome_urls, - index_for_error, user_script.get(), error_out, + parse_options.can_execute_script_everywhere, valid_schemes, + parse_options.all_urls_includes_chrome_urls, + parse_options.index_for_error, user_script.get(), error_out, wants_file_access_out)) { return nullptr; }
diff --git a/extensions/common/api/scripts_internal/script_serialization.h b/extensions/common/api/scripts_internal/script_serialization.h index 30b86bd..fbed764 100644 --- a/extensions/common/api/scripts_internal/script_serialization.h +++ b/extensions/common/api/scripts_internal/script_serialization.h
@@ -25,6 +25,20 @@ api::scripts_internal::SerializedUserScript SerializeUserScript( const UserScript& user_script); +// Additional options for parsing user scripts. +struct SerializedUserScriptParseOptions { + // If populated, used in the error message. + absl::optional<int> index_for_error; + // If populated, used instead of the default schemes for URLPattern parsing. + absl::optional<int> custom_schemes; + // If true, indicates the extension can execute scripts on every page without + // additional permission (this should only be true for special extensions like + // ChromeVox). + bool can_execute_script_everywhere = false; + // If true, `<all_urls>` match patterns will also match chrome:-scheme URLs. + bool all_urls_includes_chrome_urls = false; +}; + // Attempts to deserialize `serialized_script` into a new `UserScript`. This can // fail if `serialized_script` has invalid values for parsed types (e.g., // match patterns). `allowed_in_incognito` indicates if the corresponding @@ -33,27 +47,15 @@ // If `wants_file_access_out` is provided, it will be populated with whether the // extension wants file access according to the patterns in the serialized // script. -// If `index_for_error` is populated, it will be used in the error message. -// If `custom_schemes` is provided, they will be used instead of the default -// schemes for URLPattern parsing. -// If `can_execute_script_everywhere` is true, it indicates the extension -// doesn't need additional file access permissions. -// If `all_urls_includes_chrome_urls` is true, <all_urls> patterns will also -// include chrome:-scheme URLs. // TODO(devlin): It'd be nice to use absl::optional here, but UserScripts are // currently passed by pointer a lot. -// TODO(devlin): Pull most/all these optional parameters out into a struct to -// pass in. std::unique_ptr<UserScript> ParseSerializedUserScript( const api::scripts_internal::SerializedUserScript& serialized_script, const Extension& extension, bool allowed_in_incognito, std::u16string* error_out = nullptr, bool* wants_file_access_out = nullptr, - absl::optional<int> index_for_error = absl::nullopt, - absl::optional<int> custom_schemes = absl::nullopt, - absl::optional<bool> can_execute_script_everywhere = absl::nullopt, - bool all_urls_includes_chrome_urls = false); + SerializedUserScriptParseOptions parse_options = {}); } // namespace script_serialization } // namespace extensions
diff --git a/extensions/common/manifest_handlers/content_scripts_handler.cc b/extensions/common/manifest_handlers/content_scripts_handler.cc index 137d2cd..3e749207 100644 --- a/extensions/common/manifest_handlers/content_scripts_handler.cc +++ b/extensions/common/manifest_handlers/content_scripts_handler.cc
@@ -130,11 +130,17 @@ // script content. const bool allowed_in_incognito = false; bool wants_file_access = false; + + script_serialization::SerializedUserScriptParseOptions parse_options; + parse_options.index_for_error = definition_index; + parse_options.custom_schemes = valid_schemes; + parse_options.can_execute_script_everywhere = can_execute_script_everywhere; + parse_options.all_urls_includes_chrome_urls = all_urls_includes_chrome_urls; + std::unique_ptr<UserScript> user_script = script_serialization::ParseSerializedUserScript( serialized_script, *extension, allowed_in_incognito, error, - &wants_file_access, definition_index, valid_schemes, - can_execute_script_everywhere, all_urls_includes_chrome_urls); + &wants_file_access, parse_options); if (!user_script) { // Parsing failed. `error` should be properly populated.
diff --git a/extensions/renderer/api/messaging/one_time_message_handler.cc b/extensions/renderer/api/messaging/one_time_message_handler.cc index e516c0d..02d073b 100644 --- a/extensions/renderer/api/messaging/one_time_message_handler.cc +++ b/extensions/renderer/api/messaging/one_time_message_handler.cc
@@ -53,13 +53,17 @@ // An opener port in the context; i.e., the caller of runtime.sendMessage. struct OneTimeOpener { int request_id = -1; +#if BUILDFLAG(ENABLE_EXTENSIONS_LEGACY_IPC) int routing_id = MSG_ROUTING_NONE; +#endif binding::AsyncResponseType async_type = binding::AsyncResponseType::kNone; }; // A receiver port in the context; i.e., a listener to runtime.onMessage. struct OneTimeReceiver { +#if BUILDFLAG(ENABLE_EXTENSIONS_LEGACY_IPC) int routing_id = MSG_ROUTING_NONE; +#endif std::string event_name; v8::Global<v8::Object> sender; }; @@ -77,10 +81,12 @@ constexpr char OneTimeMessageContextData::kPerContextDataKey[]; +#if BUILDFLAG(ENABLE_EXTENSIONS_LEGACY_IPC) int RoutingIdForScriptContext(ScriptContext* script_context) { content::RenderFrame* render_frame = script_context->GetRenderFrame(); return render_frame ? render_frame->GetRoutingID() : MSG_ROUTING_NONE; } +#endif void OneTimeMessageResponseHelper( const v8::FunctionCallbackInfo<v8::Value>& info) { @@ -179,7 +185,9 @@ v8::Local<v8::Promise> promise; bool wants_response = async_type != binding::AsyncResponseType::kNone; +#if BUILDFLAG(ENABLE_EXTENSIONS_LEGACY_IPC) int routing_id = RoutingIdForScriptContext(script_context); +#endif if (wants_response) { // If this is a promise based request no callback should have been passed // in. @@ -192,7 +200,9 @@ binding::ResultModifierFunction()); OneTimeOpener& port = data->openers[new_port_id]; port.request_id = details.request_id; +#if BUILDFLAG(ENABLE_EXTENSIONS_LEGACY_IPC) port.routing_id = routing_id; +#endif port.async_type = async_type; promise = details.promise; DCHECK_EQ(async_type == binding::AsyncResponseType::kPromise, @@ -260,7 +270,9 @@ DCHECK(!base::Contains(data->receivers, target_port_id)); OneTimeReceiver& receiver = data->receivers[target_port_id]; receiver.sender.Reset(isolate, sender); +#if BUILDFLAG(ENABLE_EXTENSIONS_LEGACY_IPC) receiver.routing_id = RoutingIdForScriptContext(script_context); +#endif receiver.event_name = event_name; }
diff --git a/gpu/ipc/service/image_transport_surface_linux.cc b/gpu/ipc/service/image_transport_surface_linux.cc index adaca1c..d4ef5efd 100644 --- a/gpu/ipc/service/image_transport_surface_linux.cc +++ b/gpu/ipc/service/image_transport_surface_linux.cc
@@ -5,7 +5,6 @@ #include "gpu/ipc/service/image_transport_surface.h" #include "build/build_config.h" -#include "gpu/ipc/service/pass_through_image_transport_surface.h" #include "ui/gl/init/gl_factory.h" namespace gpu { @@ -30,16 +29,7 @@ SurfaceHandle surface_handle, gl::GLSurfaceFormat format) { DCHECK_NE(surface_handle, kNullSurfaceHandle); - scoped_refptr<gl::GLSurface> surface = - gl::init::CreateViewGLSurface(display, surface_handle); - bool override_vsync_for_multi_window_swap = false; - if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE) { - override_vsync_for_multi_window_swap = true; - } - if (!surface) - return surface; - return scoped_refptr<gl::GLSurface>(new PassThroughImageTransportSurface( - delegate, surface.get(), override_vsync_for_multi_window_swap)); + return gl::init::CreateViewGLSurface(display, surface_handle); } } // namespace gpu
diff --git a/gpu/ipc/service/image_transport_surface_win.cc b/gpu/ipc/service/image_transport_surface_win.cc index db06f0e..83c8298 100644 --- a/gpu/ipc/service/image_transport_surface_win.cc +++ b/gpu/ipc/service/image_transport_surface_win.cc
@@ -10,7 +10,7 @@ #include "gpu/command_buffer/service/feature_info.h" #include "gpu/config/gpu_finch_features.h" #include "gpu/config/gpu_preferences.h" -#include "gpu/ipc/service/pass_through_image_transport_surface.h" +#include "gpu/ipc/service/image_transport_surface_delegate.h" #include "ui/gfx/native_widget_types.h" #include "ui/gl/dcomp_presenter.h" #include "ui/gl/direct_composition_support.h" @@ -104,11 +104,7 @@ return nullptr; } - // |override_vsync_for_multi_window_swap| is needed because Present() blocks - // when multiple windows use swap interval 1 all the time. With this flag the - // surface forces swap interval 0 when multiple windows are presenting. - return scoped_refptr<gl::GLSurface>(new PassThroughImageTransportSurface( - delegate, surface.get(), /*override_vsync_for_multi_window_swap=*/true)); + return surface; } } // namespace gpu
diff --git a/infra/config/generated/builders/ci/CFI Linux CF/gn-args.json b/infra/config/generated/builders/ci/CFI Linux CF/gn-args.json new file mode 100644 index 0000000..5375620 --- /dev/null +++ b/infra/config/generated/builders/ci/CFI Linux CF/gn-args.json
@@ -0,0 +1,14 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_cfi": true, + "is_component_build": false, + "is_debug": false, + "use_cfi_cast": true, + "use_cfi_diag": true, + "use_cfi_icall": true, + "use_cfi_recover": true, + "use_remoteexec": true, + "use_thin_lto": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/CFI Linux CF/properties.json b/infra/config/generated/builders/ci/CFI Linux CF/properties.json index a8e6d4f..367c486 100644 --- a/infra/config/generated/builders/ci/CFI Linux CF/properties.json +++ b/infra/config/generated/builders/ci/CFI Linux CF/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/CFI Linux CF/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/CFI Linux ToT/gn-args.json b/infra/config/generated/builders/ci/CFI Linux ToT/gn-args.json new file mode 100644 index 0000000..e3475a2c --- /dev/null +++ b/infra/config/generated/builders/ci/CFI Linux ToT/gn-args.json
@@ -0,0 +1,14 @@ +{ + "gn_args": { + "dcheck_always_on": true, + "is_cfi": true, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "llvm_force_head_revision": true, + "use_cfi_cast": true, + "use_cfi_diag": true, + "use_cfi_icall": true, + "use_thin_lto": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/CFI Linux ToT/properties.json b/infra/config/generated/builders/ci/CFI Linux ToT/properties.json index 2aa18cb..33e9ecd 100644 --- a/infra/config/generated/builders/ci/CFI Linux ToT/properties.json +++ b/infra/config/generated/builders/ci/CFI Linux ToT/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/CFI Linux ToT/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git "a/infra/config/generated/builders/ci/CrWinAsan\050dll\051/gn-args.json" "b/infra/config/generated/builders/ci/CrWinAsan\050dll\051/gn-args.json" new file mode 100644 index 0000000..e19b03a --- /dev/null +++ "b/infra/config/generated/builders/ci/CrWinAsan\050dll\051/gn-args.json"
@@ -0,0 +1,12 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_asan": true, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "v8_enable_verify_heap": true + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/CrWinAsan\050dll\051/properties.json" "b/infra/config/generated/builders/ci/CrWinAsan\050dll\051/properties.json" index 765445d1..4efcd7e5 100644 --- "a/infra/config/generated/builders/ci/CrWinAsan\050dll\051/properties.json" +++ "b/infra/config/generated/builders/ci/CrWinAsan\050dll\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/CrWinAsan(dll)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/CrWinAsan/gn-args.json b/infra/config/generated/builders/ci/CrWinAsan/gn-args.json new file mode 100644 index 0000000..2ba997c5 --- /dev/null +++ b/infra/config/generated/builders/ci/CrWinAsan/gn-args.json
@@ -0,0 +1,13 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "enable_ipc_fuzzer": true, + "is_asan": true, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "v8_enable_verify_heap": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/CrWinAsan/properties.json b/infra/config/generated/builders/ci/CrWinAsan/properties.json index e01f7de..57ff2254 100644 --- a/infra/config/generated/builders/ci/CrWinAsan/properties.json +++ b/infra/config/generated/builders/ci/CrWinAsan/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/CrWinAsan/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git "a/infra/config/generated/builders/ci/ToTAndroid \050dbg\051/gn-args.json" "b/infra/config/generated/builders/ci/ToTAndroid \050dbg\051/gn-args.json" new file mode 100644 index 0000000..c6436296 --- /dev/null +++ "b/infra/config/generated/builders/ci/ToTAndroid \050dbg\051/gn-args.json"
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "debuggable_apks": false, + "is_clang": true, + "is_component_build": true, + "is_debug": true, + "llvm_force_head_revision": true, + "target_os": "android" + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTAndroid \050dbg\051/properties.json" "b/infra/config/generated/builders/ci/ToTAndroid \050dbg\051/properties.json" index 69e4b63..5259c563 100644 --- "a/infra/config/generated/builders/ci/ToTAndroid \050dbg\051/properties.json" +++ "b/infra/config/generated/builders/ci/ToTAndroid \050dbg\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTAndroid (dbg)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTAndroid x64/gn-args.json b/infra/config/generated/builders/ci/ToTAndroid x64/gn-args.json new file mode 100644 index 0000000..30831c72 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTAndroid x64/gn-args.json
@@ -0,0 +1,12 @@ +{ + "gn_args": { + "dcheck_always_on": true, + "debuggable_apks": false, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "target_cpu": "x64", + "target_os": "android" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTAndroid x64/properties.json b/infra/config/generated/builders/ci/ToTAndroid x64/properties.json index 91ff7ac..a864fcda 100644 --- a/infra/config/generated/builders/ci/ToTAndroid x64/properties.json +++ b/infra/config/generated/builders/ci/ToTAndroid x64/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTAndroid x64/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTAndroid x86/gn-args.json b/infra/config/generated/builders/ci/ToTAndroid x86/gn-args.json new file mode 100644 index 0000000..4a6a0799 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTAndroid x86/gn-args.json
@@ -0,0 +1,12 @@ +{ + "gn_args": { + "dcheck_always_on": true, + "debuggable_apks": false, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "target_cpu": "x86", + "target_os": "android" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTAndroid x86/properties.json b/infra/config/generated/builders/ci/ToTAndroid x86/properties.json index 780b963b..c4d88ec0 100644 --- a/infra/config/generated/builders/ci/ToTAndroid x86/properties.json +++ b/infra/config/generated/builders/ci/ToTAndroid x86/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTAndroid x86/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTAndroid/gn-args.json b/infra/config/generated/builders/ci/ToTAndroid/gn-args.json new file mode 100644 index 0000000..f4f5883 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTAndroid/gn-args.json
@@ -0,0 +1,15 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "debuggable_apks": false, + "ffmpeg_branding": "Chrome", + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "llvm_force_head_revision": true, + "proprietary_codecs": true, + "strip_debug_info": true, + "symbol_level": 1, + "target_os": "android" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTAndroid/properties.json b/infra/config/generated/builders/ci/ToTAndroid/properties.json index 41ce904e..bef425b8 100644 --- a/infra/config/generated/builders/ci/ToTAndroid/properties.json +++ b/infra/config/generated/builders/ci/ToTAndroid/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTAndroid/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTAndroid64/gn-args.json b/infra/config/generated/builders/ci/ToTAndroid64/gn-args.json new file mode 100644 index 0000000..389ed7789 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTAndroid64/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "debuggable_apks": false, + "is_clang": true, + "is_debug": false, + "llvm_force_head_revision": true, + "target_cpu": "arm64", + "target_os": "android" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTAndroid64/properties.json b/infra/config/generated/builders/ci/ToTAndroid64/properties.json index 570d6398..65bdae8 100644 --- a/infra/config/generated/builders/ci/ToTAndroid64/properties.json +++ b/infra/config/generated/builders/ci/ToTAndroid64/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTAndroid64/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTAndroidASan/gn-args.json b/infra/config/generated/builders/ci/ToTAndroidASan/gn-args.json new file mode 100644 index 0000000..27ec2ad --- /dev/null +++ b/infra/config/generated/builders/ci/ToTAndroidASan/gn-args.json
@@ -0,0 +1,13 @@ +{ + "gn_args": { + "debuggable_apks": false, + "is_asan": true, + "is_clang": true, + "is_component_build": true, + "is_debug": true, + "llvm_force_head_revision": true, + "strip_debug_info": true, + "symbol_level": 1, + "target_os": "android" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTAndroidASan/properties.json b/infra/config/generated/builders/ci/ToTAndroidASan/properties.json index 4674fe0..2278938a 100644 --- a/infra/config/generated/builders/ci/ToTAndroidASan/properties.json +++ b/infra/config/generated/builders/ci/ToTAndroidASan/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTAndroidASan/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTAndroidCoverage x86/gn-args.json b/infra/config/generated/builders/ci/ToTAndroidCoverage x86/gn-args.json new file mode 100644 index 0000000..374ce72 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTAndroidCoverage x86/gn-args.json
@@ -0,0 +1,13 @@ +{ + "gn_args": { + "dcheck_always_on": true, + "debuggable_apks": false, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "target_cpu": "x86", + "target_os": "android", + "use_clang_coverage": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTAndroidCoverage x86/properties.json b/infra/config/generated/builders/ci/ToTAndroidCoverage x86/properties.json index 874e804..f1187f4 100644 --- a/infra/config/generated/builders/ci/ToTAndroidCoverage x86/properties.json +++ b/infra/config/generated/builders/ci/ToTAndroidCoverage x86/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTAndroidCoverage x86/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTAndroidOfficial/gn-args.json b/infra/config/generated/builders/ci/ToTAndroidOfficial/gn-args.json new file mode 100644 index 0000000..9b3f84b --- /dev/null +++ b/infra/config/generated/builders/ci/ToTAndroidOfficial/gn-args.json
@@ -0,0 +1,16 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "debuggable_apks": false, + "ffmpeg_branding": "Chrome", + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "is_official_build": true, + "llvm_force_head_revision": true, + "proprietary_codecs": true, + "symbol_level": 1, + "target_cpu": "arm64", + "target_os": "android" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTAndroidOfficial/properties.json b/infra/config/generated/builders/ci/ToTAndroidOfficial/properties.json index 2dc20ca..f98ef67 100644 --- a/infra/config/generated/builders/ci/ToTAndroidOfficial/properties.json +++ b/infra/config/generated/builders/ci/ToTAndroidOfficial/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTAndroidOfficial/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git "a/infra/config/generated/builders/ci/ToTChromeOS \050dbg\051/gn-args.json" "b/infra/config/generated/builders/ci/ToTChromeOS \050dbg\051/gn-args.json" new file mode 100644 index 0000000..80ac8b2 --- /dev/null +++ "b/infra/config/generated/builders/ci/ToTChromeOS \050dbg\051/gn-args.json"
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "also_build_ash_chrome": true, + "chromeos_is_browser_only": true, + "is_clang": true, + "is_debug": true, + "llvm_force_head_revision": true, + "target_os": "chromeos" + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTChromeOS \050dbg\051/properties.json" "b/infra/config/generated/builders/ci/ToTChromeOS \050dbg\051/properties.json" index 6344e62..6120de5 100644 --- "a/infra/config/generated/builders/ci/ToTChromeOS \050dbg\051/properties.json" +++ "b/infra/config/generated/builders/ci/ToTChromeOS \050dbg\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTChromeOS (dbg)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTChromeOS/gn-args.json b/infra/config/generated/builders/ci/ToTChromeOS/gn-args.json new file mode 100644 index 0000000..ebfb1e26 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTChromeOS/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "also_build_ash_chrome": true, + "chromeos_is_browser_only": true, + "dcheck_always_on": false, + "is_clang": true, + "is_debug": false, + "llvm_force_head_revision": true, + "target_os": "chromeos" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTChromeOS/properties.json b/infra/config/generated/builders/ci/ToTChromeOS/properties.json index c5d3124..1796bad 100644 --- a/infra/config/generated/builders/ci/ToTChromeOS/properties.json +++ b/infra/config/generated/builders/ci/ToTChromeOS/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTChromeOS/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTFuchsia x64/gn-args.json b/infra/config/generated/builders/ci/ToTFuchsia x64/gn-args.json new file mode 100644 index 0000000..b6685a51 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTFuchsia x64/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "llvm_force_head_revision": true, + "target_os": "fuchsia" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTFuchsia x64/properties.json b/infra/config/generated/builders/ci/ToTFuchsia x64/properties.json index 6e608d47..5299a45 100644 --- a/infra/config/generated/builders/ci/ToTFuchsia x64/properties.json +++ b/infra/config/generated/builders/ci/ToTFuchsia x64/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTFuchsia x64/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTFuchsiaOfficial arm64/gn-args.json b/infra/config/generated/builders/ci/ToTFuchsiaOfficial arm64/gn-args.json new file mode 100644 index 0000000..88aaa14 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTFuchsiaOfficial arm64/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "is_clang": true, + "is_component_build": false, + "is_official_build": true, + "llvm_force_head_revision": true, + "target_cpu": "arm64", + "target_os": "fuchsia", + "test_host_cpu": "arm64" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTFuchsiaOfficial arm64/properties.json b/infra/config/generated/builders/ci/ToTFuchsiaOfficial arm64/properties.json index 45174f34..dcbe945 100644 --- a/infra/config/generated/builders/ci/ToTFuchsiaOfficial arm64/properties.json +++ b/infra/config/generated/builders/ci/ToTFuchsiaOfficial arm64/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTFuchsiaOfficial arm64/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git "a/infra/config/generated/builders/ci/ToTLinux \050dbg\051/gn-args.json" "b/infra/config/generated/builders/ci/ToTLinux \050dbg\051/gn-args.json" new file mode 100644 index 0000000..c08030c --- /dev/null +++ "b/infra/config/generated/builders/ci/ToTLinux \050dbg\051/gn-args.json"
@@ -0,0 +1,8 @@ +{ + "gn_args": { + "is_clang": true, + "is_component_build": true, + "is_debug": true, + "llvm_force_head_revision": true + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTLinux \050dbg\051/properties.json" "b/infra/config/generated/builders/ci/ToTLinux \050dbg\051/properties.json" index 2a72e02..79bac73 100644 --- "a/infra/config/generated/builders/ci/ToTLinux \050dbg\051/properties.json" +++ "b/infra/config/generated/builders/ci/ToTLinux \050dbg\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTLinux (dbg)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTLinux/gn-args.json b/infra/config/generated/builders/ci/ToTLinux/gn-args.json new file mode 100644 index 0000000..499ca05 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTLinux/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 2 + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTLinux/properties.json b/infra/config/generated/builders/ci/ToTLinux/properties.json index 074e141..ece3dda 100644 --- a/infra/config/generated/builders/ci/ToTLinux/properties.json +++ b/infra/config/generated/builders/ci/ToTLinux/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTLinux/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTLinuxASan/gn-args.json b/infra/config/generated/builders/ci/ToTLinuxASan/gn-args.json new file mode 100644 index 0000000..2ac345a --- /dev/null +++ b/infra/config/generated/builders/ci/ToTLinuxASan/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_asan": true, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "is_lsan": true, + "llvm_force_head_revision": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTLinuxASan/properties.json b/infra/config/generated/builders/ci/ToTLinuxASan/properties.json index 2b9e5f15..053cc44a 100644 --- a/infra/config/generated/builders/ci/ToTLinuxASan/properties.json +++ b/infra/config/generated/builders/ci/ToTLinuxASan/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTLinuxASan/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTLinuxASanLibfuzzer/gn-args.json b/infra/config/generated/builders/ci/ToTLinuxASanLibfuzzer/gn-args.json new file mode 100644 index 0000000..3670283 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTLinuxASanLibfuzzer/gn-args.json
@@ -0,0 +1,17 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "enable_mojom_fuzzer": true, + "enable_nacl": false, + "ffmpeg_branding": "ChromeOS", + "is_asan": true, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "optimize_for_fuzzing": true, + "pdf_enable_xfa": true, + "proprietary_codecs": true, + "use_libfuzzer": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTLinuxASanLibfuzzer/properties.json b/infra/config/generated/builders/ci/ToTLinuxASanLibfuzzer/properties.json index e14fa87..05e48056 100644 --- a/infra/config/generated/builders/ci/ToTLinuxASanLibfuzzer/properties.json +++ b/infra/config/generated/builders/ci/ToTLinuxASanLibfuzzer/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTLinuxASanLibfuzzer/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTLinuxCoverage/gn-args.json b/infra/config/generated/builders/ci/ToTLinuxCoverage/gn-args.json new file mode 100644 index 0000000..46ea7c2 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTLinuxCoverage/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "use_clang_coverage": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTLinuxMSan/gn-args.json b/infra/config/generated/builders/ci/ToTLinuxMSan/gn-args.json new file mode 100644 index 0000000..4f9fe42 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTLinuxMSan/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_debug": false, + "is_msan": true, + "llvm_force_head_revision": true, + "msan_track_origins": 2 + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTLinuxMSan/properties.json b/infra/config/generated/builders/ci/ToTLinuxMSan/properties.json index 1a37422..a302156 100644 --- a/infra/config/generated/builders/ci/ToTLinuxMSan/properties.json +++ b/infra/config/generated/builders/ci/ToTLinuxMSan/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTLinuxMSan/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTLinuxPGO/gn-args.json b/infra/config/generated/builders/ci/ToTLinuxPGO/gn-args.json new file mode 100644 index 0000000..e310e6a --- /dev/null +++ b/infra/config/generated/builders/ci/ToTLinuxPGO/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "chrome_pgo_phase": 1, + "is_clang": true, + "is_official_build": true, + "is_on_release_branch": true, + "llvm_force_head_revision": true, + "symbol_level": 0 + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTLinuxPGO/properties.json b/infra/config/generated/builders/ci/ToTLinuxPGO/properties.json index 106a70c7..58d38e3 100644 --- a/infra/config/generated/builders/ci/ToTLinuxPGO/properties.json +++ b/infra/config/generated/builders/ci/ToTLinuxPGO/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTLinuxPGO/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTLinuxTSan/gn-args.json b/infra/config/generated/builders/ci/ToTLinuxTSan/gn-args.json new file mode 100644 index 0000000..ff47433 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTLinuxTSan/gn-args.json
@@ -0,0 +1,9 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_debug": false, + "is_tsan": true, + "llvm_force_head_revision": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTLinuxTSan/properties.json b/infra/config/generated/builders/ci/ToTLinuxTSan/properties.json index 75fcee1..e73a8a7 100644 --- a/infra/config/generated/builders/ci/ToTLinuxTSan/properties.json +++ b/infra/config/generated/builders/ci/ToTLinuxTSan/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTLinuxTSan/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTLinuxUBSanVptr/gn-args.json b/infra/config/generated/builders/ci/ToTLinuxUBSanVptr/gn-args.json new file mode 100644 index 0000000..7a6d0fa --- /dev/null +++ b/infra/config/generated/builders/ci/ToTLinuxUBSanVptr/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "is_ubsan_no_recover": true, + "is_ubsan_vptr": true, + "llvm_force_head_revision": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTLinuxUBSanVptr/properties.json b/infra/config/generated/builders/ci/ToTLinuxUBSanVptr/properties.json index 534f025..dc35d161 100644 --- a/infra/config/generated/builders/ci/ToTLinuxUBSanVptr/properties.json +++ b/infra/config/generated/builders/ci/ToTLinuxUBSanVptr/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTLinuxUBSanVptr/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git "a/infra/config/generated/builders/ci/ToTMac \050dbg\051/gn-args.json" "b/infra/config/generated/builders/ci/ToTMac \050dbg\051/gn-args.json" new file mode 100644 index 0000000..c08030c --- /dev/null +++ "b/infra/config/generated/builders/ci/ToTMac \050dbg\051/gn-args.json"
@@ -0,0 +1,8 @@ +{ + "gn_args": { + "is_clang": true, + "is_component_build": true, + "is_debug": true, + "llvm_force_head_revision": true + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTMac \050dbg\051/properties.json" "b/infra/config/generated/builders/ci/ToTMac \050dbg\051/properties.json" index d10883c..c7bd3d18 100644 --- "a/infra/config/generated/builders/ci/ToTMac \050dbg\051/properties.json" +++ "b/infra/config/generated/builders/ci/ToTMac \050dbg\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTMac (dbg)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTMac/gn-args.json b/infra/config/generated/builders/ci/ToTMac/gn-args.json new file mode 100644 index 0000000..9963fe5 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTMac/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1 + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTMac/properties.json b/infra/config/generated/builders/ci/ToTMac/properties.json index 78f64e0a..56ba5d5 100644 --- a/infra/config/generated/builders/ci/ToTMac/properties.json +++ b/infra/config/generated/builders/ci/ToTMac/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTMac/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTMacASan/gn-args.json b/infra/config/generated/builders/ci/ToTMacASan/gn-args.json new file mode 100644 index 0000000..7fb32e4 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTMacASan/gn-args.json
@@ -0,0 +1,12 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "enable_nacl": false, + "is_asan": true, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1 + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTMacASan/properties.json b/infra/config/generated/builders/ci/ToTMacASan/properties.json index a263965..3849d43 100644 --- a/infra/config/generated/builders/ci/ToTMacASan/properties.json +++ b/infra/config/generated/builders/ci/ToTMacASan/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTMacASan/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTMacArm64/gn-args.json b/infra/config/generated/builders/ci/ToTMacArm64/gn-args.json new file mode 100644 index 0000000..4506e5fc --- /dev/null +++ b/infra/config/generated/builders/ci/ToTMacArm64/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "target_cpu": "arm64" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTMacArm64PGO/gn-args.json b/infra/config/generated/builders/ci/ToTMacArm64PGO/gn-args.json new file mode 100644 index 0000000..edcec84 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTMacArm64PGO/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "chrome_pgo_phase": 1, + "is_clang": true, + "is_official_build": true, + "is_on_release_branch": true, + "llvm_force_head_revision": true, + "symbol_level": 0, + "target_cpu": "arm64" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTMacCoverage/gn-args.json b/infra/config/generated/builders/ci/ToTMacCoverage/gn-args.json new file mode 100644 index 0000000..46ea7c2 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTMacCoverage/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "use_clang_coverage": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTMacPGO/gn-args.json b/infra/config/generated/builders/ci/ToTMacPGO/gn-args.json new file mode 100644 index 0000000..743617ed --- /dev/null +++ b/infra/config/generated/builders/ci/ToTMacPGO/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "chrome_pgo_phase": 1, + "is_clang": true, + "is_official_build": true, + "is_on_release_branch": true, + "llvm_force_head_revision": true, + "symbol_level": 0, + "target_cpu": "x64" + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTWin\050dbg\051/gn-args.json" "b/infra/config/generated/builders/ci/ToTWin\050dbg\051/gn-args.json" new file mode 100644 index 0000000..2ffa823 --- /dev/null +++ "b/infra/config/generated/builders/ci/ToTWin\050dbg\051/gn-args.json"
@@ -0,0 +1,9 @@ +{ + "gn_args": { + "is_clang": true, + "is_component_build": true, + "is_debug": true, + "llvm_force_head_revision": true, + "target_cpu": "x86" + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTWin\050dbg\051/properties.json" "b/infra/config/generated/builders/ci/ToTWin\050dbg\051/properties.json" index 5c0e21e..dc7a907 100644 --- "a/infra/config/generated/builders/ci/ToTWin\050dbg\051/properties.json" +++ "b/infra/config/generated/builders/ci/ToTWin\050dbg\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWin(dbg)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git "a/infra/config/generated/builders/ci/ToTWin\050dll\051/gn-args.json" "b/infra/config/generated/builders/ci/ToTWin\050dll\051/gn-args.json" new file mode 100644 index 0000000..294b17b --- /dev/null +++ "b/infra/config/generated/builders/ci/ToTWin\050dll\051/gn-args.json"
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "dcheck_always_on": true, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "target_cpu": "x86" + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTWin\050dll\051/properties.json" "b/infra/config/generated/builders/ci/ToTWin\050dll\051/properties.json" index 56b03d0..3459dc2 100644 --- "a/infra/config/generated/builders/ci/ToTWin\050dll\051/properties.json" +++ "b/infra/config/generated/builders/ci/ToTWin\050dll\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWin(dll)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTWin/gn-args.json b/infra/config/generated/builders/ci/ToTWin/gn-args.json new file mode 100644 index 0000000..4259c20 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTWin/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "target_cpu": "x86" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTWin/properties.json b/infra/config/generated/builders/ci/ToTWin/properties.json index d03040dc..a0c6157 100644 --- a/infra/config/generated/builders/ci/ToTWin/properties.json +++ b/infra/config/generated/builders/ci/ToTWin/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWin/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git "a/infra/config/generated/builders/ci/ToTWin64\050dbg\051/gn-args.json" "b/infra/config/generated/builders/ci/ToTWin64\050dbg\051/gn-args.json" new file mode 100644 index 0000000..c08030c --- /dev/null +++ "b/infra/config/generated/builders/ci/ToTWin64\050dbg\051/gn-args.json"
@@ -0,0 +1,8 @@ +{ + "gn_args": { + "is_clang": true, + "is_component_build": true, + "is_debug": true, + "llvm_force_head_revision": true + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTWin64\050dbg\051/properties.json" "b/infra/config/generated/builders/ci/ToTWin64\050dbg\051/properties.json" index c9c051c3..b05bf0c 100644 --- "a/infra/config/generated/builders/ci/ToTWin64\050dbg\051/properties.json" +++ "b/infra/config/generated/builders/ci/ToTWin64\050dbg\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWin64(dbg)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git "a/infra/config/generated/builders/ci/ToTWin64\050dll\051/gn-args.json" "b/infra/config/generated/builders/ci/ToTWin64\050dll\051/gn-args.json" new file mode 100644 index 0000000..cbc709a --- /dev/null +++ "b/infra/config/generated/builders/ci/ToTWin64\050dll\051/gn-args.json"
@@ -0,0 +1,9 @@ +{ + "gn_args": { + "dcheck_always_on": true, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true + } +} \ No newline at end of file
diff --git "a/infra/config/generated/builders/ci/ToTWin64\050dll\051/properties.json" "b/infra/config/generated/builders/ci/ToTWin64\050dll\051/properties.json" index 866a084..3d1d1e8 100644 --- "a/infra/config/generated/builders/ci/ToTWin64\050dll\051/properties.json" +++ "b/infra/config/generated/builders/ci/ToTWin64\050dll\051/properties.json"
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWin64(dll)/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTWin64/gn-args.json b/infra/config/generated/builders/ci/ToTWin64/gn-args.json new file mode 100644 index 0000000..0551d4e --- /dev/null +++ b/infra/config/generated/builders/ci/ToTWin64/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1 + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTWin64/properties.json b/infra/config/generated/builders/ci/ToTWin64/properties.json index 4330c548..2060e3c4 100644 --- a/infra/config/generated/builders/ci/ToTWin64/properties.json +++ b/infra/config/generated/builders/ci/ToTWin64/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWin64/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTWin64PGO/gn-args.json b/infra/config/generated/builders/ci/ToTWin64PGO/gn-args.json new file mode 100644 index 0000000..e310e6a --- /dev/null +++ b/infra/config/generated/builders/ci/ToTWin64PGO/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "chrome_pgo_phase": 1, + "is_clang": true, + "is_official_build": true, + "is_on_release_branch": true, + "llvm_force_head_revision": true, + "symbol_level": 0 + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTWin64PGO/properties.json b/infra/config/generated/builders/ci/ToTWin64PGO/properties.json index 5dc6c8c..9c627fa 100644 --- a/infra/config/generated/builders/ci/ToTWin64PGO/properties.json +++ b/infra/config/generated/builders/ci/ToTWin64PGO/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWin64PGO/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTWinASanLibfuzzer/gn-args.json b/infra/config/generated/builders/ci/ToTWinASanLibfuzzer/gn-args.json new file mode 100644 index 0000000..8673d81 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTWinASanLibfuzzer/gn-args.json
@@ -0,0 +1,15 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "enable_nacl": false, + "ffmpeg_branding": "Chrome", + "is_asan": true, + "is_clang": true, + "is_debug": false, + "llvm_force_head_revision": true, + "pdf_enable_xfa": true, + "proprietary_codecs": true, + "symbol_level": 1, + "use_libfuzzer": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTWinASanLibfuzzer/properties.json b/infra/config/generated/builders/ci/ToTWinASanLibfuzzer/properties.json index e93d0f0..1eadceb 100644 --- a/infra/config/generated/builders/ci/ToTWinASanLibfuzzer/properties.json +++ b/infra/config/generated/builders/ci/ToTWinASanLibfuzzer/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWinASanLibfuzzer/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTWinArm64PGO/gn-args.json b/infra/config/generated/builders/ci/ToTWinArm64PGO/gn-args.json new file mode 100644 index 0000000..edcec84 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTWinArm64PGO/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "chrome_pgo_phase": 1, + "is_clang": true, + "is_official_build": true, + "is_on_release_branch": true, + "llvm_force_head_revision": true, + "symbol_level": 0, + "target_cpu": "arm64" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTWinArm64PGO/properties.json b/infra/config/generated/builders/ci/ToTWinArm64PGO/properties.json index e5582182..39d8d33 100644 --- a/infra/config/generated/builders/ci/ToTWinArm64PGO/properties.json +++ b/infra/config/generated/builders/ci/ToTWinArm64PGO/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTWinArm64PGO/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTWindowsCoverage/gn-args.json b/infra/config/generated/builders/ci/ToTWindowsCoverage/gn-args.json new file mode 100644 index 0000000..46ea7c2 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTWindowsCoverage/gn-args.json
@@ -0,0 +1,10 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "is_clang": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "use_clang_coverage": true + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTiOS/gn-args.json b/infra/config/generated/builders/ci/ToTiOS/gn-args.json new file mode 100644 index 0000000..68e29680 --- /dev/null +++ b/infra/config/generated/builders/ci/ToTiOS/gn-args.json
@@ -0,0 +1,14 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "enable_run_ios_unittests_with_xctest": true, + "ios_enable_code_signing": false, + "is_clang": true, + "is_component_build": false, + "is_debug": false, + "llvm_force_head_revision": true, + "target_cpu": "x64", + "target_environment": "simulator", + "target_os": "ios" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/ToTiOS/properties.json b/infra/config/generated/builders/ci/ToTiOS/properties.json index 634bac38..8691689 100644 --- a/infra/config/generated/builders/ci/ToTiOS/properties.json +++ b/infra/config/generated/builders/ci/ToTiOS/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTiOS/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/ToTiOSDevice/gn-args.json b/infra/config/generated/builders/ci/ToTiOSDevice/gn-args.json new file mode 100644 index 0000000..52bf76d --- /dev/null +++ b/infra/config/generated/builders/ci/ToTiOSDevice/gn-args.json
@@ -0,0 +1,13 @@ +{ + "gn_args": { + "dcheck_always_on": false, + "enable_run_ios_unittests_with_xctest": true, + "ios_code_signing_identity_description": "iPhone Developer", + "is_clang": true, + "is_debug": false, + "llvm_force_head_revision": true, + "target_cpu": "arm64", + "target_environment": "device", + "target_os": "ios" + } +} \ 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 c862996..7c1b8af 100644 --- a/infra/config/generated/builders/ci/ToTiOSDevice/properties.json +++ b/infra/config/generated/builders/ci/ToTiOSDevice/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/ToTiOSDevice/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/ci/linux-win_cross-rel/gn-args.json b/infra/config/generated/builders/ci/linux-win_cross-rel/gn-args.json new file mode 100644 index 0000000..aa8932a --- /dev/null +++ b/infra/config/generated/builders/ci/linux-win_cross-rel/gn-args.json
@@ -0,0 +1,11 @@ +{ + "gn_args": { + "dcheck_always_on": true, + "is_clang": true, + "is_component_build": true, + "is_debug": false, + "llvm_force_head_revision": true, + "symbol_level": 1, + "target_os": "win" + } +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/linux-win_cross-rel/properties.json b/infra/config/generated/builders/ci/linux-win_cross-rel/properties.json index 93aabfcf..f9a11fc 100644 --- a/infra/config/generated/builders/ci/linux-win_cross-rel/properties.json +++ b/infra/config/generated/builders/ci/linux-win_cross-rel/properties.json
@@ -1,6 +1,9 @@ { "$build/chromium_tests_builder_config": { "builder_config": { + "additional_exclusions": [ + "infra/config/generated/builders/ci/linux-win_cross-rel/gn-args.json" + ], "builder_db": { "entries": [ {
diff --git a/infra/config/generated/builders/gn_args_locations.json b/infra/config/generated/builders/gn_args_locations.json index 1a9c6ac4..2a572bc 100644 --- a/infra/config/generated/builders/gn_args_locations.json +++ b/infra/config/generated/builders/gn_args_locations.json
@@ -2,6 +2,53 @@ "chromium": { "linux-official": "ci/linux-official/gn-args.json" }, + "chromium.clang": { + "CFI Linux CF": "ci/CFI Linux CF/gn-args.json", + "CFI Linux ToT": "ci/CFI Linux ToT/gn-args.json", + "CrWinAsan": "ci/CrWinAsan/gn-args.json", + "CrWinAsan(dll)": "ci/CrWinAsan(dll)/gn-args.json", + "ToTAndroid": "ci/ToTAndroid/gn-args.json", + "ToTAndroid (dbg)": "ci/ToTAndroid (dbg)/gn-args.json", + "ToTAndroid x64": "ci/ToTAndroid x64/gn-args.json", + "ToTAndroid x86": "ci/ToTAndroid x86/gn-args.json", + "ToTAndroid64": "ci/ToTAndroid64/gn-args.json", + "ToTAndroidASan": "ci/ToTAndroidASan/gn-args.json", + "ToTAndroidCoverage x86": "ci/ToTAndroidCoverage x86/gn-args.json", + "ToTAndroidOfficial": "ci/ToTAndroidOfficial/gn-args.json", + "ToTChromeOS": "ci/ToTChromeOS/gn-args.json", + "ToTChromeOS (dbg)": "ci/ToTChromeOS (dbg)/gn-args.json", + "ToTFuchsia x64": "ci/ToTFuchsia x64/gn-args.json", + "ToTFuchsiaOfficial arm64": "ci/ToTFuchsiaOfficial arm64/gn-args.json", + "ToTLinux": "ci/ToTLinux/gn-args.json", + "ToTLinux (dbg)": "ci/ToTLinux (dbg)/gn-args.json", + "ToTLinuxASan": "ci/ToTLinuxASan/gn-args.json", + "ToTLinuxASanLibfuzzer": "ci/ToTLinuxASanLibfuzzer/gn-args.json", + "ToTLinuxCoverage": "ci/ToTLinuxCoverage/gn-args.json", + "ToTLinuxMSan": "ci/ToTLinuxMSan/gn-args.json", + "ToTLinuxPGO": "ci/ToTLinuxPGO/gn-args.json", + "ToTLinuxTSan": "ci/ToTLinuxTSan/gn-args.json", + "ToTLinuxUBSanVptr": "ci/ToTLinuxUBSanVptr/gn-args.json", + "ToTMac": "ci/ToTMac/gn-args.json", + "ToTMac (dbg)": "ci/ToTMac (dbg)/gn-args.json", + "ToTMacASan": "ci/ToTMacASan/gn-args.json", + "ToTMacArm64": "ci/ToTMacArm64/gn-args.json", + "ToTMacArm64PGO": "ci/ToTMacArm64PGO/gn-args.json", + "ToTMacCoverage": "ci/ToTMacCoverage/gn-args.json", + "ToTMacPGO": "ci/ToTMacPGO/gn-args.json", + "ToTWin": "ci/ToTWin/gn-args.json", + "ToTWin(dbg)": "ci/ToTWin(dbg)/gn-args.json", + "ToTWin(dll)": "ci/ToTWin(dll)/gn-args.json", + "ToTWin64": "ci/ToTWin64/gn-args.json", + "ToTWin64(dbg)": "ci/ToTWin64(dbg)/gn-args.json", + "ToTWin64(dll)": "ci/ToTWin64(dll)/gn-args.json", + "ToTWin64PGO": "ci/ToTWin64PGO/gn-args.json", + "ToTWinASanLibfuzzer": "ci/ToTWinASanLibfuzzer/gn-args.json", + "ToTWinArm64PGO": "ci/ToTWinArm64PGO/gn-args.json", + "ToTWindowsCoverage": "ci/ToTWindowsCoverage/gn-args.json", + "ToTiOS": "ci/ToTiOS/gn-args.json", + "ToTiOSDevice": "ci/ToTiOSDevice/gn-args.json", + "linux-win_cross-rel": "ci/linux-win_cross-rel/gn-args.json" + }, "chromium.linux": { "Cast Audio Linux": "ci/Cast Audio Linux/gn-args.json", "Cast Linux": "ci/Cast Linux/gn-args.json",
diff --git a/infra/config/generated/health-specs/health-specs.json b/infra/config/generated/health-specs/health-specs.json index ebed73ee..6dc9132 100644 --- a/infra/config/generated/health-specs/health-specs.json +++ b/infra/config/generated/health-specs/health-specs.json
@@ -1,1585 +1,2560 @@ { "_default": { - "build_time": { - "p50_mins": null - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "", + "thresholds": { + "build_time": { + "p50_mins": null + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, - "thresholds": { + "specs": { "ci": { "ASAN Debug": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "ASAN Release": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "ASAN Release Media": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "ASan Debug (32-bit x86 with V8-ARM)": { - "_default": "_default" + "contact_team_email": "v8-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "ASan Release (32-bit x86 with V8-ARM)": { - "_default": "_default" + "contact_team_email": "v8-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "ASan Release Media (32-bit x86 with V8-ARM)": { - "_default": "_default" + "contact_team_email": "v8-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Android ASAN (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Android Release (Nexus 5X)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Android WebView O (dbg)": { - "_default": "_default" + "contact_team_email": "woa-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Android WebView P (dbg)": { - "_default": "_default" + "contact_team_email": "woa-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Android arm Builder (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Android arm64 Builder (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Android arm64 Builder All Targets (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Android x64 Builder (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Android x64 Builder All Targets (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Android x86 Builder (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "CFI Linux CF": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "CFI Linux ToT": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "Cast Android (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Cast Audio Linux": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Cast Linux": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Cast Linux ARM64": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Cast Linux Debug": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Centipede Upload Linux ASan": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "ChromiumOS ASAN Release": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "CrWinAsan": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "CrWinAsan(dll)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "Dawn Android arm Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Android arm DEPS Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Android arm DEPS Release (Nexus 5X)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Android arm DEPS Release (Pixel 4)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Android arm Release (Nexus 5X)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Android arm Release (Pixel 4)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Android arm64 DEPS Release (Pixel 6)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Android arm64 Release (Pixel 6)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Linux TSAN Release": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Linux x64 Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Linux x64 DEPS Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Linux x64 DEPS Release (Intel UHD 630)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Linux x64 DEPS Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Linux x64 Release (Intel UHD 630)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Linux x64 Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac arm64 DEPS Release (Apple M2)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac arm64 Release (Apple M2)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac x64 Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac x64 DEPS Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac x64 DEPS Release (AMD)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac x64 DEPS Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac x64 Experimental Release (AMD)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac x64 Experimental Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac x64 Release (AMD)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Mac x64 Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 ASAN Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 ASAN Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 ASAN Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 DEPS Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 DEPS Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 DEPS Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 Experimental Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x64 Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x86 Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x86 DEPS Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x86 DEPS Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x86 DEPS Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x86 Experimental Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x86 Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Dawn Win10 x86 Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Deterministic Android": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Deterministic Android (dbg)": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Deterministic Fuchsia (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-fuchsia-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Deterministic Linux": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Deterministic Linux (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "GPU Linux Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "GPU Linux Builder (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "GPU Mac Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "GPU Mac Builder (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "GPU Win x64 Builder": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "GPU Win x64 Builder (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Leak Detection Linux": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Chrome OS ASan": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux ASan": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux ASan Debug": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux MSan": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux UBSan": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux V8-ARM64 ASan": { - "_default": "_default" + "contact_team_email": "v8-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux V8-ARM64 ASan Debug": { - "_default": "_default" + "contact_team_email": "v8-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux32 ASan": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux32 V8-ARM ASan": { - "_default": "_default" + "contact_team_email": "v8-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Linux32 V8-ARM ASan Debug": { - "_default": "_default" + "contact_team_email": "v8-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Mac ASan": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload Windows ASan": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Libfuzzer Upload iOS Catalyst Debug": { - "_default": "_default" + "contact_team_email": "chrome-deet-core@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux ASan LSan Builder": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux ASan LSan Tests (1)": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Builder": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Builder (Wayland)": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Builder (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux CFI": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Chromium OS ASan LSan Builder": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Chromium OS ASan LSan Tests (1)": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux ChromiumOS MSan Builder": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux ChromiumOS MSan Tests": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Debug (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux MSan Builder": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux MSan Tests": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux TSan Builder": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux TSan Tests": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Tests": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Tests (Wayland)": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Linux Tests (dbg)(1)": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "MSAN Release (chained origins)": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "MSAN Release (no origins)": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac ASAN Release": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac ASAN Release Media": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "Mac ASan 64 Builder": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac ASan 64 Tests (1)": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac Builder": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac Builder (dbg)": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac Debug (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac Release (Intel)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac Retina Debug (AMD)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac Retina Release (AMD)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac10.15 Tests": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac11 Tests": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Mac12 Tests": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "Mac13 Tests": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "Mac13 Tests (dbg)": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "Network Service Linux": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Oreo Phone Tester": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "TSAN Debug": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "TSAN Release": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "ToTAndroid": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTAndroid (dbg)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTAndroid x64": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTAndroid x86": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTAndroid64": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTAndroidASan": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTAndroidCoverage x86": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTAndroidOfficial": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTChromeOS": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTChromeOS (dbg)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTFuchsia x64": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTFuchsiaOfficial arm64": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinux": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinux (dbg)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinuxASan": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinuxASanLibfuzzer": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinuxCoverage": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinuxMSan": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinuxPGO": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinuxTSan": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTLinuxUBSanVptr": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTMac": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTMac (dbg)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTMacASan": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTMacArm64": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTMacArm64PGO": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTMacCoverage": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTMacPGO": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWin": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWin(dbg)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWin(dll)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWin64": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWin64(dbg)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWin64(dll)": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWin64PGO": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWinASanLibfuzzer": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWinArm64PGO": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTWindowsCoverage": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTiOS": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "ToTiOSDevice": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "UBSan Release": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "UBSan vptr Release": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "WebKit Linux ASAN": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "WebKit Linux Leak": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "WebKit Linux MSAN": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "WebKit Win10": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Win ASan Release": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Win ASan Release Media": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "Win Builder": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Win Builder (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Win x64 Builder": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Win x64 Builder (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Win10 Tests x64": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Win10 Tests x64 (dbg)": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Win10 x64 Debug (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Win10 x64 Release (NVIDIA)": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "Win11 Tests x64": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "Windows deterministic": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-10-arm64-rel": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-11-x86-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "android-12-x64-rel": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-12l-x64-dbg-tests": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-13-x64-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "android-angle-chromium-arm64-builder": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-angle-chromium-arm64-nexus5x": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-archive-rel": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-arm64-archive-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "android-arm64-proguard-rel": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-asan": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "android-bfcache-rel": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-binary-size-generator": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-arm-dbg": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-arm-rel": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-arm64-dbg": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-arm64-rel": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-asan-arm-rel": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-mainline-clang-arm64-dbg": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-mainline-clang-arm64-rel": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-mainline-clang-x86-dbg": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-mainline-clang-x86-rel": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-marshmallow-arm64-perf-rel": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-riscv64-dbg": { - "_default": "_default" + "contact_team_email": "cronet-sheriff@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-riscv64-rel": { - "_default": "_default" + "contact_team_email": "cronet-sheriff@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x64-dbg": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x64-dbg-12-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x64-dbg-13-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x64-dbg-14-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x64-rel": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-dbg": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-dbg-10-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-dbg-11-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-dbg-lollipop-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-dbg-marshmallow-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-dbg-nougat-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-dbg-oreo-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-dbg-pie-tests": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-cronet-x86-rel": { - "_default": "_default" + "contact_team_email": "cronet-team@google.com", + "thresholds": { + "_default": "_default" + } }, "android-official": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-oreo-x86-rel": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-pie-arm64-dbg": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-pie-arm64-rel": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-pie-x86-rel": { - "_default": "_default" + "contact_team_email": "clank-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-webview-10-x86-rel-tests": { - "_default": "_default" + "contact_team_email": "woa-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "android-x86-rel": { - "_default": "_default" + "contact_team_email": "woa-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "chromeos-amd64-generic-asan-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-amd64-generic-cfi-thin-lto-rel": { - "build_time": { - "p50_mins": 100 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 100 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-amd64-generic-dbg": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-amd64-generic-lacros-dbg": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-amd64-generic-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-amd64-generic-rel-gtest": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-amd64-generic-rel-renamed": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-amd64-generic-rel-tast": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-arm-generic-dbg": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-arm-generic-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-arm64-generic-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-jacuzzi-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "chromeos-octopus-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "fuchsia-angle-builder": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "fuchsia-arm64-cast-receiver-rel": { - "_default": "_default" + "contact_team_email": "chrome-fuchsia-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "fuchsia-arm64-rel": { - "_default": "_default" + "contact_team_email": "chrome-fuchsia-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "fuchsia-official": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "fuchsia-x64-cast-receiver-rel": { - "_default": "_default" + "contact_team_email": "chrome-fuchsia-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "fuchsia-x64-dbg": { - "_default": "_default" + "contact_team_email": "chrome-fuchsia-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "fuchsia-x64-rel": { - "_default": "_default" + "contact_team_email": "chrome-fuchsia-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "ios-angle-builder": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "ios-angle-intel": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "ios-asan": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "ios-catalyst": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "ios-device": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "ios-simulator": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "ios-simulator-full-configs": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "ios-simulator-noncq": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "lacros-amd64-generic-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "lacros-amd64-generic-rel-non-skylab": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "lacros-arm-archive-rel": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "lacros-arm-generic-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "lacros-arm-generic-rel-skylab": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "lacros-arm64-archive-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "lacros-arm64-generic-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "lacros-arm64-generic-rel-skylab": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "lacros64-archive-rel": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-angle-chromium-builder": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-angle-chromium-intel": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-angle-chromium-nvidia": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-archive-rel": { - "_default": "_default" + "contact_team_email": "chrome-browser-infra-team@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-arm64-rel-cft": { - "_default": "_default" + "contact_team_email": "browser-automation-staff@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-ash-chromium-generator-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "linux-bfcache-rel": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-cfm-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "core-devices-eng@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "linux-chromeos-archive-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "linux-chromeos-dbg": { - "build_time": { - "p50_mins": 150 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 150 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "linux-chromeos-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chromeos-sw-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "linux-extended-tracing-rel": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-gcc-rel": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-lacros-archive-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "linux-lacros-asan-lsan-rel": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-lacros-builder-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "linux-lacros-dbg": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "linux-lacros-tester-rel": { - "build_time": { - "p50_mins": 60 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "build_time": { + "p50_mins": 60 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "linux-official": { - "build_time": { - "p50_mins": 240 - }, - "fail_rate": { - "average": 0.2 - }, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "thresholds": { + "build_time": { + "p50_mins": 240 + }, + "fail_rate": { + "average": 0.2 + }, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "linux-rel-cft": { - "_default": "_default" + "contact_team_email": "browser-automation-staff@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-swangle-chromium-x64": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-swangle-chromium-x64-exp": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-swangle-tot-swiftshader-x64": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-swangle-x64": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-swangle-x64-exp": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-ubsan-vptr": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-v4l2-codec-rel": { - "_default": "_default" + "contact_team_email": "chrome-linux-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "linux-win_cross-rel": { - "build_time": {}, - "infra_fail_rate": { - "average": 0.05 - }, - "pending_time": { - "p50_mins": 20 + "contact_team_email": "lexan@google.com", + "thresholds": { + "build_time": {}, + "infra_fail_rate": { + "average": 0.05 + }, + "pending_time": { + "p50_mins": 20 + } } }, "mac-angle-chromium-amd": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "mac-angle-chromium-builder": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "mac-angle-chromium-intel": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "mac-archive-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "mac-arm64-archive-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "mac-arm64-dbg": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "mac-arm64-on-arm64-rel": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "mac-arm64-rel": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "mac-intel-on-arm64-rel": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "mac-official": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "mac-rel-cft": { - "_default": "_default" + "contact_team_email": "browser-automation-staff@google.com", + "thresholds": { + "_default": "_default" + } }, "mac-swangle-chromium-x64": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "mac11-arm64-rel-tests": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "mac12-arm64-rel-tests": { - "_default": "_default" + "thresholds": { + "_default": "_default" + } }, "mac13-arm64-rel-tests": { - "_default": "_default" + "contact_team_email": "bling-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "win-angle-chromium-x64-builder": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "win-angle-chromium-x86-builder": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "win-archive-rel": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "win-asan": { - "_default": "_default" + "contact_team_email": "chrome-sanitizer-builder-owners@google.com", + "thresholds": { + "_default": "_default" + } }, "win-official": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "win-rel-cft": { - "_default": "_default" + "contact_team_email": "browser-automation-staff@google.com", + "thresholds": { + "_default": "_default" + } }, "win-swangle-chromium-x86": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "win-swangle-tot-swiftshader-x64": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "win-swangle-tot-swiftshader-x86": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "win-swangle-x64": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "win-swangle-x86": { - "_default": "_default" + "contact_team_email": "chrome-gpu-infra@google.com", + "thresholds": { + "_default": "_default" + } }, "win10-angle-chromium-x64-intel": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "win10-angle-chromium-x64-nvidia": { - "_default": "_default" + "contact_team_email": "angle-team@google.com", + "thresholds": { + "_default": "_default" + } }, "win32-archive-rel": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } }, "win32-official": { - "_default": "_default" + "contact_team_email": "chrome-desktop-engprod@google.com", + "thresholds": { + "_default": "_default" + } } } }
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index c635320..95e07bd 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -34564,6 +34564,11 @@ ' "sdk_package_name": "emulator"' ' },' ' {' + ' "cipd_yaml": "third_party/android_sdk/cipd/emulator.yaml",' + ' "sdk_channel": "BETA",' + ' "sdk_package_name": "emulator"' + ' },' + ' {' ' "cipd_yaml": "third_party/android_sdk/cipd/platforms/android-34.yaml",' ' "sdk_package_name": "platforms;android-34"' ' },' @@ -86918,6 +86923,10 @@ value: 10 } experiments { + key: "chromium.enable_cleandead" + value: 5 + } + experiments { key: "chromium_swarming.expose_merge_script_failures" value: 100 }
diff --git a/infra/config/generated/testing/gn_isolate_map.pyl b/infra/config/generated/testing/gn_isolate_map.pyl index e3380038..d5ecf1d 100644 --- a/infra/config/generated/testing/gn_isolate_map.pyl +++ b/infra/config/generated/testing/gn_isolate_map.pyl
@@ -1657,7 +1657,7 @@ "script": "//testing/run_pytype.py", }, "touch_to_fill_junit_tests": { - "label": "//chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests", + "label": "//chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests", "type": "generated_script", }, "trace_processor_shell": {
diff --git a/infra/config/generated/testing/test_suites.pyl b/infra/config/generated/testing/test_suites.pyl index 60c705a..f1d08bd 100644 --- a/infra/config/generated/testing/test_suites.pyl +++ b/infra/config/generated/testing/test_suites.pyl
@@ -4333,7 +4333,7 @@ ], }, }, - 'webdriver_tests_suite': { + 'webdriver_wpt_tests': { 'test': 'chrome_wpt_tests', 'results_handler': 'layout tests', 'mixins': [ @@ -5548,7 +5548,7 @@ }, 'wpt_web_tests': { - 'wpt_tests_suite': { + 'chrome_wpt_tests': { 'test': 'chrome_wpt_tests', 'results_handler': 'layout tests', 'args': [
diff --git a/infra/config/generated/testing/variants.pyl b/infra/config/generated/testing/variants.pyl index 9e427c25..3422554 100644 --- a/infra/config/generated/testing/variants.pyl +++ b/infra/config/generated/testing/variants.pyl
@@ -86,16 +86,16 @@ }, 'LACROS_VERSION_SKEW_DEV': { 'identifier': 'Lacros version skew testing ash dev', - 'description': 'Run with ash-chrome version 120.0.6099.8', + 'description': 'Run with ash-chrome version 120.0.6099.13', 'args': [ - '--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.8/test_ash_chrome', + '--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome', ], 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/linux-ash-chromium/x86_64/ash.zip', - 'location': 'lacros_version_skew_tests_v120.0.6099.8', - 'revision': 'version:120.0.6099.8', + 'location': 'lacros_version_skew_tests_v120.0.6099.13', + 'revision': 'version:120.0.6099.13', }, ], }, @@ -472,7 +472,7 @@ 'identifier': 'BRYA_RELEASE_DEV', 'skylab': { 'cros_board': 'brya', - 'cros_img': 'brya-release/R119-15633.10.0', + 'cros_img': 'brya-release/R120-15662.4.0', 'dut_pool': 'chrome', }, }, @@ -480,7 +480,7 @@ 'identifier': 'BRYA_RELEASE_BETA', 'skylab': { 'cros_board': 'brya', - 'cros_img': 'brya-release/R118-15604.42.0', + 'cros_img': 'brya-release/R119-15633.37.0', 'dut_pool': 'chrome', }, }, @@ -488,7 +488,7 @@ 'identifier': 'BRYA_RELEASE_STABLE', 'skylab': { 'cros_board': 'brya', - 'cros_img': 'brya-release/R117-15572.63.2', + 'cros_img': 'brya-release/R118-15604.57.0', 'dut_pool': 'chrome', }, }, @@ -503,21 +503,21 @@ 'identifier': 'DEDEDE_RELEASE_DEV', 'skylab': { 'cros_board': 'dedede', - 'cros_img': 'dedede-release/R119-15633.10.0', + 'cros_img': 'dedede-release/R120-15656.0.0', }, }, 'CROS_DEDEDE_RELEASE_BETA': { 'identifier': 'DEDEDE_RELEASE_BETA', 'skylab': { 'cros_board': 'dedede', - 'cros_img': 'dedede-release/R118-15604.42.0', + 'cros_img': 'dedede-release/R119-15633.37.0', }, }, 'CROS_DEDEDE_RELEASE_STABLE': { 'identifier': 'DEDEDE_RELEASE_STABLE', 'skylab': { 'cros_board': 'dedede', - 'cros_img': 'dedede-release/R117-15572.63.0', + 'cros_img': 'dedede-release/R118-15604.57.0', }, }, 'CROS_FIZZ_RELEASE_LKGM': { @@ -532,7 +532,7 @@ 'identifier': 'FIZZ_RELEASE_DEV', 'skylab': { 'cros_board': 'fizz', - 'cros_img': 'fizz-release/R119-15633.10.0', + 'cros_img': 'fizz-release/R120-15662.4.0', 'dut_pool': 'chrome', }, }, @@ -540,7 +540,7 @@ 'identifier': 'FIZZ_RELEASE_BETA', 'skylab': { 'cros_board': 'fizz', - 'cros_img': 'fizz-release/R118-15604.42.0', + 'cros_img': 'fizz-release/R119-15633.37.0', 'dut_pool': 'chrome', }, }, @@ -548,7 +548,7 @@ 'identifier': 'FIZZ_RELEASE_STABLE', 'skylab': { 'cros_board': 'fizz', - 'cros_img': 'fizz-release/R117-15572.63.0', + 'cros_img': 'fizz-release/R118-15604.56.0', 'dut_pool': 'chrome', }, }, @@ -564,7 +564,7 @@ 'identifier': 'GUYBRUSH_RELEASE_DEV', 'skylab': { 'cros_board': 'guybrush', - 'cros_img': 'guybrush-release/R119-15626.0.0', + 'cros_img': 'guybrush-release/R120-15662.4.0', 'dut_pool': 'chrome', }, }, @@ -572,7 +572,7 @@ 'identifier': 'GUYBRUSH_RELEASE_BETA', 'skylab': { 'cros_board': 'guybrush', - 'cros_img': 'guybrush-release/R118-15604.42.0', + 'cros_img': 'guybrush-release/R119-15633.37.0', 'dut_pool': 'chrome', }, }, @@ -580,7 +580,7 @@ 'identifier': 'GUYBRUSH_RELEASE_STABLE', 'skylab': { 'cros_board': 'guybrush', - 'cros_img': 'guybrush-release/R117-15572.63.0', + 'cros_img': 'guybrush-release/R118-15604.57.0', 'dut_pool': 'chrome', }, }, @@ -596,7 +596,7 @@ 'identifier': 'PUFF_RELEASE_DEV', 'skylab': { 'cros_board': 'puff', - 'cros_img': 'puff-release/R119-15633.10.0', + 'cros_img': 'puff-release/R120-15662.4.0', 'dut_pool': 'chrome', }, }, @@ -604,7 +604,7 @@ 'identifier': 'PUFF_RELEASE_BETA', 'skylab': { 'cros_board': 'puff', - 'cros_img': 'puff-release/R118-15604.42.0', + 'cros_img': 'puff-release/R119-15633.37.0', 'dut_pool': 'chrome', }, }, @@ -612,7 +612,7 @@ 'identifier': 'PUFF_RELEASE_STABLE', 'skylab': { 'cros_board': 'puff', - 'cros_img': 'puff-release/R117-15572.63.0', + 'cros_img': 'puff-release/R118-15604.57.0', 'dut_pool': 'chrome', }, }, @@ -638,21 +638,21 @@ 'identifier': 'HANA_RELEASE_DEV', 'skylab': { 'cros_board': 'hana', - 'cros_img': 'hana-release/R119-15633.10.0', + 'cros_img': 'hana-release/R120-15662.4.0', }, }, 'CROS_HANA_RELEASE_BETA': { 'identifier': 'HANA_RELEASE_BETA', 'skylab': { 'cros_board': 'hana', - 'cros_img': 'hana-release/R118-15604.42.0', + 'cros_img': 'hana-release/R119-15633.37.0', }, }, 'CROS_HANA_RELEASE_STABLE': { 'identifier': 'HANA_RELEASE_STABLE', 'skylab': { 'cros_board': 'hana', - 'cros_img': 'hana-release/R117-15572.63.0', + 'cros_img': 'hana-release/R118-15604.57.0', }, }, 'CROS_JACUZZI_RELEASE_LKGM': { @@ -666,14 +666,14 @@ 'identifier': 'JACUZZI_RELEASE_DEV', 'skylab': { 'cros_board': 'jacuzzi', - 'cros_img': 'jacuzzi-release/R119-15633.10.0', + 'cros_img': 'jacuzzi-release/R120-15662.4.0', }, }, 'CROS_JACUZZI_RELEASE_BETA': { 'identifier': 'JACUZZI_RELEASE_BETA', 'skylab': { 'cros_board': 'jacuzzi', - 'cros_img': 'jacuzzi-release/R118-15604.42.0', + 'cros_img': 'jacuzzi-release/R119-15633.37.0', }, }, 'CROS_JACUZZI_RELEASE_CHROME_FROM_TLS_ASH_LKGM': { @@ -687,7 +687,7 @@ 'identifier': 'JACUZZI_RELEASE_STABLE', 'skylab': { 'cros_board': 'jacuzzi', - 'cros_img': 'jacuzzi-release/R117-15572.63.0', + 'cros_img': 'jacuzzi-release/R118-15604.57.0', }, }, 'CROS_JACUZZI_PUBLIC_LKGM': { @@ -742,21 +742,21 @@ 'identifier': 'OCTOPUS_RELEASE_DEV', 'skylab': { 'cros_board': 'octopus', - 'cros_img': 'octopus-release/R119-15633.10.0', + 'cros_img': 'octopus-release/R120-15662.4.0', }, }, 'CROS_OCTOPUS_RELEASE_BETA': { 'identifier': 'OCTOPUS_RELEASE_BETA', 'skylab': { 'cros_board': 'octopus', - 'cros_img': 'octopus-release/R118-15604.42.0', + 'cros_img': 'octopus-release/R119-15633.37.0', }, }, 'CROS_OCTOPUS_RELEASE_STABLE': { 'identifier': 'OCTOPUS_RELEASE_STABLE', 'skylab': { 'cros_board': 'octopus', - 'cros_img': 'octopus-release/R117-15572.63.0', + 'cros_img': 'octopus-release/R118-15604.57.0', }, }, 'CROS_STRONGBAD_RELEASE_LKGM': { @@ -770,21 +770,21 @@ 'identifier': 'strongbad_RELEASE_DEV', 'skylab': { 'cros_board': 'strongbad', - 'cros_img': 'strongbad-release/R119-15633.10.0', + 'cros_img': 'strongbad-release/R120-15662.4.0', }, }, 'CROS_STRONGBAD_RELEASE_BETA': { 'identifier': 'STRONGBAD_RELEASE_BETA', 'skylab': { 'cros_board': 'strongbad', - 'cros_img': 'strongbad-release/R118-15604.42.0', + 'cros_img': 'strongbad-release/R119-15633.37.0', }, }, 'CROS_STRONGBAD_RELEASE_STABLE': { 'identifier': 'STRONGBAD_RELEASE_STABLE', 'skylab': { 'cros_board': 'strongbad', - 'cros_img': 'strongbad-release/R117-15572.63.0', + 'cros_img': 'strongbad-release/R118-15604.57.0', }, }, 'CROS_TROGDOR_RELEASE_ASH_LKGM': {
diff --git a/infra/config/gn_args/gn_args.star b/infra/config/gn_args/gn_args.star index 618dc64..9dc96339 100644 --- a/infra/config/gn_args/gn_args.star +++ b/infra/config/gn_args/gn_args.star
@@ -7,6 +7,13 @@ load("//lib/gn_args.star", "gn_args") gn_args.config( + "also_build_ash_chrome", + args = { + "also_build_ash_chrome": True, + }, +) + +gn_args.config( "also_build_lacros_chrome_for_architecture_amd64", args = { "also_build_lacros_chrome_for_architecture": "amd64", @@ -18,6 +25,31 @@ args_file = "//build/args/chromeos/amd64-generic-vm.gni", ) +# We build Android with codecs on most bots to ensure maximum test +# coverage, but use 'android_without_codecs' on bots responsible for +# building publicly advertised non-Official Android builds -- +# which are not allowed to have proprietary codecs enabled. +gn_args.config( + "android", + configs = [ + "android_without_codecs", + "chrome_with_codecs", + ], +) + +# Builders never have a use for android:debuggable="true". They do not use +# JWDP (java debugger), and do not need it to access application files +# since they always use userdebug OS builds (which have root access). +# android:debuggable="true" causes ART to run more slowly, so tests run +# faster without it. https://crbug.com/1276429 +gn_args.config( + "android_without_codecs", + args = { + "target_os": "android", + "debuggable_apks": False, + }, +) + gn_args.config( "arm64", args = { @@ -26,6 +58,20 @@ ) gn_args.config( + "arm64_host", + args = { + "test_host_cpu": "arm64", + }, +) + +gn_args.config( + "asan", + args = { + "is_asan": True, + }, +) + +gn_args.config( "cast_audio", args = { "is_cast_audio_only": True, @@ -47,6 +93,44 @@ ) gn_args.config( + "cfi", + args = { + "is_cfi": True, + }, +) + +gn_args.config( + "cfi_diag", + args = { + "use_cfi_diag": True, + }, +) + +gn_args.config( + "cfi_full", + args = { + "use_cfi_cast": True, + }, + configs = [ + "cfi", + ], +) + +gn_args.config( + "cfi_icall", + args = { + "use_cfi_icall": True, + }, +) + +gn_args.config( + "cfi_recover", + args = { + "use_cfi_recover": True, + }, +) + +gn_args.config( "chrome_with_codecs", args = { "proprietary_codecs": True, @@ -57,6 +141,23 @@ ) gn_args.config( + "chromeos", + args = { + "target_os": "chromeos", + }, +) + +gn_args.config( + "chromeos_codecs", + args = { + "proprietary_codecs": True, + }, + configs = [ + "ffmpeg_branding_chromeos", + ], +) + +gn_args.config( "chromeos_device", args = { "is_chromeos_device": True, @@ -64,6 +165,23 @@ ) gn_args.config( + "clang", + args = { + "is_clang": True, + }, +) + +gn_args.config( + "clang_tot", + args = { + "llvm_force_head_revision": True, + }, + configs = [ + "clang", + ], +) + +gn_args.config( "dcheck_always_on", args = { "dcheck_always_on": True, @@ -155,6 +273,34 @@ ) gn_args.config( + "ffmpeg_branding_chromeos", + args = { + "ffmpeg_branding": "ChromeOS", + }, +) + +gn_args.config( + "fuchsia", + args = { + "target_os": "fuchsia", + }, +) + +gn_args.config( + "full_symbols", + args = { + "symbol_level": 2, + }, +) + +gn_args.config( + "fuzzer", + args = { + "enable_ipc_fuzzer": True, + }, +) + +gn_args.config( "goma", args = { "use_goma": True, @@ -176,12 +322,50 @@ ) gn_args.config( + "ios_chromium_cert", + args = { + "ios_code_signing_identity_description": "iPhone Developer", + }, +) + +gn_args.config( + "ios_device", + args = {"target_environment": "device"}, + configs = ["ios"], +) + +# defaults to true under ios_sdk.gni +gn_args.config( + "ios_disable_code_signing", + args = { + "ios_enable_code_signing": False, + }, +) + +gn_args.config( "ios_simulator", args = {"target_environment": "simulator"}, configs = ["ios"], ) gn_args.config( + "lacros_on_linux", + args = { + "chromeos_is_browser_only": True, + }, + configs = [ + "chromeos", + ], +) + +gn_args.config( + "libfuzzer", + args = { + "use_libfuzzer": True, + }, +) + +gn_args.config( "linux_wayland", args = { "ozone_auto_platforms": False, @@ -192,6 +376,13 @@ ) gn_args.config( + "lsan", + args = { + "is_lsan": True, + }, +) + +gn_args.config( "minimal_symbols", args = { "symbol_level": 1, @@ -199,6 +390,21 @@ ) gn_args.config( + "mojo_fuzzer", + args = { + "enable_mojom_fuzzer": True, + }, +) + +gn_args.config( + "msan", + args = { + "is_msan": True, + "msan_track_origins": 2, + }, +) + +gn_args.config( "no_clang", args = { "is_clang": False, @@ -227,6 +433,13 @@ ) gn_args.config( + "optimize_for_fuzzing", + args = { + "optimize_for_fuzzing": True, + }, +) + +gn_args.config( "ozone_headless", args = { "ozone_platform_headless": True, @@ -248,6 +461,23 @@ ) gn_args.config( + "pdf_xfa", + args = { + "pdf_enable_xfa": True, + }, +) + +gn_args.config( + "pgo_phase_1", + args = { + "chrome_pgo_phase": 1, + }, + configs = [ + "v8_release_branch", + ], +) + +gn_args.config( "reclient", args = { "use_remoteexec": True, @@ -311,6 +541,20 @@ ) gn_args.config( + "strip_debug_info", + args = { + "strip_debug_info": True, + }, +) + +gn_args.config( + "thin_lto", + args = { + "use_thin_lto": True, + }, +) + +gn_args.config( "try_builder", configs = [ "dcheck_always_on", @@ -320,6 +564,32 @@ ) gn_args.config( + "tsan", + args = { + "is_tsan": True, + }, +) + +gn_args.config( + "ubsan_vptr", + args = { + "is_ubsan_vptr": True, + }, +) + +# TODO(krasin): Remove when https://llvm.org/bugs/show_bug.cgi?id=25569 +# is fixed and just use ubsan_vptr instead. +gn_args.config( + "ubsan_vptr_no_recover_hack", + args = { + "is_ubsan_no_recover": True, + }, + configs = [ + "ubsan_vptr", + ], +) + +gn_args.config( "use_clang_coverage", args = { "use_clang_coverage": True, @@ -351,6 +621,28 @@ ) gn_args.config( + "v8_heap", + args = { + "v8_enable_verify_heap": True, + }, +) + +# V8 flag that disables v8_enable_runtime_call_stats on release branches. +gn_args.config( + "v8_release_branch", + args = { + "is_on_release_branch": True, + }, +) + +gn_args.config( + "win_cross", + args = { + "target_os": "win", + }, +) + +gn_args.config( "x64", args = { "target_cpu": "x64",
diff --git a/infra/config/lib/builder_health_indicators.star b/infra/config/lib/builder_health_indicators.star index e1b4d393..a2f6a1f 100644 --- a/infra/config/lib/builder_health_indicators.star +++ b/infra/config/lib/builder_health_indicators.star
@@ -33,6 +33,11 @@ ), ) +_default_spec = struct( + thresholds = _default_thresholds, + contact_team_email = "", +) + _blank_thresholds = struct( infra_fail_rate = struct( average = None, @@ -50,7 +55,7 @@ DEFAULT = struct(_default = "_default") -def spec(**kwargs): +def thresholds(**kwargs): return structs.evolve(_blank_thresholds, **kwargs) def modified_default(**kwargs): @@ -59,11 +64,15 @@ def _exempted_from_contact(bucket, builder): return builder in _exempted_from_contact_builders.get(bucket, []) -def register_health_spec(bucket, name, spec, contact_team_email): +def register_health_spec(bucket, name, thresholds, contact_team_email): if not contact_team_email and not _exempted_from_contact(bucket, name): fail("Builder " + name + " must have a contact_team_email. All new builders must specify a team email for contact in case the builder stops being healthy or providing value.") - if spec: + if thresholds: + spec = struct( + thresholds = thresholds, + contact_team_email = contact_team_email, + ) health_spec_key = _HEALTH_SPEC.add( bucket, name, @@ -82,8 +91,8 @@ specs.setdefault(bucket, {})[builder] = node.props result = { - "_default": _default_thresholds, - "thresholds": specs, + "_default": _default_spec, + "specs": specs, } ctx.output["health-specs/health-specs.json"] = json.indent(json.encode(result), indent = " ") @@ -968,7 +977,7 @@ health_spec = struct( DEFAULT = DEFAULT, - spec = spec, + spec = thresholds, modified_default = modified_default, )
diff --git a/infra/config/subprojects/chromium/ci/chromium.clang.star b/infra/config/subprojects/chromium/ci/chromium.clang.star index f7be48d..9d2dff9e 100644 --- a/infra/config/subprojects/chromium/ci/chromium.clang.star +++ b/infra/config/subprojects/chromium/ci/chromium.clang.star
@@ -10,6 +10,7 @@ load("//lib/branches.star", "branches") load("//lib/ci.star", "ci") load("//lib/consoles.star", "consoles") +load("//lib/gn_args.star", "gn_args") ci.defaults.set( executable = ci.DEFAULT_EXECUTABLE, @@ -126,6 +127,17 @@ short_name = "CF", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "cfi_full", + "cfi_icall", + "cfi_diag", + "cfi_recover", + "thin_lto", + "release_builder", + "reclient", + ], + ), notifies = ["CFI Linux"], reclient_instance = reclient.instance.DEFAULT_TRUSTED, reclient_jobs = reclient.jobs.DEFAULT, @@ -151,6 +163,17 @@ short_name = "ToT", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "cfi_full", + "cfi_icall", + "cfi_diag", + "thin_lto", + "release_builder", + "dcheck_always_on", + ], + ), notifies = ["CFI Linux"], ) @@ -175,6 +198,16 @@ short_name = "asn", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "asan", + "clang_tot", + "fuzzer", + "release_builder", + "v8_heap", + "minimal_symbols", + ], + ), ) ci.builder( @@ -198,6 +231,16 @@ short_name = "dll", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "asan", + "clang_tot", + "shared", + "release", + "v8_heap", + "minimal_symbols", + ], + ), ) ci.builder( @@ -226,6 +269,15 @@ short_name = "rel", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "android", + "release_builder", + "minimal_symbols", + "strip_debug_info", + "clang_tot", + ], + ), ) ci.builder( @@ -254,6 +306,14 @@ short_name = "dbg", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "android_without_codecs", + "clang_tot", + "shared", + "debug", + ], + ), ) ci.builder( @@ -282,6 +342,16 @@ short_name = "x64", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "android_without_codecs", + "clang_tot", + "shared", + "release", + "x64", + "dcheck_always_on", + ], + ), ) ci.builder( @@ -310,6 +380,16 @@ short_name = "x86", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "android_without_codecs", + "clang_tot", + "shared", + "release", + "x86", + "dcheck_always_on", + ], + ), ) ci.builder( @@ -338,6 +418,17 @@ short_name = "and", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "android_without_codecs", + "clang_tot", + "shared", + "release", + "x86", + "dcheck_always_on", + "use_clang_coverage", + ], + ), ) ci.builder( @@ -366,6 +457,14 @@ short_name = "a64", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "android_without_codecs", + "clang_tot", + "release", + "arm64", + ], + ), ) ci.builder( @@ -394,6 +493,15 @@ short_name = "asn", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "android_without_codecs", + "clang_tot", + "asan", + "debug_builder", + "strip_debug_info", + ], + ), ) ci.builder( @@ -422,6 +530,16 @@ short_name = "off", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "android", + "release_builder", + "minimal_symbols", + "official_optimize", + "clang_tot", + "arm64", + ], + ), ) ci.builder( @@ -448,6 +566,14 @@ short_name = "rel", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "lacros_on_linux", + "release", + "also_build_ash_chrome", + "clang_tot", + ], + ), ) ci.builder( @@ -474,6 +600,14 @@ short_name = "dbg", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "lacros_on_linux", + "debug", + "also_build_ash_chrome", + "clang_tot", + ], + ), ) ci.builder( @@ -510,6 +644,13 @@ ), ], contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "fuchsia", + "release_builder", + "clang_tot", + ], + ), ) ci.builder( @@ -548,6 +689,16 @@ ), ], contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "official_optimize", + "fuchsia", + "arm64", + "clang_tot", + "static", + "arm64_host", + ], + ), ) clang_tot_linux_builder( @@ -566,6 +717,16 @@ ), build_gs_bucket = "chromium-clang-archive", ), + gn_args = gn_args.config( + # Enable debug info, as on official builders, to catch issues with + # optimized debug info. + configs = [ + "clang_tot", + "full_symbols", + "shared", + "release", + ], + ), short_name = "rel", ) @@ -585,6 +746,13 @@ ), build_gs_bucket = "chromium-clang-archive", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "shared", + "debug", + ], + ), short_name = "dbg", ) @@ -604,6 +772,14 @@ ), build_gs_bucket = "chromium-clang-archive", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "asan", + "lsan", + "release_builder", + ], + ), short_name = "asn", ) @@ -625,6 +801,20 @@ ), # Requires a large disk, so has a machine specifically devoted to it builderless = False, + gn_args = gn_args.config( + configs = [ + "libfuzzer", + "asan", + "clang_tot", + "shared", + "release", + "chromeos_codecs", + "pdf_xfa", + "disable_nacl", + "optimize_for_fuzzing", + "mojo_fuzzer", + ], + ), short_name = "fuz", ) @@ -632,6 +822,14 @@ name = "ToTLinuxCoverage", executable = "recipe:chromium_clang_coverage_tot", category = "ToT Code Coverage", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "use_clang_coverage", + "minimal_symbols", + "release", + ], + ), short_name = "linux", ) @@ -652,6 +850,13 @@ build_gs_bucket = "chromium-clang-archive", ), os = os.LINUX_FOCAL, + gn_args = gn_args.config( + configs = [ + "clang_tot", + "msan", + "release", + ], + ), short_name = "msn", ) @@ -671,6 +876,14 @@ ), build_gs_bucket = "chromium-clang-archive", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "official_optimize", + "no_symbols", + "pgo_phase_1", + ], + ), short_name = "pgo", ) @@ -690,6 +903,13 @@ ), build_gs_bucket = "chromium-clang-archive", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "tsan", + "release", + ], + ), short_name = "tsn", ) @@ -709,6 +929,13 @@ ), build_gs_bucket = "chromium-clang-archive", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "ubsan_vptr_no_recover_hack", + "release_builder", + ], + ), short_name = "usn", ) @@ -734,6 +961,14 @@ short_name = "rel", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "minimal_symbols", + "release_builder", + "x86", + ], + ), ) ci.builder( @@ -758,6 +993,14 @@ short_name = "dbg", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "shared", + "debug", + "x86", + ], + ), ) ci.builder( @@ -781,6 +1024,16 @@ short_name = "dll", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "minimal_symbols", + "shared", + "release", + "x86", + "dcheck_always_on", + ], + ), ) ci.builder( @@ -804,6 +1057,13 @@ short_name = "rel", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "minimal_symbols", + "release_builder", + ], + ), ) ci.builder( @@ -828,6 +1088,13 @@ short_name = "dbg", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "shared", + "debug", + ], + ), ) ci.builder( @@ -852,6 +1119,14 @@ short_name = "dll", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "shared", + "release", + "dcheck_always_on", + ], + ), ) ci.builder( @@ -876,6 +1151,18 @@ short_name = "fuz", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "libfuzzer", + "asan", + "clang_tot", + "release", + "chrome_with_codecs", + "pdf_xfa", + "disable_nacl", + "minimal_symbols", + ], + ), ) ci.builder( @@ -906,6 +1193,15 @@ short_name = "pgo-arm", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "official_optimize", + "no_symbols", + "pgo_phase_1", + "arm64", + ], + ), ) ci.builder( @@ -917,6 +1213,14 @@ short_name = "win", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "use_clang_coverage", + "minimal_symbols", + "release", + ], + ), ) ci.builder( @@ -940,6 +1244,14 @@ short_name = "pgo", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "official_optimize", + "no_symbols", + "pgo_phase_1", + ], + ), ) ci.builder( @@ -966,6 +1278,16 @@ short_name = "lxw", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "win_cross", + "minimal_symbols", + "shared", + "release", + "dcheck_always_on", + ], + ), ) ci.builder( @@ -996,6 +1318,16 @@ short_name = "sim", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "ios_simulator", + "x64", + "ios_disable_code_signing", + "release_builder", + "xctest", + ], + ), xcode = xcode.x14main, ) @@ -1027,6 +1359,16 @@ short_name = "dev", ), contact_team_email = "lexan@google.com", + gn_args = gn_args.config( + configs = [ + "clang_tot", + "ios_device", + "arm64", + "release", + "ios_chromium_cert", + "xctest", + ], + ), xcode = xcode.x14main, ) @@ -1050,6 +1392,14 @@ short_name = "rel", ), execution_timeout = 20 * time.hour, + gn_args = gn_args.config( + configs = [ + "clang_tot", + "minimal_symbols", + "shared", + "release", + ], + ), ) clang_mac_builder( @@ -1072,6 +1422,13 @@ short_name = "dbg", ), execution_timeout = 20 * time.hour, + gn_args = gn_args.config( + configs = [ + "clang_tot", + "shared", + "debug", + ], + ), ) clang_mac_builder( @@ -1094,6 +1451,15 @@ short_name = "asn", ), execution_timeout = 20 * time.hour, + gn_args = gn_args.config( + configs = [ + "asan", + "disable_nacl", + "clang_tot", + "minimal_symbols", + "release_builder", + ], + ), ) clang_mac_builder( @@ -1102,6 +1468,15 @@ category = "ToT Mac", short_name = "pgo", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "official_optimize", + "no_symbols", + "pgo_phase_1", + "x64", + ], + ), ) clang_mac_builder( @@ -1110,6 +1485,15 @@ category = "ToT Mac", short_name = "pgo-arm", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "official_optimize", + "no_symbols", + "pgo_phase_1", + "arm64", + ], + ), ) clang_mac_builder( @@ -1118,6 +1502,14 @@ category = "ToT Mac", short_name = "arm", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "minimal_symbols", + "arm64", + "release", + ], + ), ) clang_mac_builder( @@ -1127,4 +1519,12 @@ category = "ToT Code Coverage", short_name = "mac", ), + gn_args = gn_args.config( + configs = [ + "clang_tot", + "use_clang_coverage", + "minimal_symbols", + "release", + ], + ), )
diff --git a/infra/config/subprojects/chromium/ci/chromium.infra.star b/infra/config/subprojects/chromium/ci/chromium.infra.star index bf5fccf..3ca3ce0 100644 --- a/infra/config/subprojects/chromium/ci/chromium.infra.star +++ b/infra/config/subprojects/chromium/ci/chromium.infra.star
@@ -197,6 +197,11 @@ "cipd_yaml": "third_party/android_sdk/cipd/emulator.yaml", }, { + "sdk_package_name": "emulator", + "cipd_yaml": "third_party/android_sdk/cipd/emulator.yaml", + "sdk_channel": "BETA", + }, + { "sdk_package_name": "platforms;android-34", "cipd_yaml": "third_party/android_sdk/cipd/platforms/android-34.yaml", },
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star b/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star index 4f73bee..93f62be 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star
@@ -271,6 +271,8 @@ experiments = { # go/nplus1shardsproposal "chromium.add_one_test_shard": 10, + # crbug/940930 + "chromium.enable_cleandead": 5, }, gn_args = gn_args.config( configs = [
diff --git a/infra/config/targets/basic_suites.star b/infra/config/targets/basic_suites.star index da93202..afc6f46 100644 --- a/infra/config/targets/basic_suites.star +++ b/infra/config/targets/basic_suites.star
@@ -5115,7 +5115,7 @@ ], ), ), - "webdriver_tests_suite": targets.legacy_test_config( + "webdriver_wpt_tests": targets.legacy_test_config( test = "chrome_wpt_tests", results_handler = "layout tests", mixins = [ @@ -6585,7 +6585,7 @@ targets.legacy_basic_suite( name = "wpt_web_tests", tests = { - "wpt_tests_suite": targets.legacy_test_config( + "chrome_wpt_tests": targets.legacy_test_config( test = "chrome_wpt_tests", results_handler = "layout tests", args = [
diff --git a/infra/config/targets/cros-skylab-variants.json b/infra/config/targets/cros-skylab-variants.json index 187e2e42..e9eaa54 100644 --- a/infra/config/targets/cros-skylab-variants.json +++ b/infra/config/targets/cros-skylab-variants.json
@@ -19,8 +19,8 @@ "CROS_BRYA_RELEASE_DEV": { "skylab": { "cros_board": "brya", - "cros_chrome_version": "119.0.6045.16", - "cros_img": "brya-release/R119-15633.10.0", + "cros_chrome_version": "120.0.6099.8", + "cros_img": "brya-release/R120-15662.4.0", "dut_pool": "chrome" }, "enabled": true, @@ -29,8 +29,8 @@ "CROS_BRYA_RELEASE_BETA": { "skylab": { "cros_board": "brya", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "brya-release/R118-15604.42.0", + "cros_chrome_version": "119.0.6045.116", + "cros_img": "brya-release/R119-15633.37.0", "dut_pool": "chrome" }, "enabled": true, @@ -39,8 +39,8 @@ "CROS_BRYA_RELEASE_STABLE": { "skylab": { "cros_board": "brya", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "brya-release/R117-15572.63.2", + "cros_chrome_version": "118.0.5993.124", + "cros_img": "brya-release/R118-15604.57.0", "dut_pool": "chrome" }, "enabled": true, @@ -57,8 +57,8 @@ "CROS_DEDEDE_RELEASE_DEV": { "skylab": { "cros_board": "dedede", - "cros_chrome_version": "119.0.6045.16", - "cros_img": "dedede-release/R119-15633.10.0" + "cros_chrome_version": "120.0.6085.0", + "cros_img": "dedede-release/R120-15656.0.0" }, "enabled": true, "identifier": "DEDEDE_RELEASE_DEV" @@ -66,8 +66,8 @@ "CROS_DEDEDE_RELEASE_BETA": { "skylab": { "cros_board": "dedede", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "dedede-release/R118-15604.42.0" + "cros_chrome_version": "119.0.6045.116", + "cros_img": "dedede-release/R119-15633.37.0" }, "enabled": true, "identifier": "DEDEDE_RELEASE_BETA" @@ -75,8 +75,8 @@ "CROS_DEDEDE_RELEASE_STABLE": { "skylab": { "cros_board": "dedede", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "dedede-release/R117-15572.63.0" + "cros_chrome_version": "118.0.5993.124", + "cros_img": "dedede-release/R118-15604.57.0" }, "enabled": true, "identifier": "DEDEDE_RELEASE_STABLE" @@ -93,8 +93,8 @@ "CROS_FIZZ_RELEASE_DEV": { "skylab": { "cros_board": "fizz", - "cros_chrome_version": "119.0.6045.16", - "cros_img": "fizz-release/R119-15633.10.0", + "cros_chrome_version": "120.0.6099.8", + "cros_img": "fizz-release/R120-15662.4.0", "dut_pool": "chrome" }, "enabled": true, @@ -103,8 +103,8 @@ "CROS_FIZZ_RELEASE_BETA": { "skylab": { "cros_board": "fizz", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "fizz-release/R118-15604.42.0", + "cros_chrome_version": "119.0.6045.116", + "cros_img": "fizz-release/R119-15633.37.0", "dut_pool": "chrome" }, "enabled": true, @@ -113,8 +113,8 @@ "CROS_FIZZ_RELEASE_STABLE": { "skylab": { "cros_board": "fizz", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "fizz-release/R117-15572.63.0", + "cros_chrome_version": "118.0.5993.123", + "cros_img": "fizz-release/R118-15604.56.0", "dut_pool": "chrome" }, "enabled": true, @@ -132,8 +132,8 @@ "CROS_GUYBRUSH_RELEASE_DEV": { "skylab": { "cros_board": "guybrush", - "cros_chrome_version": "119.0.6024.0", - "cros_img": "guybrush-release/R119-15626.0.0", + "cros_chrome_version": "120.0.6099.8", + "cros_img": "guybrush-release/R120-15662.4.0", "dut_pool": "chrome" }, "enabled": true, @@ -142,8 +142,8 @@ "CROS_GUYBRUSH_RELEASE_BETA": { "skylab": { "cros_board": "guybrush", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "guybrush-release/R118-15604.42.0", + "cros_chrome_version": "119.0.6045.116", + "cros_img": "guybrush-release/R119-15633.37.0", "dut_pool": "chrome" }, "enabled": true, @@ -152,8 +152,8 @@ "CROS_GUYBRUSH_RELEASE_STABLE": { "skylab": { "cros_board": "guybrush", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "guybrush-release/R117-15572.63.0", + "cros_chrome_version": "118.0.5993.124", + "cros_img": "guybrush-release/R118-15604.57.0", "dut_pool": "chrome" }, "enabled": true, @@ -171,8 +171,8 @@ "CROS_PUFF_RELEASE_DEV": { "skylab": { "cros_board": "puff", - "cros_chrome_version": "119.0.6045.16", - "cros_img": "puff-release/R119-15633.10.0", + "cros_chrome_version": "120.0.6099.8", + "cros_img": "puff-release/R120-15662.4.0", "dut_pool": "chrome" }, "enabled": true, @@ -181,8 +181,8 @@ "CROS_PUFF_RELEASE_BETA": { "skylab": { "cros_board": "puff", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "puff-release/R118-15604.42.0", + "cros_chrome_version": "119.0.6045.116", + "cros_img": "puff-release/R119-15633.37.0", "dut_pool": "chrome" }, "enabled": true, @@ -191,8 +191,8 @@ "CROS_PUFF_RELEASE_STABLE": { "skylab": { "cros_board": "puff", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "puff-release/R117-15572.63.0", + "cros_chrome_version": "118.0.5993.124", + "cros_img": "puff-release/R118-15604.57.0", "dut_pool": "chrome" }, "enabled": true, @@ -222,8 +222,8 @@ "CROS_HANA_RELEASE_DEV": { "skylab": { "cros_board": "hana", - "cros_chrome_version": "119.0.6045.16", - "cros_img": "hana-release/R119-15633.10.0" + "cros_chrome_version": "120.0.6099.8", + "cros_img": "hana-release/R120-15662.4.0" }, "enabled": true, "identifier": "HANA_RELEASE_DEV" @@ -231,8 +231,8 @@ "CROS_HANA_RELEASE_BETA": { "skylab": { "cros_board": "hana", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "hana-release/R118-15604.42.0" + "cros_chrome_version": "119.0.6045.116", + "cros_img": "hana-release/R119-15633.37.0" }, "enabled": true, "identifier": "HANA_RELEASE_BETA" @@ -240,8 +240,8 @@ "CROS_HANA_RELEASE_STABLE": { "skylab": { "cros_board": "hana", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "hana-release/R117-15572.63.0" + "cros_chrome_version": "118.0.5993.124", + "cros_img": "hana-release/R118-15604.57.0" }, "enabled": true, "identifier": "HANA_RELEASE_STABLE" @@ -257,8 +257,8 @@ "CROS_JACUZZI_RELEASE_DEV": { "skylab": { "cros_board": "jacuzzi", - "cros_chrome_version": "119.0.6045.16", - "cros_img": "jacuzzi-release/R119-15633.10.0" + "cros_chrome_version": "120.0.6099.8", + "cros_img": "jacuzzi-release/R120-15662.4.0" }, "enabled": true, "identifier": "JACUZZI_RELEASE_DEV" @@ -266,8 +266,8 @@ "CROS_JACUZZI_RELEASE_BETA": { "skylab": { "cros_board": "jacuzzi", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "jacuzzi-release/R118-15604.42.0" + "cros_chrome_version": "119.0.6045.116", + "cros_img": "jacuzzi-release/R119-15633.37.0" }, "enabled": true, "identifier": "JACUZZI_RELEASE_BETA" @@ -282,8 +282,8 @@ "CROS_JACUZZI_RELEASE_STABLE": { "skylab": { "cros_board": "jacuzzi", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "jacuzzi-release/R117-15572.63.0" + "cros_chrome_version": "118.0.5993.124", + "cros_img": "jacuzzi-release/R118-15604.57.0" }, "enabled": true, "identifier": "JACUZZI_RELEASE_STABLE" @@ -348,8 +348,8 @@ "CROS_OCTOPUS_RELEASE_DEV": { "skylab": { "cros_board": "octopus", - "cros_chrome_version": "119.0.6045.16", - "cros_img": "octopus-release/R119-15633.10.0" + "cros_chrome_version": "120.0.6099.8", + "cros_img": "octopus-release/R120-15662.4.0" }, "enabled": true, "identifier": "OCTOPUS_RELEASE_DEV" @@ -357,8 +357,8 @@ "CROS_OCTOPUS_RELEASE_BETA": { "skylab": { "cros_board": "octopus", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "octopus-release/R118-15604.42.0" + "cros_chrome_version": "119.0.6045.116", + "cros_img": "octopus-release/R119-15633.37.0" }, "enabled": true, "identifier": "OCTOPUS_RELEASE_BETA" @@ -366,8 +366,8 @@ "CROS_OCTOPUS_RELEASE_STABLE": { "skylab": { "cros_board": "octopus", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "octopus-release/R117-15572.63.0" + "cros_chrome_version": "118.0.5993.124", + "cros_img": "octopus-release/R118-15604.57.0" }, "enabled": true, "identifier": "OCTOPUS_RELEASE_STABLE" @@ -383,8 +383,8 @@ "CROS_STRONGBAD_RELEASE_DEV": { "skylab": { "cros_board": "strongbad", - "cros_chrome_version": "119.0.6045.16", - "cros_img": "strongbad-release/R119-15633.10.0" + "cros_chrome_version": "120.0.6099.8", + "cros_img": "strongbad-release/R120-15662.4.0" }, "enabled": true, "identifier": "strongbad_RELEASE_DEV" @@ -392,8 +392,8 @@ "CROS_STRONGBAD_RELEASE_BETA": { "skylab": { "cros_board": "strongbad", - "cros_chrome_version": "118.0.5993.76", - "cros_img": "strongbad-release/R118-15604.42.0" + "cros_chrome_version": "119.0.6045.116", + "cros_img": "strongbad-release/R119-15633.37.0" }, "enabled": true, "identifier": "STRONGBAD_RELEASE_BETA" @@ -401,8 +401,8 @@ "CROS_STRONGBAD_RELEASE_STABLE": { "skylab": { "cros_board": "strongbad", - "cros_chrome_version": "117.0.5938.157", - "cros_img": "strongbad-release/R117-15572.63.0" + "cros_chrome_version": "118.0.5993.124", + "cros_img": "strongbad-release/R118-15604.57.0" }, "enabled": true, "identifier": "STRONGBAD_RELEASE_STABLE"
diff --git a/infra/config/targets/lacros-version-skew-variants.json b/infra/config/targets/lacros-version-skew-variants.json index 81564be..e53aa0a3d 100644 --- a/infra/config/targets/lacros-version-skew-variants.json +++ b/infra/config/targets/lacros-version-skew-variants.json
@@ -17,16 +17,16 @@ }, "LACROS_VERSION_SKEW_DEV": { "args": [ - "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "identifier": "Lacros version skew testing ash dev", "swarming": { "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ] }
diff --git a/infra/config/targets/targets.star b/infra/config/targets/targets.star index 59fea3e6..39e5172 100644 --- a/infra/config/targets/targets.star +++ b/infra/config/targets/targets.star
@@ -2027,7 +2027,7 @@ targets.generated_script( name = "touch_to_fill_junit_tests", - label = "//chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests", + label = "//chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests", ) targets.compile_target(
diff --git a/internal b/internal index c7418cb..48b0109 160000 --- a/internal +++ b/internal
@@ -1 +1 @@ -Subproject commit c7418cbf4981c8cb53efffc321eb95d7bb648108 +Subproject commit 48b0109464d269d64245a7527afeca3f3a9fed8b
diff --git a/ios/chrome/app/BUILD.gn b/ios/chrome/app/BUILD.gn index f3263fe..8b0fb967 100644 --- a/ios/chrome/app/BUILD.gn +++ b/ios/chrome/app/BUILD.gn
@@ -440,6 +440,7 @@ "//components/component_updater/installer_policies", "//components/crash/core/common", "//components/download/public/background_service:public", + "//components/enterprise/idle", "//components/favicon/core", "//components/favicon_base", "//components/feature_engagement", @@ -479,6 +480,7 @@ "//ios/chrome/browser/default_browser/model:utils", "//ios/chrome/browser/download/model", "//ios/chrome/browser/download/model/background_service:background_service", + "//ios/chrome/browser/enterprise/model/idle", "//ios/chrome/browser/external_files/model", "//ios/chrome/browser/favicon", "//ios/chrome/browser/feature_engagement/model",
diff --git a/ios/chrome/app/DEPS b/ios/chrome/app/DEPS index 9ee3cac..cab2adb 100644 --- a/ios/chrome/app/DEPS +++ b/ios/chrome/app/DEPS
@@ -9,6 +9,7 @@ "+components/crash/core/app", "+components/crash/core/common", "+components/download/public/background_service/background_download_service.h", + "+components/enterprise/idle", "+components/favicon_base", "+components/favicon/core", "+components/feature_engagement",
diff --git a/ios/chrome/app/app_startup_parameters.h b/ios/chrome/app/app_startup_parameters.h index 9c20c63..cc6aac6 100644 --- a/ios/chrome/app/app_startup_parameters.h +++ b/ios/chrome/app/app_startup_parameters.h
@@ -44,6 +44,7 @@ START_LENS_FROM_INTENTS, OPEN_CLEAR_BROWSING_DATA_DIALOG, TAB_OPENING_POST_OPENING_ACTION_COUNT, + ADD_BOOKMARKS, }; class GURL; @@ -73,6 +74,11 @@ @property(nonatomic, assign) std::map<std::string, std::string> externalURLParams; +// The list of inputted URLs to process. These URLs aren't automatically opened. +// Used in the context of Siri shortcuts that allow URL inputs that are not +// meant to be opened in new tabs automatically. +@property(nonatomic, readwrite, strong) NSArray<NSURL*>* inputURLs; + // The mode in which the tab must be opened. Defaults to UNDETERMINED. @property(nonatomic, assign) ApplicationModeForTabOpening applicationMode; // Action to be taken after loading the URL.
diff --git a/ios/chrome/app/app_startup_parameters.mm b/ios/chrome/app/app_startup_parameters.mm index 192a1d4..a0d5631 100644 --- a/ios/chrome/app/app_startup_parameters.mm +++ b/ios/chrome/app/app_startup_parameters.mm
@@ -18,6 +18,7 @@ } @synthesize externalURLParams = _externalURLParams; +@synthesize inputURLs = _inputURLs; @synthesize postOpeningAction = _postOpeningAction; @synthesize applicationMode = _applicationMode; // TODO(crbug.com/1021752): Remove this stub. @@ -122,6 +123,9 @@ case OPEN_CLEAR_BROWSING_DATA_DIALOG: [description appendString:@", should open Clear Browsing Data dialog"]; break; + case ADD_BOOKMARKS: + [description appendString:@", should add bookmarks"]; + break; default: break; }
diff --git a/ios/chrome/app/application_delegate/BUILD.gn b/ios/chrome/app/application_delegate/BUILD.gn index 18b60a0d..d0db2cbc 100644 --- a/ios/chrome/app/application_delegate/BUILD.gn +++ b/ios/chrome/app/application_delegate/BUILD.gn
@@ -175,6 +175,7 @@ "//base", "//build:branding_buildflags", "//components/crash/core/common", + "//components/enterprise/idle", "//components/feature_engagement", "//components/metrics", "//components/previous_session_info", @@ -186,6 +187,7 @@ "//ios/chrome/browser/crash_report/model", "//ios/chrome/browser/default_browser/model:utils", "//ios/chrome/browser/device_sharing", + "//ios/chrome/browser/enterprise/model/idle", "//ios/chrome/browser/feature_engagement/model", "//ios/chrome/browser/geolocation/model", "//ios/chrome/browser/metrics",
diff --git a/ios/chrome/app/application_delegate/app_state.mm b/ios/chrome/app/application_delegate/app_state.mm index 857b265..aeacb43 100644 --- a/ios/chrome/app/application_delegate/app_state.mm +++ b/ios/chrome/app/application_delegate/app_state.mm
@@ -16,6 +16,7 @@ #import "base/metrics/histogram_macros.h" #import "base/notreached.h" #import "base/task/bind_post_task.h" +#import "components/enterprise/idle/idle_features.h" #import "components/feature_engagement/public/event_constants.h" #import "components/feature_engagement/public/tracker.h" #import "components/metrics/metrics_service.h" @@ -31,6 +32,7 @@ #import "ios/chrome/browser/crash_report/model/crash_loop_detection_util.h" #import "ios/chrome/browser/crash_report/model/features.h" #import "ios/chrome/browser/device_sharing/device_sharing_manager.h" +#import "ios/chrome/browser/enterprise/model/idle/idle_service_factory.h" #import "ios/chrome/browser/feature_engagement/model/tracker_factory.h" #import "ios/chrome/browser/metrics/model/web_state_list_metrics_browser_agent.h" #import "ios/chrome/browser/shared/coordinator/scene/scene_delegate.h" @@ -245,6 +247,15 @@ return; } + // mainBrowserState may be empty in tests e.g. + // `AppStateTest.applicationWillEnterForeground`. + if (self.mainBrowserState && + base::FeatureList::IsEnabled(enterprise_idle::kIdleTimeout)) { + enterprise_idle::IdleServiceFactory::GetForBrowserState( + self.mainBrowserState) + ->OnApplicationWillEnterBackground(); + } + [MetricsMediator applicationDidEnterBackground:[memoryHelper foregroundMemoryWarningCount]]; @@ -319,6 +330,11 @@ if (self.mainBrowserState) { AuthenticationServiceFactory::GetForBrowserState(self.mainBrowserState) ->OnApplicationWillEnterForeground(); + if (base::FeatureList::IsEnabled(enterprise_idle::kIdleTimeout)) { + enterprise_idle::IdleServiceFactory::GetForBrowserState( + self.mainBrowserState) + ->OnApplicationWillEnterForeground(); + } } crash_keys::SetCurrentlyInBackground(false);
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index 9c8bc5e..d776bc2c 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -22,6 +22,7 @@ #import "components/component_updater/installer_policies/optimization_hints_component_installer.h" #import "components/component_updater/installer_policies/safety_tips_component_installer.h" #import "components/component_updater/url_param_filter_remover.h" +#import "components/enterprise/idle/idle_features.h" #import "components/feature_engagement/public/event_constants.h" #import "components/feature_engagement/public/tracker.h" #import "components/metrics/metrics_pref_names.h" @@ -69,6 +70,7 @@ #import "ios/chrome/browser/credential_provider/model/credential_provider_buildflags.h" #import "ios/chrome/browser/default_browser/model/utils.h" #import "ios/chrome/browser/download/model/download_directory_util.h" +#import "ios/chrome/browser/enterprise/model/idle/idle_service_factory.h" #import "ios/chrome/browser/external_files/model/external_file_remover_factory.h" #import "ios/chrome/browser/external_files/model/external_file_remover_impl.h" #import "ios/chrome/browser/feature_engagement/model/tracker_factory.h" @@ -616,6 +618,15 @@ [self scheduleLowPriorityStartupTasks]; + // Run after UI created to avoid trying to update UI before it is available. + // TODO(b/301676922): This should run for all browser states if multiple + // profiles become supported on iOS. + if (base::FeatureList::IsEnabled(enterprise_idle::kIdleTimeout)) { + enterprise_idle::IdleServiceFactory::GetForBrowserState( + self.appState.mainBrowserState) + ->OnApplicationWillEnterForeground(); + } + // Now that everything is properly set up, run the tests. tests_hook::RunTestsIfPresent();
diff --git a/ios/chrome/app/resources/Info.plist b/ios/chrome/app/resources/Info.plist index d4d33dd..f0add28 100644 --- a/ios/chrome/app/resources/Info.plist +++ b/ios/chrome/app/resources/Info.plist
@@ -93,6 +93,7 @@ <string>${CHROMIUM_HANDOFF_ID}</string> <string>${IOS_MOVE_TAB_ACTIVITY_TYPE}</string> <string>NSUserActivityTypeBrowsingWeb</string> + <string>AddBookmarkToChromeIntent</string> <string>OpenInChromeIncognitoIntent</string> <string>OpenInChromeIntent</string> <string>SearchInChromeIntent</string> @@ -188,8 +189,8 @@ <key>KSChannelChromeScheme</key> <string>${CHROMIUM_URL_CHANNEL_SCHEME}</string> <key>NSContactsUsageDescription</key> - <string>IDS_IOS_CONTACTS_USAGE_DESCRIPTION</string> - <key>NSCameraUsageDescription</key> + <string>IDS_IOS_CONTACTS_USAGE_DESCRIPTION</string> + <key>NSCameraUsageDescription</key> <string>IDS_IOS_CAMERA_USAGE_DESCRIPTION</string> <key>NSLocationWhenInUseUsageDescription</key> <string>IDS_IOS_LOCATION_WHEN_IN_USE_USAGE_DESCRIPTION</string>
diff --git a/ios/chrome/app/resources/chrome_localize_strings_config.plist b/ios/chrome/app/resources/chrome_localize_strings_config.plist index 4910e3e..3c49be6 100644 --- a/ios/chrome/app/resources/chrome_localize_strings_config.plist +++ b/ios/chrome/app/resources/chrome_localize_strings_config.plist
@@ -234,6 +234,54 @@ <string>IDS_IOS_INTENTS_MANAGE_PAYMENT_METHODS_TITLE</string> </dict> <dict> + <key>input</key> + <string>IDS_IOS_INTENTS_URL_PARAMETER</string> + <key>output</key> + <string>4AJfPA</string> + </dict> + <dict> + <key>input</key> + <string>IDS_IOS_INTENTS_URL_PARAMETER</string> + <key>output</key> + <string>C8MCpv</string> + </dict> + <dict> + <key>input</key> + <string>IDS_IOS_INTENTS_URL_PARAMETER</string> + <key>output</key> + <string>WNafUz</string> + </dict> + <dict> + <key>input</key> + <string>IDS_IOS_INTENTS_URL_PARAMETER</string> + <key>output</key> + <string>KLnTiq</string> + </dict> + <dict> + <key>input</key> + <string>IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE</string> + <key>output</key> + <string>cOdzlF</string> + </dict> + <dict> + <key>input</key> + <string>IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION</string> + <key>output</key> + <string>O3cebQ</string> + </dict> + <dict> + <key>input</key> + <string>IDS_IOS_INTENTS_ADD_BOOKMARK_PARAMETER_COMBINATION_TITLE</string> + <key>output</key> + <string>EbPDC3</string> + </dict> + <dict> + <key>input</key> + <string>IDS_IOS_INTENTS_ADD_BOOKMARK_PROMPT_DIALOG</string> + <key>output</key> + <string>o9kImZ</string> + </dict> + <dict> <key>output</key> <string>7kOtAx</string> <key>input</key>
diff --git a/ios/chrome/app/strings/ios_chromium_strings.grd b/ios/chrome/app/strings/ios_chromium_strings.grd index 8048b69a..a742ccb 100644 --- a/ios/chrome/app/strings/ios_chromium_strings.grd +++ b/ios/chrome/app/strings/ios_chromium_strings.grd
@@ -391,6 +391,12 @@ <message name="IDS_IOS_INCOGNITO_REAUTH_SETTING_NAME" desc="Name of the Setting to protect Incognito tabs with biometric authentication, e.g. Face ID or Touch ID. [iOS only]"> Lock Incognito Tabs When You Close Chromium </message> + <message name="IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE" desc="Shortcut name to add bookmarks to Chromium [iOS only]."> + Add Bookmarks to Chromium + </message> + <message name="IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION" desc="Shortcut description to add a bookmark to Chromium [iOS only]."> + Adds the inputted URLs to your bookmarks in Chromium. + </message> <message name="IDS_IOS_LOCATION_WHEN_IN_USE_USAGE_DESCRIPTION" desc="Specifies the reason for accessing the user's location information while the app is in use [Length: unlimited] [iOS only]."> Chromium shares your location with sites you allow. </message>
diff --git a/ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION.png.sha1 b/ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..ae189a7 --- /dev/null +++ b/ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +e514068dae7562241451c9d718adfb2e0d2f7de3 \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE.png.sha1 b/ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE.png.sha1 new file mode 100644 index 0000000..81038a2 --- /dev/null +++ b/ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE.png.sha1
@@ -0,0 +1 @@ +451d8034caf8259cc15efb31d02e86ba631aadd4 \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_google_chrome_strings.grd b/ios/chrome/app/strings/ios_google_chrome_strings.grd index 8193807..c3acdb99 100644 --- a/ios/chrome/app/strings/ios_google_chrome_strings.grd +++ b/ios/chrome/app/strings/ios_google_chrome_strings.grd
@@ -391,6 +391,12 @@ <message name="IDS_IOS_INCOGNITO_REAUTH_SETTING_NAME" desc="Name of the Setting to protect Incognito tabs with biometric authentication, e.g. Face ID or Touch ID. [iOS only]"> Lock Incognito Tabs When You Close Chrome </message> + <message name="IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE" desc="Shortcut name to add bookmarks to Chrome [iOS only]."> + Add Bookmarks to Chrome + </message> + <message name="IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION" desc="Shortcut description to add a bookmark to Chrome [iOS only]."> + Adds the inputted URLs to your bookmarks in Chrome. + </message> <message name="IDS_IOS_LOCATION_WHEN_IN_USE_USAGE_DESCRIPTION" desc="Specifies the reason for accessing the user's location information while the app is in use [Length: unlimited] [iOS only]."> Chrome shares your location with sites you allow. </message>
diff --git a/ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION.png.sha1 b/ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..ae189a7 --- /dev/null +++ b/ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +e514068dae7562241451c9d718adfb2e0d2f7de3 \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE.png.sha1 b/ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE.png.sha1 new file mode 100644 index 0000000..81038a2 --- /dev/null +++ b/ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_TITLE.png.sha1
@@ -0,0 +1 @@ +451d8034caf8259cc15efb31d02e86ba631aadd4 \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index 1f0cf17a..ea38184 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1643,6 +1643,12 @@ <message name="IDS_IOS_INSPECT_UI_CONSOLE_STOP_LOGGING" desc="The button on the top of the debugging page to stop JavaScript console logging [iOS only]."> Stop Logging </message> + <message name="IDS_IOS_INTENTS_ADD_BOOKMARK_PARAMETER_COMBINATION_TITLE" desc="Apple Shortcuts.app format for displaying the URL input [iOS only]."> + Add ${url} to bookmarks + </message> + <message name="IDS_IOS_INTENTS_ADD_BOOKMARK_PROMPT_DIALOG" desc="Prompt dialog shown or spoken to the user (by Siri) asking them to clarify which URL they'd like to bookmark for the Add Bookmark Shortcut [iOS only]. This is required by iOS, but never actually shown to the user hence why the attached screenshot is empty."> + What URL would you like to bookmark? + </message> <message name="IDS_IOS_INTENTS_OPEN_IN_CHROME_TITLE" desc="Shortcut name to open URL in Chrome [iOS only]."> Open URLs in Chrome </message> @@ -1677,6 +1683,9 @@ user is adding or editing a Search in Chrome shortcut[iOS only]."> Search ${searchPhrase} in Chrome </message> + <message name="IDS_IOS_INTENTS_URL_PARAMETER" desc="The URL the user would like to pass as input parameter to Shortcuts that require a URL as input [iOS only]."> + URL + </message> <message name="IDS_IOS_JAVA_SCRIPT_DIALOG_BLOCKING_BUTTON_TEXT" desc="The text used for the button added to JavaScript dialogs to prevent a page from spamming the user with endless alerts. [Length:27em]"> Suppress Dialogs </message>
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_PARAMETER_COMBINATION_TITLE.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_PARAMETER_COMBINATION_TITLE.png.sha1 new file mode 100644 index 0000000..fdafb63 --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_PARAMETER_COMBINATION_TITLE.png.sha1
@@ -0,0 +1 @@ +cca1ff54aec6519603f28becbf6f16b089d5e1c0 \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_PROMPT_DIALOG.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_PROMPT_DIALOG.png.sha1 new file mode 100644 index 0000000..01efb52c --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_ADD_BOOKMARK_PROMPT_DIALOG.png.sha1
@@ -0,0 +1 @@ +3cabf4dbb6d8fb080e2fbc72efd8c9264ee4c099 \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_URL_PARAMETER.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_URL_PARAMETER.png.sha1 new file mode 100644 index 0000000..20cbdb7 --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INTENTS_URL_PARAMETER.png.sha1
@@ -0,0 +1 @@ +577559606d793fb1552b1bd410bc35f343bdbb91 \ No newline at end of file
diff --git a/ios/chrome/browser/autofill/bottom_sheet/BUILD.gn b/ios/chrome/browser/autofill/bottom_sheet/BUILD.gn index 304f529..29b35975 100644 --- a/ios/chrome/browser/autofill/bottom_sheet/BUILD.gn +++ b/ios/chrome/browser/autofill/bottom_sheet/BUILD.gn
@@ -8,6 +8,9 @@ sources = [ "autofill_bottom_sheet_java_script_feature.h", "autofill_bottom_sheet_java_script_feature.mm", + "autofill_bottom_sheet_observer.h", + "autofill_bottom_sheet_observer_bridge.h", + "autofill_bottom_sheet_observer_bridge.mm", "autofill_bottom_sheet_tab_helper.h", "autofill_bottom_sheet_tab_helper.mm", ] @@ -32,6 +35,17 @@ ] } +source_set("unit_tests") { + testonly = true + sources = [ "autofill_bottom_sheet_observer_bridge_unittest.mm" ] + deps = [ + ":bottom_sheet", + "//components/autofill/ios/form_util", + "//ios/web/public/test/fakes", + "//testing/gtest", + ] +} + optimize_ts("bottom_sheet_ts") { visibility = [ ":bottom_sheet" ]
diff --git a/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer.h b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer.h new file mode 100644 index 0000000..3995c27 --- /dev/null +++ b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer.h
@@ -0,0 +1,30 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_AUTOFILL_BOTTOM_SHEET_AUTOFILL_BOTTOM_SHEET_OBSERVER_H_ +#define IOS_CHROME_BROWSER_AUTOFILL_BOTTOM_SHEET_AUTOFILL_BOTTOM_SHEET_OBSERVER_H_ + +namespace autofill { + +struct FormActivityParams; + +// Interface for observing autofill bottom sheet activity. +class AutofillBottomSheetObserver { + public: + AutofillBottomSheetObserver() {} + + AutofillBottomSheetObserver(const AutofillBottomSheetObserver&) = delete; + AutofillBottomSheetObserver& operator=(const AutofillBottomSheetObserver&) = + delete; + + virtual ~AutofillBottomSheetObserver() {} + + // Called when the payments bottom sheet is about to be shown. Sends the + // params used to open the payments bottom sheet. + virtual void WillShowPaymentsBottomSheet(const FormActivityParams& params) {} +}; + +} // namespace autofill + +#endif // IOS_CHROME_BROWSER_AUTOFILL_BOTTOM_SHEET_AUTOFILL_BOTTOM_SHEET_OBSERVER_H_
diff --git a/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.h b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.h new file mode 100644 index 0000000..a5e2053 --- /dev/null +++ b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.h
@@ -0,0 +1,47 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_AUTOFILL_BOTTOM_SHEET_AUTOFILL_BOTTOM_SHEET_OBSERVER_BRIDGE_H_ +#define IOS_CHROME_BROWSER_AUTOFILL_BOTTOM_SHEET_AUTOFILL_BOTTOM_SHEET_OBSERVER_BRIDGE_H_ + +#import <Foundation/Foundation.h> + +#import "base/scoped_observation.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.h" + +@protocol AutofillBottomSheetObserving <NSObject> +@optional +// Invoked by AutofillBottomSheetObserverBridge::WillShowPaymentsBottomSheet. +- (void)willShowPaymentsBottomSheetWithParams: + (const autofill::FormActivityParams&)params; + +@end + +namespace autofill { + +// Use this class to be notified of the autofill bottom sheet activity in an +// Objective-C class. Implement the AutofillBottomSheetObserving protocol and +// create a AutofillBottomSheetObserverBridge passing self and +// AutofillBottomSheetTabHelper. +class AutofillBottomSheetObserverBridge : public AutofillBottomSheetObserver { + public: + // `owner` will not be retained. + AutofillBottomSheetObserverBridge(id<AutofillBottomSheetObserving> owner, + AutofillBottomSheetTabHelper* helper); + ~AutofillBottomSheetObserverBridge() override; + + // AutofillBottomSheetObserver overrides: + void WillShowPaymentsBottomSheet(const FormActivityParams& params) override; + + private: + __weak id<AutofillBottomSheetObserving> owner_ = nil; + base::ScopedObservation<AutofillBottomSheetTabHelper, + AutofillBottomSheetObserver> + scoped_observation_{this}; +}; + +} // namespace autofill + +#endif // IOS_CHROME_BROWSER_AUTOFILL_BOTTOM_SHEET_AUTOFILL_BOTTOM_SHEET_OBSERVER_BRIDGE_H_
diff --git a/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.mm b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.mm new file mode 100644 index 0000000..4de317e3 --- /dev/null +++ b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.mm
@@ -0,0 +1,22 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.h" + +namespace autofill { +AutofillBottomSheetObserverBridge::AutofillBottomSheetObserverBridge( + id<AutofillBottomSheetObserving> owner, + AutofillBottomSheetTabHelper* helper) + : owner_(owner) { + scoped_observation_.Observe(helper); +} + +AutofillBottomSheetObserverBridge::~AutofillBottomSheetObserverBridge() = + default; + +void AutofillBottomSheetObserverBridge::WillShowPaymentsBottomSheet( + const FormActivityParams& params) { + [owner_ willShowPaymentsBottomSheetWithParams:params]; +} +} // namespace autofill
diff --git a/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge_unittest.mm b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge_unittest.mm new file mode 100644 index 0000000..f5e2186 --- /dev/null +++ b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge_unittest.mm
@@ -0,0 +1,85 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.h" + +#import "components/autofill/ios/form_util/form_activity_params.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_java_script_feature.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.h" +#import "ios/web/public/test/fakes/fake_web_frames_manager.h" +#import "ios/web/public/test/fakes/fake_web_state.h" +#import "testing/platform_test.h" + +@interface FakeAutofillBottomSheetObserving + : NSObject <AutofillBottomSheetObserving> + +- (autofill::FormActivityParams)params; + +@end + +@implementation FakeAutofillBottomSheetObserving { + autofill::FormActivityParams _params; +} + +- (autofill::FormActivityParams)params { + return _params; +} + +- (void)willShowPaymentsBottomSheetWithParams: + (const autofill::FormActivityParams&)params { + _params = params; +} + +@end + +// Test fixture to test AutofillBottomSheetObserverBridge class. +class AutofillBottomSheetObserverBridgeTest : public PlatformTest { + protected: + AutofillBottomSheetObserverBridgeTest() { + observer_ = [[FakeAutofillBottomSheetObserving alloc] init]; + + auto frames_manager = std::make_unique<web::FakeWebFramesManager>(); + web::ContentWorld content_world = + AutofillBottomSheetJavaScriptFeature::GetInstance() + ->GetSupportedContentWorld(); + fake_web_state_.SetWebFramesManager(content_world, + std::move(frames_manager)); + + AutofillBottomSheetTabHelper::CreateForWebState(&fake_web_state_, nil); + AutofillBottomSheetTabHelper* helper = + AutofillBottomSheetTabHelper::FromWebState(&fake_web_state_); + + observer_bridge_ = + std::make_unique<autofill::AutofillBottomSheetObserverBridge>(observer_, + helper); + } + web::FakeWebState fake_web_state_; + FakeAutofillBottomSheetObserving* observer_; + std::unique_ptr<autofill::AutofillBottomSheetObserverBridge> observer_bridge_; +}; + +// Tests willShowPaymentsBottomSheetWithParams: forwarding. +TEST_F(AutofillBottomSheetObserverBridgeTest, TestShowPaymentsBottomSheet) { + // Params values are empty. + EXPECT_EQ("", [observer_ params].form_name); + EXPECT_EQ("", [observer_ params].field_type); + EXPECT_EQ("", [observer_ params].type); + + std::string form_name = "form-name"; + std::string field_type = "text"; + std::string type = "focus"; + + autofill::FormActivityParams params; + params.form_name = form_name; + params.field_type = field_type; + params.type = type; + + observer_bridge_->WillShowPaymentsBottomSheet(params); + + // Params values are filled properly. + EXPECT_EQ(form_name, [observer_ params].form_name); + EXPECT_EQ(field_type, [observer_ params].field_type); + EXPECT_EQ(type, [observer_ params].type); +}
diff --git a/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.h b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.h index 6df11fb..463e8522 100644 --- a/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.h +++ b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.h
@@ -14,6 +14,7 @@ #import "ios/web/public/web_state_user_data.h" namespace autofill { +class AutofillBottomSheetObserver; struct FormActivityParams; } // namespace autofill @@ -41,6 +42,10 @@ ~AutofillBottomSheetTabHelper() override; + // Observer registration methods. + void AddObserver(autofill::AutofillBottomSheetObserver* observer); + void RemoveObserver(autofill::AutofillBottomSheetObserver* observer); + // Handler for JavaScript messages. Dispatch to more specific handler. void OnFormMessageReceived(const web::ScriptMessage& message); @@ -147,6 +152,9 @@ std::map<std::string, std::set<autofill::FieldRendererId>> registered_payments_renderer_ids_; + base::ObserverList<autofill::AutofillBottomSheetObserver>::Unchecked + observers_; + WEB_STATE_USER_DATA_KEY_DECL(); };
diff --git a/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.mm b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.mm index 83114e06..d437784 100644 --- a/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.mm +++ b/ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.mm
@@ -16,6 +16,7 @@ #import "components/password_manager/ios/password_account_storage_notice_handler.h" #import "components/prefs/pref_service.h" #import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_java_script_feature.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer.h" #import "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/shared/model/prefs/pref_names.h" #import "ios/chrome/browser/shared/public/commands/autofill_bottom_sheet_commands.h" @@ -69,6 +70,16 @@ commands_handler_ = commands_handler; } +void AutofillBottomSheetTabHelper::AddObserver( + autofill::AutofillBottomSheetObserver* observer) { + observers_.AddObserver(observer); +} + +void AutofillBottomSheetTabHelper::RemoveObserver( + autofill::AutofillBottomSheetObserver* observer) { + observers_.RemoveObserver(observer); +} + void AutofillBottomSheetTabHelper::OnFormMessageReceived( const web::ScriptMessage& message) { autofill::FormActivityParams params; @@ -108,6 +119,9 @@ void AutofillBottomSheetTabHelper::ShowPaymentsBottomSheet( const autofill::FormActivityParams params) { + for (auto& observer : observers_) { + observer.WillShowPaymentsBottomSheet(params); + } [commands_handler_ showPaymentsBottomSheet:params]; }
diff --git a/ios/chrome/browser/browser_state/model/BUILD.gn b/ios/chrome/browser/browser_state/model/BUILD.gn index 26f3aa5..12e0ad5 100644 --- a/ios/chrome/browser/browser_state/model/BUILD.gn +++ b/ios/chrome/browser/browser_state/model/BUILD.gn
@@ -87,6 +87,7 @@ "//ios/chrome/browser/dom_distiller/model", "//ios/chrome/browser/download/model", "//ios/chrome/browser/download/model/background_service", + "//ios/chrome/browser/enterprise/model/idle", "//ios/chrome/browser/favicon", "//ios/chrome/browser/feature_engagement/model", "//ios/chrome/browser/follow:service_factory",
diff --git a/ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.mm b/ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.mm index 5176d9980..b29a7c9d 100644 --- a/ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.mm +++ b/ios/chrome/browser/browser_state/model/browser_state_keyed_service_factories.mm
@@ -27,6 +27,7 @@ #import "ios/chrome/browser/dom_distiller/model/dom_distiller_service_factory.h" #import "ios/chrome/browser/download/model/background_service/background_download_service_factory.h" #import "ios/chrome/browser/download/model/browser_download_service_factory.h" +#import "ios/chrome/browser/enterprise/model/idle/idle_service_factory.h" #import "ios/chrome/browser/favicon/favicon_service_factory.h" #import "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h" #import "ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.h" @@ -118,6 +119,7 @@ autofill::PersonalDataManagerFactory::GetInstance(); commerce::ShoppingServiceFactory::GetInstance(); dom_distiller::DomDistillerServiceFactory::GetInstance(); + enterprise_idle::IdleServiceFactory::GetInstance(); feature_engagement::TrackerFactory::GetInstance(); ios::AboutSigninInternalsFactory::GetInstance(); ios::AccountBookmarkSyncServiceFactory::GetInstance();
diff --git a/ios/chrome/browser/enterprise/model/idle/BUILD.gn b/ios/chrome/browser/enterprise/model/idle/BUILD.gn new file mode 100644 index 0000000..4f94a68 --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/BUILD.gn
@@ -0,0 +1,49 @@ +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("idle") { + sources = [ + "action_runner.h", + "action_runner_impl.h", + "action_runner_impl.mm", + "idle_service.h", + "idle_service.mm", + "idle_service_factory.h", + "idle_service_factory.mm", + ] + deps = [ + "//base", + "//components/enterprise/idle", + "//components/keyed_service/core", + "//components/keyed_service/ios", + "//components/pref_registry", + "//components/prefs", + "//ios/chrome/browser/shared/model/application_context", + "//ios/chrome/browser/shared/model/browser_state", + ] +} + +source_set("unit_tests") { + testonly = true + sources = [ "idle_service_unittest.mm" ] + deps = [ + ":idle", + "//base", + "//base/test:test_support", + "//components/account_id", + "//components/enterprise", + "//components/enterprise:test_support", + "//components/enterprise/idle", + "//components/policy/core/browser:test_support", + "//components/pref_registry", + "//components/prefs", + "//ios/chrome/browser/prefs/model", + "//ios/chrome/browser/shared/model/browser/test:test_support", + "//ios/chrome/browser/shared/model/browser_state:test_support", + "//ios/chrome/test:test_support", + "//ios/web/public/test", + "//testing/gtest", + "//third_party/ocmock", + ] +}
diff --git a/ios/chrome/browser/enterprise/model/idle/action_runner.h b/ios/chrome/browser/enterprise/model/idle/action_runner.h new file mode 100644 index 0000000..7206224 --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/action_runner.h
@@ -0,0 +1,30 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_ACTION_RUNNER_H_ +#define IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_ACTION_RUNNER_H_ + +namespace enterprise_idle { + +// Runs actions specified by the IdleTimeoutActions policy. Wrapper around +// Action that handles asynchronicity, and runs them in order of priority. +// One per profile. Owned by `IdleService`. +class ActionRunner { + public: + explicit ActionRunner() = default; + virtual ~ActionRunner() = default; + ActionRunner(const ActionRunner&) = delete; + ActionRunner& operator=(const ActionRunner&) = delete; + ActionRunner(ActionRunner&&) = delete; + ActionRunner& operator=(ActionRunner&&) = delete; + + // Runs all the actions, in order of priority. Actions are run sequentially, + // not in parallel. If an action fails for whatever reason, skips the + // remaining actions. + virtual void Run() = 0; +}; + +} // namespace enterprise_idle + +#endif // IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_ACTION_RUNNER_H_
diff --git a/ios/chrome/browser/enterprise/model/idle/action_runner_impl.h b/ios/chrome/browser/enterprise/model/idle/action_runner_impl.h new file mode 100644 index 0000000..7316518a5 --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/action_runner_impl.h
@@ -0,0 +1,22 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_ACTION_RUNNER_IMPL_H_ +#define IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_ACTION_RUNNER_IMPL_H_ + +#import "ios/chrome/browser/enterprise/model/idle/action_runner.h" + +#import "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" + +namespace enterprise_idle { + +class ActionRunnerImpl : public ActionRunner { + public: + ActionRunnerImpl(ChromeBrowserState* chrome_browser_state); + void Run() override; +}; + +} // namespace enterprise_idle + +#endif // IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_ACTION_RUNNER_IMPL_H_
diff --git a/ios/chrome/browser/enterprise/model/idle/action_runner_impl.mm b/ios/chrome/browser/enterprise/model/idle/action_runner_impl.mm new file mode 100644 index 0000000..afeafff --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/action_runner_impl.mm
@@ -0,0 +1,14 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/enterprise/model/idle/action_runner_impl.h" + +namespace enterprise_idle { + +ActionRunnerImpl::ActionRunnerImpl(ChromeBrowserState* chrome_browser_state) {} + +void ActionRunnerImpl::Run() { + // TODO: Implement this function. +} +} // namespace enterprise_idle
diff --git a/ios/chrome/browser/enterprise/model/idle/idle_service.h b/ios/chrome/browser/enterprise/model/idle/idle_service.h new file mode 100644 index 0000000..c9f49bf6 --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/idle_service.h
@@ -0,0 +1,79 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_IDLE_SERVICE_H_ +#define IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_IDLE_SERVICE_H_ + +#import "base/cancelable_callback.h" +#import "base/memory/weak_ptr.h" +#import "base/time/time.h" +#import "components/keyed_service/core/keyed_service.h" +#import "components/prefs/pref_change_registrar.h" +#import "ios/chrome/browser/enterprise/model/idle/action_runner_impl.h" + +class ChromeBrowserState; + +namespace enterprise_idle { + +// Manages the idle state of a profile for the IdleTimeout enterprise +// policy. Keeps track of the policy's value, and triggers actions to run when +// the browser is idle in foreground or on startup. +class IdleService : public KeyedService { + public: + enum class LastState { kIdleOnBackground, kIdleOnForeground }; + + explicit IdleService(ChromeBrowserState* browser_state); + + IdleService(const IdleService&) = delete; + IdleService& operator=(const IdleService&) = delete; + ~IdleService() override; + + // TODO(b/301676922): Move calls to `OnApplicationWillEnterForeground` + // and `OnApplicationWillEnterBackground` to an AppStateObserver. + // Called when the application is foregrounded, which can be after one of + // two cases: + // 1. Cold Start when the browser was not already running + // 2. Warm start when the browser was already running in the background + void OnApplicationWillEnterForeground(); + // Called when the application is backgrounded to cancel the scheduled task. + // This ensure that actions do not run when the app is backgrounded or when + // the screen is locked. + void OnApplicationWillEnterBackground(); + + void SetActionRunnerForTesting(std::unique_ptr<ActionRunner> action_runner); + ActionRunner* GetActionRunnerForTesting(); + + void Shutdown() override; + + private: + // Returns the value of the `kIdleTimeout` pref. + base::TimeDelta GetTimeout() const; + // Called when the IdleTimeout policy changes. + void OnIdleTimeoutPrefChanged(); + // Posts a task that checks whether the browser has been idle for time >= + // `idle_threshold_". + void PostCheckIdleTask(base::TimeDelta time_from_now); + // Checks whether the idle state has been reached. If idle state is reached, + // it calls `RunActionsForState` to run actions. Otherwise, it posts a task to + // check again when the browser might possibly become idle. + void MaybeRunActions(); + // Runs the actions based on `IdleTimeoutActions` and update the UI based on + // the last state the browser was idle in. + void RunActionsForState(LastState last_state); + // Calculates the time to when the browser might become idle. + base::TimeDelta GetPossibleTimeToIdle(); + + void SetLastActiveTime(); + base::Time GetLastActiveTime(); + + ChromeBrowserState* browser_state_; + std::unique_ptr<ActionRunner> action_runner_; + PrefChangeRegistrar pref_change_registrar_; + base::CancelableOnceCallback<void()> cancelable_actions_callback_; + base::WeakPtrFactory<IdleService> weak_factory_{this}; +}; + +} // namespace enterprise_idle + +#endif // IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_IDLE_SERVICE_H_
diff --git a/ios/chrome/browser/enterprise/model/idle/idle_service.mm b/ios/chrome/browser/enterprise/model/idle/idle_service.mm new file mode 100644 index 0000000..ab45e5b --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/idle_service.mm
@@ -0,0 +1,157 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/enterprise/model/idle/idle_service.h" + +#import <UIKit/UIKit.h> + +#import "base/check_is_test.h" +#import "components/enterprise/idle/idle_features.h" +#import "components/enterprise/idle/idle_pref_names.h" +#import "components/prefs/pref_service.h" +#import "ios/chrome/browser/shared/model/application_context/application_context.h" + +namespace enterprise_idle { + +IdleService::IdleService(ChromeBrowserState* browser_state) + : browser_state_(browser_state), + action_runner_(std::make_unique<ActionRunnerImpl>(browser_state_)) { + if (!base::FeatureList::IsEnabled(kIdleTimeout)) { + return; + } + + pref_change_registrar_.Init(browser_state_->GetPrefs()); + pref_change_registrar_.Add( + enterprise_idle::prefs::kIdleTimeout, + base::BindRepeating(&IdleService::OnIdleTimeoutPrefChanged, + base::Unretained(this))); +} + +IdleService::~IdleService() = default; + +void IdleService::Shutdown() { + pref_change_registrar_.RemoveAll(); + action_runner_.reset(); +} + +base::TimeDelta IdleService::GetTimeout() const { + return browser_state_->GetPrefs()->GetTimeDelta( + enterprise_idle::prefs::kIdleTimeout); +} + +void IdleService::OnApplicationWillEnterForeground() { + DCHECK(base::FeatureList::IsEnabled(kIdleTimeout)); + + base::TimeDelta idle_threshold = GetTimeout(); + base::Time last_active_time = GetLastActiveTime(); + base::Time last_idle_time = browser_state_->GetPrefs()->GetTime( + enterprise_idle::prefs::kLastIdleTimestamp); + + // Do nothing when the policy is unset. + if (!idle_threshold.is_positive()) { + return; + } + + // This case will happen the first time the browser runs with the + // `LastActiveTimestamp` pref or if the policy is not set. + if (last_active_time == base::Time()) { + PostCheckIdleTask(idle_threshold); + } + + // There are two cases we want to run the actions: + // 1. If the browser has never been idle, the last idle timestamp will be + // empty, so just check the last active time. + // 2. If the browser has been inactive, and the actions were not + // run while the browser was backgrounded or closed. + // The conditions are separated for readability. + else if (last_idle_time == base::Time() && + (base::Time::Now() - last_active_time) >= idle_threshold) { + RunActionsForState(LastState::kIdleOnBackground); + } else if (last_idle_time != base::Time() && + last_idle_time <= last_active_time + idle_threshold) { + RunActionsForState(LastState::kIdleOnBackground); + } else { + // The browser's last state was: + // 1. active less than `idle_threshold` minutes ago. + // 2. idle and the actions were already run when it was idle. + // Restart the timer as foregrounding is considered new user activity. + PostCheckIdleTask(idle_threshold); + } + + SetLastActiveTime(); +} + +void IdleService::OnApplicationWillEnterBackground() { + // Relying on `OnApplicationWillEnterForeground` to reset the callback + // is not reliable. The old tasks remain leading to unpredictable scheduling + // behaviour. + cancelable_actions_callback_.Cancel(); +} + +void IdleService::OnIdleTimeoutPrefChanged() { + if (GetTimeout().is_positive()) { + MaybeRunActions(); + } else { + // Cancel any outstanding callback if idle timeout is no longer valid. + cancelable_actions_callback_.Cancel(); + } +} + +base::TimeDelta IdleService::GetPossibleTimeToIdle() { + return GetLastActiveTime() - base::Time::Now() + GetTimeout(); +} + +void IdleService::PostCheckIdleTask(base::TimeDelta time_from_now) { + cancelable_actions_callback_.Reset(base::BindOnce( + &IdleService::MaybeRunActions, weak_factory_.GetWeakPtr())); + // Post task to check idle state when it can potentially happen. + base::SequencedTaskRunner::GetCurrentDefault()->PostDelayedTask( + FROM_HERE, cancelable_actions_callback_.callback(), time_from_now); +} + +void IdleService::MaybeRunActions() { + DCHECK(base::FeatureList::IsEnabled(kIdleTimeout)); + base::TimeDelta idle_threshold = GetTimeout(); + base::Time last_active_time = GetLastActiveTime(); + + if ((base::Time::Now() - last_active_time) >= idle_threshold) { + RunActionsForState(LastState::kIdleOnForeground); + return; + } + + PostCheckIdleTask(GetPossibleTimeToIdle()); +} + +void IdleService::RunActionsForState(LastState last_state) { + DCHECK(base::FeatureList::IsEnabled(kIdleTimeout)); + browser_state_->GetPrefs()->SetTime( + enterprise_idle::prefs::kLastIdleTimestamp, base::Time::Now()); + // TODO: Implement the IdleTimeoutActions and UI changes. Show UI if + // action runner will clear data and last state is background. + action_runner_->Run(); + + PostCheckIdleTask(GetTimeout()); +} + +void IdleService::SetLastActiveTime() { + GetApplicationContext()->GetLocalState()->SetTime( + enterprise_idle::prefs::kLastActiveTimestamp, base::Time::Now()); +} + +base::Time IdleService::GetLastActiveTime() { + return GetApplicationContext()->GetLocalState()->GetTime( + enterprise_idle::prefs::kLastActiveTimestamp); +} + +void IdleService::SetActionRunnerForTesting( + std::unique_ptr<ActionRunner> action_runner) { + CHECK_IS_TEST(); + action_runner_ = std::move(action_runner); +} + +ActionRunner* IdleService::GetActionRunnerForTesting() { + return action_runner_.get(); +} + +} // namespace enterprise_idle
diff --git a/ios/chrome/browser/enterprise/model/idle/idle_service_factory.h b/ios/chrome/browser/enterprise/model/idle/idle_service_factory.h new file mode 100644 index 0000000..c14dbc0 --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/idle_service_factory.h
@@ -0,0 +1,42 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_IDLE_SERVICE_FACTORY_H_ +#define IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_IDLE_SERVICE_FACTORY_H_ + +#import "base/no_destructor.h" +#import "components/keyed_service/ios/browser_state_keyed_service_factory.h" +#import "components/pref_registry/pref_registry_syncable.h" +#import "ios/chrome/browser/enterprise/model/idle/idle_service.h" + +namespace enterprise_idle { + +// Singleton that owns all IdleServices and associates them with +// ChromeBrowserState. +class IdleServiceFactory : public BrowserStateKeyedServiceFactory { + public: + IdleServiceFactory(const BrowserStateKeyedServiceFactory&) = delete; + IdleServiceFactory& operator=(const BrowserStateKeyedServiceFactory&) = + delete; + + static IdleService* GetForBrowserState(ChromeBrowserState* browser_state); + static IdleServiceFactory* GetInstance(); + + private: + friend class base::NoDestructor<IdleServiceFactory>; + + IdleServiceFactory(); + ~IdleServiceFactory() override; + + // BrowserStateKeyedServiceFactory implementation. + std::unique_ptr<KeyedService> BuildServiceInstanceFor( + web::BrowserState* context) const override; + + void RegisterBrowserStatePrefs( + user_prefs::PrefRegistrySyncable* registry) override; +}; + +} // namespace enterprise_idle + +#endif // IOS_CHROME_BROWSER_ENTERPRISE_MODEL_IDLE_IDLE_SERVICE_FACTORY_H_
diff --git a/ios/chrome/browser/enterprise/model/idle/idle_service_factory.mm b/ios/chrome/browser/enterprise/model/idle/idle_service_factory.mm new file mode 100644 index 0000000..e4fbae8 --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/idle_service_factory.mm
@@ -0,0 +1,46 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/enterprise/model/idle/idle_service_factory.h" + +#import "components/enterprise/idle/idle_pref_names.h" +#import "components/keyed_service/ios/browser_state_dependency_manager.h" +#import "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" + +namespace enterprise_idle { + +IdleService* IdleServiceFactory::GetForBrowserState( + ChromeBrowserState* browser_state) { + return static_cast<IdleService*>( + GetInstance()->GetServiceForBrowserState(browser_state, true)); +} + +IdleServiceFactory* IdleServiceFactory::GetInstance() { + static base::NoDestructor<IdleServiceFactory> instance; + return instance.get(); +} + +IdleServiceFactory::IdleServiceFactory() + : BrowserStateKeyedServiceFactory( + "IdleService", + BrowserStateDependencyManager::GetInstance()) {} + +IdleServiceFactory::~IdleServiceFactory() = default; + +std::unique_ptr<KeyedService> IdleServiceFactory::BuildServiceInstanceFor( + web::BrowserState* context) const { + return std::make_unique<IdleService>( + ChromeBrowserState::FromBrowserState(context)); +} + +void IdleServiceFactory::RegisterBrowserStatePrefs( + user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterTimeDeltaPref(enterprise_idle::prefs::kIdleTimeout, + base::TimeDelta()); + registry->RegisterListPref(enterprise_idle::prefs::kIdleTimeoutActions); + registry->RegisterTimePref(enterprise_idle::prefs::kLastIdleTimestamp, + base::Time()); +} + +} // namespace enterprise_idle
diff --git a/ios/chrome/browser/enterprise/model/idle/idle_service_unittest.mm b/ios/chrome/browser/enterprise/model/idle/idle_service_unittest.mm new file mode 100644 index 0000000..3d3b59d --- /dev/null +++ b/ios/chrome/browser/enterprise/model/idle/idle_service_unittest.mm
@@ -0,0 +1,253 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/enterprise/model/idle/idle_service.h" +#import "base/test/scoped_feature_list.h" +#import "base/time/time.h" +#import "components/enterprise/idle/idle_features.h" +#import "components/enterprise/idle/idle_pref_names.h" +#import "ios/chrome/browser/enterprise/model/idle/action_runner.h" +#import "ios/chrome/browser/shared/model/browser_state/test_chrome_browser_state.h" +#import "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" +#import "ios/web/public/test/web_task_environment.h" +#import "testing/gmock/include/gmock/gmock.h" +#import "testing/gtest/include/gtest/gtest.h" +#import "testing/platform_test.h" + +using ::testing::_; + +namespace enterprise_idle { + +class ChromeBrowserState; +class ActionRunner; + +// Tests that the idle service schedules tasks and runs actions as expected when +// the browser is starting up, re-foregrounded or already in foreground. Also +// tests that the actions run at the right time when the value of the +// IdleTimeout policy changes. +class IdleTimeoutServiceTest : public PlatformTest { + // Mocks the `Run()` method which is used to check that actions run the + // right time(s) in the tests. + class MockActionRunner : public ActionRunner { + public: + MockActionRunner() {} + MOCK_METHOD(void, Run, (), (override)); + ~MockActionRunner() override {} + }; + + public: + IdleTimeoutServiceTest() = default; + + void SetIdleTimeoutPolicy(base::TimeDelta timeout) { + browser_state_.get()->GetPrefs()->SetTimeDelta(prefs::kIdleTimeout, + timeout); + } + + void SetLastActiveTime(base::Time time) { + local_state_.Get()->SetTime(prefs::kLastActiveTimestamp, time); + } + + base::Time GetLastIdleTime() { + return browser_state_.get()->GetPrefs()->GetTime(prefs::kLastIdleTimestamp); + } + + void InitIdleService() { + idle_service_ = std::make_unique<IdleService>( + browser_state_->GetOriginalChromeBrowserState()); + idle_service_->SetActionRunnerForTesting( + base::WrapUnique(new MockActionRunner())); + action_runner_ = static_cast<MockActionRunner*>( + idle_service_->GetActionRunnerForTesting()); + } + + void SetUp() override { + scoped_feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); + scoped_feature_list_->InitWithFeatures({enterprise_idle::kIdleTimeout}, {}); + TestChromeBrowserState::Builder test_cbs_builder; + browser_state_ = test_cbs_builder.Build(); + } + + void TearDown() override { + idle_service_->Shutdown(); + idle_service_.reset(); + browser_state_.reset(); + base::RunLoop run_loop; + run_loop.RunUntilIdle(); + } + + protected: + web::WebTaskEnvironment task_environment_{ + web::WebTaskEnvironment::Options::DEFAULT, + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + + MockActionRunner* action_runner_; + std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list_; + std::unique_ptr<TestChromeBrowserState> browser_state_; + std::unique_ptr<IdleService> idle_service_; + IOSChromeScopedTestingLocalState local_state_; +}; + +// When policy timeout is set after being unset. +TEST_F(IdleTimeoutServiceTest, IdleTimeoutPrefsSet_OnPolicySet) { + InitIdleService(); + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterForeground(); + task_environment_.FastForwardBy(base::Seconds(30)); + // Shorten timeout and expect immediate call to run actions after pref change. + EXPECT_CALL(*action_runner_, Run()).Times(1); + SetIdleTimeoutPolicy(base::Minutes(1)); + task_environment_.FastForwardBy(base::Seconds(30)); +} + +// When policy timeout is shortened, actions should run right away. +TEST_F(IdleTimeoutServiceTest, IdleTimeoutPrefsSet_OnPolicyChange) { + SetIdleTimeoutPolicy(base::Minutes(3)); + InitIdleService(); + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterForeground(); + + // Shorten timeout and expect immediate call to run actions after pref change. + task_environment_.FastForwardBy(base::Minutes(2)); + EXPECT_CALL(*action_runner_, Run()); + SetIdleTimeoutPolicy(base::Minutes(1)); + + task_environment_.FastForwardBy(base::Seconds(30)); + // Increase the timeout again and make sure actions do not run except on time. + EXPECT_CALL(*action_runner_, Run()).Times(1); + SetIdleTimeoutPolicy(base::Minutes(2)); + task_environment_.FastForwardBy(base::Minutes(1)); +} + +// Start-up Case: last active time and last idle time unset. +TEST_F(IdleTimeoutServiceTest, NoActionsRunOnStartup_FirstRunWithPolicySet) { + SetIdleTimeoutPolicy(base::Minutes(1)); + InitIdleService(); + // No call expected when foregrounded. + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterForeground(); + EXPECT_CALL(*action_runner_, Run()).Times(2); + task_environment_.FastForwardBy(base::Minutes(2)); + EXPECT_EQ(GetLastIdleTime(), base::Time::Now()); +} + +// Start-up Case: current time < last active time + idle threshold. +TEST_F(IdleTimeoutServiceTest, NoActionsRunOnStartup_NoBackgroundTimeout) { + // Sets the last active time to 30s ago. + SetLastActiveTime(base::Time::Now() - base::Seconds(30)); + SetIdleTimeoutPolicy(base::Minutes(1)); + InitIdleService(); + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterForeground(); + EXPECT_CALL(*action_runner_, Run()).Times(2); + task_environment_.FastForwardBy(base::Minutes(2)); +} + +// Start-up Case: base::Time::Now() > last_active_time + idle threshold. +// Last idle time is not set. +TEST_F(IdleTimeoutServiceTest, ActionsRunOnStartup_PostBackgroundTimeout) { + SetLastActiveTime(base::Time::Now() - base::Seconds(90)); + SetIdleTimeoutPolicy(base::Minutes(1)); + InitIdleService(); + EXPECT_CALL(*action_runner_, Run()).Times(1); + idle_service_->OnApplicationWillEnterForeground(); + EXPECT_CALL(*action_runner_, Run()).Times(2); + task_environment_.FastForwardBy(base::Minutes(2)); +} + +// Backgrund then reforeground case: +// base::Time::Now() - last_active_time < idle_threshold. +TEST_F( + IdleTimeoutServiceTest, + NoActionsRunInBackground_NoActionsRunOnReforegroundWithPrevUserActivity) { + SetIdleTimeoutPolicy(base::Minutes(1)); + InitIdleService(); + idle_service_->OnApplicationWillEnterForeground(); + task_environment_.FastForwardBy(base::Seconds(30)); + // Simulate user activity. + SetLastActiveTime(base::Time::Now()); + + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterBackground(); + task_environment_.FastForwardBy(base::Seconds(30)); + + // Idle threshold was not exceeded as idle time = 30s. + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterForeground(); + + // Ensure that idle state is detected after that. + EXPECT_CALL(*action_runner_, Run()).Times(1); + task_environment_.FastForwardBy(base::Minutes(1)); + EXPECT_EQ(GetLastIdleTime(), base::Time::Now()); +} + +// Backgrund then reforeground case: +// last_idle_time > last_active_time + idle_threshold +TEST_F(IdleTimeoutServiceTest, + NoActionsRunInBackground_NoActionsRunOnReforegrounWithPrevTimeout) { + SetIdleTimeoutPolicy(base::Minutes(1)); + InitIdleService(); + idle_service_->OnApplicationWillEnterForeground(); + EXPECT_CALL(*action_runner_, Run()).Times(2); + task_environment_.FastForwardBy(base::Minutes(2)); + EXPECT_EQ(GetLastIdleTime(), base::Time::Now()); + + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterBackground(); + task_environment_.FastForwardBy(base::Minutes(1)); + + // No action run on foreground because run was called last idle time and the + // browser was not active after that. + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterForeground(); + + // Ensure that idle state is detected after that. + EXPECT_CALL(*action_runner_, Run()).Times(1); + task_environment_.FastForwardBy(base::Minutes(1)); +} + +// Backgrund then reforeground case: +// base::Time::Now() - last_active_time > idle_threshold +TEST_F(IdleTimeoutServiceTest, + NoActionsRunInBackground_ActionsRunOnReforeground) { + SetIdleTimeoutPolicy(base::Minutes(1)); + InitIdleService(); + idle_service_->OnApplicationWillEnterForeground(); + task_environment_.FastForwardBy(base::Seconds(30)); + // Simulate user activity. + SetLastActiveTime(base::Time::Now()); + + EXPECT_CALL(*action_runner_, Run()).Times(0); + idle_service_->OnApplicationWillEnterBackground(); + task_environment_.FastForwardBy(base::Seconds(80)); + + EXPECT_CALL(*action_runner_, Run()).Times(1); + idle_service_->OnApplicationWillEnterForeground(); + EXPECT_EQ(GetLastIdleTime(), base::Time::Now()); + + // Ensure that idle state is detected after that. + EXPECT_CALL(*action_runner_, Run()).Times(1); + task_environment_.FastForwardBy(base::Minutes(1)); + EXPECT_EQ(GetLastIdleTime(), base::Time::Now()); +} + +TEST_F(IdleTimeoutServiceTest, ActionsRunAtCorrectTimesWhileForegrounded) { + SetIdleTimeoutPolicy(base::Minutes(3)); + InitIdleService(); + idle_service_->OnApplicationWillEnterForeground(); + + task_environment_.FastForwardBy(base::Seconds(40)); + // Simulate user activity at t=40s. + SetLastActiveTime(base::Time::Now()); + + // At t=3, actions will not run because idle time has not reached 3. + // Should check again and run at t=3:40. + EXPECT_CALL(*action_runner_, Run()).Times(0); + task_environment_.FastForwardBy(base::Minutes(3) - base::Seconds(40)); + + EXPECT_CALL(*action_runner_, Run()).Times(1); + task_environment_.FastForwardBy(base::Seconds(40)); + EXPECT_EQ(GetLastIdleTime(), base::Time::Now()); +} + +} // namespace enterprise_idle
diff --git a/ios/chrome/browser/intents/intents_constants.h b/ios/chrome/browser/intents/intents_constants.h index 3cc6e13..44c0cb4 100644 --- a/ios/chrome/browser/intents/intents_constants.h +++ b/ios/chrome/browser/intents/intents_constants.h
@@ -24,6 +24,8 @@ // Constants for Siri shortcuts. // +// NSUserActivity for Add Bookmark to Chrome intent. +extern NSString* const kSiriShortcutAddBookmarkToChrome; // NSUserActivity for Open in Chrome intent. extern NSString* const kSiriShortcutOpenInChrome; // NSUserActivity for Search in Chrome intent.
diff --git a/ios/chrome/browser/intents/intents_constants.mm b/ios/chrome/browser/intents/intents_constants.mm index 6e7156ed..4482ec52 100644 --- a/ios/chrome/browser/intents/intents_constants.mm +++ b/ios/chrome/browser/intents/intents_constants.mm
@@ -12,6 +12,7 @@ @"OpenLensFromAppIconLongPress"; NSString* const kShortcutLensFromSpotlight = @"OpenLensFromSpotlight"; +NSString* const kSiriShortcutAddBookmarkToChrome = @"AddBookmarkToChromeIntent"; NSString* const kSiriShortcutOpenInChrome = @"OpenInChromeIntent"; NSString* const kSiriShortcutSearchInChrome = @"SearchInChromeIntent"; NSString* const kSiriShortcutOpenInIncognito = @"OpenInChromeIncognitoIntent";
diff --git a/ios/chrome/browser/intents/user_activity_handler.mm b/ios/chrome/browser/intents/user_activity_handler.mm index 2c1d5e6c..9a21e941ec 100644 --- a/ios/chrome/browser/intents/user_activity_handler.mm +++ b/ios/chrome/browser/intents/user_activity_handler.mm
@@ -18,7 +18,6 @@ #import "components/handoff/handoff_utility.h" #import "components/search_engines/template_url_service.h" #import "ios/chrome/app/app_startup_parameters.h" -#import "ios/chrome/browser/intents/intents_constants.h" #import "ios/chrome/app/application_delegate/startup_information.h" #import "ios/chrome/app/application_delegate/tab_opening.h" #import "ios/chrome/app/application_mode.h" @@ -27,6 +26,7 @@ #import "ios/chrome/app/startup/app_launch_metrics.h" #import "ios/chrome/app/startup/chrome_app_startup_parameters.h" #import "ios/chrome/browser/intents/intent_type.h" +#import "ios/chrome/browser/intents/intents_constants.h" #import "ios/chrome/browser/metrics/first_user_action_recorder.h" #import "ios/chrome/browser/policy/policy_util.h" #import "ios/chrome/browser/search_engines/model/template_url_service_factory.h" @@ -40,6 +40,7 @@ #import "ios/chrome/browser/shared/model/web_state_list/web_state_list.h" #import "ios/chrome/browser/url_loading/model/image_search_param_generator.h" #import "ios/chrome/browser/url_loading/model/url_loading_params.h" +#import "ios/chrome/common/intents/AddBookmarkToChromeIntent.h" #import "ios/chrome/common/intents/OpenInChromeIncognitoIntent.h" #import "ios/chrome/common/intents/OpenInChromeIntent.h" #import "ios/chrome/common/intents/SearchInChromeIntent.h" @@ -71,6 +72,7 @@ [activityType isEqualToString:kShortcutQRScanner] || [activityType isEqualToString:kShortcutLensFromAppIconLongPress] || [activityType isEqualToString:kShortcutLensFromSpotlight] || + [activityType isEqualToString:kSiriShortcutAddBookmarkToChrome] || [activityType isEqualToString:kSiriShortcutSearchInChrome] || [activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { return @[ kRegularMode, kIncognitoMode ]; @@ -325,6 +327,25 @@ initStage:initStage]; return YES; + } else if ([userActivity.activityType + isEqualToString:kSiriShortcutAddBookmarkToChrome]) { + base::UmaHistogramEnumeration(kAppLaunchSource, + AppLaunchSource::SIRI_SHORTCUT); + base::RecordAction( + UserMetricsAction("IOSLaunchedByAddBookmarkToChromeIntent")); + + AddBookmarkToChromeIntent* intent = + base::apple::ObjCCastStrict<AddBookmarkToChromeIntent>( + userActivity.interaction.intent); + + if (!intent || !intent.url || intent.url.count == 0) { + return NO; + } + + AppStartupParameters* startupParams = + [self startupParametersForOpeningNewTabWithAction:ADD_BOOKMARKS]; + startupParams.inputURLs = intent.url; + [connectionInformation setStartupParameters:startupParams]; } else if ([userActivity.activityType isEqualToString:kSiriOpenLatestTab]) { base::UmaHistogramEnumeration("IOS.Spotlight.LaunchedIntentType", IntentType::kOpenLatestTab);
diff --git a/ios/chrome/browser/intents/user_activity_handler_unittest.mm b/ios/chrome/browser/intents/user_activity_handler_unittest.mm index a647fd8..4b964c1 100644 --- a/ios/chrome/browser/intents/user_activity_handler_unittest.mm +++ b/ios/chrome/browser/intents/user_activity_handler_unittest.mm
@@ -21,7 +21,6 @@ #import "ios/chrome/app/app_startup_parameters.h" #import "ios/chrome/app/application_delegate/app_state_observer.h" #import "ios/chrome/app/application_delegate/fake_startup_information.h" -#import "ios/chrome/browser/intents/intents_constants.h" #import "ios/chrome/app/application_delegate/mock_tab_opener.h" #import "ios/chrome/app/application_delegate/startup_information.h" #import "ios/chrome/app/application_delegate/tab_opening.h" @@ -30,6 +29,7 @@ #import "ios/chrome/app/spotlight/actions_spotlight_manager.h" #import "ios/chrome/app/spotlight/spotlight_util.h" #import "ios/chrome/browser/flags/chrome_switches.h" +#import "ios/chrome/browser/intents/intents_constants.h" #import "ios/chrome/browser/policy/policy_util.h" #import "ios/chrome/browser/shared/coordinator/scene/connection_information.h" #import "ios/chrome/browser/shared/coordinator/scene/test/fake_connection_information.h" @@ -41,8 +41,10 @@ #import "ios/chrome/browser/shared/model/url/chrome_url_constants.h" #import "ios/chrome/browser/shared/model/web_state_list/web_state_list.h" #import "ios/chrome/browser/shared/model/web_state_list/web_state_opener.h" +#import "ios/chrome/browser/shared/public/commands/bookmarks_commands.h" #import "ios/chrome/browser/shared/public/features/features.h" #import "ios/chrome/browser/url_loading/model/url_loading_params.h" +#import "ios/chrome/common/intents/AddBookmarkToChromeIntent.h" #import "ios/chrome/common/intents/ClearBrowsingDataIntent.h" #import "ios/chrome/common/intents/ManagePasswordsIntent.h" #import "ios/chrome/common/intents/ManagePaymentMethodsIntent.h" @@ -975,6 +977,129 @@ EXPECT_FALSE(getHandleStartupParametersHasBeenCalled()); } +// Tests that Chrome does continue the activity for the Add Bookmarks intent. +TEST_F(UserActivityHandlerTest, ContinueUserActivityBookmarks) { + NSUserActivity* userActivity = [[NSUserActivity alloc] + initWithActivityType:kSiriShortcutAddBookmarkToChrome]; + + AddBookmarkToChromeIntent* intent = [[AddBookmarkToChromeIntent alloc] init]; + NSArray<NSURL*>* URLs = + @[ [[NSURL alloc] initWithString:@"https://google.com"] ]; + intent.url = URLs; + + INInteraction* interaction = [[INInteraction alloc] initWithIntent:intent + response:nil]; + + id mock_user_activity = CreateMockNSUserActivity(userActivity, interaction); + + FakeStartupInformation* fakeStartupInformation = + [[FakeStartupInformation alloc] init]; + FakeConnectionInformation* connectionInformationMock = + [[FakeConnectionInformation alloc] init]; + MockTabOpener* tabOpener = [[MockTabOpener alloc] init]; + + [UserActivityHandler continueUserActivity:mock_user_activity + applicationIsActive:YES + tabOpener:tabOpener + connectionInformation:connectionInformationMock + startupInformation:fakeStartupInformation + browserState:nullptr + initStage:InitStageFinal]; + + EXPECT_EQ(ADD_BOOKMARKS, + [connectionInformationMock startupParameters].postOpeningAction); +} + +// Tests that Chrome does not continue the activity for the Add Bookmarks intent +// due to still being in first run. +TEST_F(UserActivityHandlerTest, ContinueUserActivityBookmarksFailsFirstRun) { + NSUserActivity* userActivity = [[NSUserActivity alloc] + initWithActivityType:@"AddBookmarkToChromeIntent"]; + + NSArray<NSURL*>* URLs = + @[ [[NSURL alloc] initWithString:@"https://google.com"] ]; + AddBookmarkToChromeIntent* intent = [[AddBookmarkToChromeIntent alloc] init]; + intent.url = URLs; + + INInteraction* interaction = [[INInteraction alloc] initWithIntent:intent + response:nil]; + + id mock_user_activity = CreateMockNSUserActivity(userActivity, interaction); + id startupInformationMock = + [OCMockObject niceMockForProtocol:@protocol(StartupInformation)]; + id connectionInformationMock = + [OCMockObject niceMockForProtocol:@protocol(ConnectionInformation)]; + MockTabOpener* tabOpener = [[MockTabOpener alloc] init]; + + BOOL result = + [UserActivityHandler continueUserActivity:mock_user_activity + applicationIsActive:NO + tabOpener:tabOpener + connectionInformation:connectionInformationMock + startupInformation:startupInformationMock + browserState:nullptr + initStage:InitStageFirstRun]; + + EXPECT_FALSE(result); +} + +// Tests that Chrome does not continue the activity if the intent URLs array is +// empty. +TEST_F(UserActivityHandlerTest, + ContinueUserActivityBookmarksFailsURLsArrayEmpty) { + NSUserActivity* userActivity = [[NSUserActivity alloc] + initWithActivityType:@"AddBookmarkToChromeIntent"]; + + NSArray<NSURL*>* URLs = @[]; + AddBookmarkToChromeIntent* intent = [[AddBookmarkToChromeIntent alloc] init]; + intent.url = URLs; + + INInteraction* interaction = [[INInteraction alloc] initWithIntent:intent + response:nil]; + + id mock_user_activity = CreateMockNSUserActivity(userActivity, interaction); + id startupInformationMock = + [OCMockObject niceMockForProtocol:@protocol(StartupInformation)]; + id connectionInformationMock = + [OCMockObject niceMockForProtocol:@protocol(ConnectionInformation)]; + MockTabOpener* tabOpener = [[MockTabOpener alloc] init]; + + BOOL result = + [UserActivityHandler continueUserActivity:mock_user_activity + applicationIsActive:NO + tabOpener:tabOpener + connectionInformation:connectionInformationMock + startupInformation:startupInformationMock + browserState:nullptr + initStage:InitStageFirstRun]; + + EXPECT_FALSE(result); +} + +// Tests that Chrome does not continue the activity if the intent URLs are not +// set for the Add Bookmarks intent. +TEST_F(UserActivityHandlerTest, ContinueUserActivityBookmarksFailsNoURLs) { + NSUserActivity* userActivity = [[NSUserActivity alloc] + initWithActivityType:@"AddBookmarkToChromeIntent"]; + + id startupInformationMock = + [OCMockObject niceMockForProtocol:@protocol(StartupInformation)]; + id connectionInformationMock = + [OCMockObject niceMockForProtocol:@protocol(ConnectionInformation)]; + MockTabOpener* tabOpener = [[MockTabOpener alloc] init]; + + BOOL result = + [UserActivityHandler continueUserActivity:userActivity + applicationIsActive:NO + tabOpener:tabOpener + connectionInformation:connectionInformationMock + startupInformation:startupInformationMock + browserState:nullptr + initStage:InitStageFirstRun]; + + EXPECT_FALSE(result); +} + // Test that Chrome respond to open reading list intent. TEST_F(UserActivityHandlerTest, ContinueUserActivityIntentOpenReadingList) { NSUserActivity* userActivity =
diff --git a/ios/chrome/browser/policy/BUILD.gn b/ios/chrome/browser/policy/BUILD.gn index bcd5382..02ba073a 100644 --- a/ios/chrome/browser/policy/BUILD.gn +++ b/ios/chrome/browser/policy/BUILD.gn
@@ -68,6 +68,7 @@ "//components/commerce/core:pref_names", "//components/component_updater", "//components/enterprise", + "//components/enterprise/idle", "//components/history/core/common", "//components/keyed_service/ios", "//components/metrics",
diff --git a/ios/chrome/browser/policy/configuration_policy_handler_list_factory.mm b/ios/chrome/browser/policy/configuration_policy_handler_list_factory.mm index ec89055..dd64be3 100644 --- a/ios/chrome/browser/policy/configuration_policy_handler_list_factory.mm +++ b/ios/chrome/browser/policy/configuration_policy_handler_list_factory.mm
@@ -16,6 +16,7 @@ #import "components/enterprise/browser/reporting/cloud_reporting_frequency_policy_handler.h" #import "components/enterprise/browser/reporting/cloud_reporting_policy_handler.h" #import "components/enterprise/browser/reporting/common_pref_names.h" +#import "components/enterprise/idle/idle_timeout_policy_handler.h" #import "components/history/core/common/pref_names.h" #import "components/metrics/metrics_pref_names.h" #import "components/password_manager/core/common/password_manager_pref_names.h" @@ -193,5 +194,10 @@ std::make_unique<policy::BooleanDisablingPolicyHandler>( policy::key::kUrlKeyedMetricsAllowed, unified_consent::prefs::kUrlKeyedAnonymizedDataCollectionEnabled))); + handlers->AddHandler( + std::make_unique<enterprise_idle::IdleTimeoutPolicyHandler>()); + handlers->AddHandler( + std::make_unique<enterprise_idle::IdleTimeoutActionsPolicyHandler>( + chrome_schema)); return handlers; }
diff --git a/ios/chrome/browser/shared/coordinator/scene/scene_controller.mm b/ios/chrome/browser/shared/coordinator/scene/scene_controller.mm index d921db0..04efcfe 100644 --- a/ios/chrome/browser/shared/coordinator/scene/scene_controller.mm +++ b/ios/chrome/browser/shared/coordinator/scene/scene_controller.mm
@@ -87,6 +87,7 @@ #import "ios/chrome/browser/shared/model/web_state_list/web_state_list_observer_bridge.h" #import "ios/chrome/browser/shared/model/web_state_list/web_state_opener.h" #import "ios/chrome/browser/shared/public/commands/application_commands.h" +#import "ios/chrome/browser/shared/public/commands/bookmarks_commands.h" #import "ios/chrome/browser/shared/public/commands/browser_commands.h" #import "ios/chrome/browser/shared/public/commands/browser_coordinator_commands.h" #import "ios/chrome/browser/shared/public/commands/browsing_data_commands.h" @@ -2444,6 +2445,10 @@ return ^{ [weakSelf openClearBrowsingDataDialog]; }; + case ADD_BOOKMARKS: + return ^{ + [weakSelf addBookmarks:weakSelf.startupParameters.inputURLs]; + }; default: return nil; } @@ -2591,6 +2596,17 @@ webStateList->ActivateWebStateAt(index); } +- (void)addBookmarks:(NSArray<NSURL*>*)URLs { + if (!self.currentInterface.browser || [URLs count] < 1) { + return; + } + + id<BookmarksCommands> bookmarksCommandsHandler = HandlerForProtocol( + self.currentInterface.browser->GetCommandDispatcher(), BookmarksCommands); + + [bookmarksCommandsHandler bulkCreateBookmarksWithURLs:URLs]; +} + #pragma mark - TabOpening implementation. - (void)dismissModalsAndMaybeOpenSelectedTabInMode: @@ -2672,7 +2688,7 @@ if (currentWebState) { web::NavigationManager* navigation_manager = currentWebState->GetNavigationManager(); - // Check if the current tab is in the procress of restoration and whether it + // Check if the current tab is in the process of restoration and whether it // is an NTP. If so, add the tabs-opening action to the // RestoreCompletionCallback queue so that the tabs are opened only after // the NTP finishes restoring. This is to avoid an edge where multiple tabs
diff --git a/ios/chrome/browser/shared/model/prefs/BUILD.gn b/ios/chrome/browser/shared/model/prefs/BUILD.gn index 650ec12..1deb5c9 100644 --- a/ios/chrome/browser/shared/model/prefs/BUILD.gn +++ b/ios/chrome/browser/shared/model/prefs/BUILD.gn
@@ -39,6 +39,7 @@ "//components/content_settings/core/browser", "//components/dom_distiller/core", "//components/enterprise", + "//components/enterprise/idle", "//components/feed/core/v2/public/ios:feed_ios_public", "//components/flags_ui", "//components/gcm_driver",
diff --git a/ios/chrome/browser/shared/model/prefs/browser_prefs.mm b/ios/chrome/browser/shared/model/prefs/browser_prefs.mm index f15f122..48fddd9 100644 --- a/ios/chrome/browser/shared/model/prefs/browser_prefs.mm +++ b/ios/chrome/browser/shared/model/prefs/browser_prefs.mm
@@ -20,6 +20,7 @@ #import "components/content_settings/core/browser/host_content_settings_map.h" #import "components/dom_distiller/core/distilled_page_prefs.h" #import "components/enterprise/browser/reporting/common_pref_names.h" +#import "components/enterprise/idle/idle_pref_names.h" #import "components/feed/core/v2/public/ios/pref_names.h" #import "components/flags_ui/pref_service_flags_storage.h" #import "components/handoff/handoff_manager.h" @@ -310,6 +311,8 @@ registry->RegisterDictionaryPref(prefs::kOverflowMenuDestinationUsageHistory, PrefRegistry::LOSSY_PREF); + registry->RegisterTimePref(enterprise_idle::prefs::kLastActiveTimestamp, + base::Time(), PrefRegistry::LOSSY_PREF); registry->RegisterListPref(prefs::kOverflowMenuNewDestinations, PrefRegistry::LOSSY_PREF); registry->RegisterListPref(prefs::kOverflowMenuDestinationsOrder);
diff --git a/ios/chrome/browser/ui/authentication/signin/signin_coordinator_egtest.mm b/ios/chrome/browser/ui/authentication/signin/signin_coordinator_egtest.mm index 65e6264..278777b 100644 --- a/ios/chrome/browser/ui/authentication/signin/signin_coordinator_egtest.mm +++ b/ios/chrome/browser/ui/authentication/signin/signin_coordinator_egtest.mm
@@ -248,7 +248,11 @@ (MAYBE_testSyncOnWhenPassphraseIntroducedAfterSignIn)] || [self isRunningTest:@selector(testAddAccountAutomatically)] || [self isRunningTest:@selector(testCancelFromSyncOffLink)] || - [self isRunningTest:@selector(testSignInOneUser)]) { + [self isRunningTest:@selector(testSignInOneUser)] || + [self + isRunningTest:@selector + (testPrimaryAccountLabelUpdate_ReplaceSyncPromosWithSignInPromosDisabled + )]) { // TODO(crbug.com/1477295): Evaluate if these tests are relevant with // kReplaceSyncPromosWithSignInPromos enabled. config.features_disabled.push_back( @@ -1616,4 +1620,51 @@ // Test no crash. } +// Tests in the sign-in+sync consent dialog, that the primary button title is +// "Add Account" when there is no account, and the title is updated to +// "Yes, I'm In" once the account has been added. +// This test can be removed once `ReplaceSyncPromosWithSignInPromos` flag is +// removed. +// Related to crbug.com/1497272. +- (void) + testPrimaryAccountLabelUpdate_ReplaceSyncPromosWithSignInPromosDisabled { + // "Add Account" button matcher (with title and accessibility identifier). + id<GREYMatcher> addAccountButtonMatcher = grey_allOf( + grey_accessibilityLabel( + l10n_util::GetNSString(IDS_IOS_ACCOUNT_UNIFIED_CONSENT_ADD_ACCOUNT)), + grey_accessibilityID(kAddAccountAccessibilityIdentifier), nil); + // "Yes, I'm In" button matcher (with title and accessibility identifier). + id<GREYMatcher> yesIamInButtonMatcher = grey_allOf( + grey_accessibilityLabel( + l10n_util::GetNSString(IDS_IOS_ACCOUNT_UNIFIED_CONSENT_OK_BUTTON)), + grey_accessibilityID(kConfirmationAccessibilityIdentifier), nil); + [self openSigninFromView:OpenSigninMethodFromSettings tapSettingsLink:NO]; + [ChromeEarlGreyUI waitForAppToIdle]; + // Verify that the "Add Account" button is visible and the "Yes, I'm In" is + // not. + [[EarlGrey selectElementWithMatcher:addAccountButtonMatcher] + assertWithMatcher:grey_sufficientlyVisible()]; + [[EarlGrey selectElementWithMatcher:yesIamInButtonMatcher] + assertWithMatcher:grey_notVisible()]; + // Set up a fake identity to add and sign-in with. + FakeSystemIdentity* fakeIdentity = [FakeSystemIdentity fakeIdentity1]; + [SigninEarlGrey addFakeIdentityForSSOAuthAddAccountFlow:fakeIdentity]; + // Open Add Account screen. + [SigninEarlGreyUI tapAddAccountButton]; + [ChromeEarlGreyUI waitForAppToIdle]; + [[EarlGrey + selectElementWithMatcher:grey_allOf( + grey_accessibilityID( + kFakeAuthAddAccountButtonIdentifier), + grey_sufficientlyVisible(), nil)] + performAction:grey_tap()]; + [ChromeEarlGreyUI waitForAppToIdle]; + // Verify that the "Yes, I'm In" button is visible and the "Add Account" is + // not. + [[EarlGrey selectElementWithMatcher:yesIamInButtonMatcher] + assertWithMatcher:grey_sufficientlyVisible()]; + [[EarlGrey selectElementWithMatcher:addAccountButtonMatcher] + assertWithMatcher:grey_notVisible()]; +} + @end
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory/BUILD.gn b/ios/chrome/browser/ui/autofill/form_input_accessory/BUILD.gn index d53a52c..c05b3d9 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory/BUILD.gn +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/BUILD.gn
@@ -37,6 +37,7 @@ "//ios/chrome/app/strings", "//ios/chrome/browser/autofill:autofill", "//ios/chrome/browser/autofill:autofill_shared", + "//ios/chrome/browser/autofill/bottom_sheet", "//ios/chrome/browser/autofill/manual_fill", "//ios/chrome/browser/default_browser/model:utils", "//ios/chrome/browser/feature_engagement/model", @@ -84,6 +85,7 @@ "//components/autofill/ios/form_util:form_util_feature", "//components/autofill/ios/form_util:test_support", "//ios/chrome/browser/autofill:autofill_shared", + "//ios/chrome/browser/autofill/bottom_sheet", "//ios/chrome/browser/shared/model/browser/test:test_support", "//ios/chrome/browser/shared/model/browser_state:test_support", "//ios/chrome/browser/shared/model/web_state_list",
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.mm b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.mm index a84b5d5..ff1005d9 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator.mm
@@ -17,6 +17,8 @@ #import "components/autofill/ios/form_util/form_activity_observer_bridge.h" #import "components/autofill/ios/form_util/form_activity_params.h" #import "components/password_manager/core/browser/password_counter.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_observer_bridge.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.h" #import "ios/chrome/browser/autofill/form_input_accessory_view_handler.h" #import "ios/chrome/browser/autofill/form_input_suggestions_provider.h" #import "ios/chrome/browser/autofill/form_suggestion_tab_helper.h" @@ -74,7 +76,8 @@ password_manager::PasswordCounter counter_; }; -@interface FormInputAccessoryMediator () <BooleanObserver, +@interface FormInputAccessoryMediator () <AutofillBottomSheetObserving, + BooleanObserver, FormActivityObserver, FormInputAccessoryViewDelegate, CRWWebStateObserver, @@ -145,6 +148,10 @@ std::unique_ptr<autofill::FormActivityObserverBridge> _formActivityObserverBridge; + // Bridge for the AutofillBottomSheetObserver. + std::unique_ptr<autofill::AutofillBottomSheetObserverBridge> + _autofillBottomSheetObserverBridge; + // Whether suggestions have previously been shown. BOOL _suggestionsHaveBeenShown; @@ -193,6 +200,9 @@ _formActivityObserverBridge = std::make_unique<autofill::FormActivityObserverBridge>(_webState, self); + _autofillBottomSheetObserverBridge = + std::make_unique<autofill::AutofillBottomSheetObserverBridge>( + self, AutofillBottomSheetTabHelper::FromWebState(webState)); _webStateObserverBridge = std::make_unique<web::WebStateObserverBridge>(self); webState->AddObserver(_webStateObserverBridge.get()); @@ -251,6 +261,7 @@ - (void)dealloc { // TODO(crbug.com/1454777) DUMP_WILL_BE_CHECK(!_formActivityObserverBridge.get()); + DUMP_WILL_BE_CHECK(!_autofillBottomSheetObserverBridge.get()); DUMP_WILL_BE_CHECK(!_personalDataManager); DUMP_WILL_BE_CHECK(!_webState); DUMP_WILL_BE_CHECK(!_webStateList); @@ -258,6 +269,7 @@ - (void)disconnect { _formActivityObserverBridge.reset(); + _autofillBottomSheetObserverBridge.reset(); if (_personalDataManager && _personalDataManagerObserver.get()) { _personalDataManager->RemoveObserver(_personalDataManagerObserver.get()); _personalDataManagerObserver.reset(); @@ -285,6 +297,7 @@ _webStateObserverBridge.reset(); _webState = nullptr; _formActivityObserverBridge.reset(); + _autofillBottomSheetObserverBridge.reset(); } } @@ -298,6 +311,20 @@ [self updateSuggestionsIfNeeded]; } +#pragma mark - AutofillBottomSheetObserving + +- (void)willShowPaymentsBottomSheetWithParams: + (const autofill::FormActivityParams&)params { + // Update params in this mediator because -keyboardWillShow will be called + // before the bottom sheet is being notified to show and that will call + // -retrieveSuggestionsForForm with the last seen params. Depending on what + // the current page is auto focused on, it could be the incorrect params and + // we need to update it. + _lastSeenParams = params; + _hasLastSeenParams = YES; + [self updateSuggestionsIfNeeded]; +} + #pragma mark - FormActivityObserver - (void)webState:(web::WebState*)webState @@ -519,6 +546,10 @@ webState->AddObserver(_webStateObserverBridge.get()); _formActivityObserverBridge = std::make_unique<autofill::FormActivityObserverBridge>(webState, self); + _autofillBottomSheetObserverBridge = + std::make_unique<autofill::AutofillBottomSheetObserverBridge>( + self, AutofillBottomSheetTabHelper::FromWebState(webState)); + FormSuggestionTabHelper* tabHelper = FormSuggestionTabHelper::FromWebState(webState); if (tabHelper) {
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator_unittest.mm b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator_unittest.mm index 50914c9..f107bab 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator_unittest.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/form_input_accessory_mediator_unittest.mm
@@ -7,6 +7,7 @@ #import "components/autofill/ios/form_util/form_activity_params.h" #import "components/autofill/ios/form_util/form_util_java_script_feature.h" #import "components/autofill/ios/form_util/test_form_activity_tab_helper.h" +#import "ios/chrome/browser/autofill/bottom_sheet/autofill_bottom_sheet_tab_helper.h" #import "ios/chrome/browser/autofill/form_input_suggestions_provider.h" #import "ios/chrome/browser/shared/model/web_state_list/test/fake_web_state_list_delegate.h" #import "ios/chrome/browser/shared/model/web_state_list/web_state_list.h" @@ -58,6 +59,9 @@ test_web_state_->SetNavigationManager( std::make_unique<web::FakeNavigationManager>()); + + AutofillBottomSheetTabHelper::CreateForWebState(test_web_state_.get(), nil); + web_state_list_.InsertWebState(0, std::move(test_web_state_), WebStateList::INSERT_ACTIVATE, WebStateOpener());
diff --git a/ios/chrome/browser/ui/browser_view/BUILD.gn b/ios/chrome/browser/ui/browser_view/BUILD.gn index 594fbae..07d1fdc7 100644 --- a/ios/chrome/browser/ui/browser_view/BUILD.gn +++ b/ios/chrome/browser/ui/browser_view/BUILD.gn
@@ -25,6 +25,7 @@ "//base:i18n", "//components/bookmarks/browser", "//components/commerce/core:shopping_service", + "//components/enterprise/idle", "//components/feature_engagement/public", "//components/image_fetcher/ios", "//components/language/ios/browser",
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm index daaf3264..b62c226 100644 --- a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
@@ -10,6 +10,9 @@ #import "base/ios/ios_util.h" #import "base/strings/sys_string_conversions.h" #import "base/task/sequenced_task_runner.h" +#import "components/enterprise/idle/idle_features.h" +#import "components/enterprise/idle/idle_pref_names.h" +#import "components/prefs/pref_service.h" #import "components/signin/public/identity_manager/identity_manager.h" #import "components/strings/grit/components_strings.h" #import "components/ukm/ios/ukm_url_recorder.h" @@ -21,6 +24,7 @@ #import "ios/chrome/browser/ntp/new_tab_page_tab_helper.h" #import "ios/chrome/browser/ntp/new_tab_page_util.h" #import "ios/chrome/browser/reading_list/model/reading_list_browser_agent.h" +#import "ios/chrome/browser/shared/model/application_context/application_context.h" #import "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/shared/model/url/chrome_url_constants.h" #import "ios/chrome/browser/shared/model/web_state_list/web_state_list.h" @@ -1776,6 +1780,12 @@ _lastTapPoint = [[view superview] convertPoint:viewCoordinate toView:self.view]; _lastTapTime = CACurrentMediaTime(); + if (base::FeatureList::IsEnabled(enterprise_idle::kIdleTimeout)) { + // Last tap timestamp will be consumed by `IdleService` if IdleTimeout + // policy is set. + GetApplicationContext()->GetLocalState()->SetTime( + enterprise_idle::prefs::kLastActiveTimestamp, base::Time::Now()); + } } #pragma mark - ** Protocol Implementations and Helpers **
diff --git a/ios/chrome/browser/ui/settings/signin_settings_egtest.mm b/ios/chrome/browser/ui/settings/signin_settings_egtest.mm index df23f4d..e0ee0b4 100644 --- a/ios/chrome/browser/ui/settings/signin_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/signin_settings_egtest.mm
@@ -66,7 +66,10 @@ [self isRunningTest:@selector (testHistorySyncSkippedIfDeclinedJustBefore)] || [self isRunningTest:@selector(testHistorySyncSkippedIfDeclinedTwice)] || - [self isRunningTest:@selector(testInterruptWhenHistoryOptInShown)]) { + [self isRunningTest:@selector(testInterruptWhenHistoryOptInShown)] || + [self isRunningTest:@selector + (testSigninSecondTimeAfterAddingAccountAgain)] || + [self isRunningTest:@selector(testSigninWithNoAccountOnDevice)]) { config.features_enabled.push_back( syncer::kReplaceSyncPromosWithSignInPromos); } @@ -181,8 +184,110 @@ @"Tabs sync should be enabled."); } +// Tests that history sync opt-in is presented for the following scenario: +// + Add account +// + Sign-in and accept history sync +// + Sign-out +// + Remove account +// + Add same account again +// + Sign-in +// => Expect history sync opt-in dialog. +- (void)testSigninSecondTimeAfterAddingAccountAgain { + FakeSystemIdentity* fakeIdentity = [FakeSystemIdentity fakeIdentity1]; + [SigninEarlGrey addFakeIdentity:fakeIdentity]; + [ChromeEarlGreyUI openSettingsMenu]; + // Tap on sign-in cell. + [[EarlGrey selectElementWithMatcher:SettingsSignInRowMatcher()] + performAction:grey_tap()]; + // Confirm sign in. + [[EarlGrey selectElementWithMatcher: + grey_allOf(grey_accessibilityID( + kWebSigninPrimaryButtonAccessibilityIdentifier), + grey_sufficientlyVisible(), nil)] + performAction:grey_tap()]; + // Accept History Sync. + [[[EarlGrey selectElementWithMatcher: + chrome_test_util::SigninScreenPromoPrimaryButtonMatcher()] + usingSearchAction:chrome_test_util::HistoryOptInScrollDown() + onElementWithMatcher:chrome_test_util::HistoryOptInPromoMatcher()] + performAction:grey_tap()]; + [ChromeEarlGreyUI waitForAppToIdle]; + // Close settings. + [[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsDoneButton()] + performAction:grey_tap()]; + [SigninEarlGreyUI + signOutWithConfirmationChoice:SignOutConfirmationChoiceNotSyncing]; + [ChromeEarlGreyUI openSettingsMenu]; + // Tap on sign-in cell. + [[EarlGrey selectElementWithMatcher:SettingsSignInRowMatcher()] + performAction:grey_tap()]; + // Confirm sign in. + [[EarlGrey selectElementWithMatcher: + grey_allOf(grey_accessibilityID( + kWebSigninPrimaryButtonAccessibilityIdentifier), + grey_sufficientlyVisible(), nil)] + performAction:grey_tap()]; + [ChromeEarlGreyUI waitForAppToIdle]; + // History sync opt-in not visibled. + [[EarlGrey + selectElementWithMatcher:chrome_test_util::HistoryOptInPromoMatcher()] + assertWithMatcher:grey_nil()]; + // Close settings. + [[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsDoneButton()] + performAction:grey_tap()]; + // Verify that the history sync is enabled. + GREYAssertTrue( + [SigninEarlGreyAppInterface + isSelectedTypeEnabled:syncer::UserSelectableType::kHistory], + @"History sync should be enabled."); + GREYAssertTrue([SigninEarlGreyAppInterface + isSelectedTypeEnabled:syncer::UserSelectableType::kTabs], + @"Tabs sync should be enabled."); +} + +// Tests sign-in and accept history sync opt-in from the settings when having +// no account on the device. +- (void)testSigninWithNoAccountOnDevice { + [ChromeEarlGreyUI openSettingsMenu]; + // Tap on sign-in cell. + [[EarlGrey selectElementWithMatcher:SettingsSignInRowMatcher()] + performAction:grey_tap()]; + // Set up a fake identity to add and sign-in with. + FakeSystemIdentity* fakeIdentity = [FakeSystemIdentity fakeIdentity1]; + [SigninEarlGrey addFakeIdentityForSSOAuthAddAccountFlow:fakeIdentity]; + [[EarlGrey + selectElementWithMatcher:grey_allOf( + grey_accessibilityID( + kFakeAuthAddAccountButtonIdentifier), + grey_sufficientlyVisible(), nil)] + performAction:grey_tap()]; + // Make sure the fake SSO view controller is fully removed. + [ChromeEarlGreyUI waitForAppToIdle]; + // Accept History Sync. + [[[EarlGrey selectElementWithMatcher: + chrome_test_util::SigninScreenPromoPrimaryButtonMatcher()] + usingSearchAction:chrome_test_util::HistoryOptInScrollDown() + onElementWithMatcher:chrome_test_util::HistoryOptInPromoMatcher()] + performAction:grey_tap()]; + [ChromeEarlGreyUI waitForAppToIdle]; + // Close settings. + [[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsDoneButton()] + performAction:grey_tap()]; + // Verify that the history sync is enabled. + GREYAssertTrue( + [SigninEarlGreyAppInterface + isSelectedTypeEnabled:syncer::UserSelectableType::kHistory], + @"History sync should be enabled."); + GREYAssertTrue([SigninEarlGreyAppInterface + isSelectedTypeEnabled:syncer::UserSelectableType::kTabs], + @"Tabs sync should be enabled."); +} + // For a signed out user without device accounts, tests that the sign-in row is // shown with the correct strings and opens the dialog to enable sync upon tap. +// kReplaceSyncPromosWithSignInPromos is disabled. This test can be removed +// once the kReplaceSyncPromosWithSignInPromos is removed. +// This test is replace with `testSigninWithNoAccountOnDevice`. - (void)testSigninRowOpensSyncDialogIfSignedOutAndNoDeviceAccounts { [ChromeEarlGreyUI openSettingsMenu];
diff --git a/ios/chrome/common/intents/BUILD.gn b/ios/chrome/common/intents/BUILD.gn index b450ec8..0fedd3e 100644 --- a/ios/chrome/common/intents/BUILD.gn +++ b/ios/chrome/common/intents/BUILD.gn
@@ -7,6 +7,7 @@ intent_definition("intents") { intent_file = "Intents.intentdefinition" intent_names = [ + "AddBookmarkToChromeIntent", "OpenInChromeIncognitoIntent", "OpenInChromeIntent", "SearchInChromeIntent",
diff --git a/ios/chrome/common/intents/Intents.intentdefinition b/ios/chrome/common/intents/Intents.intentdefinition index cc25f8e..a024609 100644 --- a/ios/chrome/common/intents/Intents.intentdefinition +++ b/ios/chrome/common/intents/Intents.intentdefinition
@@ -9,9 +9,9 @@ <key>INIntentDefinitionNamespace</key> <string>Oi5136</string> <key>INIntentDefinitionSystemVersion</key> - <string>22G90</string> + <string>22G120</string> <key>INIntentDefinitionToolsBuildVersion</key> - <string>15A5195m</string> + <string>15A240d</string> <key>INIntentDefinitionToolsVersion</key> <string>15.0</string> <key>INIntents</key> @@ -66,7 +66,7 @@ <key>INIntentParameterPromptDialogCustom</key> <true/> <key>INIntentParameterPromptDialogFormatString</key> - <string>What URL?</string> + <string>What URL would you like to open in Chrome?</string> <key>INIntentParameterPromptDialogFormatStringID</key> <string>3PpdH5</string> <key>INIntentParameterPromptDialogType</key> @@ -265,7 +265,7 @@ <key>INIntentParameterPromptDialogCustom</key> <true/> <key>INIntentParameterPromptDialogFormatString</key> - <string>What URL?</string> + <string>What URL would you like to open in Chrome Incognito?</string> <key>INIntentParameterPromptDialogFormatStringID</key> <string>sNz7Cu</string> <key>INIntentParameterPromptDialogType</key> @@ -309,6 +309,104 @@ </dict> <dict> <key>INIntentCategory</key> + <string>create</string> + <key>INIntentConfigurable</key> + <true/> + <key>INIntentDescriptionID</key> + <string>O3cebQ</string> + <key>INIntentEligibleForWidgets</key> + <true/> + <key>INIntentIneligibleForSuggestions</key> + <true/> + <key>INIntentInput</key> + <string>url</string> + <key>INIntentLastParameterTag</key> + <integer>7</integer> + <key>INIntentManagedParameterCombinations</key> + <dict> + <key>url</key> + <dict> + <key>INIntentParameterCombinationSupportsBackgroundExecution</key> + <true/> + <key>INIntentParameterCombinationTitle</key> + <string>Add ${url} to bookmarks</string> + <key>INIntentParameterCombinationTitleID</key> + <string>EbPDC3</string> + <key>INIntentParameterCombinationUpdatesLinked</key> + <true/> + </dict> + </dict> + <key>INIntentName</key> + <string>AddBookmarkToChrome</string> + <key>INIntentParameters</key> + <array> + <dict> + <key>INIntentParameterConfigurable</key> + <true/> + <key>INIntentParameterDisplayName</key> + <string>URL</string> + <key>INIntentParameterDisplayNameID</key> + <string>WNafUz</string> + <key>INIntentParameterDisplayPriority</key> + <integer>1</integer> + <key>INIntentParameterName</key> + <string>url</string> + <key>INIntentParameterPromptDialogs</key> + <array> + <dict> + <key>INIntentParameterPromptDialogCustom</key> + <true/> + <key>INIntentParameterPromptDialogType</key> + <string>Configuration</string> + </dict> + <dict> + <key>INIntentParameterPromptDialogCustom</key> + <true/> + <key>INIntentParameterPromptDialogFormatString</key> + <string>What URL would you like to bookmark?</string> + <key>INIntentParameterPromptDialogFormatStringID</key> + <string>o9kImZ</string> + <key>INIntentParameterPromptDialogType</key> + <string>Primary</string> + </dict> + </array> + <key>INIntentParameterSupportsMultipleValues</key> + <true/> + <key>INIntentParameterSupportsResolution</key> + <true/> + <key>INIntentParameterTag</key> + <integer>7</integer> + <key>INIntentParameterType</key> + <string>URL</string> + </dict> + </array> + <key>INIntentResponse</key> + <dict> + <key>INIntentResponseCodes</key> + <array> + <dict> + <key>INIntentResponseCodeName</key> + <string>success</string> + <key>INIntentResponseCodeSuccess</key> + <true/> + </dict> + <dict> + <key>INIntentResponseCodeName</key> + <string>failure</string> + </dict> + </array> + </dict> + <key>INIntentTitle</key> + <string>Add Bookmark to Chrome</string> + <key>INIntentTitleID</key> + <string>cOdzlF</string> + <key>INIntentType</key> + <string>Custom</string> + <key>INIntentVerb</key> + <string>Add</string> + </dict> + <dict> + <key>INIntentCategory</key> <string>information</string> <key>INIntentConfigurable</key> <true/>
diff --git a/ios/chrome/intents_extension/appex/Info.plist b/ios/chrome/intents_extension/appex/Info.plist index ba6914e..8bcee10 100644 --- a/ios/chrome/intents_extension/appex/Info.plist +++ b/ios/chrome/intents_extension/appex/Info.plist
@@ -30,6 +30,7 @@ <array/> <key>IntentsSupported</key> <array> + <string>AddBookmarkToChromeIntent</string> <string>OpenInChromeIncognitoIntent</string> <string>OpenInChromeIntent</string> <string>SearchInChromeIntent</string>
diff --git a/ios/chrome/intents_extension/chrome_intents_handler.mm b/ios/chrome/intents_extension/chrome_intents_handler.mm index 4117321..1415dfda 100644 --- a/ios/chrome/intents_extension/chrome_intents_handler.mm +++ b/ios/chrome/intents_extension/chrome_intents_handler.mm
@@ -6,6 +6,7 @@ #import <Foundation/Foundation.h> +#import "ios/chrome/common/intents/AddBookmarkToChromeIntent.h" #import "ios/chrome/common/intents/ClearBrowsingDataIntent.h" #import "ios/chrome/common/intents/ManagePasswordsIntent.h" #import "ios/chrome/common/intents/ManagePaymentMethodsIntent.h" @@ -27,7 +28,8 @@ #import "ios/chrome/common/intents/SetChromeDefaultBrowserIntent.h" #import "ios/chrome/common/intents/ViewHistoryIntent.h" -@interface ChromeIntentsHandler () <OpenInChromeIncognitoIntentHandling, +@interface ChromeIntentsHandler () <AddBookmarkToChromeIntentHandling, + OpenInChromeIncognitoIntentHandling, OpenInChromeIntentHandling, SearchInChromeIntentHandling, OpenReadingListIntentHandling, @@ -55,6 +57,37 @@ return self; } +#pragma mark - AddBookmarkToChromeIntentHandling + +- (void)resolveUrlForAddBookmarkToChrome:(AddBookmarkToChromeIntent*)intent + withCompletion: + (void (^)(NSArray<INURLResolutionResult*>*)) + completion { + NSMutableArray<INURLResolutionResult*>* result = + [NSMutableArray arrayWithCapacity:intent.url.count]; + + for (NSURL* url in intent.url) { + [result addObject:[INURLResolutionResult successWithResolvedURL:url]]; + } + + completion(result); +} + +- (void)handleAddBookmarkToChrome:(AddBookmarkToChromeIntent*)intent + completion:(void (^)(AddBookmarkToChromeIntentResponse*)) + completion { + NSUserActivity* activity = [[NSUserActivity alloc] + initWithActivityType:NSStringFromClass( + [AddBookmarkToChromeIntent class])]; + + AddBookmarkToChromeIntentResponse* response = + [[AddBookmarkToChromeIntentResponse alloc] + initWithCode:AddBookmarkToChromeIntentResponseCodeContinueInApp + userActivity:activity]; + + completion(response); +} + #pragma mark - OpenInChromeIncognitoIntentHandling - (void)resolveUrlForOpenInChromeIncognito:(OpenInChromeIncognitoIntent*)intent
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn index 4fa8691..ca82b4a 100644 --- a/ios/chrome/test/BUILD.gn +++ b/ios/chrome/test/BUILD.gn
@@ -198,6 +198,7 @@ "//ios/chrome/app/startup:unit_tests", "//ios/chrome/browser/app_launcher/model:unit_tests", "//ios/chrome/browser/autofill:unit_tests", + "//ios/chrome/browser/autofill/bottom_sheet:unit_tests", "//ios/chrome/browser/autofill/manual_fill:unit_tests", "//ios/chrome/browser/bookmarks/model:unit_tests", "//ios/chrome/browser/bring_android_tabs/model:unit_tests", @@ -211,6 +212,7 @@ "//ios/chrome/browser/device_sharing:unit_tests", "//ios/chrome/browser/download/model:unit_tests", "//ios/chrome/browser/download/model/background_service:unit_tests", + "//ios/chrome/browser/enterprise/model/idle:unit_tests", "//ios/chrome/browser/favicon:unit_tests", "//ios/chrome/browser/feature_engagement/model:unit_tests", "//ios/chrome/browser/find_in_page/model:unit_tests",
diff --git a/ios/chrome/test/data/policy/pref_mapping/IdleTimeout.json b/ios/chrome/test/data/policy/pref_mapping/IdleTimeout.json index 6279528..74636f53 100644 --- a/ios/chrome/test/data/policy/pref_mapping/IdleTimeout.json +++ b/ios/chrome/test/data/policy/pref_mapping/IdleTimeout.json
@@ -1,5 +1,31 @@ [ - { - "reason_for_missing_test": "The service to register the policy's pref is not implemented yet." - } + { + "os": [ + "ios" + ], + "policy_pref_mapping_tests": [ + { + "policies": { + "IdleTimeout": 10, + "IdleTimeoutActions": [] + }, + "prefs": { + "idle_timeout": { + "value": "600000000" + } + } + }, + { + "policies": { + "IdleTimeout": 0, + "IdleTimeoutActions": [] + }, + "prefs": { + "idle_timeout": { + "value": "60000000" + } + } + } + ] + } ]
diff --git a/ios/chrome/test/data/policy/pref_mapping/IdleTimeoutActions.json b/ios/chrome/test/data/policy/pref_mapping/IdleTimeoutActions.json index 6279528..86c93eb31 100644 --- a/ios/chrome/test/data/policy/pref_mapping/IdleTimeoutActions.json +++ b/ios/chrome/test/data/policy/pref_mapping/IdleTimeoutActions.json
@@ -1,5 +1,21 @@ [ - { - "reason_for_missing_test": "The service to register the policy's pref is not implemented yet." - } + { + "os": [ + "ios" + ], + "policy_pref_mapping_tests": [ + { + "policies": { + "IdleTimeout": 10, + "IdleTimeoutActions": ["clear_cookies_and_other_site_data", + "clear_cached_images_and_files"] + }, + "prefs": { + "idle_timeout_actions": { + "value": [4, 5] + } + } + } + ] + } ]
diff --git a/ios/third_party/earl_grey2/src b/ios/third_party/earl_grey2/src index 2afe6d2..ed56cf1 160000 --- a/ios/third_party/earl_grey2/src +++ b/ios/third_party/earl_grey2/src
@@ -1 +1 @@ -Subproject commit 2afe6d25f15c122be700d7e693cd095f46495a69 +Subproject commit ed56cf15bef0ebd3ffb726897df2ec55d33bdf61
diff --git a/ios_internal b/ios_internal index 44710d0..c6eeaf4 160000 --- a/ios_internal +++ b/ios_internal
@@ -1 +1 @@ -Subproject commit 44710d02e1e10d2013b2e30325cf482aa82afee1 +Subproject commit c6eeaf49b25eceebf916e331e8a243e3f2455ab2
diff --git a/ipc/ipc_channel_mojo_unittest.cc b/ipc/ipc_channel_mojo_unittest.cc index 0074d4a..26a8f4e 100644 --- a/ipc/ipc_channel_mojo_unittest.cc +++ b/ipc/ipc_channel_mojo_unittest.cc
@@ -28,6 +28,7 @@ #include "base/message_loop/message_pump_type.h" #include "base/path_service.h" #include "base/pickle.h" +#include "base/process/process.h" #include "base/run_loop.h" #include "base/synchronization/waitable_event.h" #include "base/task/single_thread_task_runner.h" @@ -53,6 +54,7 @@ #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/lib/validation_errors.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" +#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h" #include "mojo/public/cpp/bindings/urgent_message_scope.h" #include "mojo/public/cpp/system/functions.h" #include "mojo/public/cpp/system/wait.h" @@ -1252,7 +1254,9 @@ void set_driver(IPC::mojom::SimpleTestDriver* driver) { driver_ = driver; } void set_sync_sender(IPC::Sender* sync_sender) { sync_sender_ = sync_sender; } - void WaitForValueRequest() { + void WaitForValueRequest() { Run(); } + + void Run() { run_loop_ = std::make_unique<base::RunLoop>(); run_loop_->Run(); } @@ -1281,6 +1285,32 @@ run_loop_->Quit(); } + // No implementation needed. Only called on an endpoint which never binds its + // receiver. + void BindSync( + mojo::PendingAssociatedReceiver<IPC::mojom::SimpleTestClient> receiver, + BindSyncCallback callback) override { + NOTREACHED(); + } + + void GetReceiverWithQueuedSyncMessage( + GetReceiverWithQueuedSyncMessageCallback callback) override { + // Immediately send back a sync IPC over the new pipe and expect the call to + // be interrupted without a reply. Note that we also reply *before* issuing + // the sync call to allow the main test process to make progress. + mojo::AssociatedRemote<IPC::mojom::SimpleTestClient> remote; + mojo::PendingAssociatedReceiver<IPC::mojom::SimpleTestClient> + queued_receiver; + { + // The nested receiver we send will already know its peer is closed when + // it arrives. + mojo::AssociatedRemote<IPC::mojom::SimpleTestClient> unused; + queued_receiver = unused.BindNewEndpointAndPassReceiver(); + } + std::move(callback).Run(remote.BindNewEndpointAndPassReceiver()); + EXPECT_FALSE(remote->BindSync(std::move(queued_receiver))); + } + // IPC::Listener: bool OnMessageReceived(const IPC::Message& message) override { int32_t response; @@ -1351,6 +1381,99 @@ DestroyProxy(); } +// https://crbug.com/1500485: This test causes problems on Android. +#if BUILDFLAG(IS_ANDROID) +#define MAYBE_SyncAssociatedInterfacePipeError \ + DISABLED_SyncAssociatedInterfacePipeError +#else +#define MAYBE_SyncAssociatedInterfacePipeError SyncAssociatedInterfacePipeError +#endif +TEST_F(IPCChannelProxyMojoTest, MAYBE_SyncAssociatedInterfacePipeError) { + // Regression test for https://crbug.com/1494461. + + Init("SyncAssociatedInterfacePipeError"); + + ListenerWithSyncAssociatedInterface listener; + CreateProxy(&listener); + listener.set_sync_sender(proxy()); + RunProxy(); + + mojo::AssociatedRemote<IPC::mojom::SimpleTestClient> client; + proxy()->GetRemoteAssociatedInterface( + client.BindNewEndpointAndPassReceiver()); + + mojo::AssociatedRemote<IPC::mojom::Terminator> terminator; + proxy()->GetRemoteAssociatedInterface( + terminator.BindNewEndpointAndPassReceiver()); + + // The setup here is to have the client process add a new associated endpoint + // with a sync message queued on it, towards us. As soon as we receive the + // endpoint we close it, but its state (including its inbound sync message + // queue) isn't actually destroyed until the peer is closed too. + // + // Note that the client creates the endpoint rather than us, because client + // endpoints are assigned lower interface IDs and will thus elicit the + // necessary endpoint ordering to trigger https://crbug.com/1494461 below. + { + base::RunLoop loop; + client->GetReceiverWithQueuedSyncMessage(base::BindLambdaForTesting( + [&loop](mojo::PendingAssociatedReceiver<IPC::mojom::SimpleTestClient> + receiver) { loop.Quit(); })); + loop.Run(); + } + + // If https://crbug.com/1494461 is present, it should be hit within this call, + // as soon as client termination signals a local pipe error and marks the + // above endpoint's peer as closed. + EXPECT_FALSE(terminator->Terminate()); + +#if BUILDFLAG(IS_ANDROID) + // NOTE: On Android, the client's forced termination will look like an error, + // but it is not. + WaitForClientShutdown(); +#else + EXPECT_TRUE(WaitForClientShutdown()); +#endif + + DestroyProxy(); +} + +class TerminatorImpl : public IPC::mojom::Terminator { + public: + TerminatorImpl() = default; + ~TerminatorImpl() override = default; + + static void Create( + mojo::PendingAssociatedReceiver<IPC::mojom::Terminator> receiver) { + mojo::MakeSelfOwnedAssociatedReceiver(std::make_unique<TerminatorImpl>(), + std::move(receiver)); + } + + // IPC::mojom::Terminator: + void Terminate(TerminateCallback callback) override { + base::Process::TerminateCurrentProcessImmediately(0); + } +}; + +DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE( + SyncAssociatedInterfacePipeError, + ChannelProxyClient) { + SimpleTestClientImpl client_impl; + CreateProxy(&client_impl); + + // Let the IO thread receive a message to self-terminate this process. This + // is used to forcibly shut down the client on the test's request. Without + // doing this (and doing a clean shutdown instead) the client will clean up + // interfaces and make it impossible to trigger the regression path for + // https://crbug.com/1494461. + proxy()->AddAssociatedInterfaceForIOThread( + base::BindRepeating(&TerminatorImpl::Create)); + + RunProxy(); + client_impl.Run(); + DestroyProxy(); +} + TEST_F(IPCChannelProxyMojoTest, Pause) { // Ensures that pausing a channel elicits the expected behavior when sending // messages, unpausing, sending more messages, and then manually flushing.
diff --git a/ipc/ipc_mojo_bootstrap.cc b/ipc/ipc_mojo_bootstrap.cc index 558f2ea3..360901a 100644 --- a/ipc/ipc_mojo_bootstrap.cc +++ b/ipc/ipc_mojo_bootstrap.cc
@@ -827,13 +827,12 @@ // handle. DCHECK(!endpoint->client()); DCHECK(endpoint->peer_closed()); - MarkClosedAndMaybeRemove(endpoint); + MarkClosed(endpoint); } else { - MarkPeerClosedAndMaybeRemove(endpoint); + MarkPeerClosed(endpoint); } } - - DCHECK(endpoints_.empty()); + endpoints_.clear(); GetMemoryDumpProvider().RemoveController(this); } @@ -878,15 +877,19 @@ base::AutoLock locker(lock_); encountered_error_ = true; + std::vector<uint32_t> endpoints_to_remove; std::vector<scoped_refptr<Endpoint>> endpoints_to_notify; for (auto iter = endpoints_.begin(); iter != endpoints_.end();) { Endpoint* endpoint = iter->second.get(); ++iter; - if (endpoint->client()) + if (endpoint->client()) { endpoints_to_notify.push_back(endpoint); + } - MarkPeerClosedAndMaybeRemove(endpoint); + if (MarkPeerClosed(endpoint)) { + endpoints_to_remove.push_back(endpoint->id()); + } } for (auto& endpoint : endpoints_to_notify) { @@ -895,6 +898,10 @@ if (endpoint->client()) NotifyEndpointOfError(endpoint.get(), false /* force_async */); } + + for (uint32_t id : endpoints_to_remove) { + endpoints_.erase(id); + } } void NotifyEndpointOfError(Endpoint* endpoint, bool force_async) { @@ -933,19 +940,33 @@ NotifyEndpointOfError(endpoint, false /* force_async */); } - void MarkClosedAndMaybeRemove(Endpoint* endpoint) { + // Marks `endpoint` as closed and returns true if and only if its peer was + // also already closed. + bool MarkClosed(Endpoint* endpoint) { lock_.AssertAcquired(); endpoint->set_closed(); - if (endpoint->closed() && endpoint->peer_closed()) - endpoints_.erase(endpoint->id()); + return endpoint->peer_closed(); } - void MarkPeerClosedAndMaybeRemove(Endpoint* endpoint) { + // Marks `endpoint` as having a closed peer and returns true if and only if + // `endpoint` itself was also already closed. + bool MarkPeerClosed(Endpoint* endpoint) { lock_.AssertAcquired(); endpoint->set_peer_closed(); endpoint->SignalSyncMessageEvent(); - if (endpoint->closed() && endpoint->peer_closed()) + return endpoint->closed(); + } + + void MarkClosedAndMaybeRemove(Endpoint* endpoint) { + if (MarkClosed(endpoint)) { endpoints_.erase(endpoint->id()); + } + } + + void MarkPeerClosedAndMaybeRemove(Endpoint* endpoint) { + if (MarkPeerClosed(endpoint)) { + endpoints_.erase(endpoint->id()); + } } Endpoint* FindOrInsertEndpoint(mojo::InterfaceId id, bool* inserted) {
diff --git a/ipc/ipc_test.mojom b/ipc/ipc_test.mojom index 3d22218..f20aaea 100644 --- a/ipc/ipc_test.mojom +++ b/ipc/ipc_test.mojom
@@ -16,9 +16,19 @@ RequestQuit() => (); }; +interface Terminator { + [Sync] Terminate() => (); +}; + interface SimpleTestClient { [Sync] RequestValue() => (int32 value); + + [Sync] + BindSync(pending_associated_receiver<SimpleTestClient> receiver) => (); + + GetReceiverWithQueuedSyncMessage() => + (pending_associated_receiver<SimpleTestClient> receiver); }; interface PingReceiver {
diff --git a/media/base/audio_bus.cc b/media/base/audio_bus.cc index 2e3d7e2..e3428100 100644 --- a/media/base/audio_bus.cc +++ b/media/base/audio_bus.cc
@@ -6,7 +6,6 @@ #include <stddef.h> #include <stdint.h> -#include <string.h> #include <limits> #include <utility> @@ -28,9 +27,9 @@ // We do this by allocating space for potentially more frames than requested. // This method returns the required size for the contiguous memory block // in bytes and outputs the adjusted number of frames via |out_aligned_frames|. -static size_t CalculateMemorySizeInternal(int channels, - int frames, - int* out_aligned_frames) { +static int CalculateMemorySizeInternal(int channels, + int frames, + int* out_aligned_frames) { // Since our internal sample format is float, we can guarantee the alignment // by making the number of frames an integer multiple of // AudioBus::kChannelAlignment / sizeof(float). @@ -64,11 +63,10 @@ ValidateConfig(channels, frames_); int aligned_frames = 0; - size_t size = CalculateMemorySizeInternal(channels, frames, &aligned_frames); + int size = CalculateMemorySizeInternal(channels, frames, &aligned_frames); data_.reset(static_cast<float*>(base::AlignedAlloc( size, AudioBus::kChannelAlignment))); - memset(data_.get(), 0, size); BuildChannelData(channels, aligned_frames, data_.get()); }
diff --git a/net/cert/cert_verifier.cc b/net/cert/cert_verifier.cc index bcc185c..feee793 100644 --- a/net/cert/cert_verifier.cc +++ b/net/cert/cert_verifier.cc
@@ -28,22 +28,21 @@ public: scoped_refptr<net::CertVerifyProc> CreateCertVerifyProc( scoped_refptr<net::CertNetFetcher> cert_net_fetcher, - const CertVerifyProc::ImplParams& impl_params, - const CertVerifyProc::InstanceParams& instance_params) override { + const CertVerifyProcFactory::ImplParams& impl_params) override { #if BUILDFLAG(CHROME_ROOT_STORE_OPTIONAL) if (impl_params.use_chrome_root_store) { return CertVerifyProc::CreateBuiltinWithChromeRootStore( std::move(cert_net_fetcher), impl_params.crl_set, - base::OptionalToPtr(impl_params.root_store_data), instance_params); + base::OptionalToPtr(impl_params.root_store_data)); } #endif #if BUILDFLAG(CHROME_ROOT_STORE_ONLY) return CertVerifyProc::CreateBuiltinWithChromeRootStore( std::move(cert_net_fetcher), impl_params.crl_set, - base::OptionalToPtr(impl_params.root_store_data), instance_params); + base::OptionalToPtr(impl_params.root_store_data)); #elif BUILDFLAG(IS_FUCHSIA) - return CertVerifyProc::CreateBuiltinVerifyProc( - std::move(cert_net_fetcher), impl_params.crl_set, instance_params); + return CertVerifyProc::CreateBuiltinVerifyProc(std::move(cert_net_fetcher), + impl_params.crl_set); #else return CertVerifyProc::CreateSystemVerifyProc(std::move(cert_net_fetcher), impl_params.crl_set); @@ -117,7 +116,7 @@ scoped_refptr<CertNetFetcher> cert_net_fetcher) { auto proc_factory = base::MakeRefCounted<DefaultCertVerifyProcFactory>(); return std::make_unique<MultiThreadedCertVerifier>( - proc_factory->CreateCertVerifyProc(std::move(cert_net_fetcher), {}, {}), + proc_factory->CreateCertVerifyProc(std::move(cert_net_fetcher), {}), proc_factory); } @@ -133,10 +132,14 @@ const CertVerifier::Config& rhs) { return std::tie( lhs.enable_rev_checking, lhs.require_rev_checking_local_anchors, - lhs.enable_sha1_local_anchors, lhs.disable_symantec_enforcement) == + lhs.enable_sha1_local_anchors, lhs.disable_symantec_enforcement, + lhs.additional_trust_anchors, + lhs.additional_untrusted_authorities) == std::tie( rhs.enable_rev_checking, rhs.require_rev_checking_local_anchors, - rhs.enable_sha1_local_anchors, rhs.disable_symantec_enforcement); + rhs.enable_sha1_local_anchors, rhs.disable_symantec_enforcement, + rhs.additional_trust_anchors, + rhs.additional_untrusted_authorities); } bool operator!=(const CertVerifier::Config& lhs,
diff --git a/net/cert/cert_verifier.h b/net/cert/cert_verifier.h index 96b47d0..026ffc8e 100644 --- a/net/cert/cert_verifier.h +++ b/net/cert/cert_verifier.h
@@ -68,6 +68,18 @@ // Disable enforcement of the policies described at // https://security.googleblog.com/2017/09/chromes-plan-to-distrust-symantec.html bool disable_symantec_enforcement = false; + + // Additional trust anchors to consider during path validation. Ordinarily, + // implementations of CertVerifier use trust anchors from the configured + // system store. This is implementation-specific plumbing for passing + // additional anchors through. + CertificateList additional_trust_anchors; + + // Additional temporary certs to consider as intermediates during path + // validation. Ordinarily, implementations of CertVerifier use intermediate + // certs from the configured system store. This is implementation-specific + // plumbing for passing additional intermediates through. + CertificateList additional_untrusted_authorities; }; class Request { @@ -229,8 +241,7 @@ // Update the CertVerifyProc with a new set of parameters. virtual void UpdateVerifyProcData( scoped_refptr<CertNetFetcher> cert_net_fetcher, - const net::CertVerifyProc::ImplParams& impl_params, - const net::CertVerifyProc::InstanceParams& instance_params) = 0; + const net::CertVerifyProcFactory::ImplParams& impl_params) = 0; }; } // namespace net
diff --git a/net/cert/cert_verify_proc.cc b/net/cert/cert_verify_proc.cc index a052bc1..f6c4dac 100644 --- a/net/cert/cert_verify_proc.cc +++ b/net/cert/cert_verify_proc.cc
@@ -368,12 +368,14 @@ return true; } -base::Value::Dict CertVerifyParams(X509Certificate* cert, - const std::string& hostname, - const std::string& ocsp_response, - const std::string& sct_list, - int flags, - CRLSet* crl_set) { +base::Value::Dict CertVerifyParams( + X509Certificate* cert, + const std::string& hostname, + const std::string& ocsp_response, + const std::string& sct_list, + int flags, + CRLSet* crl_set, + const CertificateList& additional_trust_anchors) { base::Value::Dict dict; dict.Set("certificates", NetLogX509CertificateList(cert)); if (!ocsp_response.empty()) { @@ -389,6 +391,19 @@ if (crl_set->IsExpired()) dict.Set("crlset_is_expired", true); + if (!additional_trust_anchors.empty()) { + base::Value::List certs; + for (auto& anchor : additional_trust_anchors) { + std::string pem_encoded; + if (X509Certificate::GetPEMEncodedFromDER( + x509_util::CryptoBufferAsStringPiece(anchor->cert_buffer()), + &pem_encoded)) { + certs.Append(std::move(pem_encoded)); + } + } + dict.Set("additional_trust_anchors", std::move(certs)); + } + return dict; } @@ -414,11 +429,10 @@ // static scoped_refptr<CertVerifyProc> CertVerifyProc::CreateBuiltinVerifyProc( scoped_refptr<CertNetFetcher> cert_net_fetcher, - scoped_refptr<CRLSet> crl_set, - const InstanceParams instance_params) { - return CreateCertVerifyProcBuiltin( - std::move(cert_net_fetcher), std::move(crl_set), - CreateSslSystemTrustStore(), instance_params); + scoped_refptr<CRLSet> crl_set) { + return CreateCertVerifyProcBuiltin(std::move(cert_net_fetcher), + std::move(crl_set), + CreateSslSystemTrustStore()); } #endif @@ -427,15 +441,13 @@ scoped_refptr<CertVerifyProc> CertVerifyProc::CreateBuiltinWithChromeRootStore( scoped_refptr<CertNetFetcher> cert_net_fetcher, scoped_refptr<CRLSet> crl_set, - const ChromeRootStoreData* root_store_data, - const InstanceParams instance_params) { + const ChromeRootStoreData* root_store_data) { std::unique_ptr<TrustStoreChrome> chrome_root = root_store_data ? std::make_unique<TrustStoreChrome>(*root_store_data) : std::make_unique<TrustStoreChrome>(); return CreateCertVerifyProcBuiltin( std::move(cert_net_fetcher), std::move(crl_set), - CreateSslSystemTrustStoreChromeRoot(std::move(chrome_root)), - instance_params); + CreateSslSystemTrustStoreChromeRoot(std::move(chrome_root))); } #endif @@ -451,6 +463,7 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) { CHECK(cert); @@ -458,7 +471,7 @@ net_log.BeginEvent(NetLogEventType::CERT_VERIFY_PROC, [&] { return CertVerifyParams(cert, hostname, ocsp_response, sct_list, flags, - crl_set()); + crl_set(), additional_trust_anchors); }); // CertVerifyProc's contract allows ::VerifyInternal() to wait on File I/O // (such as the Windows registry or smart cards on all platforms) or may re- @@ -473,7 +486,7 @@ verify_result->verified_cert = cert; int rv = VerifyInternal(cert, hostname, ocsp_response, sct_list, flags, - verify_result, net_log); + additional_trust_anchors, verify_result, net_log); CHECK(verify_result->verified_cert); @@ -820,7 +833,7 @@ return validity_duration > base::Days(398); } -CertVerifyProc::ImplParams::ImplParams() { +CertVerifyProcFactory::ImplParams::ImplParams() { crl_set = net::CRLSet::BuiltinCRLSet(); #if BUILDFLAG(CHROME_ROOT_STORE_OPTIONAL) use_chrome_root_store = @@ -828,23 +841,13 @@ #endif } -CertVerifyProc::ImplParams::~ImplParams() = default; +CertVerifyProcFactory::ImplParams::~ImplParams() = default; -CertVerifyProc::ImplParams::ImplParams(const ImplParams&) = default; -CertVerifyProc::ImplParams& CertVerifyProc::ImplParams::operator=( +CertVerifyProcFactory::ImplParams::ImplParams(const ImplParams&) = default; +CertVerifyProcFactory::ImplParams& CertVerifyProcFactory::ImplParams::operator=( const ImplParams& other) = default; -CertVerifyProc::ImplParams::ImplParams(ImplParams&&) = default; -CertVerifyProc::ImplParams& CertVerifyProc::ImplParams::operator=( +CertVerifyProcFactory::ImplParams::ImplParams(ImplParams&&) = default; +CertVerifyProcFactory::ImplParams& CertVerifyProcFactory::ImplParams::operator=( ImplParams&& other) = default; -CertVerifyProc::InstanceParams::InstanceParams() = default; -CertVerifyProc::InstanceParams::~InstanceParams() = default; - -CertVerifyProc::InstanceParams::InstanceParams(const InstanceParams&) = default; -CertVerifyProc::InstanceParams& CertVerifyProc::InstanceParams::operator=( - const InstanceParams& other) = default; -CertVerifyProc::InstanceParams::InstanceParams(InstanceParams&&) = default; -CertVerifyProc::InstanceParams& CertVerifyProc::InstanceParams::operator=( - InstanceParams&& other) = default; - } // namespace net
diff --git a/net/cert/cert_verify_proc.h b/net/cert/cert_verify_proc.h index e4c1e5e..faeff3a 100644 --- a/net/cert/cert_verify_proc.h +++ b/net/cert/cert_verify_proc.h
@@ -69,57 +69,6 @@ VERIFY_FLAGS_LAST = VERIFY_DISABLE_NETWORK_FETCHES }; - // The set factory parameters that are variable over time, but are expected to - // be consistent between multiple verifiers that are created. For example, - // CertNetFetcher is not in this struct as it is expected that different - // verifiers will have different net fetchers. (There is no technical - // restriction against creating different verifiers with different ImplParams, - // structuring the parameters this way just makes some APIs more convenient - // for the common case.) - struct NET_EXPORT ImplParams { - ImplParams(); - ~ImplParams(); - ImplParams(const ImplParams&); - ImplParams& operator=(const ImplParams& other); - ImplParams(ImplParams&&); - ImplParams& operator=(ImplParams&& other); - - scoped_refptr<CRLSet> crl_set; -#if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) - absl::optional<net::ChromeRootStoreData> root_store_data; -#endif -#if BUILDFLAG(CHROME_ROOT_STORE_OPTIONAL) - bool use_chrome_root_store; -#endif - }; - - // The set of parameters that are variable over time and can differ between - // different verifiers created by a CertVerifierProcFactory. - struct NET_EXPORT InstanceParams { - InstanceParams(); - ~InstanceParams(); - InstanceParams(const InstanceParams&); - InstanceParams& operator=(const InstanceParams& other); - InstanceParams(InstanceParams&&); - InstanceParams& operator=(InstanceParams&& other); - - // TODO(crbug.com/1477317): store these as ParsedCertificateList here so - // that it only needs to be done once since the same InstanceParams can be - // used to create a CertVerifyProc multiple times. - - // Additional trust anchors to consider during path validation. Ordinarily, - // implementations of CertVerifier use trust anchors from the configured - // system store. This is implementation-specific plumbing for passing - // additional anchors through. - CertificateList additional_trust_anchors; - - // Additional temporary certs to consider as intermediates during path - // validation. Ordinarily, implementations of CertVerifier use intermediate - // certs from the configured system store. This is implementation-specific - // plumbing for passing additional intermediates through. - CertificateList additional_untrusted_authorities; - }; - // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class NameNormalizationResult { @@ -143,8 +92,7 @@ // Creates and returns a CertVerifyProcBuiltin using the SSL SystemTrustStore. static scoped_refptr<CertVerifyProc> CreateBuiltinVerifyProc( scoped_refptr<CertNetFetcher> cert_net_fetcher, - scoped_refptr<CRLSet> crl_set, - const InstanceParams instance_params); + scoped_refptr<CRLSet> crl_set); #endif #if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) @@ -154,8 +102,7 @@ static scoped_refptr<CertVerifyProc> CreateBuiltinWithChromeRootStore( scoped_refptr<CertNetFetcher> cert_net_fetcher, scoped_refptr<CRLSet> crl_set, - const ChromeRootStoreData* root_store_data, - const InstanceParams instance_params); + const ChromeRootStoreData* root_store_data); #endif CertVerifyProc(const CertVerifyProc&) = delete; @@ -180,14 +127,24 @@ // If VERIFY_REV_CHECKING_ENABLED is set in |flags|, online certificate // revocation checking is performed (i.e. OCSP and downloading CRLs). CRLSet // based revocation checking is always enabled, regardless of this flag. + // + // |additional_trust_anchors| lists certificates that can be trusted when + // building a certificate chain, in addition to the anchors known to the + // implementation. int Verify(X509Certificate* cert, const std::string& hostname, const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log); + // Returns true if the implementation supports passing additional trust + // anchors to the Verify() call. The |additional_trust_anchors| parameter + // passed to Verify() is ignored when this returns false. + virtual bool SupportsAdditionalTrustAnchors() const = 0; + protected: explicit CertVerifyProc(scoped_refptr<CRLSet> crl_set); virtual ~CertVerifyProc(); @@ -234,6 +191,7 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) = 0; @@ -258,13 +216,35 @@ class NET_EXPORT CertVerifyProcFactory : public base::RefCountedThreadSafe<CertVerifyProcFactory> { public: + // The set of factory parameters that are variable over time, but are + // expected to be consistent between multiple verifiers that are created. For + // example, CertNetFetcher is not in this struct as it is expected that + // different verifiers will have different net fetchers. (There is no + // technical restriction against creating different verifiers with different + // ImplParams, structuring the parameters this way just makes some APIs more + // convenient for the common case.) + struct NET_EXPORT ImplParams { + ImplParams(); + ~ImplParams(); + ImplParams(const ImplParams&); + ImplParams& operator=(const ImplParams& other); + ImplParams(ImplParams&&); + ImplParams& operator=(ImplParams&& other); + + scoped_refptr<CRLSet> crl_set; +#if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) + absl::optional<net::ChromeRootStoreData> root_store_data; +#endif +#if BUILDFLAG(CHROME_ROOT_STORE_OPTIONAL) + bool use_chrome_root_store; +#endif + }; // Create a new CertVerifyProc that uses the passed in CRLSet and // ChromeRootStoreData. virtual scoped_refptr<CertVerifyProc> CreateCertVerifyProc( scoped_refptr<CertNetFetcher> cert_net_fetcher, - const CertVerifyProc::ImplParams& impl_params, - const CertVerifyProc::InstanceParams& instance_params) = 0; + const ImplParams& impl_params) = 0; protected: virtual ~CertVerifyProcFactory() = default;
diff --git a/net/cert/cert_verify_proc_android.cc b/net/cert/cert_verify_proc_android.cc index 8ac8541..deb95a03 100644 --- a/net/cert/cert_verify_proc_android.cc +++ b/net/cert/cert_verify_proc_android.cc
@@ -352,12 +352,17 @@ CertVerifyProcAndroid::~CertVerifyProcAndroid() = default; +bool CertVerifyProcAndroid::SupportsAdditionalTrustAnchors() const { + return false; +} + int CertVerifyProcAndroid::VerifyInternal( X509Certificate* cert, const std::string& hostname, const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) { std::vector<std::string> cert_bytes;
diff --git a/net/cert/cert_verify_proc_android.h b/net/cert/cert_verify_proc_android.h index f874bff..5fed25d 100644 --- a/net/cert/cert_verify_proc_android.h +++ b/net/cert/cert_verify_proc_android.h
@@ -22,6 +22,8 @@ CertVerifyProcAndroid(const CertVerifyProcAndroid&) = delete; CertVerifyProcAndroid& operator=(const CertVerifyProcAndroid&) = delete; + bool SupportsAdditionalTrustAnchors() const override; + protected: ~CertVerifyProcAndroid() override; @@ -31,6 +33,7 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) override;
diff --git a/net/cert/cert_verify_proc_android_unittest.cc b/net/cert/cert_verify_proc_android_unittest.cc index 6500d1fe..899ebf6 100644 --- a/net/cert/cert_verify_proc_android_unittest.cc +++ b/net/cert/cert_verify_proc_android_unittest.cc
@@ -80,6 +80,7 @@ } scoped_refptr<MockCertNetFetcher> fetcher_; + const CertificateList empty_cert_list_; std::unique_ptr<CertBuilder> root_; std::unique_ptr<CertBuilder> intermediate_; std::unique_ptr<CertBuilder> leaf_; @@ -101,8 +102,8 @@ CertVerifyResult verify_result; EXPECT_EQ(OK, proc->Verify(LeafWithIntermediate().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if the certificate does not contain an AIA URL, no AIA fetch @@ -117,8 +118,8 @@ EXPECT_EQ( ERR_CERT_AUTHORITY_INVALID, proc->Verify(LeafOnly().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if a certificate contains one file:// URL and one http:// URL, @@ -148,8 +149,8 @@ CertVerifyResult verify_result; EXPECT_EQ(OK, proc->Verify(LeafOnly().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if an AIA request returns the wrong intermediate, certificate @@ -171,8 +172,8 @@ EXPECT_EQ( ERR_CERT_AUTHORITY_INVALID, proc->Verify(LeafOnly().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if an AIA request returns an error, certificate verification @@ -191,8 +192,8 @@ EXPECT_EQ( ERR_CERT_AUTHORITY_INVALID, proc->Verify(LeafOnly().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if an AIA request returns an unparseable cert, certificate @@ -211,8 +212,8 @@ EXPECT_EQ( ERR_CERT_AUTHORITY_INVALID, proc->Verify(LeafOnly().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if a certificate has two HTTP AIA URLs, they are both fetched. If @@ -247,8 +248,8 @@ CertVerifyResult verify_result; EXPECT_EQ(OK, proc->Verify(LeafOnly().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if an intermediate is fetched via AIA, and the intermediate itself @@ -278,8 +279,8 @@ EXPECT_EQ( ERR_CERT_AUTHORITY_INVALID, proc->Verify(LeafOnly().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if a certificate contains six AIA URLs, only the first five are @@ -307,8 +308,8 @@ EXPECT_EQ( ERR_CERT_AUTHORITY_INVALID, proc->Verify(LeafOnly().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } // Tests that if the supplied chain contains an intermediate with an AIA URL, @@ -332,8 +333,8 @@ EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, proc->Verify(LeafWithIntermediate().get(), kHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource())); + /*sct_list=*/std::string(), 0, empty_cert_list_, + &verify_result, NetLogWithSource())); } } // namespace net
diff --git a/net/cert/cert_verify_proc_builtin.cc b/net/cert/cert_verify_proc_builtin.cc index 4f692d5..89f7980a 100644 --- a/net/cert/cert_verify_proc_builtin.cc +++ b/net/cert/cert_verify_proc_builtin.cc
@@ -79,14 +79,6 @@ return results; } -base::Value::Dict NetLogAdditionalCert(const CRYPTO_BUFFER* cert_handle, - const bssl::CertificateTrust& trust, - const bssl::CertErrors& errors) { - base::Value::Dict results = NetLogCertParams(cert_handle, errors); - results.Set("trust", trust.ToDebugString()); - return results; -} - #if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) base::Value::Dict NetLogChromeRootStoreVersion( int64_t chrome_root_store_version) { @@ -178,12 +170,9 @@ class CertVerifyProcTrustStore { public: // |system_trust_store| must outlive this object. - explicit CertVerifyProcTrustStore( - SystemTrustStore* system_trust_store, - bssl::TrustStoreInMemory* additional_trust_store) - : system_trust_store_(system_trust_store), - additional_trust_store_(additional_trust_store) { - trust_store_.AddTrustStore(additional_trust_store_); + explicit CertVerifyProcTrustStore(SystemTrustStore* system_trust_store) + : system_trust_store_(system_trust_store) { + trust_store_.AddTrustStore(&additional_trust_store_); trust_store_.AddTrustStore(system_trust_store_->GetTrustStore()); // When running in test mode, also layer in the test-only root certificates. // @@ -198,6 +187,10 @@ bssl::TrustStore* trust_store() { return &trust_store_; } + void AddTrustAnchor(std::shared_ptr<const bssl::ParsedCertificate> cert) { + additional_trust_store_.AddTrustAnchor(std::move(cert)); + } + bool IsKnownRoot(const bssl::ParsedCertificate* trust_anchor) const { if (TestRootCerts::HasInstance() && TestRootCerts::GetInstance()->IsKnownRoot( @@ -209,12 +202,12 @@ bool IsAdditionalTrustAnchor( const bssl::ParsedCertificate* trust_anchor) const { - return additional_trust_store_->Contains(trust_anchor); + return additional_trust_store_.Contains(trust_anchor); } private: raw_ptr<SystemTrustStore> system_trust_store_; - raw_ptr<bssl::TrustStoreInMemory> additional_trust_store_; + bssl::TrustStoreInMemory additional_trust_store_; bssl::TrustStoreCollection trust_store_; }; @@ -420,20 +413,13 @@ base::TimeTicks deadline_; }; -std::shared_ptr<const bssl::ParsedCertificate> ParseCertificateFromBuffer( - CRYPTO_BUFFER* cert_handle, - bssl::CertErrors* errors) { - return bssl::ParsedCertificate::Create( - bssl::UpRef(cert_handle), x509_util::DefaultParseCertificateOptions(), - errors); -} - class CertVerifyProcBuiltin : public CertVerifyProc { public: CertVerifyProcBuiltin(scoped_refptr<CertNetFetcher> net_fetcher, scoped_refptr<CRLSet> crl_set, - std::unique_ptr<SystemTrustStore> system_trust_store, - const CertVerifyProc::InstanceParams& instance_params); + std::unique_ptr<SystemTrustStore> system_trust_store); + + bool SupportsAdditionalTrustAnchors() const override; protected: ~CertVerifyProcBuiltin() override; @@ -444,69 +430,38 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) override; const scoped_refptr<CertNetFetcher> net_fetcher_; const std::unique_ptr<SystemTrustStore> system_trust_store_; - bssl::TrustStoreInMemory additional_trust_store_; }; CertVerifyProcBuiltin::CertVerifyProcBuiltin( scoped_refptr<CertNetFetcher> net_fetcher, scoped_refptr<CRLSet> crl_set, - std::unique_ptr<SystemTrustStore> system_trust_store, - const CertVerifyProc::InstanceParams& instance_params) + std::unique_ptr<SystemTrustStore> system_trust_store) : CertVerifyProc(std::move(crl_set)), net_fetcher_(std::move(net_fetcher)), system_trust_store_(std::move(system_trust_store)) { DCHECK(system_trust_store_); - - NetLogWithSource net_log = - NetLogWithSource::Make(net::NetLogSourceType::CERT_VERIFY_PROC_CREATED); - net_log.BeginEvent(NetLogEventType::CERT_VERIFY_PROC_CREATED); - - // Parse the additional trust anchors and setup trust store. - for (const auto& x509_cert : instance_params.additional_trust_anchors) { - bssl::CertErrors parsing_errors; - std::shared_ptr<const bssl::ParsedCertificate> cert = - ParseCertificateFromBuffer(x509_cert->cert_buffer(), &parsing_errors); - if (cert) { - additional_trust_store_.AddTrustAnchor(std::move(cert)); - } - net_log.AddEvent(NetLogEventType::CERT_VERIFY_PROC_ADDITIONAL_CERT, [&] { - return NetLogAdditionalCert(x509_cert->cert_buffer(), - bssl::CertificateTrust::ForTrustAnchor(), - parsing_errors); - }); - } - - for (const auto& x509_cert : - instance_params.additional_untrusted_authorities) { - bssl::CertErrors parsing_errors; - std::shared_ptr<const bssl::ParsedCertificate> cert = - ParseCertificateFromBuffer(x509_cert->cert_buffer(), &parsing_errors); - // Only add the untrusted cert if it isn't already present in - // `additional_trust_store_`. If the same cert was already added as a - // trust anchor then adding it again as an untrusted cert can lead to it - // not being treated as a trust anchor since TrustStoreInMemory doesn't - // expect to contain duplicates. - if (cert && !additional_trust_store_.Contains(cert.get())) { - additional_trust_store_.AddCertificateWithUnspecifiedTrust( - std::move(cert)); - } - net_log.AddEvent(NetLogEventType::CERT_VERIFY_PROC_ADDITIONAL_CERT, [&] { - return NetLogAdditionalCert(x509_cert->cert_buffer(), - bssl::CertificateTrust::ForUnspecified(), - parsing_errors); - }); - } - - net_log.EndEvent(NetLogEventType::CERT_VERIFY_PROC_CREATED); } CertVerifyProcBuiltin::~CertVerifyProcBuiltin() = default; +bool CertVerifyProcBuiltin::SupportsAdditionalTrustAnchors() const { + return true; +} + +std::shared_ptr<const bssl::ParsedCertificate> ParseCertificateFromBuffer( + CRYPTO_BUFFER* cert_handle, + bssl::CertErrors* errors) { + return bssl::ParsedCertificate::Create( + bssl::UpRef(cert_handle), x509_util::DefaultParseCertificateOptions(), + errors); +} + void AddIntermediatesToIssuerSource(X509Certificate* x509_cert, bssl::CertIssuerSourceStatic* intermediates, const NetLogWithSource& net_log) { @@ -519,9 +474,8 @@ net_log.AddEvent(NetLogEventType::CERT_VERIFY_PROC_INPUT_CERT, [&] { return NetLogCertParams(intermediate.get(), errors); }); - if (cert) { + if (cert) intermediates->AddCert(std::move(cert)); - } } } @@ -795,6 +749,7 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) { // VerifyInternal() is expected to carry out verifications using the current @@ -819,10 +774,6 @@ } #endif - // TODO(crbug.com/1477317): Netlog extra configuration information stored - // inside CertVerifyProcBuiltin (e.g. certs in additional_trust_store and - // system trust store) - // Parse the target certificate. std::shared_ptr<const bssl::ParsedCertificate> target; { @@ -844,8 +795,22 @@ bssl::CertIssuerSourceStatic intermediates; AddIntermediatesToIssuerSource(input_cert, &intermediates, net_log); - CertVerifyProcTrustStore trust_store(system_trust_store_.get(), - &additional_trust_store_); + // Parse the additional trust anchors and setup trust store. + CertVerifyProcTrustStore trust_store(system_trust_store_.get()); + for (const auto& x509_cert : additional_trust_anchors) { + bssl::CertErrors parsing_errors; + std::shared_ptr<const bssl::ParsedCertificate> cert = + ParseCertificateFromBuffer(x509_cert->cert_buffer(), &parsing_errors); + if (cert) + trust_store.AddTrustAnchor(std::move(cert)); + // TODO(crbug.com/634484): this duplicates the logging of the + // additional_trust_anchors maybe should only log if there is a parse + // error/warning? + net_log.AddEvent( + NetLogEventType::CERT_VERIFY_PROC_ADDITIONAL_TRUST_ANCHOR, [&] { + return NetLogCertParams(x509_cert->cert_buffer(), parsing_errors); + }); + } // Get the global dependencies. const EVRootCAMetadata* ev_metadata = EVRootCAMetadata::GetInstance(); @@ -959,11 +924,10 @@ scoped_refptr<CertVerifyProc> CreateCertVerifyProcBuiltin( scoped_refptr<CertNetFetcher> net_fetcher, scoped_refptr<CRLSet> crl_set, - std::unique_ptr<SystemTrustStore> system_trust_store, - const CertVerifyProc::InstanceParams& instance_params) { + std::unique_ptr<SystemTrustStore> system_trust_store) { return base::MakeRefCounted<CertVerifyProcBuiltin>( - std::move(net_fetcher), std::move(crl_set), std::move(system_trust_store), - instance_params); + std::move(net_fetcher), std::move(crl_set), + std::move(system_trust_store)); } base::TimeDelta GetCertVerifyProcBuiltinTimeLimitForTesting() {
diff --git a/net/cert/cert_verify_proc_builtin.h b/net/cert/cert_verify_proc_builtin.h index 60f78a2e..34fd9a1 100644 --- a/net/cert/cert_verify_proc_builtin.h +++ b/net/cert/cert_verify_proc_builtin.h
@@ -10,11 +10,11 @@ #include "base/memory/scoped_refptr.h" #include "base/time/time.h" #include "net/base/net_export.h" -#include "net/cert/cert_verify_proc.h" namespace net { class CertNetFetcher; +class CertVerifyProc; class CRLSet; class SystemTrustStore; @@ -24,8 +24,7 @@ NET_EXPORT scoped_refptr<CertVerifyProc> CreateCertVerifyProcBuiltin( scoped_refptr<CertNetFetcher> net_fetcher, scoped_refptr<CRLSet> crl_set, - std::unique_ptr<SystemTrustStore> system_trust_store, - const CertVerifyProc::InstanceParams& instance_params); + std::unique_ptr<SystemTrustStore> system_trust_store); // Returns the time limit used by CertVerifyProcBuiltin. Intended for test use. NET_EXPORT_PRIVATE base::TimeDelta
diff --git a/net/cert/cert_verify_proc_builtin_unittest.cc b/net/cert/cert_verify_proc_builtin_unittest.cc index 8696c34..b76d3ff 100644 --- a/net/cert/cert_verify_proc_builtin_unittest.cc +++ b/net/cert/cert_verify_proc_builtin_unittest.cc
@@ -99,15 +99,17 @@ scoped_refptr<X509Certificate> cert, const std::string& hostname, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, NetLogSource* out_source) { base::ScopedAllowBaseSyncPrimitivesForTesting scoped_allow_blocking; NetLogWithSource net_log(NetLogWithSource::Make( net::NetLog::Get(), net::NetLogSourceType::CERT_VERIFIER_TASK)); - int error = verify_proc->Verify(cert.get(), hostname, - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - verify_result, net_log); + int error = + verify_proc->Verify(cert.get(), hostname, + /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, + additional_trust_anchors, verify_result, net_log); *out_source = net_log.source(); return error; } @@ -129,7 +131,7 @@ } #if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) - int64_t chrome_root_store_version() const override { return 0; } + int64_t chrome_root_store_version() override { return 0; } #endif private: @@ -163,8 +165,11 @@ public: void SetUp() override { cert_net_fetcher_ = base::MakeRefCounted<CertNetFetcherURLRequest>(); - - InitializeVerifyProc({}); + auto mock_system_trust_store = std::make_unique<MockSystemTrustStore>(); + mock_system_trust_store_ = mock_system_trust_store.get(); + verify_proc_ = CreateCertVerifyProcBuiltin( + cert_net_fetcher_, CRLSet::EmptyCRLSetForTesting(), + std::move(mock_system_trust_store)); context_ = CreateTestURLRequestContextBuilder()->Build(); @@ -173,19 +178,10 @@ void TearDown() override { cert_net_fetcher_->Shutdown(); } - void InitializeVerifyProc(const CertificateList& additional_trust_anchors) { - auto mock_system_trust_store = std::make_unique<MockSystemTrustStore>(); - mock_system_trust_store_ = mock_system_trust_store.get(); - CertVerifyProc::InstanceParams instance_params; - instance_params.additional_trust_anchors = additional_trust_anchors; - verify_proc_ = CreateCertVerifyProcBuiltin( - cert_net_fetcher_, CRLSet::EmptyCRLSetForTesting(), - std::move(mock_system_trust_store), instance_params); - } - void Verify(scoped_refptr<X509Certificate> cert, const std::string& hostname, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, NetLogSource* out_source, CompletionOnceCallback callback) { @@ -193,7 +189,8 @@ FROM_HERE, {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::BindOnce(&VerifyOnWorkerThread, verify_proc_, std::move(cert), - hostname, flags, verify_result, out_source), + hostname, flags, additional_trust_anchors, verify_result, + out_source), std::move(callback)); } @@ -245,8 +242,6 @@ TEST_F(CertVerifyProcBuiltinTest, ShouldBypassHSTS) { auto [leaf, root] = CertBuilder::CreateSimpleChain2(); - InitializeVerifyProc( - /*additional_trust_anchors=*/{root->GetX509Certificate()}); EmbeddedTestServer test_server(EmbeddedTestServer::TYPE_HTTP); ASSERT_TRUE(test_server.InitializeAndListen()); @@ -272,6 +267,7 @@ test_server.base_url().host())); Verify(chain.get(), "www.example.com", CertVerifyProc::VERIFY_REV_CHECKING_ENABLED, + /*additional_trust_anchors=*/{root->GetX509Certificate()}, &verify_result, &verify_net_log_source, verify_callback.callback()); int error = verify_callback.WaitForResult(); @@ -282,8 +278,6 @@ TEST_F(CertVerifyProcBuiltinTest, SimpleSuccess) { auto [leaf, intermediate, root] = CertBuilder::CreateSimpleChain3(); - InitializeVerifyProc( - /*additional_trust_anchors=*/{root->GetX509Certificate()}); scoped_refptr<X509Certificate> chain = leaf->GetX509CertificateChain(); ASSERT_TRUE(chain.get()); @@ -292,8 +286,9 @@ CertVerifyResult verify_result; NetLogSource verify_net_log_source; TestCompletionCallback callback; - Verify(chain.get(), "www.example.com", /*flags=*/0, &verify_result, - &verify_net_log_source, callback.callback()); + Verify(chain.get(), "www.example.com", /*flags=*/0, + /*additional_trust_anchors=*/{root->GetX509Certificate()}, + &verify_result, &verify_net_log_source, callback.callback()); int error = callback.WaitForResult(); EXPECT_THAT(error, IsOk()); @@ -304,8 +299,6 @@ TEST_F(CertVerifyProcBuiltinTest, CRLNotCheckedForKnownRoots) { auto [leaf, root] = CertBuilder::CreateSimpleChain2(); - InitializeVerifyProc( - /*additional_trust_anchors=*/{root->GetX509Certificate()}); EmbeddedTestServer test_server(EmbeddedTestServer::TYPE_HTTP); ASSERT_TRUE(test_server.InitializeAndListen()); @@ -326,6 +319,7 @@ TestCompletionCallback verify_callback; Verify(chain.get(), "www.example.com", CertVerifyProc::VERIFY_REV_CHECKING_ENABLED, + /*additional_trust_anchors=*/{root->GetX509Certificate()}, &verify_result, &verify_net_log_source, verify_callback.callback()); int error = verify_callback.WaitForResult(); @@ -341,6 +335,7 @@ TestCompletionCallback verify_callback; Verify(chain.get(), "www.example.com", CertVerifyProc::VERIFY_REV_CHECKING_ENABLED, + /*additional_trust_anchors=*/{root->GetX509Certificate()}, &verify_result, &verify_net_log_source, verify_callback.callback()); int error = verify_callback.WaitForResult(); @@ -358,8 +353,6 @@ // checking, additional CRL fetches will not be attempted. TEST_F(CertVerifyProcBuiltinTest, RevocationCheckDeadlineCRL) { auto [leaf, intermediate, root] = CertBuilder::CreateSimpleChain3(); - InitializeVerifyProc( - /*additional_trust_anchors=*/{root->GetX509Certificate()}); const base::TimeDelta timeout_increment = CertNetFetcherURLRequest::GetDefaultTimeoutForTesting() + @@ -408,6 +401,7 @@ TestCompletionCallback verify_callback; Verify(chain.get(), "www.example.com", CertVerifyProc::VERIFY_REV_CHECKING_ENABLED, + /*additional_trust_anchors=*/{root->GetX509Certificate()}, &verify_result, &verify_net_log_source, verify_callback.callback()); for (int i = 0; i < expected_request_count; i++) { @@ -434,8 +428,6 @@ // checking, additional OCSP fetches will not be attempted. TEST_F(CertVerifyProcBuiltinTest, RevocationCheckDeadlineOCSP) { auto [leaf, intermediate, root] = CertBuilder::CreateSimpleChain3(); - InitializeVerifyProc( - /*additional_trust_anchors=*/{root->GetX509Certificate()}); const base::TimeDelta timeout_increment = CertNetFetcherURLRequest::GetDefaultTimeoutForTesting() + @@ -483,6 +475,7 @@ TestCompletionCallback verify_callback; Verify(chain.get(), "www.example.com", CertVerifyProc::VERIFY_REV_CHECKING_ENABLED, + /*additional_trust_anchors=*/{root->GetX509Certificate()}, &verify_result, &verify_net_log_source, verify_callback.callback()); for (int i = 0; i < expected_request_count; i++) { @@ -507,8 +500,6 @@ // is done. TEST_F(CertVerifyProcBuiltinTest, EVNoOCSPRevocationChecks) { auto [leaf, intermediate, root] = CertBuilder::CreateSimpleChain3(); - InitializeVerifyProc( - /*additional_trust_anchors=*/{root->GetX509Certificate()}); // Add test EV policy to leaf and intermediate. static const char kEVTestCertPolicy[] = "1.2.3.4"; @@ -546,6 +537,7 @@ TestCompletionCallback verify_callback; Verify(chain.get(), "www.example.com", /*flags=*/0, + /*additional_trust_anchors=*/{root->GetX509Certificate()}, &verify_result, &verify_net_log_source, verify_callback.callback()); // EV doesn't do revocation checking, therefore verification result @@ -582,8 +574,6 @@ TEST_F(CertVerifyProcBuiltinTest, DeadlineExceededDuringSyncGetIssuers) { auto [leaf, intermediate, root] = CertBuilder::CreateSimpleChain3(); - InitializeVerifyProc( - /*additional_trust_anchors=*/{root->GetX509Certificate()}); BlockingTrustStore trust_store; AddTrustStore(&trust_store); @@ -602,6 +592,7 @@ TestCompletionCallback verify_callback; Verify(chain.get(), "www.example.com", /*flags=*/0, + /*additional_trust_anchors=*/{root->GetX509Certificate()}, &verify_result, &verify_net_log_source, verify_callback.callback()); // Wait for trust_store.SyncGetIssuersOf to be called. @@ -672,8 +663,8 @@ CertVerifyResult verify_result; NetLogSource verify_net_log_source; TestCompletionCallback callback; - Verify(chain.get(), "www.example.com", flags, &verify_result, - &verify_net_log_source, callback.callback()); + Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result, &verify_net_log_source, callback.callback()); int error = callback.WaitForResult(); // Unknown signature algorithm in the leaf cert should result in the cert // being invalid. @@ -696,8 +687,8 @@ CertVerifyResult verify_result; NetLogSource verify_net_log_source; TestCompletionCallback callback; - Verify(chain.get(), "www.example.com", flags, &verify_result, - &verify_net_log_source, callback.callback()); + Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result, &verify_net_log_source, callback.callback()); int error = callback.WaitForResult(); // Invalid signature algorithm in the leaf cert should result in the // cert being invalid. @@ -718,8 +709,8 @@ CertVerifyResult verify_result; NetLogSource verify_net_log_source; TestCompletionCallback callback; - Verify(chain.get(), "www.example.com", flags, &verify_result, - &verify_net_log_source, callback.callback()); + Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result, &verify_net_log_source, callback.callback()); int error = callback.WaitForResult(); // Unknown signature algorithm in the intermediate cert should result in the // cert being invalid. @@ -743,8 +734,8 @@ CertVerifyResult verify_result; NetLogSource verify_net_log_source; TestCompletionCallback callback; - Verify(chain.get(), "www.example.com", flags, &verify_result, - &verify_net_log_source, callback.callback()); + Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result, &verify_net_log_source, callback.callback()); int error = callback.WaitForResult(); // Invalid signature algorithm in the intermediate cert should result in the // cert being invalid. @@ -765,8 +756,8 @@ CertVerifyResult verify_result; NetLogSource verify_net_log_source; TestCompletionCallback callback; - Verify(chain.get(), "www.example.com", flags, &verify_result, - &verify_net_log_source, callback.callback()); + Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result, &verify_net_log_source, callback.callback()); int error = callback.WaitForResult(); // Unknown signature algorithm in the root cert should have no effect on // verification. @@ -799,8 +790,8 @@ CertVerifyResult verify_result; NetLogSource verify_net_log_source; TestCompletionCallback callback; - Verify(chain.get(), "www.example.com", flags, &verify_result, - &verify_net_log_source, callback.callback()); + Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result, &verify_net_log_source, callback.callback()); int error = callback.WaitForResult(); // Invalid signature algorithm in the root cert should have no effect on // verification. @@ -878,8 +869,8 @@ CertVerifyResult verify_result; NetLogSource verify_net_log_source; TestCompletionCallback callback; - Verify(chain.get(), "www.example.com", flags, &verify_result, - &verify_net_log_source, callback.callback()); + Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result, &verify_net_log_source, callback.callback()); int error = callback.WaitForResult(); auto events = net_log_observer.GetEntriesForSource(verify_net_log_source);
diff --git a/net/cert/cert_verify_proc_ios.cc b/net/cert/cert_verify_proc_ios.cc index f4356c2..440e725 100644 --- a/net/cert/cert_verify_proc_ios.cc +++ b/net/cert/cert_verify_proc_ios.cc
@@ -386,6 +386,10 @@ #endif // !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < // __IPHONE_12_0 +bool CertVerifyProcIOS::SupportsAdditionalTrustAnchors() const { + return false; +} + CertVerifyProcIOS::~CertVerifyProcIOS() = default; int CertVerifyProcIOS::VerifyInternal( @@ -394,6 +398,7 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) { ScopedCFTypeRef<CFArrayRef> trust_policies;
diff --git a/net/cert/cert_verify_proc_ios.h b/net/cert/cert_verify_proc_ios.h index a5a5308..87e4a1e 100644 --- a/net/cert/cert_verify_proc_ios.h +++ b/net/cert/cert_verify_proc_ios.h
@@ -26,6 +26,8 @@ // indicated that the certificate is not trusted. static CertStatus GetCertFailureStatusFromError(CFErrorRef error); + bool SupportsAdditionalTrustAnchors() const override; + protected: ~CertVerifyProcIOS() override; @@ -42,6 +44,7 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) override; };
diff --git a/net/cert/cert_verify_proc_unittest.cc b/net/cert/cert_verify_proc_unittest.cc index df95b9d..03bc456 100644 --- a/net/cert/cert_verify_proc_unittest.cc +++ b/net/cert/cert_verify_proc_unittest.cc
@@ -136,6 +136,9 @@ MockCertVerifyProc(const MockCertVerifyProc&) = delete; MockCertVerifyProc& operator=(const MockCertVerifyProc&) = delete; + // CertVerifyProc implementation: + bool SupportsAdditionalTrustAnchors() const override { return false; } + protected: ~MockCertVerifyProc() override = default; @@ -145,6 +148,7 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) override; @@ -152,13 +156,15 @@ const int error_ = OK; }; -int MockCertVerifyProc::VerifyInternal(X509Certificate* cert, - const std::string& hostname, - const std::string& ocsp_response, - const std::string& sct_list, - int flags, - CertVerifyResult* verify_result, - const NetLogWithSource& net_log) { +int MockCertVerifyProc::VerifyInternal( + X509Certificate* cert, + const std::string& hostname, + const std::string& ocsp_response, + const std::string& sct_list, + int flags, + const CertificateList& additional_trust_anchors, + CertVerifyResult* verify_result, + const NetLogWithSource& net_log) { *verify_result = result_; verify_result->verified_cert = cert; return error_; @@ -197,13 +203,7 @@ scoped_refptr<CertVerifyProc> CreateCertVerifyProc( CertVerifyProcType type, scoped_refptr<CertNetFetcher> cert_net_fetcher, - scoped_refptr<CRLSet> crl_set, - CertificateList additional_trust_anchors, - CertificateList additional_untrusted_authorities) { - CertVerifyProc::InstanceParams instance_params; - instance_params.additional_trust_anchors = additional_trust_anchors; - instance_params.additional_untrusted_authorities = - additional_untrusted_authorities; + scoped_refptr<CRLSet> crl_set) { switch (type) { #if BUILDFLAG(IS_ANDROID) case CERT_VERIFY_PROC_ANDROID: @@ -215,17 +215,16 @@ #endif #if BUILDFLAG(IS_FUCHSIA) case CERT_VERIFY_PROC_BUILTIN: - return CreateCertVerifyProcBuiltin( - std::move(cert_net_fetcher), std::move(crl_set), - CreateSslSystemTrustStore(), instance_params); + return CreateCertVerifyProcBuiltin(std::move(cert_net_fetcher), + std::move(crl_set), + CreateSslSystemTrustStore()); #endif #if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) case CERT_VERIFY_PROC_BUILTIN_CHROME_ROOTS: return CreateCertVerifyProcBuiltin( std::move(cert_net_fetcher), std::move(crl_set), CreateSslSystemTrustStoreChromeRoot( - std::make_unique<net::TrustStoreChrome>()), - instance_params); + std::make_unique<net::TrustStoreChrome>())); #endif default: return nullptr; @@ -293,57 +292,51 @@ // CertNetFetcher may be initialized by subclasses that want to use net // fetching by calling SetUpWithCertNetFetcher instead of SetUp. - void SetUpWithCertNetFetcher( - scoped_refptr<CertNetFetcher> cert_net_fetcher, - scoped_refptr<CRLSet> crl_set, - CertificateList additional_trust_anchors, - CertificateList additional_untrusted_authorities) { + void SetUpWithCertNetFetcher(scoped_refptr<CertNetFetcher> cert_net_fetcher, + scoped_refptr<CRLSet> crl_set) { CertVerifyProcType type = verify_proc_type(); - verify_proc_ = CreateCertVerifyProc( - type, std::move(cert_net_fetcher), std::move(crl_set), - additional_trust_anchors, additional_untrusted_authorities); + verify_proc_ = CreateCertVerifyProc(type, std::move(cert_net_fetcher), + std::move(crl_set)); ASSERT_TRUE(verify_proc_); } virtual void SetUpCertVerifyProc(scoped_refptr<CRLSet> crl_set) { - SetUpWithCertNetFetcher(nullptr, std::move(crl_set), - /*additional_trust_anchors=*/{}, - /*additional_untrusted_authorities=*/{}); - } - - virtual void SetUpWithAdditionalCerts( - CertificateList additional_trust_anchors, - CertificateList additional_untrusted_authorities) { - SetUpWithCertNetFetcher(nullptr, CRLSet::BuiltinCRLSet(), - additional_trust_anchors, - additional_untrusted_authorities); + SetUpWithCertNetFetcher(nullptr, std::move(crl_set)); } int Verify(X509Certificate* cert, const std::string& hostname, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result, const NetLogWithSource& net_log) { return verify_proc_->Verify(cert, hostname, /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, - verify_result, net_log); + additional_trust_anchors, verify_result, + net_log); } int Verify(X509Certificate* cert, const std::string& hostname, int flags, + const CertificateList& additional_trust_anchors, CertVerifyResult* verify_result) { - return Verify(cert, hostname, flags, verify_result, NetLogWithSource()); + return Verify(cert, hostname, flags, additional_trust_anchors, + verify_result, NetLogWithSource()); } int Verify(X509Certificate* cert, const std::string& hostname) { CertVerifyResult verify_result; int flags = 0; - return Verify(cert, hostname, flags, &verify_result); + return Verify(cert, hostname, flags, CertificateList(), &verify_result); } CertVerifyProcType verify_proc_type() const { return GetParam(); } + bool SupportsAdditionalTrustAnchors() const { + return verify_proc_->SupportsAdditionalTrustAnchors(); + } + // Returns true if the RSA/DSA keysize will be considered weak on the current // platform. IsInvalidRsaDsaKeySize should be checked prior, since some very // weak keys may be considered invalid. @@ -542,7 +535,8 @@ CertVerifyResult verify_result; int flags = 0; - int error = Verify(cert.get(), "www.example.com", flags, &verify_result); + int error = Verify(cert.get(), "www.example.com", flags, CertificateList(), + &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_IS_EV); } @@ -563,7 +557,8 @@ CertVerifyResult verify_result; int flags = 0; - int error = Verify(cert.get(), "www.example.com", flags, &verify_result); + int error = Verify(cert.get(), "www.example.com", flags, CertificateList(), + &verify_result); if (ScopedTestRootCanTrustTargetCert(verify_proc_type())) { EXPECT_THAT(error, IsOk()); ASSERT_TRUE(verify_result.verified_cert); @@ -593,7 +588,8 @@ CertVerifyResult verify_result; int flags = 0; - int error = Verify(cert.get(), "www.example.com", flags, &verify_result); + int error = Verify(cert.get(), "www.example.com", flags, CertificateList(), + &verify_result); if (ScopedTestRootCanTrustTargetCert(verify_proc_type())) { EXPECT_THAT(error, IsOk()); ASSERT_TRUE(verify_result.verified_cert); @@ -651,7 +647,8 @@ ScopedTestRoot scoped_test_root({root_cert}); CertVerifyResult verify_result; int flags = 0; - int error = Verify(cert.get(), "www.example.com", flags, &verify_result); + int error = Verify(cert.get(), "www.example.com", flags, + CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); ASSERT_TRUE(verify_result.verified_cert); // Verified chain should include the intermediate and the root. @@ -663,7 +660,8 @@ ScopedTestRoot scoped_test_root({intermediate_cert, root_cert}); CertVerifyResult verify_result; int flags = 0; - int error = Verify(cert.get(), "www.example.com", flags, &verify_result); + int error = Verify(cert.get(), "www.example.com", flags, + CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); ASSERT_TRUE(verify_result.verified_cert); // Verified chain should only go to the trusted intermediate, not the @@ -693,7 +691,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.fake.com", flags, &verify_result); + int error = Verify(chain.get(), "www.fake.com", flags, CertificateList(), + &verify_result); // This actually fails because Chrome only looks for hostnames in // SubjectAltNames now and no SubjectAltName is present. @@ -718,7 +717,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.fake.com", flags, &verify_result); + int error = Verify(chain.get(), "www.fake.com", flags, CertificateList(), + &verify_result); // SubjectAltName is valid and Chrome does not use the common name. EXPECT_THAT(error, IsOk()); @@ -740,7 +740,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.fake.com", flags, &verify_result); + int error = Verify(chain.get(), "www.fake.com", flags, CertificateList(), + &verify_result); // SubjectAltName is invalid. EXPECT_THAT(error, IsError(ERR_CERT_COMMON_NAME_INVALID)); @@ -778,8 +779,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = - Verify(cert_with_bad_target.get(), "127.0.0.1", flags, &verify_result); + int error = Verify(cert_with_bad_target.get(), "127.0.0.1", flags, + CertificateList(), &verify_result); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_INVALID); EXPECT_THAT(error, IsError(ERR_CERT_INVALID)); @@ -817,7 +818,7 @@ int flags = 0; CertVerifyResult verify_result; int error = Verify(cert_with_bad_intermediate.get(), "127.0.0.1", flags, - &verify_result, net_log); + CertificateList(), &verify_result, net_log); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0u, verify_result.cert_status); @@ -861,7 +862,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_DATE_INVALID)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_DATE_INVALID); } @@ -893,8 +895,9 @@ ScopedTestRoot scoped_root(root->GetX509Certificate()); CertVerifyResult verify_result; - int error = Verify(leaf->GetX509CertificateChain().get(), - "www.example.com", 0, &verify_result); + int error = + Verify(leaf->GetX509CertificateChain().get(), "www.example.com", 0, + CertificateList(), &verify_result); if (IsInvalidKeyType(ee_type) || IsInvalidKeyType(signer_type)) { EXPECT_NE(OK, error); @@ -949,8 +952,8 @@ CertVerifyResult verify_result; int flags = 0; - int error = - Verify(cert_chain.get(), "www.example.com", flags, &verify_result); + int error = Verify(cert_chain.get(), "www.example.com", flags, + CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); // The extra root should be discarded. @@ -981,14 +984,15 @@ CertVerifyResult verify_result; int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; - int error = - Verify(cert_chain.get(), "mail.google.com", flags, &verify_result); + int error = Verify(cert_chain.get(), "mail.google.com", flags, + CertificateList(), &verify_result); EXPECT_NE(OK, error); // Now turn off revocation checking. Certificate verification should still // fail. flags = 0; - error = Verify(cert_chain.get(), "mail.google.com", flags, &verify_result); + error = Verify(cert_chain.get(), "mail.google.com", flags, CertificateList(), + &verify_result); EXPECT_NE(OK, error); } @@ -1011,13 +1015,13 @@ int flags = 0; CertVerifyResult verify_result; - int error = - Verify(leaf_cert.get(), "test.example.com", flags, &verify_result); + int error = Verify(leaf_cert.get(), "test.example.com", flags, + CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); - error = - Verify(leaf_cert.get(), "foo.test2.example.com", flags, &verify_result); + error = Verify(leaf_cert.get(), "foo.test2.example.com", flags, + CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); } @@ -1038,8 +1042,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = - Verify(leaf_cert.get(), "test.example.com", flags, &verify_result); + int error = Verify(leaf_cert.get(), "test.example.com", flags, + CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_NAME_CONSTRAINT_VIOLATION)); EXPECT_EQ(CERT_STATUS_NAME_CONSTRAINT_VIOLATION, verify_result.cert_status & CERT_STATUS_NAME_CONSTRAINT_VIOLATION); @@ -1117,7 +1121,8 @@ return verify_proc->Verify( chain.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), &verify_result, + NetLogWithSource()); } private: @@ -1430,7 +1435,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0u, verify_result.cert_status & CERT_STATUS_ALL_ERRORS); } @@ -1444,7 +1450,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_VALIDITY_TOO_LONG)); // TODO(mattm): generate a dedicated cert or use CertBuilder so that this // test doesn't also hit CERT_STATUS_NON_UNIQUE_NAME. @@ -1464,7 +1471,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); // TODO(mattm): generate a dedicated cert or use CertBuilder so that this // test doesn't also hit CERT_STATUS_NON_UNIQUE_NAME. @@ -1482,8 +1490,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = - Verify(cert_chain.get(), "smallstrategies.com", flags, &verify_result); + int error = Verify(cert_chain.get(), "smallstrategies.com", flags, + CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()) << "This test relies on a real certificate that " << "expires on Nov 29 2024. If failing on/after " @@ -1513,7 +1521,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert_chain.get(), "127.0.0.1", flags, &verify_result); + int error = Verify(cert_chain.get(), "127.0.0.1", flags, CertificateList(), + &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(3u, verify_result.public_key_hashes.size()); @@ -1563,8 +1572,9 @@ // this is just matching how the test was originally written, and we'll // delete this sometime soon anyway so there's not much benefit to thinking // about it too hard.) - int error = Verify(leaf->GetX509CertificateFullChain().get(), - "www.example.com", flags, &verify_result); + int error = + Verify(leaf->GetX509CertificateFullChain().get(), "www.example.com", + flags, CertificateList(), &verify_result); EXPECT_NE(error, OK); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM); @@ -1598,7 +1608,8 @@ CertVerifyResult verify_result; EXPECT_EQ(static_cast<X509Certificate*>(nullptr), verify_result.verified_cert.get()); - int error = Verify(google_full_chain.get(), "127.0.0.1", 0, &verify_result); + int error = Verify(google_full_chain.get(), "127.0.0.1", 0, CertificateList(), + &verify_result); EXPECT_THAT(error, IsOk()); ASSERT_NE(static_cast<X509Certificate*>(nullptr), verify_result.verified_cert.get()); @@ -1636,8 +1647,8 @@ auto verify_proc = base::MakeRefCounted<MockCertVerifyProc>(dummy_result); error = verify_proc->Verify(cert.get(), kIntranetHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), + &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_NON_UNIQUE_NAME); @@ -1647,8 +1658,8 @@ verify_proc = base::MakeRefCounted<MockCertVerifyProc>(dummy_result); error = verify_proc->Verify(cert.get(), kIntranetHostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, - NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), + &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_FALSE(verify_result.cert_status & CERT_STATUS_NON_UNIQUE_NAME); } @@ -1704,7 +1715,8 @@ CertVerifyResult test_result_1; error = verify_proc->Verify( cert, "www.example.com", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &test_result_1, NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), &test_result_1, + NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_SYMANTEC_LEGACY)); EXPECT_TRUE(test_result_1.cert_status & CERT_STATUS_SYMANTEC_LEGACY); @@ -1720,7 +1732,8 @@ CertVerifyResult test_result_2; error = verify_proc->Verify( cert, "www.example.com", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &test_result_2, NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), &test_result_2, + NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_FALSE(test_result_2.cert_status & CERT_STATUS_AUTHORITY_INVALID); @@ -1729,8 +1742,8 @@ error = verify_proc->Verify( cert, "www.example.com", /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), - CertVerifyProc::VERIFY_DISABLE_SYMANTEC_ENFORCEMENT, &test_result_3, - NetLogWithSource()); + CertVerifyProc::VERIFY_DISABLE_SYMANTEC_ENFORCEMENT, CertificateList(), + &test_result_3, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_FALSE(test_result_3.cert_status & CERT_STATUS_SYMANTEC_LEGACY); } @@ -1753,8 +1766,8 @@ CertVerifyResult test_result_1; error = verify_proc->Verify(cert.get(), "www.example.com", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &test_result_1, - NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), + &test_result_1, NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_SYMANTEC_LEGACY)); EXPECT_TRUE(test_result_1.cert_status & CERT_STATUS_SYMANTEC_LEGACY); @@ -1769,8 +1782,8 @@ CertVerifyResult test_result_2; error = verify_proc->Verify(cert.get(), "www.example.com", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &test_result_2, - NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), + &test_result_2, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_FALSE(test_result_2.cert_status & CERT_STATUS_AUTHORITY_INVALID); @@ -1779,8 +1792,8 @@ error = verify_proc->Verify( cert.get(), "www.example.com", /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), - CertVerifyProc::VERIFY_DISABLE_SYMANTEC_ENFORCEMENT, &test_result_3, - NetLogWithSource()); + CertVerifyProc::VERIFY_DISABLE_SYMANTEC_ENFORCEMENT, CertificateList(), + &test_result_3, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_FALSE(test_result_3.cert_status & CERT_STATUS_SYMANTEC_LEGACY); } @@ -1811,7 +1824,8 @@ CertVerifyResult verify_result; EXPECT_FALSE(verify_result.verified_cert); - int error = Verify(google_full_chain.get(), "127.0.0.1", 0, &verify_result); + int error = Verify(google_full_chain.get(), "127.0.0.1", 0, CertificateList(), + &verify_result); EXPECT_THAT(error, IsOk()); ASSERT_TRUE(verify_result.verified_cert); @@ -1861,7 +1875,8 @@ CertVerifyResult verify_result; EXPECT_FALSE(verify_result.verified_cert); - int error = Verify(google_full_chain.get(), "127.0.0.1", 0, &verify_result); + int error = Verify(google_full_chain.get(), "127.0.0.1", 0, CertificateList(), + &verify_result); EXPECT_THAT(error, IsOk()); ASSERT_TRUE(verify_result.verified_cert); @@ -1879,7 +1894,7 @@ } TEST_P(CertVerifyProcInternalTest, AdditionalTrustAnchors) { - if (!VerifyProcTypeIsBuiltin()) { + if (!SupportsAdditionalTrustAnchors()) { LOG(INFO) << "Skipping this test in this platform."; return; } @@ -1900,7 +1915,8 @@ // list. int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result.cert_status); EXPECT_FALSE(verify_result.is_issued_by_additional_trust_anchor); @@ -1908,81 +1924,20 @@ // Now add the |ca_cert| to the |trust_anchors|, and verification should pass. CertificateList trust_anchors; trust_anchors.push_back(ca_cert); - SetUpWithAdditionalCerts(trust_anchors, {}); - error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + error = Verify(cert.get(), "127.0.0.1", flags, trust_anchors, &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); EXPECT_TRUE(verify_result.is_issued_by_additional_trust_anchor); // Clearing the |trust_anchors| makes verification fail again (the cache // should be skipped). - SetUpWithAdditionalCerts({}, {}); - error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result.cert_status); EXPECT_FALSE(verify_result.is_issued_by_additional_trust_anchor); } -TEST_P(CertVerifyProcInternalTest, AdditionalIntermediates) { - if (!VerifyProcTypeIsBuiltin()) { - LOG(INFO) << "Skipping this test in this platform."; - return; - } - - auto [leaf, intermediate, root] = CertBuilder::CreateSimpleChain3(); - scoped_refptr<X509Certificate> leaf_cert = leaf->GetX509Certificate(); - scoped_refptr<X509Certificate> intermediate_cert = - intermediate->GetX509Certificate(); - scoped_refptr<X509Certificate> root_cert = root->GetX509Certificate(); - constexpr char kHostname[] = "www.example.com"; - - ScopedTestRoot trust_root(root_cert); - // Leaf should not verify without intermediate found - EXPECT_THAT(Verify(leaf_cert.get(), kHostname), - IsError(ERR_CERT_AUTHORITY_INVALID)); - - // Leaf should verify after intermediate is passed in to CertVerifyProc. Chain - // should be {leaf, intermediate, root}. - SetUpWithAdditionalCerts({}, {intermediate->GetX509Certificate()}); - CertVerifyResult verify_result; - int error = Verify(leaf_cert.get(), kHostname, /*flags=*/0, &verify_result); - EXPECT_THAT(error, IsOk()); - ASSERT_TRUE(verify_result.verified_cert); - EXPECT_EQ(verify_result.verified_cert->intermediate_buffers().size(), 2U); - EXPECT_TRUE(x509_util::CryptoBufferEqual( - verify_result.verified_cert->intermediate_buffers().back().get(), - root_cert->cert_buffer())); - EXPECT_TRUE(x509_util::CryptoBufferEqual( - verify_result.verified_cert->intermediate_buffers().front().get(), - intermediate_cert->cert_buffer())); -} - -TEST_P(CertVerifyProcInternalTest, AdditionalTrustAnchorDuplicateIntermediate) { - if (!VerifyProcTypeIsBuiltin()) { - LOG(INFO) << "Skipping this test in this platform."; - return; - } - - auto [leaf, intermediate, root] = CertBuilder::CreateSimpleChain3(); - constexpr char kHostname[] = "www.example.com"; - - // Leaf should not verify without anything set up. - EXPECT_THAT(Verify(leaf->GetX509Certificate().get(), kHostname), - IsError(ERR_CERT_AUTHORITY_INVALID)); - - // Leaf should verify with intermediate and root added. - CertificateList trust_anchors, intermediates; - intermediates.push_back(intermediate->GetX509Certificate()); - trust_anchors.push_back(root->GetX509Certificate()); - SetUpWithAdditionalCerts(trust_anchors, intermediates); - EXPECT_THAT(Verify(leaf->GetX509Certificate().get(), kHostname), IsOk()); - - // Leaf should still verify after root is also in intermediates list. - intermediates.push_back(root->GetX509Certificate()); - SetUpWithAdditionalCerts(trust_anchors, intermediates); - EXPECT_THAT(Verify(leaf->GetX509Certificate().get(), kHostname), IsOk()); -} - // Tests that certificates issued by user-supplied roots are not flagged as // issued by a known root. This should pass whether or not the platform supports // detecting known roots. @@ -1997,7 +1952,8 @@ // Verification should pass. int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); // But should not be marked as a known root. @@ -2025,7 +1981,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); @@ -2039,7 +1996,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); // Second, test revocation by serial number of a cert directly under the @@ -2051,7 +2009,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); } @@ -2075,7 +2034,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(leaf.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(leaf.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); // Test revocation by serial number of a certificate not under the root. @@ -2087,7 +2047,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(leaf.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(leaf.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); } @@ -2111,7 +2072,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(leaf.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(leaf.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); // Test revocation of the root itself. @@ -2123,7 +2085,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(leaf.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(leaf.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); EXPECT_EQ(3u, verify_result.public_key_hashes.size()); @@ -2154,7 +2117,8 @@ // Confirm that verifying the certificate chain with an empty CRLSet succeeds. SetUpCertVerifyProc(CRLSet::EmptyCRLSetForTesting()); - int error = Verify(leaf.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(leaf.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); std::string crl_set_bytes; @@ -2167,7 +2131,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(leaf.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(leaf.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); // Revoke the root by subject. Verification should now fail. @@ -2177,7 +2142,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(leaf.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(leaf.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); // Revoke the leaf by subject, but only if the SPKI doesn't match the given @@ -2188,7 +2154,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(leaf.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(leaf.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); } @@ -2211,7 +2178,8 @@ SetUpCertVerifyProc(crl_set); int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); @@ -2224,7 +2192,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); if (SupportsCRLSet()) { EXPECT_THAT(error, IsError(ERR_CERT_KNOWN_INTERCEPTION_BLOCKED)); EXPECT_TRUE(verify_result.cert_status & @@ -2254,7 +2223,8 @@ SetUpCertVerifyProc(crl_set); int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); @@ -2267,7 +2237,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); if (SupportsCRLSet()) { EXPECT_THAT(error, IsError(ERR_CERT_KNOWN_INTERCEPTION_BLOCKED)); EXPECT_TRUE(verify_result.cert_status & @@ -2284,7 +2255,8 @@ ASSERT_TRUE(second_cert); SetUpCertVerifyProc(crl_set); - error = Verify(second_cert.get(), "127.0.0.1", flags, &verify_result); + error = Verify(second_cert.get(), "127.0.0.1", flags, CertificateList(), + &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); } @@ -2307,7 +2279,8 @@ SetUpCertVerifyProc(crl_set); int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + int error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); @@ -2320,7 +2293,8 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, &crl_set)); SetUpCertVerifyProc(crl_set); - error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + error = + Verify(cert.get(), "127.0.0.1", flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_KNOWN_INTERCEPTION_DETECTED); @@ -2411,7 +2385,8 @@ SetUpCertVerifyProc(crl_set); int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "127.0.0.1", flags, &verify_result); + int error = Verify(cert.get(), "127.0.0.1", flags, CertificateList(), + &verify_result); if (!testcase.expect_valid) { EXPECT_NE(OK, error); @@ -2457,7 +2432,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.example.com", flags, &verify_result); + int error = Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result); // Current time is before certificate's notBefore. Verification should fail. EXPECT_THAT(error, IsError(ERR_CERT_DATE_INVALID)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_DATE_INVALID); @@ -2476,7 +2452,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.example.com", flags, &verify_result); + int error = Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result); // Current time is before certificate's notBefore. Verification should fail. EXPECT_THAT(error, IsError(ERR_CERT_DATE_INVALID)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_DATE_INVALID); @@ -2495,7 +2472,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.example.com", flags, &verify_result); + int error = Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result); // Current time is before certificate's notBefore. Verification should fail. EXPECT_THAT(error, IsError(ERR_CERT_DATE_INVALID)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_DATE_INVALID); @@ -2514,7 +2492,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.example.com", flags, &verify_result); + int error = Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result); // Current time is between notBefore and notAfter. Verification should // succeed. EXPECT_THAT(error, IsOk()); @@ -2533,7 +2512,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.example.com", flags, &verify_result); + int error = Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result); // Current time is between notBefore and notAfter. Verification should // succeed. EXPECT_THAT(error, IsOk()); @@ -2552,7 +2532,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain.get(), "www.example.com", flags, &verify_result); + int error = Verify(chain.get(), "www.example.com", flags, CertificateList(), + &verify_result); // Current time is after certificate's notAfter. Verification should fail. EXPECT_THAT(error, IsError(ERR_CERT_DATE_INVALID)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_DATE_INVALID); @@ -2579,7 +2560,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "www.example.com", flags, &verify_result); + int error = Verify(cert.get(), "www.example.com", flags, CertificateList(), + &verify_result); // The intermediate was signed by a different root with a different key but // with the same name as the trusted one, and the intermediate has no @@ -2618,7 +2600,8 @@ int flags = 0; CertVerifyResult verify_result; - int error = Verify(cert.get(), "www.example.com", flags, &verify_result); + int error = Verify(cert.get(), "www.example.com", flags, CertificateList(), + &verify_result); // The leaf was signed by a different intermediate with a different key but // with the same name as the one in the chain, and the leaf has no @@ -2685,7 +2668,7 @@ int flags = 0; CertVerifyResult verify_result; int error = Verify(leaf->GetX509CertificateChain().get(), "www.example.com", - flags, &verify_result); + flags, CertificateList(), &verify_result); switch (verify_proc_type()) { case CERT_VERIFY_PROC_IOS: @@ -2718,7 +2701,7 @@ int flags = 0; CertVerifyResult verify_result; int error = Verify(leaf->GetX509CertificateChain().get(), "www.example.com", - flags, &verify_result); + flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); ExpectNormalizationHistogram(error); @@ -2741,7 +2724,7 @@ int flags = 0; CertVerifyResult verify_result; int error = Verify(leaf->GetX509CertificateChain().get(), "www.example.com", - flags, &verify_result); + flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); ExpectByteEqualHistogram(); @@ -2810,9 +2793,7 @@ void SetUpCertVerifyProc(scoped_refptr<CRLSet> crl_set) override { EXPECT_TRUE(cert_net_fetcher_); - SetUpWithCertNetFetcher(cert_net_fetcher_, std::move(crl_set), - /*additional_trust_anchors=*/{}, - /*additional_untrusted_authorities=*/{}); + SetUpWithCertNetFetcher(cert_net_fetcher_, std::move(crl_set)); } void TearDown() override { @@ -3022,7 +3003,8 @@ // Verifying the chain should fail as the intermediate is missing, and // cannot be fetched via AIA. - error = Verify(leaf.get(), kHostname, flags, &verify_result); + error = + Verify(leaf.get(), kHostname, flags, CertificateList(), &verify_result); EXPECT_NE(OK, error); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); @@ -3067,9 +3049,9 @@ // If VERIFY_DISABLE_NETWORK_FETCHES is specified, AIA should not be // attempted and verifying the chain should fail since the intermediate // can't be found. - int error = - Verify(leaf.get(), kHostname, - CertVerifyProc::VERIFY_DISABLE_NETWORK_FETCHES, &verify_result); + int error = Verify(leaf.get(), kHostname, + CertVerifyProc::VERIFY_DISABLE_NETWORK_FETCHES, + CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(0u, verify_result.verified_cert->intermediate_buffers().size()); } @@ -3078,7 +3060,8 @@ CertVerifyResult verify_result; // Verifying the chain should succeed as the missing intermediate can be // fetched via AIA. - int error = Verify(leaf.get(), kHostname, /*flags=*/0, &verify_result); + int error = Verify(leaf.get(), kHostname, /*flags=*/0, CertificateList(), + &verify_result); EXPECT_THAT(error, IsOk()); } } @@ -3127,7 +3110,8 @@ // Verifying the chain should succeed as the missing intermediate can be // fetched via AIA. - error = Verify(leaf.get(), kHostname, flags, &verify_result); + error = + Verify(leaf.get(), kHostname, flags, CertificateList(), &verify_result); if (verify_proc_type() == CERT_VERIFY_PROC_ANDROID) { // Android doesn't support PEM - https://crbug.com/725180 @@ -3180,7 +3164,8 @@ // Verifying the chain should succeed as the missing intermediate can be // fetched via AIA. - error = Verify(leaf.get(), kHostname, flags, &verify_result); + error = + Verify(leaf.get(), kHostname, flags, CertificateList(), &verify_result); if (verify_proc_type() == CERT_VERIFY_PROC_ANDROID) { // Android doesn't support PEM - https://crbug.com/725180 @@ -3239,7 +3224,8 @@ const int flags = 0; CertVerifyResult verify_result; - int error = Verify(chain_sha1.get(), kHostname, flags, &verify_result); + int error = Verify(chain_sha1.get(), kHostname, flags, CertificateList(), + &verify_result); if (VerifyProcTypeIsBuiltin()) { // Should have built a chain through the SHA256 intermediate. This was only @@ -3291,7 +3277,8 @@ // Verify with hard-fail revocation checking for local anchors. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsError(ERR_CERT_NO_REVOCATION_MECHANISM)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_REV_CHECKING_ENABLED); @@ -3319,7 +3306,8 @@ const int flags = CertVerifyProc::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS | CertVerifyProc::VERIFY_DISABLE_NETWORK_FETCHES; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should succeed, VERIFY_DISABLE_NETWORK_FETCHES takes priority. EXPECT_THAT(error, IsOk()); @@ -3354,7 +3342,8 @@ // Verify with hard-fail revocation checking for local anchors. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should pass, leaf and intermediate were covered by CRLs and were not // revoked. @@ -3393,7 +3382,8 @@ // Verify with hard-fail revocation checking for local anchors. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should pass, leaf and intermediate were covered by CRLs and were not // revoked. @@ -3427,7 +3417,8 @@ // Verify with hard-fail revocation checking for local anchors. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should fail, leaf is revoked. EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); @@ -3460,7 +3451,8 @@ // Verify with hard-fail revocation checking for local anchors. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should fail, intermediate is revoked. EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); @@ -3496,7 +3488,8 @@ // Verify with hard-fail revocation checking for local anchors. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should fail since no revocation information was available for the leaf. EXPECT_THAT(error, IsError(ERR_CERT_UNABLE_TO_CHECK_REVOCATION)); @@ -3532,7 +3525,8 @@ // Verify with hard-fail revocation checking for local anchors. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should fail since no revocation information was available for the // intermediate. @@ -3559,7 +3553,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_FALSE(verify_result.cert_status & CERT_STATUS_NO_REVOCATION_MECHANISM); @@ -3596,7 +3591,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_REV_CHECKING_ENABLED); @@ -3633,7 +3629,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_REV_CHECKING_ENABLED); @@ -3665,7 +3662,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should fail, leaf is revoked. EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); @@ -3700,7 +3698,8 @@ const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED | CertVerifyProc::VERIFY_DISABLE_NETWORK_FETCHES; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should succeed, VERIFY_DISABLE_NETWORK_FETCHES takes priority. EXPECT_THAT(error, IsOk()); @@ -3733,7 +3732,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should fail, intermediate is revoked. EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); @@ -3768,7 +3768,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should fail, leaf is revoked. EXPECT_THAT(error, IsError(ERR_CERT_REVOKED)); @@ -3809,7 +3810,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Verification should succeed: MD5 signature algorithm is not supported // and soft-fail checking will ignore the inability to get revocation @@ -3847,7 +3849,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should succeed due to soft-fail revocation checking. EXPECT_THAT(error, IsOk()); @@ -3883,7 +3886,8 @@ // Verify with soft-fail revocation checking. const int flags = CertVerifyProc::VERIFY_REV_CHECKING_ENABLED; CertVerifyResult verify_result; - int error = Verify(chain.get(), kHostname, flags, &verify_result); + int error = + Verify(chain.get(), kHostname, flags, CertificateList(), &verify_result); // Should succeed due to soft-fail revocation checking. EXPECT_THAT(error, IsOk()); @@ -3926,7 +3930,7 @@ CertVerifyResult verify_result; int flags = 0; int error = Verify(chain.get(), ocsp_test_server.host_port_pair().host(), - flags, &verify_result); + flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_IS_EV); EXPECT_FALSE(verify_result.cert_status & CERT_STATUS_REV_CHECKING_ENABLED); @@ -3968,7 +3972,7 @@ CertVerifyResult verify_result; int flags = 0; int error = Verify(chain.get(), ocsp_test_server.host_port_pair().host(), - flags, &verify_result); + flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_IS_EV); EXPECT_FALSE(verify_result.cert_status & CERT_STATUS_REV_CHECKING_ENABLED); @@ -4010,7 +4014,7 @@ CertVerifyResult verify_result; int flags = 0; int error = Verify(chain.get(), ocsp_test_server.host_port_pair().host(), - flags, &verify_result); + flags, CertificateList(), &verify_result); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_IS_EV); EXPECT_FALSE(verify_result.cert_status & CERT_STATUS_REV_CHECKING_ENABLED); @@ -4033,7 +4037,7 @@ int flags = 0; return CertVerifyProcInternalTest::Verify( chain_.front()->GetX509CertificateChain().get(), "www.example.com", - flags, &verify_result); + flags, CertificateList(), &verify_result); } int Verify() { @@ -4994,7 +4998,7 @@ int flags = 0; return CertVerifyProcInternalTest::Verify( chain_.front()->GetX509Certificate().get(), "www.example.com", flags, - &verify_result); + CertificateList(), &verify_result); } int Verify() { @@ -5298,9 +5302,9 @@ ScopedTestRoot test_root(cert_->GetX509Certificate(), trust); CertVerifyResult verify_result; int flags = 0; - return CertVerifyProcInternalTest::Verify(cert_->GetX509Certificate().get(), - "www.example.com", flags, - &verify_result); + return CertVerifyProcInternalTest::Verify( + cert_->GetX509Certificate().get(), "www.example.com", flags, + CertificateList(), &verify_result); } int Verify() { @@ -5589,7 +5593,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_WEAK_SIGNATURE_ALGORITHM)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM); @@ -5598,7 +5603,8 @@ verify_result.Reset(); error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_WEAK_SIGNATURE_ALGORITHM)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM); } @@ -5618,7 +5624,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_WEAK_SIGNATURE_ALGORITHM)); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_SHA1_SIGNATURE_PRESENT); @@ -5627,7 +5634,8 @@ verify_result.Reset(); error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_TRUE(verify_result.cert_status & CERT_STATUS_SHA1_SIGNATURE_PRESENT); } @@ -5710,8 +5718,8 @@ auto proc = base::MakeRefCounted<MockCertVerifyProc>(CertVerifyResult()); int error = proc->Verify(ee_chain.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, - NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), + &verify_result, NetLogWithSource()); EXPECT_EQ(!!(data.expected_algorithms & EXPECT_SHA1), verify_result.has_sha1); EXPECT_EQ(!!(data.expected_algorithms & EXPECT_STATUS_INVALID), !!(verify_result.cert_status & CERT_STATUS_INVALID)); @@ -5836,7 +5844,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), hostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), 0, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), 0, CertificateList(), &verify_result, + NetLogWithSource()); if (valid) { EXPECT_THAT(error, IsOk()); EXPECT_FALSE(verify_result.cert_status & CERT_STATUS_COMMON_NAME_INVALID); @@ -5947,7 +5956,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_EQ(OK, error); histograms.ExpectUniqueSample(kTrustAnchorVerifyHistogram, kGTSRootR4HistogramID, 1); @@ -5994,7 +6004,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_EQ(OK, error); // Only GTS Root R3 should be recorded. @@ -6031,10 +6042,11 @@ int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify( - leaf->GetX509Certificate().get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + int error = + verify_proc->Verify(leaf->GetX509Certificate().get(), "www.example.com", + /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, CertificateList(), + &verify_result, NetLogWithSource()); EXPECT_EQ(OK, error); const base::HistogramBase::Sample kUnknownRootHistogramID = 0; histograms.ExpectUniqueSample(kTrustAnchorVerifyHistogram, @@ -6061,10 +6073,11 @@ int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(cert.get(), "127.0.0.1", - /*ocsp_response=*/"invalid OCSP data", - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = + verify_proc->Verify(cert.get(), "127.0.0.1", + /*ocsp_response=*/"invalid OCSP data", + /*sct_list=*/std::string(), flags, CertificateList(), + &verify_result, NetLogWithSource()); EXPECT_EQ(OK, error); EXPECT_EQ(bssl::OCSPVerifyResult::PROVIDED, @@ -6094,7 +6107,8 @@ CertVerifyResult verify_result; int error = verify_proc->Verify( cert.get(), "127.0.0.1", /*ocsp_response=*/"invalid OCSP data", - /*sct_list=*/std::string(), flags, &verify_result, NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), &verify_result, + NetLogWithSource()); EXPECT_EQ(OK, error); EXPECT_EQ(bssl::OCSPVerifyResult::PARSE_RESPONSE_ERROR,
diff --git a/net/cert/internal/system_trust_store.cc b/net/cert/internal/system_trust_store.cc index b912ddf..68201b4 100644 --- a/net/cert/internal/system_trust_store.cc +++ b/net/cert/internal/system_trust_store.cc
@@ -52,26 +52,6 @@ namespace net { -namespace { - -class DummySystemTrustStore : public SystemTrustStore { - public: - bssl::TrustStore* GetTrustStore() override { return &trust_store_; } - - bool IsKnownRoot(const bssl::ParsedCertificate* trust_anchor) const override { - return false; - } - -#if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) - int64_t chrome_root_store_version() const override { return 0; } -#endif - - private: - bssl::TrustStoreCollection trust_store_; -}; - -} // namespace - #if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) class SystemTrustStoreChromeWithUnOwnedSystemStore : public SystemTrustStore { public: @@ -97,7 +77,7 @@ return trust_store_chrome_->Contains(trust_anchor); } - int64_t chrome_root_store_version() const override { + int64_t chrome_root_store_version() override { return trust_store_chrome_->version(); } @@ -312,8 +292,4 @@ #endif -std::unique_ptr<SystemTrustStore> CreateEmptySystemTrustStore() { - return std::make_unique<DummySystemTrustStore>(); -} - } // namespace net
diff --git a/net/cert/internal/system_trust_store.h b/net/cert/internal/system_trust_store.h index 75722b6..cb602c7e 100644 --- a/net/cert/internal/system_trust_store.h +++ b/net/cert/internal/system_trust_store.h
@@ -41,7 +41,7 @@ #if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) // Returns the current version of the Chrome Root Store being used. If // Chrome Root Store is not in use, returns 0. - virtual int64_t chrome_root_store_version() const = 0; + virtual int64_t chrome_root_store_version() = 0; #endif }; @@ -67,10 +67,6 @@ std::unique_ptr<bssl::TrustStore> trust_store_system); #endif // BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) -// Creates an instance of SystemTrustStore that initially does not have any -// trust roots. -NET_EXPORT std::unique_ptr<SystemTrustStore> CreateEmptySystemTrustStore(); - #if BUILDFLAG(IS_MAC) // Initializes trust cache on a worker thread, if the builtin verifier is // enabled.
diff --git a/net/cert/multi_threaded_cert_verifier.cc b/net/cert/multi_threaded_cert_verifier.cc index 77bbe3f..056fc35c 100644 --- a/net/cert/multi_threaded_cert_verifier.cc +++ b/net/cert/multi_threaded_cert_verifier.cc
@@ -11,16 +11,22 @@ #include "base/memory/weak_ptr.h" #include "base/task/thread_pool.h" #include "base/threading/thread_restrictions.h" +#include "crypto/crypto_buildflags.h" #include "net/base/net_errors.h" #include "net/base/trace_constants.h" #include "net/base/tracing.h" #include "net/cert/cert_verify_proc.h" #include "net/cert/cert_verify_result.h" +#include "net/cert/crl_set.h" #include "net/cert/x509_certificate.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_source_type.h" #include "net/log/net_log_with_source.h" +#if BUILDFLAG(USE_NSS_CERTS) +#include "net/cert/x509_util_nss.h" +#endif + namespace net { // Allows DoVerifyOnWorkerThread to wait on a base::WaitableEvent. @@ -65,15 +71,16 @@ const std::string& ocsp_response, const std::string& sct_list, int flags, + const CertificateList& additional_trust_anchors, const NetLogWithSource& net_log) { TRACE_EVENT0(NetTracingCategory(), "DoVerifyOnWorkerThread"); auto verify_result = std::make_unique<ResultHelper>(); verify_result->net_log = net_log; MultiThreadedCertVerifierScopedAllowBaseSyncPrimitives allow_base_sync_primitives; - verify_result->error = - verify_proc->Verify(cert.get(), hostname, ocsp_response, sct_list, flags, - &verify_result->result, net_log); + verify_result->error = verify_proc->Verify( + cert.get(), hostname, ocsp_response, sct_list, flags, + additional_trust_anchors, &verify_result->result, net_log); return verify_result; } @@ -145,7 +152,8 @@ {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::BindOnce(&DoVerifyOnWorkerThread, verify_proc, params.certificate(), params.hostname(), params.ocsp_response(), - params.sct_list(), flags, net_log), + params.sct_list(), flags, config.additional_trust_anchors, + net_log), base::BindOnce(&MultiThreadedCertVerifier::InternalRequest::OnJobComplete, weak_factory_.GetWeakPtr())); } @@ -224,17 +232,48 @@ void MultiThreadedCertVerifier::UpdateVerifyProcData( scoped_refptr<CertNetFetcher> cert_net_fetcher, - const net::CertVerifyProc::ImplParams& impl_params, - const net::CertVerifyProc::InstanceParams& instance_params) { + const net::CertVerifyProcFactory::ImplParams& impl_params) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); verify_proc_ = verify_proc_factory_->CreateCertVerifyProc( - std::move(cert_net_fetcher), impl_params, instance_params); + std::move(cert_net_fetcher), impl_params); CHECK(verify_proc_); NotifyCertVerifierChanged(); } void MultiThreadedCertVerifier::SetConfig(const CertVerifier::Config& config) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + LOG_IF(DFATAL, verify_proc_ && + !verify_proc_->SupportsAdditionalTrustAnchors() && + !config.additional_trust_anchors.empty()) + << "Attempted to set a CertVerifier::Config with additional trust " + "anchors, but |verify_proc_| does not support additional trust " + "anchors."; + +// TODO(https://crbug.com/978854): Pass these into the actual CertVerifyProc +// rather than relying on global side-effects. +#if !BUILDFLAG(USE_NSS_CERTS) + // Not yet implemented. + DCHECK(config.additional_untrusted_authorities.empty()); +#else + // Construct a temporary list and then swap that into the member variable, to + // be polite to any verifications that might be in progress in a background + // thread. This ensures that, at least for certs that are present in both the + // old and new config, there will not be a time when the refcount drops to + // zero. For the case where a cert was in the old config and is not in the + // new config, it might be removed while a verification is still going on + // that might be able to use it. Oh well. Ideally the list should be passed + // into CertVerifyProc as noted by the TODO(https://crbug.com/978854), since + // the workers could then keep a reference to the appropriate certs as long + // as they need. + net::ScopedCERTCertificateList temp_certs; + for (const auto& cert : config.additional_untrusted_authorities) { + ScopedCERTCertificate nss_cert = + x509_util::CreateCERTCertificateFromX509Certificate(cert.get()); + if (nss_cert) + temp_certs.push_back(std::move(nss_cert)); + } + temp_certs_ = std::move(temp_certs); +#endif config_ = config; }
diff --git a/net/cert/multi_threaded_cert_verifier.h b/net/cert/multi_threaded_cert_verifier.h index 33efec6..368368c 100644 --- a/net/cert/multi_threaded_cert_verifier.h +++ b/net/cert/multi_threaded_cert_verifier.h
@@ -15,9 +15,14 @@ #include "base/memory/scoped_refptr.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" +#include "crypto/crypto_buildflags.h" #include "net/base/net_export.h" #include "net/cert/cert_verifier.h" +#if BUILDFLAG(USE_NSS_CERTS) +#include "net/cert/scoped_nss_types.h" +#endif + namespace net { class CertVerifyProc; @@ -52,8 +57,7 @@ void RemoveObserver(Observer* observer) override; void UpdateVerifyProcData( scoped_refptr<CertNetFetcher> cert_net_fetcher, - const net::CertVerifyProc::ImplParams& impl_params, - const net::CertVerifyProc::InstanceParams& instance_params) override; + const net::CertVerifyProcFactory::ImplParams& impl_params) override; private: class InternalRequest; @@ -72,6 +76,14 @@ // don't call them later, as required by the CertVerifier contract. base::LinkedList<InternalRequest> request_list_; +#if BUILDFLAG(USE_NSS_CERTS) + // Holds NSS temporary certificates that will be exposed as untrusted + // authorities by SystemCertStoreNSS. + // TODO(https://crbug.com/978854): Pass these into the actual CertVerifyProc + // rather than relying on global side-effects. + net::ScopedCERTCertificateList temp_certs_; +#endif + THREAD_CHECKER(thread_checker_); };
diff --git a/net/cert/multi_threaded_cert_verifier_unittest.cc b/net/cert/multi_threaded_cert_verifier_unittest.cc index 7423c7a..05fcc9f 100644 --- a/net/cert/multi_threaded_cert_verifier_unittest.cc +++ b/net/cert/multi_threaded_cert_verifier_unittest.cc
@@ -45,12 +45,13 @@ class MockCertVerifyProc : public CertVerifyProc { public: MockCertVerifyProc() : CertVerifyProc(CRLSet::BuiltinCRLSet()) {} - MOCK_METHOD7(VerifyInternal, + MOCK_METHOD8(VerifyInternal, int(X509Certificate*, const std::string&, const std::string&, const std::string&, int, + const CertificateList&, CertVerifyResult*, const NetLogWithSource&)); MOCK_CONST_METHOD0(SupportsAdditionalTrustAnchors, bool()); @@ -61,7 +62,7 @@ ACTION(SetCertVerifyResult) { X509Certificate* cert = arg0; - CertVerifyResult* result = arg5; + CertVerifyResult* result = arg6; result->Reset(); result->verified_cert = cert; result->cert_status = CERT_STATUS_COMMON_NAME_INVALID; @@ -69,7 +70,7 @@ ACTION(SetCertVerifyRevokedResult) { X509Certificate* cert = arg0; - CertVerifyResult* result = arg5; + CertVerifyResult* result = arg6; result->Reset(); result->verified_cert = cert; result->cert_status = CERT_STATUS_REVOKED; @@ -82,8 +83,7 @@ scoped_refptr<net::CertVerifyProc> CreateCertVerifyProc( scoped_refptr<CertNetFetcher> cert_net_fetcher, - const CertVerifyProc::ImplParams& impl_params, - const CertVerifyProc::InstanceParams& instance_params) override { + const ImplParams& impl_params) override { return mock_verify_proc_; } @@ -105,7 +105,7 @@ mock_new_verify_proc_))) { EXPECT_CALL(*mock_verify_proc_, SupportsAdditionalTrustAnchors()) .WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_verify_proc_, VerifyInternal(_, _, _, _, _, _, _)) + EXPECT_CALL(*mock_verify_proc_, VerifyInternal(_, _, _, _, _, _, _, _)) .WillRepeatedly( DoAll(SetCertVerifyResult(), Return(ERR_CERT_COMMON_NAME_INVALID))); } @@ -276,7 +276,7 @@ verifier_->SetConfig(config); EXPECT_CALL(*mock_verify_proc_, - VerifyInternal(_, _, _, _, test_config.expected_flag, _, _)) + VerifyInternal(_, _, _, _, test_config.expected_flag, _, _, _)) .WillRepeatedly( DoAll(SetCertVerifyRevokedResult(), Return(ERR_CERT_REVOKED))); @@ -307,7 +307,7 @@ EXPECT_CALL( *mock_verify_proc_, VerifyInternal(_, _, _, _, CertVerifyProc::VERIFY_DISABLE_NETWORK_FETCHES, - _, _)) + _, _, _)) .WillRepeatedly( DoAll(SetCertVerifyRevokedResult(), Return(ERR_CERT_REVOKED))); @@ -340,10 +340,10 @@ EXPECT_EQ(observer_counter.change_count(), 0u); - EXPECT_CALL(*mock_new_verify_proc_, VerifyInternal(_, _, _, _, _, _, _)) + EXPECT_CALL(*mock_new_verify_proc_, VerifyInternal(_, _, _, _, _, _, _, _)) .WillRepeatedly( DoAll(SetCertVerifyRevokedResult(), Return(ERR_CERT_REVOKED))); - verifier_->UpdateVerifyProcData(nullptr, {}, {}); + verifier_->UpdateVerifyProcData(nullptr, {}); EXPECT_EQ(observer_counter.change_count(), 1u); @@ -383,7 +383,7 @@ &verify_result, callback.callback(), &request, NetLogWithSource()); ASSERT_THAT(error, IsError(ERR_IO_PENDING)); EXPECT_TRUE(request); - verifier_->UpdateVerifyProcData(nullptr, {}, {}); + verifier_->UpdateVerifyProcData(nullptr, {}); error = callback.WaitForResult(); EXPECT_TRUE(IsCertificateError(error)); EXPECT_THAT(error, IsError(ERR_CERT_COMMON_NAME_INVALID));
diff --git a/net/cert/nss_cert_database_unittest.cc b/net/cert/nss_cert_database_unittest.cc index 8be2e31..4792cc6a 100644 --- a/net/cert/nss_cert_database_unittest.cc +++ b/net/cert/nss_cert_database_unittest.cc
@@ -207,6 +207,10 @@ std::unique_ptr<NSSCertDatabase> cert_db_; std::unique_ptr<MockNSSCertDatabaseObserver> observer_; + // When building with libstdc++, |empty_cert_list_| does not have a default + // constructor. Initialize it explicitly so that CertDatabaseNSSTest gets a + // default constructor. + const CertificateList empty_cert_list_ = CertificateList(); crypto::ScopedTestNSSDB test_nssdb_; crypto::ScopedPK11Slot public_slot_; scoped_refptr<CRLSet> crl_set_; @@ -849,14 +853,13 @@ ASSERT_TRUE(x509_found_server_cert); scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_found_server_cert.get(), "127.0.0.1", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_found_server_cert.get(), "127.0.0.1", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result.cert_status); @@ -888,14 +891,13 @@ ASSERT_TRUE(x509_puny_cert); scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_puny_cert.get(), "xn--wgv71a119e.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_puny_cert.get(), "xn--wgv71a119e.com", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result.cert_status); @@ -928,14 +930,13 @@ ASSERT_TRUE(x509_puny_cert); scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_puny_cert.get(), "xn--wgv71a119e.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_puny_cert.get(), "xn--wgv71a119e.com", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); if (base::FeatureList::IsEnabled(features::kTrustStoreTrustedLeafSupport)) { EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); @@ -978,14 +979,13 @@ ASSERT_TRUE(x509_server_cert); scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_server_cert.get(), "127.0.0.1", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_server_cert.get(), "127.0.0.1", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); } @@ -1022,14 +1022,13 @@ ASSERT_TRUE(x509_server_cert); scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_server_cert.get(), "127.0.0.1", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_server_cert.get(), "127.0.0.1", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result.cert_status); } @@ -1082,14 +1081,13 @@ // Server cert should verify. scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_server_cert.get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_server_cert.get(), "www.example.com", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); @@ -1112,10 +1110,11 @@ // Server cert should fail to verify. CertVerifyResult verify_result2; - error = verify_proc->Verify(x509_server_cert.get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result2, NetLogWithSource()); + error = + verify_proc->Verify(x509_server_cert.get(), "www.example.com", + /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, empty_cert_list_, + &verify_result2, NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result2.cert_status); } @@ -1149,14 +1148,13 @@ // Server cert should verify. scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_server_cert.get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_server_cert.get(), "www.example.com", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); @@ -1166,10 +1164,11 @@ // Server cert should fail to verify. CertVerifyResult verify_result2; - error = verify_proc->Verify(x509_server_cert.get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result2, NetLogWithSource()); + error = + verify_proc->Verify(x509_server_cert.get(), "www.example.com", + /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, empty_cert_list_, + &verify_result2, NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result2.cert_status); } @@ -1214,14 +1213,13 @@ // Server cert should verify. scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_server_cert.get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_server_cert.get(), "www.example.com", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result.cert_status); @@ -1231,10 +1229,11 @@ // Server cert should fail to verify. CertVerifyResult verify_result2; - error = verify_proc->Verify(x509_server_cert.get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result2, NetLogWithSource()); + error = + verify_proc->Verify(x509_server_cert.get(), "www.example.com", + /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, empty_cert_list_, + &verify_result2, NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result2.cert_status); } @@ -1279,14 +1278,13 @@ // Server cert should not verify. scoped_refptr<CertVerifyProc> verify_proc( CertVerifyProc::CreateBuiltinWithChromeRootStore( - /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr, - /*instance_params=*/{})); + /*cert_net_fetcher=*/nullptr, crl_set_, /*root_store_data=*/nullptr)); int flags = 0; CertVerifyResult verify_result; - int error = verify_proc->Verify(x509_server_cert.get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result, NetLogWithSource()); + int error = verify_proc->Verify( + x509_server_cert.get(), "www.example.com", + /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, + empty_cert_list_, &verify_result, NetLogWithSource()); EXPECT_THAT(error, IsError(ERR_CERT_AUTHORITY_INVALID)); EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, verify_result.cert_status); @@ -1296,10 +1294,11 @@ // Server cert should verify. CertVerifyResult verify_result2; - error = verify_proc->Verify(x509_server_cert.get(), "www.example.com", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &verify_result2, NetLogWithSource()); + error = + verify_proc->Verify(x509_server_cert.get(), "www.example.com", + /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, empty_cert_list_, + &verify_result2, NetLogWithSource()); EXPECT_THAT(error, IsOk()); EXPECT_EQ(0U, verify_result2.cert_status); }
diff --git a/net/cert/test_root_certs_unittest.cc b/net/cert/test_root_certs_unittest.cc index a2bf28b..ce501d05 100644 --- a/net/cert/test_root_certs_unittest.cc +++ b/net/cert/test_root_certs_unittest.cc
@@ -39,17 +39,16 @@ if (base::FeatureList::IsEnabled(features::kChromeRootStoreUsed)) { return CertVerifyProc::CreateBuiltinWithChromeRootStore( /*cert_net_fetcher=*/nullptr, CRLSet::BuiltinCRLSet().get(), - /*root_store_data=*/nullptr, /*instance_params=*/{}); + /*root_store_data=*/nullptr); } #endif #if BUILDFLAG(CHROME_ROOT_STORE_ONLY) return CertVerifyProc::CreateBuiltinWithChromeRootStore( /*cert_net_fetcher=*/nullptr, CRLSet::BuiltinCRLSet().get(), - /*root_store_data=*/nullptr, /*instance_params=*/{}); + /*root_store_data=*/nullptr); #elif BUILDFLAG(IS_FUCHSIA) - return CertVerifyProc::CreateBuiltinVerifyProc( - /*cert_net_fetcher=*/nullptr, CRLSet::BuiltinCRLSet().get(), - /*instance_params=*/{}); + return CertVerifyProc::CreateBuiltinVerifyProc(/*cert_net_fetcher=*/nullptr, + CRLSet::BuiltinCRLSet().get()); #else return CertVerifyProc::CreateSystemVerifyProc(/*cert_net_fetcher=*/nullptr, CRLSet::BuiltinCRLSet().get()); @@ -94,10 +93,10 @@ int flags = 0; CertVerifyResult bad_verify_result; scoped_refptr<CertVerifyProc> verify_proc(CreateCertVerifyProc()); - int bad_status = verify_proc->Verify(test_cert.get(), "127.0.0.1", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &bad_verify_result, NetLogWithSource()); + int bad_status = verify_proc->Verify( + test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, CertificateList(), &bad_verify_result, + NetLogWithSource()); EXPECT_NE(OK, bad_status); EXPECT_NE(0u, bad_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID); EXPECT_FALSE(bad_verify_result.is_issued_by_known_root); @@ -114,7 +113,7 @@ CertVerifyResult good_verify_result; int good_status = verify_proc->Verify( test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &good_verify_result, + /*sct_list=*/std::string(), flags, CertificateList(), &good_verify_result, NetLogWithSource()); EXPECT_THAT(good_status, IsOk()); EXPECT_EQ(0u, good_verify_result.cert_status); @@ -129,8 +128,8 @@ CertVerifyResult restored_verify_result; int restored_status = verify_proc->Verify( test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &restored_verify_result, - NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), + &restored_verify_result, NetLogWithSource()); EXPECT_NE(OK, restored_status); EXPECT_NE(0u, restored_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID); @@ -162,7 +161,7 @@ int good_status = verify_proc->Verify(leaf->GetX509Certificate().get(), "www.example.com", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, + /*sct_list=*/std::string(), flags, CertificateList(), &good_verify_result, NetLogWithSource()); EXPECT_THAT(good_status, IsOk()); EXPECT_EQ(0u, good_verify_result.cert_status); @@ -181,7 +180,7 @@ int restored_status = verify_proc->Verify(leaf->GetX509Certificate().get(), "www.example.com", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, + /*sct_list=*/std::string(), flags, CertificateList(), &restored_verify_result, NetLogWithSource()); EXPECT_THAT(restored_status, IsOk()); EXPECT_EQ(0u, restored_verify_result.cert_status); @@ -208,10 +207,10 @@ // Test that the good certificate fails verification, because the root // certificate should not yet be trusted. - bad_status = verify_proc->Verify(test_cert.get(), "127.0.0.1", - /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, - &bad_verify_result, NetLogWithSource()); + bad_status = verify_proc->Verify( + test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), + /*sct_list=*/std::string(), flags, CertificateList(), + &bad_verify_result, NetLogWithSource()); EXPECT_NE(OK, bad_status); EXPECT_NE(0u, bad_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID); @@ -229,8 +228,8 @@ CertVerifyResult good_verify_result; int good_status = verify_proc->Verify( test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &good_verify_result, - NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), + &good_verify_result, NetLogWithSource()); EXPECT_THAT(good_status, IsOk()); EXPECT_EQ(0u, good_verify_result.cert_status); @@ -251,8 +250,8 @@ CertVerifyResult good_verify_result; int good_status = verify_proc->Verify( test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &good_verify_result, - NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), + &good_verify_result, NetLogWithSource()); EXPECT_THAT(good_status, IsOk()); EXPECT_EQ(0u, good_verify_result.cert_status); } @@ -264,8 +263,8 @@ CertVerifyResult restored_verify_result; int restored_status = verify_proc->Verify( test_cert.get(), "127.0.0.1", /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, &restored_verify_result, - NetLogWithSource()); + /*sct_list=*/std::string(), flags, CertificateList(), + &restored_verify_result, NetLogWithSource()); EXPECT_NE(OK, restored_status); EXPECT_NE(0u, restored_verify_result.cert_status & CERT_STATUS_AUTHORITY_INVALID);
diff --git a/net/log/net_log_event_type_list.h b/net/log/net_log_event_type_list.h index ec02c4b..8038dfc 100644 --- a/net/log/net_log_event_type_list.h +++ b/net/log/net_log_event_type_list.h
@@ -3256,12 +3256,12 @@ // } EVENT_TYPE(CERT_VERIFIER_TASK_BOUND) -// This event is created when a CertVerifyProc instance is created. -EVENT_TYPE(CERT_VERIFY_PROC_CREATED) - // This event is created when CertVerifyProc is verifying a certificate. // The BEGIN phase event parameters are: // { +// "additional_trust_anchors": <Optionally, a list of PEM encoded +// certificates to be used as trust anchors +// in addition to the trust store.> // "certificates": <A list of PEM encoded certificates, the first one // being the certificate to verify and the remaining // being intermediate certificates to assist path @@ -3334,16 +3334,10 @@ // } EVENT_TYPE(CERT_VERIFY_PROC_CHROME_ROOT_STORE_VERSION) -// This event is created for each additional certificate added to +// This event is created for each additional trust anchor passed into // CertVerifyProcBuiltin. -// The event parameters are: -// { -// "certificate": <The PEM encoded certificate.> -// "trust": <The trust setting used for this certificate.> -// "errors": <Optionally, a string describing any errors or warnings -// encountered while parsing the certificate.> -// } -EVENT_TYPE(CERT_VERIFY_PROC_ADDITIONAL_CERT) +// The parameters are the same as for CERT_VERIFY_PROC_TARGET_CERT. +EVENT_TYPE(CERT_VERIFY_PROC_ADDITIONAL_TRUST_ANCHOR) // This event is created for each path building attempt performed by // CertVerifyProcBuiltin.
diff --git a/net/log/net_log_source_type_list.h b/net/log/net_log_source_type_list.h index df3c2b0..a92dbfd 100644 --- a/net/log/net_log_source_type_list.h +++ b/net/log/net_log_source_type_list.h
@@ -28,7 +28,6 @@ SOURCE_TYPE(HTTP_STREAM_JOB) SOURCE_TYPE(EXPONENTIAL_BACKOFF_THROTTLING) SOURCE_TYPE(UDP_SOCKET) -SOURCE_TYPE(CERT_VERIFY_PROC_CREATED) SOURCE_TYPE(CERT_VERIFIER_JOB) SOURCE_TYPE(CERT_VERIFIER_TASK) SOURCE_TYPE(PROXY_CLIENT_SOCKET)
diff --git a/net/socket/tcp_server_socket.cc b/net/socket/tcp_server_socket.cc index b41793b..ca80449 100644 --- a/net/socket/tcp_server_socket.cc +++ b/net/socket/tcp_server_socket.cc
@@ -27,6 +27,7 @@ : socket_(std::move(socket)) {} int TCPServerSocket::AdoptSocket(SocketDescriptor socket) { + adopted_opened_socket_ = true; return socket_->AdoptUnconnectedSocket(socket); } @@ -35,9 +36,13 @@ int TCPServerSocket::Listen(const IPEndPoint& address, int backlog, absl::optional<bool> ipv6_only) { - int result = socket_->Open(address.GetFamily()); - if (result != OK) - return result; + int result = OK; + if (!adopted_opened_socket_) { + result = socket_->Open(address.GetFamily()); + if (result != OK) { + return result; + } + } if (ipv6_only.has_value()) { CHECK_EQ(address.address(), net::IPAddress::IPv6AllZeros());
diff --git a/net/socket/tcp_server_socket.h b/net/socket/tcp_server_socket.h index c02ccb75..7fe17671 100644 --- a/net/socket/tcp_server_socket.h +++ b/net/socket/tcp_server_socket.h
@@ -74,6 +74,7 @@ std::unique_ptr<TCPSocket> accepted_socket_; IPEndPoint accepted_address_; bool pending_accept_ = false; + bool adopted_opened_socket_ = false; }; } // namespace net
diff --git a/net/tools/cert_verify_tool/cert_verify_comparision_tool.cc b/net/tools/cert_verify_tool/cert_verify_comparision_tool.cc index 360f402..8814a47 100644 --- a/net/tools/cert_verify_tool/cert_verify_comparision_tool.cc +++ b/net/tools/cert_verify_tool/cert_verify_comparision_tool.cc
@@ -103,11 +103,14 @@ // TODO(mattm): add command line flags to configure VerifyFlags. int flags = 0; + // Don't add any additional trust anchors. + net::CertificateList x509_additional_trust_anchors; // TODO(crbug.com/634484): use a real netlog and print the results? *error = proc_->Verify(&x509_target_and_intermediates, hostname, /*ocsp_response=*/std::string(), - /*sct_list=*/std::string(), flags, result, + /*sct_list=*/std::string(), flags, + x509_additional_trust_anchors, result, net::NetLogWithSource()); return *error == net::OK; @@ -139,8 +142,7 @@ net::CreateCertVerifyProcBuiltin( std::move(cert_net_fetcher), net::CRLSet::BuiltinCRLSet(), net::CreateSslSystemTrustStoreChromeRoot( - std::make_unique<net::TrustStoreChrome>()), - {})); + std::make_unique<net::TrustStoreChrome>()))); #endif }
diff --git a/net/tools/cert_verify_tool/cert_verify_tool.cc b/net/tools/cert_verify_tool/cert_verify_tool.cc index 4d92629..3c6b0b7d 100644 --- a/net/tools/cert_verify_tool/cert_verify_tool.cc +++ b/net/tools/cert_verify_tool/cert_verify_tool.cc
@@ -30,6 +30,7 @@ #include "net/url_request/url_request_context_builder.h" #include "net/url_request/url_request_context_getter.h" #include "third_party/boringssl/src/pki/trust_store.h" +#include "third_party/boringssl/src/pki/trust_store_collection.h" #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #include "net/proxy_resolution/proxy_config.h" @@ -193,6 +194,22 @@ std::unique_ptr<net::SystemTrustStore> system_trust_store_; }; +class DummySystemTrustStore : public net::SystemTrustStore { + public: + bssl::TrustStore* GetTrustStore() override { return &trust_store_; } + + bool IsKnownRoot(const bssl::ParsedCertificate* trust_anchor) const override { + return false; + } + +#if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) + int64_t chrome_root_store_version() override { return 0; } +#endif + + private: + bssl::TrustStoreCollection trust_store_; +}; + std::unique_ptr<net::SystemTrustStore> CreateSystemTrustStore( base::StringPiece impl_name, RootStoreType root_store_type) { @@ -217,7 +234,7 @@ case RootStoreType::kEmpty: default: std::cerr << impl_name << ": only using --roots specified.\n"; - return net::CreateEmptySystemTrustStore(); + return std::make_unique<DummySystemTrustStore>(); } } @@ -247,7 +264,7 @@ "CertVerifyProcBuiltin", net::CreateCertVerifyProcBuiltin( std::move(cert_net_fetcher), std::move(crl_set), - CreateSystemTrustStore(impl_name, root_store_type), {})); + CreateSystemTrustStore(impl_name, root_store_type))); } if (impl_name == "pathbuilder") {
diff --git a/net/tools/cert_verify_tool/verify_using_cert_verify_proc.cc b/net/tools/cert_verify_tool/verify_using_cert_verify_proc.cc index 38d6c5c00..4c02aadb 100644 --- a/net/tools/cert_verify_tool/verify_using_cert_verify_proc.cc +++ b/net/tools/cert_verify_tool/verify_using_cert_verify_proc.cc
@@ -129,7 +129,7 @@ int rv = cert_verify_proc->Verify( x509_target_and_intermediates.get(), hostname, /*ocsp_response=*/std::string(), /*sct_list=*/std::string(), flags, - &result, net::NetLogWithSource()); + /*additional_trust_anchors=*/{}, &result, net::NetLogWithSource()); std::cout << "CertVerifyProc result: " << net::ErrorToShortString(rv) << "\n"; PrintCertVerifyResult(result);
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 972aefa..9737490 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -10547,10 +10547,9 @@ } void UpdateCertVerifier(scoped_refptr<CRLSet> crl_set) { - net::CertVerifyProc::ImplParams params; + net::CertVerifyProcFactory::ImplParams params; params.crl_set = std::move(crl_set); - updatable_cert_verifier_->UpdateVerifyProcData(cert_net_fetcher_, params, - {}); + updatable_cert_verifier_->UpdateVerifyProcData(cert_net_fetcher_, params); } scoped_refptr<CertNetFetcherURLRequest> cert_net_fetcher_; @@ -11698,7 +11697,7 @@ // Configure a CRL that will mark |root_ca_cert| as a blocked interception // root. std::string crl_set_bytes; - net::CertVerifyProc::ImplParams params; + net::CertVerifyProcFactory::ImplParams params; ASSERT_TRUE( base::ReadFileToString(GetTestCertsDirectory().AppendASCII( "crlset_blocked_interception_by_root.raw"), @@ -11706,7 +11705,7 @@ ASSERT_TRUE(CRLSet::Parse(crl_set_bytes, ¶ms.crl_set)); updatable_cert_verifier_->UpdateVerifyProcData( - /*cert_net_fetcher=*/nullptr, params, {}); + /*cert_net_fetcher=*/nullptr, params); // Verify the connection fails as being a known interception root. {
diff --git a/printing/buildflags/BUILD.gn b/printing/buildflags/BUILD.gn index c2161da..c67554e 100644 --- a/printing/buildflags/BUILD.gn +++ b/printing/buildflags/BUILD.gn
@@ -13,7 +13,7 @@ header = "buildflags.h" flags = [ - "ENABLE_PRINTING=$enable_printing", + "ENABLE_PRINTING=$enable_printing || $enable_printing_tests", "ENABLE_PRINT_PREVIEW=$enable_print_preview", "ENABLE_BASIC_PRINT_DIALOG=$enable_basic_print_dialog", "ENABLE_CONCURRENT_BASIC_PRINT_DIALOGS=$enable_concurrent_basic_print_dialogs",
diff --git a/remoting/host/chromeos/remote_support_host_ash.cc b/remoting/host/chromeos/remote_support_host_ash.cc index ecaacb8..20b26ea 100644 --- a/remoting/host/chromeos/remote_support_host_ash.cc +++ b/remoting/host/chromeos/remote_support_host_ash.cc
@@ -48,17 +48,20 @@ ChromeOsEnterpriseParams EnterpriseParamsFromDict( const base::Value::Dict& dict) { return ChromeOsEnterpriseParams{ - .suppress_user_dialogs = dict.FindBool(kSuppressUserDialogs).value(), - .suppress_notifications = dict.FindBool(kSuppressNotifications).value(), - .terminate_upon_input = dict.FindBool(kTerminateUponInput).value(), + .suppress_user_dialogs = + dict.FindBool(kSuppressUserDialogs).value_or(false), + .suppress_notifications = + dict.FindBool(kSuppressNotifications).value_or(false), + .terminate_upon_input = + dict.FindBool(kTerminateUponInput).value_or(false), .curtain_local_user_session = - dict.FindBool(kCurtainLocalUserSession).value(), + dict.FindBool(kCurtainLocalUserSession).value_or(false), .show_troubleshooting_tools = - dict.FindBool(kShowTroubleshootingTools).value(), + dict.FindBool(kShowTroubleshootingTools).value_or(false), .allow_troubleshooting_tools = - dict.FindBool(kAllowTroubleshootingTools).value(), - .allow_reconnections = dict.FindBool(kAllowReconnections).value(), - .allow_file_transfer = dict.FindBool(kAllowFileTransfer).value(), + dict.FindBool(kAllowTroubleshootingTools).value_or(false), + .allow_reconnections = dict.FindBool(kAllowReconnections).value_or(false), + .allow_file_transfer = dict.FindBool(kAllowFileTransfer).value_or(false), }; } @@ -74,8 +77,20 @@ mojom::SupportSessionParams SessionParamsFromDict( const base::Value::Dict& dict) { mojom::SupportSessionParams result; - result.user_name = *dict.FindString(kUserName); - result.authorized_helper = *dict.FindString(kAuthorizedHelper); + const std::string* user_name = dict.FindString(kUserName); + if (user_name) { + result.user_name = *user_name; + } else { + LOG(ERROR) << "SupportSessionParams missing field: " << kUserName; + } + + const std::string* authorized_helper = dict.FindString(kAuthorizedHelper); + if (authorized_helper) { + result.authorized_helper = *authorized_helper; + } else { + LOG(ERROR) << "SupportSessionParams missing field: " << kAuthorizedHelper; + } + return result; }
diff --git a/remoting/host/desktop_display_info_loader_x11.cc b/remoting/host/desktop_display_info_loader_x11.cc index f506d4d..c6d78d26 100644 --- a/remoting/host/desktop_display_info_loader_x11.cc +++ b/remoting/host/desktop_display_info_loader_x11.cc
@@ -8,6 +8,7 @@ #include <memory> #include "base/memory/raw_ptr.h" +#include "remoting/base/constants.h" #include "remoting/base/logging.h" #include "remoting/host/x11_display_util.h" #include "ui/base/x/x11_display_util.h" @@ -71,7 +72,15 @@ info.y = monitor.y; info.width = monitor.width; info.height = monitor.height; - info.dpi = GetMonitorDpi(monitor).x(); + + // Hard-code the default DPI instead of calculating it from the monitor's + // resolution and physical size. This avoids an issue where the website + // pre-multiplies the ClientResolution sizes by the host's pixels/DIPs + // ratio, sometimes leading to a feedback loop of ever-increasing resizes. + // + // TODO: b/309174172 - Change this back to GetMonitorDpi(monitor).x() when + // the website issue has been addressed. + info.dpi = kDefaultDpi; info.bpp = 24; result.AddDisplay(info);
diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc index 6593913..9065e2b 100644 --- a/remoting/host/it2me/it2me_host.cc +++ b/remoting/host/it2me/it2me_host.cc
@@ -113,11 +113,19 @@ #endif } +bool It2MeHost::SessionSupportsReconnections() const { +#if BUILDFLAG(IS_CHROMEOS_ASH) || !defined(NDEBUG) + return is_enterprise_session() && + chrome_os_enterprise_params_->allow_reconnections; +#else + return false; +#endif +} + absl::optional<ReconnectParams> It2MeHost::CreateReconnectParams() const { absl::optional<ReconnectParams> reconnect_params; #if BUILDFLAG(IS_CHROMEOS_ASH) || !defined(NDEBUG) - if (!is_enterprise_session() || - !chrome_os_enterprise_params_->allow_reconnections) { + if (!SessionSupportsReconnections()) { return reconnect_params; } // This function is meant to be queried just after the remote client connects, @@ -128,8 +136,7 @@ reconnect_params->support_id = support_id_; reconnect_params->host_secret = host_secret_; reconnect_params->private_key = host_key_pair_->ToString(); - signal_strategy_->GetLocalAddress().GetFtlInfo( - nullptr, &reconnect_params->ftl_device_registration_id); + reconnect_params->ftl_device_registration_id = ftl_device_registration_id_; #endif return reconnect_params; @@ -247,8 +254,7 @@ base::Unretained(this))); } else { // Reconnections are only allowed for Chrome OS enterprise sessions. - CHECK(is_enterprise_session()); - CHECK(chrome_os_enterprise_params_->allow_reconnections); + CHECK(SessionSupportsReconnections()); // Regenerate the key pair from the private key. host_key_pair_ = RsaKeyPair::FromString(reconnect_params_->private_key); @@ -663,6 +669,13 @@ std::string access_code_hash = protocol::GetSharedSecretHash(support_id_, access_code); + if (SessionSupportsReconnections()) { + // Retrieve the registration id now that signaling is connected. This id + // will be required if the admin needs to reconnect. + signal_strategy_->GetLocalAddress().GetFtlInfo( + /*username=*/nullptr, &ftl_device_registration_id_); + } + std::string local_certificate = host_key_pair_->GenerateCertificate(); if (local_certificate.empty()) { LOG(ERROR) << "Failed to generate host certificate.";
diff --git a/remoting/host/it2me/it2me_host.h b/remoting/host/it2me/it2me_host.h index 9d46ddd..87453ca 100644 --- a/remoting/host/it2me/it2me_host.h +++ b/remoting/host/it2me/it2me_host.h
@@ -207,6 +207,9 @@ // connection is allowed. Enterprise connections use a separate policy. const char* GetRemoteSupportPolicyKey() const; + // Indicates whether the session allows a ChromeOS admin to reconnect. + bool SessionSupportsReconnections() const; + // Caller supplied fields. std::unique_ptr<ChromotingHostContext> host_context_; base::WeakPtr<It2MeHost::Observer> observer_; @@ -221,6 +224,7 @@ std::string support_id_; std::string host_secret_; + std::string ftl_device_registration_id_; scoped_refptr<RsaKeyPair> host_key_pair_; std::unique_ptr<RegisterSupportHostRequest> register_request_; std::unique_ptr<HostStatusLogger> host_status_logger_;
diff --git a/remoting/host/it2me/it2me_native_messaging_host_ash.cc b/remoting/host/it2me/it2me_native_messaging_host_ash.cc index 4788ffa..ee1859e3 100644 --- a/remoting/host/it2me/it2me_native_messaging_host_ash.cc +++ b/remoting/host/it2me/it2me_native_messaging_host_ash.cc
@@ -29,7 +29,7 @@ const mojom::SupportSessionParams& params, const absl::optional<ChromeOsEnterpriseParams>& enterprise_params) { if (enterprise_params.has_value()) { - return enterprise_params.value().suppress_notifications; + return enterprise_params->suppress_notifications; } // On non-debug builds, do not allow setting this value through the Mojom API. @@ -44,7 +44,7 @@ const mojom::SupportSessionParams& params, const absl::optional<ChromeOsEnterpriseParams>& enterprise_params) { if (enterprise_params.has_value()) { - return enterprise_params.value().suppress_user_dialogs; + return enterprise_params->suppress_user_dialogs; } // On non-debug builds, do not allow setting this value through the Mojom API. @@ -59,7 +59,7 @@ const mojom::SupportSessionParams& params, const absl::optional<ChromeOsEnterpriseParams>& enterprise_params) { if (enterprise_params.has_value()) { - return enterprise_params.value().terminate_upon_input; + return enterprise_params->terminate_upon_input; } // On non-debug builds, do not allow setting this value through the Mojom API. @@ -78,7 +78,7 @@ } if (enterprise_params.has_value()) { - return enterprise_params.value().curtain_local_user_session; + return enterprise_params->curtain_local_user_session; } // On non-debug builds, do not allow setting this value through the Mojom API. @@ -92,7 +92,7 @@ bool ShouldShowTroubleshootingTools( const absl::optional<ChromeOsEnterpriseParams>& enterprise_params) { if (enterprise_params.has_value()) { - return enterprise_params.value().show_troubleshooting_tools; + return enterprise_params->show_troubleshooting_tools; } return false; } @@ -100,7 +100,7 @@ bool ShouldAllowTroubleshootingTools( const absl::optional<ChromeOsEnterpriseParams>& enterprise_params) { if (enterprise_params.has_value()) { - return enterprise_params.value().allow_troubleshooting_tools; + return enterprise_params->allow_troubleshooting_tools; } return false; } @@ -108,7 +108,7 @@ bool ShouldAllowReconnections( const absl::optional<ChromeOsEnterpriseParams>& enterprise_params) { if (enterprise_params.has_value()) { - return enterprise_params.value().allow_reconnections; + return enterprise_params->allow_reconnections; } return false; } @@ -116,7 +116,7 @@ bool ShouldAllowFileTransfer( const absl::optional<ChromeOsEnterpriseParams>& enterprise_params) { if (enterprise_params.has_value()) { - return enterprise_params.value().allow_file_transfer; + return enterprise_params->allow_file_transfer; } return false; } @@ -191,7 +191,7 @@ .Set(kAllowFileTransfer, ShouldAllowFileTransfer(enterprise_params)) .Set(kIsEnterpriseAdminUser, enterprise_params.has_value()); if (params.authorized_helper.has_value()) { - message.Set(kAuthorizedHelper, params.authorized_helper.value()); + message.Set(kAuthorizedHelper, *params.authorized_helper); } if (reconnect_params.has_value()) { @@ -199,22 +199,18 @@ // prevent anyone else from snooping in and connecting to the session. CHECK(params.authorized_helper.has_value()); - // TODO(b/283091055): Send the reconnection params in the connect message, - // and use them to reconnect to an existing client. - LOG(WARNING) << "Should reconnect to existing client, but that's not " - "implemented yet!"; - NOTIMPLEMENTED(); + message.Set(kReconnectParamsDict, + ReconnectParams::ToDict(*reconnect_params)); } - native_message_host_->OnMessage(base::WriteJson(message).value()); + native_message_host_->OnMessage(*base::WriteJson(message)); } void It2MeNativeMessageHostAsh::Disconnect() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - native_message_host_->OnMessage( - base::WriteJson(base::Value::Dict().Set(kMessageType, kDisconnectMessage)) - .value()); + native_message_host_->OnMessage(*base::WriteJson( + base::Value::Dict().Set(kMessageType, kDisconnectMessage))); // Notify the owner that the host has been disconnected. This will result in // the destruction of this object so do not access member variables after this @@ -314,7 +310,7 @@ return; } remote_->OnHostStateReceivedAccessCode( - *access_code, base::Seconds(access_code_lifetime.value())); + *access_code, base::Seconds(*access_code_lifetime)); } else if (*new_state == kHostStateConnecting) { remote_->OnHostStateConnecting(); } else if (*new_state == kHostStateConnected) { @@ -385,8 +381,8 @@ } mojom::NatPolicyStatePtr nat_policy = mojom::NatPolicyState::New(); - nat_policy->nat_enabled = nat_enabled.value(); - nat_policy->relay_enabled = relay_enabled.value(); + nat_policy->nat_enabled = *nat_enabled; + nat_policy->relay_enabled = *relay_enabled; remote_->OnNatPolicyChanged(std::move(nat_policy)); }
diff --git a/remoting/host/it2me/reconnect_params.cc b/remoting/host/it2me/reconnect_params.cc index 702b77e..88b6043 100644 --- a/remoting/host/it2me/reconnect_params.cc +++ b/remoting/host/it2me/reconnect_params.cc
@@ -28,11 +28,23 @@ ReconnectParams ReconnectParams::FromDict(const base::Value::Dict& dict) { ReconnectParams params; - params.support_id = *dict.FindString(kReconnectSupportId); - params.host_secret = *dict.FindString(kReconnectHostSecret); - params.private_key = *dict.FindString(kReconnectPrivateKey); - params.ftl_device_registration_id = - *dict.FindString(kReconnectFtlDeviceRegistrationId); + const std::string* support_id = dict.FindString(kReconnectSupportId); + if (support_id) { + params.support_id = *support_id; + } + const std::string* host_secret = dict.FindString(kReconnectHostSecret); + if (host_secret) { + params.host_secret = *host_secret; + } + const std::string* private_key = dict.FindString(kReconnectPrivateKey); + if (private_key) { + params.private_key = *private_key; + } + const std::string* ftl_device_registration_id = + dict.FindString(kReconnectFtlDeviceRegistrationId); + if (ftl_device_registration_id) { + params.ftl_device_registration_id = *ftl_device_registration_id; + } DCHECK(params.IsValid()); return params; @@ -40,36 +52,33 @@ bool ReconnectParams::IsValid() const { if (support_id.empty()) { - LOG(WARNING) << "Missing field: support_id"; + LOG(ERROR) << "Missing field: support_id"; return false; } else if (support_id.length() != 7) { - LOG(WARNING) << "Invalid support_id: " << support_id; + LOG(ERROR) << "Invalid support_id: " << support_id; return false; } if (host_secret.empty()) { - LOG(WARNING) << "Missing field: host_secret"; + LOG(ERROR) << "Missing field: host_secret"; return false; } else if (host_secret.length() != 5) { - LOG(WARNING) << "Invalid host_secret: " << host_secret; + LOG(ERROR) << "Invalid host_secret: " << host_secret; return false; } if (private_key.empty()) { - LOG(WARNING) << "Missing field: private_key"; - return false; - } else if (private_key.length() != 384) { - LOG(WARNING) << "Invalid private_key length: " << private_key.length(); + LOG(ERROR) << "Missing field: private_key"; return false; } if (ftl_device_registration_id.empty()) { - LOG(WARNING) << "Missing field: ftl_device_registration_id"; + LOG(ERROR) << "Missing field: ftl_device_registration_id"; return false; } else if (!base::Uuid::ParseLowercase(ftl_device_registration_id) .is_valid()) { - LOG(WARNING) << "Invalid ftl_device_registration_id: " - << ftl_device_registration_id; + LOG(ERROR) << "Invalid ftl_device_registration_id: " + << ftl_device_registration_id; return false; }
diff --git a/services/accessibility/BUILD.gn b/services/accessibility/BUILD.gn index 6460173..6b11cd7 100644 --- a/services/accessibility/BUILD.gn +++ b/services/accessibility/BUILD.gn
@@ -48,6 +48,8 @@ "features/registered_wrappable.h", "features/speech_recognition_interface_binder.cc", "features/speech_recognition_interface_binder.h", + "features/sync_os_state_api_bindings.cc", + "features/sync_os_state_api_bindings.h", "features/text_decoder.cc", "features/text_decoder.h", "features/text_encoder.cc",
diff --git a/services/accessibility/DEPS b/services/accessibility/DEPS index 1fd4015..85bd7b34 100644 --- a/services/accessibility/DEPS +++ b/services/accessibility/DEPS
@@ -6,4 +6,5 @@ "+ui/accessibility/ax_relative_bounds.h", "+ui/accessibility/ax_tree_id.h", "+ui/accessibility/ax_tree_update.h", + "+ui/base/l10n/l10n_util.h", ]
diff --git a/services/accessibility/assistive_technology_controller_impl.cc b/services/accessibility/assistive_technology_controller_impl.cc index 07427f4f..6e1da0f 100644 --- a/services/accessibility/assistive_technology_controller_impl.cc +++ b/services/accessibility/assistive_technology_controller_impl.cc
@@ -152,6 +152,10 @@ std::move(automation_client)); manager.ConfigureFileLoader(&file_loader_remote_); if (type == mojom::AssistiveTechnologyType::kChromeVox || + type == mojom::AssistiveTechnologyType::kDictation) { + manager.ConfigureOSState(); + } + if (type == mojom::AssistiveTechnologyType::kChromeVox || type == mojom::AssistiveTechnologyType::kSelectToSpeak) { // TTS needs to know the type that is speaking. manager.ConfigureTts(this);
diff --git a/services/accessibility/features/atp_js_api_test.cc b/services/accessibility/features/atp_js_api_test.cc index d6bd4ee2..370dc07 100644 --- a/services/accessibility/features/atp_js_api_test.cc +++ b/services/accessibility/features/atp_js_api_test.cc
@@ -505,7 +505,7 @@ ~AccessibilityPrivateJSApiTest() override = default; mojom::AssistiveTechnologyType GetATTypeForTest() const override { - return mojom::AssistiveTechnologyType::kSelectToSpeak; + return mojom::AssistiveTechnologyType::kChromeVox; } const std::vector<std::string> GetJSFilePathsToLoad() const override { @@ -792,6 +792,51 @@ waiter.Run(); } +TEST_F(AccessibilityPrivateJSApiTest, GetDisplayNameForLocale) { + ExecuteJS(R"JS( + const locale1 = 'en-US'; + const locale2 = 'es'; + const notreal = ''; + + const remote = axtest.mojom.TestBindingInterface.getRemote(); + + let displayName = chrome.accessibilityPrivate.getDisplayNameForLocale( + locale2, locale1); + if (displayName !== 'Spanish') { + remote.log('Expected "' + displayName + '" to equal "Spanish"'); + remote.testComplete(/*success=*/false); + } + displayName = chrome.accessibilityPrivate.getDisplayNameForLocale( + locale1, locale1); + if (!displayName.includes('English')) { + remote.log('Expected "' + displayName + '" to contain "English"'); + remote.testComplete(/*success=*/false); + } + displayName = chrome.accessibilityPrivate.getDisplayNameForLocale( + locale2, locale2); + if (displayName !== 'español') { + remote.log('Expected "' + displayName + '" to equal "español"'); + remote.testComplete(/*success=*/false); + } + displayName = chrome.accessibilityPrivate.getDisplayNameForLocale( + locale2, notreal); + if (displayName !== '') { + remote.log('Expected "' + displayName + '" to equal ""'); + remote.testComplete(/*success=*/false); + } + displayName = chrome.accessibilityPrivate.getDisplayNameForLocale( + notreal, locale1); + if (displayName !== '') { + remote.log('Expected "' + displayName + '" to equal ""'); + remote.testComplete(/*success=*/false); + } + + remote.testComplete(/*success=*/ true); + )JS"); + + WaitForJSTestComplete(); +} + class SpeechRecognitionJSApiTest : public AtpJSApiTest { public: SpeechRecognitionJSApiTest() = default;
diff --git a/services/accessibility/features/javascript/accessibility_private.js b/services/accessibility/features/javascript/accessibility_private.js index d107d57..402c14a 100644 --- a/services/accessibility/features/javascript/accessibility_private.js +++ b/services/accessibility/features/javascript/accessibility_private.js
@@ -127,6 +127,18 @@ } /** + * Called to translate localeCodeToTranslate into a human-readable string in + * the locale specified by displayLocaleCode. + * @param {string} localeCodeToTranslate + * @param {string} displayLocaleCode + * @return {string} the human-readable locale string in the provided locale. + */ + getDisplayNameForLocale(localeCodeToTranslate, displayLocaleCode) { + return chrome.syncOSState.getDisplayNameForLocale( + localeCodeToTranslate, displayLocaleCode); + } + + /** * Opens a specified ChromeOS settings subpage. For example, to open a page * with the url 'chrome://settings/manageAccessibility/tts', pass in the * substring 'manageAccessibility/tts'.
diff --git a/services/accessibility/features/mojo/test/js_test_interface.cc b/services/accessibility/features/mojo/test/js_test_interface.cc index 71bfe71..098bf2b 100644 --- a/services/accessibility/features/mojo/test/js_test_interface.cc +++ b/services/accessibility/features/mojo/test/js_test_interface.cc
@@ -56,4 +56,8 @@ std::move(on_complete_).Run(success); } +void JSTestInterface::Log(const std::string& log_string) { + LOG(INFO) << log_string; +} + } // namespace ax
diff --git a/services/accessibility/features/mojo/test/js_test_interface.h b/services/accessibility/features/mojo/test/js_test_interface.h index 2b0e52a..90a978a 100644 --- a/services/accessibility/features/mojo/test/js_test_interface.h +++ b/services/accessibility/features/mojo/test/js_test_interface.h
@@ -38,6 +38,7 @@ void SendEnumToTestInterface(axtest::mojom::TestEnum num) override; void Disconnect() override; void TestComplete(bool success) override; + void Log(const std::string& log_string) override; private: base::OnceCallback<void(bool)> on_complete_;
diff --git a/services/accessibility/features/mojo/test/shim.js b/services/accessibility/features/mojo/test/shim.js index ef8c194..1af372c4 100644 --- a/services/accessibility/features/mojo/test/shim.js +++ b/services/accessibility/features/mojo/test/shim.js
@@ -3,10 +3,10 @@ // found in the LICENSE file. // The ATP V8 instance does not define 'self', which is needed by mojom. -let self = this; +const self = this; // ATP doesn't have console.* yet, so shim these over. -let console = atpconsole; +const console = atpconsole; console.assert = (check, message) => { if (!check) { atpconsole.error(message);
diff --git a/services/accessibility/features/mojo/test/test_api.test-mojom b/services/accessibility/features/mojo/test/test_api.test-mojom index 716af709..615151e 100644 --- a/services/accessibility/features/mojo/test/test_api.test-mojom +++ b/services/accessibility/features/mojo/test/test_api.test-mojom
@@ -48,4 +48,7 @@ // Called when the test is complete indicating if the test was successful // or failed. TestComplete(bool success); -}; \ No newline at end of file + + // Log a statement to the terminal. + Log(string log_string); +};
diff --git a/services/accessibility/features/sync_os_state_api_bindings.cc b/services/accessibility/features/sync_os_state_api_bindings.cc new file mode 100644 index 0000000..a090b2b --- /dev/null +++ b/services/accessibility/features/sync_os_state_api_bindings.cc
@@ -0,0 +1,46 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/accessibility/features/sync_os_state_api_bindings.h" + +#include "base/logging.h" +#include "base/strings/utf_string_conversions.h" +#include "gin/arguments.h" +#include "gin/converter.h" +#include "ui/base/l10n/l10n_util.h" +#include "v8/include/v8-function-callback.h" +#include "v8/include/v8-value.h" + +namespace { +constexpr char kUndeterminedLocale[] = "und"; +} // namespace + +namespace ax { + +std::string GetDisplayNameForLocale(const std::string& locale, + const std::string& display_locale) { + bool found_valid_result = false; + std::string locale_result; + if (l10n_util::IsValidLocaleSyntax(locale) && + l10n_util::IsValidLocaleSyntax(display_locale)) { + locale_result = base::UTF16ToUTF8(l10n_util::GetDisplayNameForLocale( + locale, display_locale, /*is_ui=*/true)); + // Check for valid locales before getting the display name. + // The ICU Locale class returns "und" for undetermined locales, and + // returns the locale string directly if it has no translation. + // Treat these cases as invalid results. + found_valid_result = + locale_result != kUndeterminedLocale && locale_result != locale; + } + + // We return an empty string to communicate that we could not determine the + // display name. + if (!found_valid_result) { + locale_result = std::string(); + } + + return locale_result; +} + +} // namespace ax
diff --git a/services/accessibility/features/sync_os_state_api_bindings.h b/services/accessibility/features/sync_os_state_api_bindings.h new file mode 100644 index 0000000..3cbb5ad --- /dev/null +++ b/services/accessibility/features/sync_os_state_api_bindings.h
@@ -0,0 +1,19 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_ACCESSIBILITY_FEATURES_SYNC_OS_STATE_API_BINDINGS_H_ +#define SERVICES_ACCESSIBILITY_FEATURES_SYNC_OS_STATE_API_BINDINGS_H_ + +#include "v8/include/v8-function-callback.h" +#include "v8/include/v8-value.h" + +namespace ax { + +// Gets the display name for the provided locale in the display_locale. +std::string GetDisplayNameForLocale(const std::string& locale, + const std::string& display_locale); + +} // namespace ax + +#endif // SERVICES_ACCESSIBILITY_FEATURES_SYNC_OS_STATE_API_BINDINGS_H_
diff --git a/services/accessibility/features/v8_manager.cc b/services/accessibility/features/v8_manager.cc index 94fbc26..b3c0f4f 100644 --- a/services/accessibility/features/v8_manager.cc +++ b/services/accessibility/features/v8_manager.cc
@@ -24,11 +24,13 @@ #include "services/accessibility/features/interface_binder.h" #include "services/accessibility/features/mojo/mojo.h" #include "services/accessibility/features/speech_recognition_interface_binder.h" +#include "services/accessibility/features/sync_os_state_api_bindings.h" #include "services/accessibility/features/tts_interface_binder.h" #include "services/accessibility/features/user_interface_interface_binder.h" #include "services/accessibility/features/v8_bindings_utils.h" #include "services/accessibility/public/mojom/accessibility_service.mojom-forward.h" #include "v8/include/v8-context.h" +#include "v8/include/v8-function.h" #include "v8/include/v8-object.h" #include "v8/include/v8-template.h" @@ -107,6 +109,10 @@ this, std::move(automation), std::move(automation_client)); } +void V8Environment::InstallOSState() { + os_state_needed_ = true; +} + void V8Environment::ExecuteScript(const std::string& script, base::OnceCallback<void()> on_complete) { bool result = BindingsIsolateHolder::ExecuteScriptInContext(script); @@ -196,6 +202,15 @@ BindingsUtils::CreateTextDecoderCallback); // TODO(crbug.com/1355633): Add other API bindings to the global template. + if (os_state_needed_) { + v8::Local<v8::ObjectTemplate> sync_os_state_template = + v8::ObjectTemplate::New(isolate); + sync_os_state_template->Set( + GetIsolate(), "getDisplayNameForLocale", + gin::CreateFunctionTemplate( + GetIsolate(), base::BindRepeating(&GetDisplayNameForLocale))); + chrome_template->Set(GetIsolate(), "syncOSState", sync_os_state_template); + } // Add the global template to the current context. v8::Local<v8::Context> context = @@ -255,6 +270,11 @@ std::make_unique<SpeechRecognitionInterfaceBinder>(ax_service_client)); } +void V8Manager::ConfigureOSState() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + v8_env_.AsyncCall(&V8Environment::InstallOSState); +} + void V8Manager::ConfigureTts( mojom::AccessibilityServiceClient* ax_service_client) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/services/accessibility/features/v8_manager.h b/services/accessibility/features/v8_manager.h index bcd59be..6a906ae 100644 --- a/services/accessibility/features/v8_manager.h +++ b/services/accessibility/features/v8_manager.h
@@ -77,6 +77,7 @@ void InstallAutomation( mojo::PendingAssociatedReceiver<mojom::Automation> automation, mojo::PendingRemote<mojom::AutomationClient> automation_client); + void InstallOSState(); void AddV8Bindings(); // Executes the given string as a Javascript script, and calls the @@ -105,6 +106,11 @@ const scoped_refptr<base::SequencedTaskRunner> main_runner_; const base::WeakPtr<V8Manager> manager_; + // Sync API bindings need to be installed during AddV8Bindings(), because the + // IsolateScope and HandleScope are limited to that function. + // Track which APIs need to be installed. + bool os_state_needed_ = false; + // Bindings wrappers for V8 APIs. // TODO(crbug.com/1355633): Add more APIs including TTS, SST, etc. std::unique_ptr<AutomationInternalBindings> automation_bindings_; @@ -129,10 +135,11 @@ // Various optional features that can be configured. All configuration must be // done before calling `FinishContextSetUp()`. + void ConfigureAutoclick(mojom::AccessibilityServiceClient* ax_service_client); void ConfigureAutomation( mojo::PendingAssociatedReceiver<mojom::Automation> automation, mojo::PendingRemote<mojom::AutomationClient> automation_client); - void ConfigureAutoclick(mojom::AccessibilityServiceClient* ax_service_client); + void ConfigureOSState(); void ConfigureSpeechRecognition( mojom::AccessibilityServiceClient* ax_service_client); void ConfigureTts(mojom::AccessibilityServiceClient* ax_service_client);
diff --git a/services/cert_verifier/cert_verifier_creation.cc b/services/cert_verifier/cert_verifier_creation.cc index 210c9a4d..3cbbdd3 100644 --- a/services/cert_verifier/cert_verifier_creation.cc +++ b/services/cert_verifier/cert_verifier_creation.cc
@@ -73,22 +73,20 @@ scoped_refptr<net::CertVerifyProc> CreateCertVerifyProc( scoped_refptr<net::CertNetFetcher> cert_net_fetcher, - const net::CertVerifyProc::ImplParams& impl_params, - const net::CertVerifyProc::InstanceParams& instance_params) override { + const CertVerifyProcFactory::ImplParams& impl_params) override { #if BUILDFLAG(CHROME_ROOT_STORE_ONLY) return CreateNewCertVerifyProc( cert_net_fetcher, impl_params.crl_set, - base::OptionalToPtr(impl_params.root_store_data), instance_params); + base::OptionalToPtr(impl_params.root_store_data)); #else #if BUILDFLAG(CHROME_ROOT_STORE_OPTIONAL) if (impl_params.use_chrome_root_store) { return CreateNewCertVerifyProc( cert_net_fetcher, impl_params.crl_set, - base::OptionalToPtr(impl_params.root_store_data), instance_params); + base::OptionalToPtr(impl_params.root_store_data)); } #endif - return CreateOldCertVerifyProc(cert_net_fetcher, impl_params.crl_set, - instance_params); + return CreateOldCertVerifyProc(cert_net_fetcher, impl_params.crl_set); #endif } @@ -102,12 +100,11 @@ // return a CertVerifyProc that supports that configuration. scoped_refptr<net::CertVerifyProc> CreateOldCertVerifyProc( scoped_refptr<net::CertNetFetcher> cert_net_fetcher, - scoped_refptr<net::CRLSet> crl_set, - const net::CertVerifyProc::InstanceParams& instance_params) { + scoped_refptr<net::CRLSet> crl_set) { #if BUILDFLAG(IS_FUCHSIA) - return net::CreateCertVerifyProcBuiltin( - std::move(cert_net_fetcher), std::move(crl_set), - net::CreateSslSystemTrustStore(), instance_params); + return net::CreateCertVerifyProcBuiltin(std::move(cert_net_fetcher), + std::move(crl_set), + net::CreateSslSystemTrustStore()); #else return net::CertVerifyProc::CreateSystemVerifyProc( std::move(cert_net_fetcher), std::move(crl_set)); @@ -121,8 +118,7 @@ scoped_refptr<net::CertVerifyProc> CreateNewCertVerifyProc( scoped_refptr<net::CertNetFetcher> cert_net_fetcher, scoped_refptr<net::CRLSet> crl_set, - const net::ChromeRootStoreData* root_store_data, - const net::CertVerifyProc::InstanceParams& instance_params) { + const net::ChromeRootStoreData* root_store_data) { std::unique_ptr<net::TrustStoreChrome> chrome_root = root_store_data ? std::make_unique<net::TrustStoreChrome>(*root_store_data) @@ -155,9 +151,9 @@ // tests that don't use threads otherwise. net::InitializeTrustStoreAndroid(); #endif - return net::CreateCertVerifyProcBuiltin( - std::move(cert_net_fetcher), std::move(crl_set), std::move(trust_store), - instance_params); + return net::CreateCertVerifyProcBuiltin(std::move(cert_net_fetcher), + std::move(crl_set), + std::move(trust_store)); } #endif // BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) @@ -180,15 +176,13 @@ std::unique_ptr<net::CertVerifierWithUpdatableProc> CreateCertVerifier( mojom::CertVerifierCreationParams* creation_params, scoped_refptr<net::CertNetFetcher> cert_net_fetcher, - const net::CertVerifyProc::ImplParams& impl_params, - const net::CertVerifyProc::InstanceParams& instance_params) { + const net::CertVerifyProcFactory::ImplParams& impl_params) { DCHECK(cert_net_fetcher || !IsUsingCertNetFetcher()); scoped_refptr<net::CertVerifyProcFactory> proc_factory = base::MakeRefCounted<CertVerifyProcFactoryImpl>(creation_params); return std::make_unique<net::MultiThreadedCertVerifier>( - proc_factory->CreateCertVerifyProc(cert_net_fetcher, impl_params, - instance_params), + proc_factory->CreateCertVerifyProc(cert_net_fetcher, impl_params), proc_factory); }
diff --git a/services/cert_verifier/cert_verifier_creation.h b/services/cert_verifier/cert_verifier_creation.h index 357b88d..1f2fe062 100644 --- a/services/cert_verifier/cert_verifier_creation.h +++ b/services/cert_verifier/cert_verifier_creation.h
@@ -29,8 +29,7 @@ std::unique_ptr<net::CertVerifierWithUpdatableProc> CreateCertVerifier( mojom::CertVerifierCreationParams* creation_params, scoped_refptr<net::CertNetFetcher> cert_net_fetcher, - const net::CertVerifyProc::ImplParams& impl_params, - const net::CertVerifyProc::InstanceParams& instance_params); + const net::CertVerifyProcFactory::ImplParams& impl_params); } // namespace cert_verifier
diff --git a/services/cert_verifier/cert_verifier_service.cc b/services/cert_verifier/cert_verifier_service.cc index 03657128..e1f2c912 100644 --- a/services/cert_verifier/cert_verifier_service.cc +++ b/services/cert_verifier/cert_verifier_service.cc
@@ -82,20 +82,16 @@ CertVerifierServiceImpl::CertVerifierServiceImpl( std::unique_ptr<net::CertVerifierWithUpdatableProc> verifier, - mojo::PendingReceiver<mojom::CertVerifierService> service_receiver, - mojo::PendingReceiver<mojom::CertVerifierServiceUpdater> updater_receiver, + mojo::PendingReceiver<mojom::CertVerifierService> receiver, mojo::PendingRemote<mojom::CertVerifierServiceClient> client, - scoped_refptr<CertNetFetcherURLLoader> cert_net_fetcher, - net::CertVerifyProc::InstanceParams instance_params) - : instance_params_(std::move(instance_params)), - verifier_(std::move(verifier)), - service_receiver_(this, std::move(service_receiver)), - updater_receiver_(this, std::move(updater_receiver)), + scoped_refptr<CertNetFetcherURLLoader> cert_net_fetcher) + : verifier_(std::move(verifier)), + receiver_(this, std::move(receiver)), client_(std::move(client)), cert_net_fetcher_(std::move(cert_net_fetcher)) { // base::Unretained is safe because |this| owns |receiver_|, so deleting // |this| will prevent |receiver_| from calling this callback. - service_receiver_.set_disconnect_handler( + receiver_.set_disconnect_handler( base::BindRepeating(&CertVerifierServiceImpl::OnDisconnectFromService, base::Unretained(this))); verifier_->AddObserver(this); @@ -130,18 +126,6 @@ } } -void CertVerifierServiceImpl::UpdateAdditionalCertificates( - mojom::AdditionalCertificatesPtr additional_certificates) { - instance_params_.additional_trust_anchors = - additional_certificates->trust_anchors; - instance_params_.additional_untrusted_authorities = - additional_certificates->all_certificates; - - verifier_->UpdateVerifyProcData(cert_net_fetcher_, - service_factory_impl_->get_impl_params(), - instance_params_); -} - void CertVerifierServiceImpl::SetCertVerifierServiceFactory( base::WeakPtr<cert_verifier::CertVerifierServiceFactoryImpl> service_factory_impl) { @@ -149,9 +133,8 @@ } void CertVerifierServiceImpl::UpdateVerifierData( - const net::CertVerifyProc::ImplParams& impl_params) { - verifier_->UpdateVerifyProcData(cert_net_fetcher_, impl_params, - instance_params_); + const net::CertVerifyProcFactory::ImplParams& impl_params) { + verifier_->UpdateVerifyProcData(cert_net_fetcher_, impl_params); } void CertVerifierServiceImpl::Verify(
diff --git a/services/cert_verifier/cert_verifier_service.h b/services/cert_verifier/cert_verifier_service.h index 1f9abb8..918678e 100644 --- a/services/cert_verifier/cert_verifier_service.h +++ b/services/cert_verifier/cert_verifier_service.h
@@ -18,7 +18,6 @@ #include "net/cert/cert_verify_proc.h" #include "net/log/net_log_with_source.h" #include "services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader.h" -#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h" #include "services/network/public/mojom/cert_verifier_service.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" @@ -36,16 +35,13 @@ // This class will delete itself upon disconnection of its Mojo receiver. class CertVerifierServiceImpl : public mojom::CertVerifierService, - public mojom::CertVerifierServiceUpdater, public net::CertVerifier::Observer { public: explicit CertVerifierServiceImpl( std::unique_ptr<net::CertVerifierWithUpdatableProc> verifier, - mojo::PendingReceiver<mojom::CertVerifierService> service_receiver, - mojo::PendingReceiver<mojom::CertVerifierServiceUpdater> updater_receiver, + mojo::PendingReceiver<mojom::CertVerifierService> receiver, mojo::PendingRemote<mojom::CertVerifierServiceClient> client, - scoped_refptr<CertNetFetcherURLLoader> cert_net_fetcher, - net::CertVerifyProc::InstanceParams instance_params); + scoped_refptr<CertNetFetcherURLLoader> cert_net_fetcher); // mojom::CertVerifierService implementation: void Verify(const net::CertVerifier::RequestParams& params, @@ -58,10 +54,6 @@ mojo::PendingRemote<mojom::URLLoaderFactoryConnector> reconnector) override; - // mojom::CertVerifierServiceUpdater implementation: - void UpdateAdditionalCertificates( - mojom::AdditionalCertificatesPtr additional_certificates) override; - // Set a pointer to the CertVerifierServiceFactory so that it may be notified // when we are deleted. void SetCertVerifierServiceFactory( @@ -69,7 +61,8 @@ service_factory_impl); // Update the wrapped verifier with CRLSet and ChromeRootStoreData. - void UpdateVerifierData(const net::CertVerifyProc::ImplParams& impl_params); + void UpdateVerifierData( + const net::CertVerifyProcFactory::ImplParams& impl_params); private: ~CertVerifierServiceImpl() override; @@ -79,10 +72,8 @@ void OnDisconnectFromService(); - net::CertVerifyProc::InstanceParams instance_params_; std::unique_ptr<net::CertVerifierWithUpdatableProc> verifier_; - mojo::Receiver<mojom::CertVerifierService> service_receiver_; - mojo::Receiver<mojom::CertVerifierServiceUpdater> updater_receiver_; + mojo::Receiver<mojom::CertVerifierService> receiver_; mojo::Remote<mojom::CertVerifierServiceClient> client_; scoped_refptr<CertNetFetcherURLLoader> cert_net_fetcher_; base::WeakPtr<cert_verifier::CertVerifierServiceFactoryImpl>
diff --git a/services/cert_verifier/cert_verifier_service_factory.cc b/services/cert_verifier/cert_verifier_service_factory.cc index c37093da..28e978e 100644 --- a/services/cert_verifier/cert_verifier_service_factory.cc +++ b/services/cert_verifier/cert_verifier_service_factory.cc
@@ -44,11 +44,10 @@ namespace { internal::CertVerifierServiceImpl* GetNewCertVerifierImpl( - mojo::PendingReceiver<mojom::CertVerifierService> service_receiver, - mojo::PendingReceiver<mojom::CertVerifierServiceUpdater> updater_receiver, + mojo::PendingReceiver<mojom::CertVerifierService> receiver, mojo::PendingRemote<mojom::CertVerifierServiceClient> client, mojom::CertVerifierCreationParamsPtr creation_params, - const net::CertVerifyProc::ImplParams& impl_params, + const net::CertVerifyProcFactory::ImplParams& impl_params, scoped_refptr<CertNetFetcherURLLoader>* out_cert_net_fetcher) { scoped_refptr<CertNetFetcherURLLoader> cert_net_fetcher; @@ -59,18 +58,8 @@ cert_net_fetcher = base::MakeRefCounted<CertNetFetcherURLLoader>(); } - // Populate initial instance params from creation params. - net::CertVerifyProc::InstanceParams instance_params; - if (creation_params->initial_additional_certificates) { - instance_params.additional_trust_anchors = - creation_params->initial_additional_certificates->trust_anchors; - instance_params.additional_untrusted_authorities = - creation_params->initial_additional_certificates->all_certificates; - } - std::unique_ptr<net::CertVerifierWithUpdatableProc> cert_verifier = - CreateCertVerifier(creation_params.get(), cert_net_fetcher, impl_params, - instance_params); + CreateCertVerifier(creation_params.get(), cert_net_fetcher, impl_params); // As an optimization, if the CertNetFetcher isn't used by the CertVerifier, // shut it down immediately. @@ -85,9 +74,8 @@ // The service will delete itself upon disconnection. return new internal::CertVerifierServiceImpl( - std::move(cert_verifier), std::move(service_receiver), - std::move(updater_receiver), std::move(client), - std::move(cert_net_fetcher), std::move(instance_params)); + std::move(cert_verifier), std::move(receiver), std::move(client), + std::move(cert_net_fetcher)); } #if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) @@ -134,27 +122,24 @@ CertVerifierServiceFactoryImpl::~CertVerifierServiceFactoryImpl() = default; void CertVerifierServiceFactoryImpl::GetNewCertVerifier( - mojo::PendingReceiver<mojom::CertVerifierService> service_receiver, - mojo::PendingReceiver<mojom::CertVerifierServiceUpdater> updater_receiver, + mojo::PendingReceiver<mojom::CertVerifierService> receiver, mojo::PendingRemote<mojom::CertVerifierServiceClient> client, mojom::CertVerifierCreationParamsPtr creation_params) { - internal::CertVerifierServiceImpl* service_impl = GetNewCertVerifierImpl( - std::move(service_receiver), std::move(updater_receiver), - std::move(client), std::move(creation_params), proc_params_, - /*out_cert_net_fetcher=*/nullptr); + internal::CertVerifierServiceImpl* service_impl = + GetNewCertVerifierImpl(std::move(receiver), std::move(client), + std::move(creation_params), proc_params_, + /*out_cert_net_fetcher=*/nullptr); verifier_services_.insert(service_impl); service_impl->SetCertVerifierServiceFactory(weak_factory_.GetWeakPtr()); } void CertVerifierServiceFactoryImpl::GetNewCertVerifierForTesting( - mojo::PendingReceiver<mojom::CertVerifierService> service_receiver, - mojo::PendingReceiver<mojom::CertVerifierServiceUpdater> updater_receiver, + mojo::PendingReceiver<mojom::CertVerifierService> receiver, mojo::PendingRemote<mojom::CertVerifierServiceClient> client, mojom::CertVerifierCreationParamsPtr creation_params, scoped_refptr<CertNetFetcherURLLoader>* cert_net_fetcher_ptr) { - GetNewCertVerifierImpl(std::move(service_receiver), - std::move(updater_receiver), std::move(client), + GetNewCertVerifierImpl(std::move(receiver), std::move(client), std::move(creation_params), proc_params_, cert_net_fetcher_ptr); }
diff --git a/services/cert_verifier/cert_verifier_service_factory.h b/services/cert_verifier/cert_verifier_service_factory.h index 8657426..96cfe5a 100644 --- a/services/cert_verifier/cert_verifier_service_factory.h +++ b/services/cert_verifier/cert_verifier_service_factory.h
@@ -40,8 +40,7 @@ // mojom::CertVerifierServiceFactory implementation: void GetNewCertVerifier( - mojo::PendingReceiver<mojom::CertVerifierService> service_receiver, - mojo::PendingReceiver<mojom::CertVerifierServiceUpdater> updater_receiver, + mojo::PendingReceiver<mojom::CertVerifierService> receiver, mojo::PendingRemote<mojom::CertVerifierServiceClient> client, mojom::CertVerifierCreationParamsPtr creation_params) override; @@ -50,7 +49,6 @@ // CertNetFetcherURLLoader is in use. void GetNewCertVerifierForTesting( mojo::PendingReceiver<mojom::CertVerifierService> receiver, - mojo::PendingReceiver<mojom::CertVerifierServiceUpdater> updater_receiver, mojo::PendingRemote<mojom::CertVerifierServiceClient> client, mojom::CertVerifierCreationParamsPtr creation_params, scoped_refptr<CertNetFetcherURLLoader>* cert_net_fetcher_ptr); @@ -72,17 +70,13 @@ // Remove a CertVerifyService from needing updates to the Chrome Root Store. void RemoveService(internal::CertVerifierServiceImpl* service_impl); - const net::CertVerifyProc::ImplParams& get_impl_params() const { - return proc_params_; - } - private: // Update all the `verifier_services_` with the current data. void UpdateVerifierServices(); void OnCRLSetParsed(scoped_refptr<net::CRLSet> parsed_crl_set); - net::CertVerifyProc::ImplParams proc_params_; + net::CertVerifyProcFactory::ImplParams proc_params_; mojo::Receiver<mojom::CertVerifierServiceFactory> receiver_;
diff --git a/services/cert_verifier/cert_verifier_service_factory_unittest.cc b/services/cert_verifier/cert_verifier_service_factory_unittest.cc index 2f16ee0e..8a83c557 100644 --- a/services/cert_verifier/cert_verifier_service_factory_unittest.cc +++ b/services/cert_verifier/cert_verifier_service_factory_unittest.cc
@@ -163,7 +163,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.InitWithNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -216,7 +215,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -251,7 +249,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -336,7 +333,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -389,7 +385,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -534,19 +529,18 @@ #endif // BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) -class CertVerifierServiceFactoryBuiltinVerifierTest : public ::testing::Test { +class CertVerifierServiceFactoryCRLSetTest : public ::testing::Test { public: void SetUp() override { - if (!SystemUsesBuiltinVerifier()) { - GTEST_SKIP() - << "Skipping test because system doesn't use builtin verifier"; + if (!SystemSupportsCRLSets()) { + GTEST_SKIP() << "Skipping test because system doesn't support CRLSets"; } ::testing::Test::SetUp(); } private: - bool SystemUsesBuiltinVerifier() { + bool SystemSupportsCRLSets() { #if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(CHROME_ROOT_STORE_ONLY) return true; #elif BUILDFLAG(CHROME_ROOT_STORE_OPTIONAL) @@ -567,7 +561,7 @@ // Test that a new Cert verifier will use an updated CRLSet if // one was already passed into CertVerifierServiceFactory. -TEST_F(CertVerifierServiceFactoryBuiltinVerifierTest, +TEST_F(CertVerifierServiceFactoryCRLSetTest, GetNewCertVerifierWithUpdatedCRLSet) { scoped_refptr<net::X509Certificate> test_root(net::ImportCertFromFile( net::GetTestCertsDirectory(), "root_ca_cert.pem")); @@ -595,7 +589,6 @@ // CRLSet already active. cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -610,7 +603,7 @@ // Test that an existing CertVerifierService will use an updated CRLSet if one // is provided to the CertVerifierServiceFactory -TEST_F(CertVerifierServiceFactoryBuiltinVerifierTest, +TEST_F(CertVerifierServiceFactoryCRLSetTest, UpdateExistingCertVerifierWithCRLSet) { scoped_refptr<net::X509Certificate> test_root(net::ImportCertFromFile( net::GetTestCertsDirectory(), "root_ca_cert.pem")); @@ -633,7 +626,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -660,7 +652,7 @@ } // Verifies newer CRLSets (by sequence number) are applied. -TEST_F(CertVerifierServiceFactoryBuiltinVerifierTest, CRLSetIsUpdatedIfNewer) { +TEST_F(CertVerifierServiceFactoryCRLSetTest, CRLSetIsUpdatedIfNewer) { scoped_refptr<net::X509Certificate> test_root(net::ImportCertFromFile( net::GetTestCertsDirectory(), "root_ca_cert.pem")); ASSERT_TRUE(test_root); @@ -682,7 +674,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -725,7 +716,7 @@ // Verifies that attempting to send an older CRLSet (by sequence number) // does not apply to existing or new contexts. -TEST_F(CertVerifierServiceFactoryBuiltinVerifierTest, CRLSetDoesNotDowngrade) { +TEST_F(CertVerifierServiceFactoryCRLSetTest, CRLSetDoesNotDowngrade) { scoped_refptr<net::X509Certificate> test_root(net::ImportCertFromFile( net::GetTestCertsDirectory(), "root_ca_cert.pem")); ASSERT_TRUE(test_root); @@ -747,7 +738,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -788,14 +778,12 @@ // Create a new CertVerifierService and ensure the latest CRLSet is still // applied. mojo::Remote<mojom::CertVerifierService> cv_service_remote2; - mojo::Remote<mojom::CertVerifierServiceUpdater> cv_service_updater_remote2; DummyCVServiceClient cv_service_client2; mojom::CertVerifierCreationParamsPtr cv_creation_params2 = mojom::CertVerifierCreationParams::New(); cv_service_factory_remote->GetNewCertVerifier( cv_service_remote2.BindNewPipeAndPassReceiver(), - cv_service_updater_remote2.BindNewPipeAndPassReceiver(), cv_service_client2.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params2)); @@ -810,7 +798,7 @@ // Verifies that attempting to send an invalid CRLSet does not affect existing // or new contexts. -TEST_F(CertVerifierServiceFactoryBuiltinVerifierTest, BadCRLSetIgnored) { +TEST_F(CertVerifierServiceFactoryCRLSetTest, BadCRLSetIgnored) { scoped_refptr<net::X509Certificate> test_root(net::ImportCertFromFile( net::GetTestCertsDirectory(), "root_ca_cert.pem")); ASSERT_TRUE(test_root); @@ -832,7 +820,6 @@ cv_service_factory_remote->GetNewCertVerifier( cv_service_remote.BindNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cv_service_client.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params)); @@ -880,14 +867,12 @@ // Create a new CertVerifierService and ensure the latest valid CRLSet is // still applied. mojo::Remote<mojom::CertVerifierService> cv_service_remote2; - mojo::Remote<mojom::CertVerifierServiceUpdater> cv_service_updater_remote2; DummyCVServiceClient cv_service_client2; mojom::CertVerifierCreationParamsPtr cv_creation_params2 = mojom::CertVerifierCreationParams::New(); cv_service_factory_remote->GetNewCertVerifier( cv_service_remote2.BindNewPipeAndPassReceiver(), - cv_service_updater_remote2.BindNewPipeAndPassReceiver(), cv_service_client2.client_.BindNewPipeAndPassRemote(), std::move(cv_creation_params2)); @@ -900,76 +885,4 @@ } } -TEST_F(CertVerifierServiceFactoryBuiltinVerifierTest, - GetNewCertVerifierWithAdditionalCerts) { - auto [leaf1, intermediate1, root1] = net::CertBuilder::CreateSimpleChain3(); - auto [leaf2, intermediate2, root2] = net::CertBuilder::CreateSimpleChain3(); - - mojo::Remote<mojom::CertVerifierServiceFactory> cv_service_factory_remote; - CertVerifierServiceFactoryImpl cv_service_factory_impl( - cv_service_factory_remote.BindNewPipeAndPassReceiver()); - - EnableChromeRootStoreIfOptional(&cv_service_factory_impl); - - mojo::Remote<mojom::CertVerifierService> cv_service_remote; - mojo::Remote<mojom::CertVerifierServiceUpdater> cv_service_updater_remote; - DummyCVServiceClient cv_service_client; - mojom::CertVerifierCreationParamsPtr cv_creation_params = - mojom::CertVerifierCreationParams::New(); - // Initial creation params supply `root1` as an additional trust anchor and - // `intermediate1` as an untrusted cert. - cv_creation_params->initial_additional_certificates = - mojom::AdditionalCertificates::New(); - cv_creation_params->initial_additional_certificates->trust_anchors.push_back( - root1->GetX509Certificate()); - cv_creation_params->initial_additional_certificates->all_certificates - .push_back(intermediate1->GetX509Certificate()); - - // Create the cert verifier. It should start with the additional trust - // anchors from the creation params already trusted. - cv_service_factory_remote->GetNewCertVerifier( - cv_service_remote.BindNewPipeAndPassReceiver(), - cv_service_updater_remote.BindNewPipeAndPassReceiver(), - cv_service_client.client_.BindNewPipeAndPassRemote(), - std::move(cv_creation_params)); - - // `leaf1` should be trusted and `leaf2` should not be trusted. - { - auto [net_error, result] = Verify( - cv_service_remote, leaf1->GetX509Certificate(), "www.example.com"); - EXPECT_THAT(net_error, IsError(net::OK)); - } - { - auto [net_error, result] = Verify( - cv_service_remote, leaf2->GetX509Certificate(), "www.example.com"); - EXPECT_THAT(net_error, IsError(net::ERR_CERT_AUTHORITY_INVALID)); - } - - EXPECT_EQ(cv_service_client.changed_count_, 0u); - - // Supply a new set of additional certificates with `root2` trusted this time. - auto new_additional_certificates = mojom::AdditionalCertificates::New(); - new_additional_certificates->trust_anchors.push_back( - root2->GetX509Certificate()); - new_additional_certificates->all_certificates.push_back( - intermediate2->GetX509Certificate()); - cv_service_updater_remote->UpdateAdditionalCertificates( - std::move(new_additional_certificates)); - - // Client should have received notification of the update. - EXPECT_NO_FATAL_FAILURE(cv_service_client.WaitForCertVerifierChange(1u)); - - // Now `leaf1` should not be trusted and `leaf2` should be trusted. - { - auto [net_error, result] = Verify( - cv_service_remote, leaf1->GetX509Certificate(), "www.example.com"); - EXPECT_THAT(net_error, IsError(net::ERR_CERT_AUTHORITY_INVALID)); - } - { - auto [net_error, result] = Verify( - cv_service_remote, leaf2->GetX509Certificate(), "www.example.com"); - EXPECT_THAT(net_error, IsError(net::OK)); - } -} - } // namespace cert_verifier
diff --git a/services/cert_verifier/cert_verifier_service_unittest.cc b/services/cert_verifier/cert_verifier_service_unittest.cc index 68be6ed..beb52bcaa 100644 --- a/services/cert_verifier/cert_verifier_service_unittest.cc +++ b/services/cert_verifier/cert_verifier_service_unittest.cc
@@ -111,8 +111,7 @@ void RemoveObserver(Observer* observer) override { observer_ = nullptr; } void UpdateVerifyProcData( scoped_refptr<net::CertNetFetcher> cert_net_fetcher, - const net::CertVerifyProc::ImplParams& impl_params, - const net::CertVerifyProc::InstanceParams& instance_params) override { + const net::CertVerifyProcFactory::ImplParams& impl_params) override { ADD_FAILURE() << "not handled"; } @@ -201,10 +200,8 @@ (void)new internal::CertVerifierServiceImpl( base::WrapUnique(dummy_cv_.get()), cv_service_remote_.BindNewPipeAndPassReceiver(), - cv_service_updater_remote_.BindNewPipeAndPassReceiver(), cv_service_client_.BindNewPipeAndPassRemote(), - /*cert_net_fetcher=*/nullptr, - /*instance_params=*/{}); + /*cert_net_fetcher=*/nullptr); } void SetUp() override { ASSERT_TRUE(GetTestCert()); } @@ -286,7 +283,6 @@ base::test::TaskEnvironment task_environment_; mojo::Remote<mojom::CertVerifierService> cv_service_remote_; - mojo::Remote<mojom::CertVerifierServiceUpdater> cv_service_updater_remote_; mojo::Receiver<mojom::CertVerifierServiceClient> cv_service_client_; unsigned cv_service_client_changed_count_ = 0; raw_ptr<DummyCertVerifier> dummy_cv_;
diff --git a/services/cert_verifier/integration_tests/network_context_unittest.cc b/services/cert_verifier/integration_tests/network_context_unittest.cc index 5727515..a30610a 100644 --- a/services/cert_verifier/integration_tests/network_context_unittest.cc +++ b/services/cert_verifier/integration_tests/network_context_unittest.cc
@@ -37,7 +37,6 @@ mojo::PendingReceiver<mojom::CertVerifierServiceClient> cert_verifier_client; cert_verifier_service_factory->GetNewCertVerifier( cert_verifier_remote.InitWithNewPipeAndPassReceiver(), - /*updater=*/mojo::NullReceiver(), cert_verifier_client.InitWithNewPipeAndPassRemote(), std::move(creation_params)); return network::mojom::CertVerifierServiceRemoteParams::New(
diff --git a/services/cert_verifier/integration_tests/network_service_unittest.cc b/services/cert_verifier/integration_tests/network_service_unittest.cc index 137e1680..e12dda4 100644 --- a/services/cert_verifier/integration_tests/network_service_unittest.cc +++ b/services/cert_verifier/integration_tests/network_service_unittest.cc
@@ -66,7 +66,6 @@ // Create a cert verifier service. cert_verifier_service_impl_.GetNewCertVerifierForTesting( cv_service_remote.InitWithNewPipeAndPassReceiver(), - /*updater_receiver=*/mojo::NullReceiver(), cv_service_client.InitWithNewPipeAndPassRemote(), mojom::CertVerifierCreationParams::New(), &cert_net_fetcher_url_loader_);
diff --git a/services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom b/services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom index 6a4c0a6..6cd79e3d 100644 --- a/services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom +++ b/services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom
@@ -8,7 +8,6 @@ import "mojo/public/mojom/base/file_path.mojom"; import "mojo/public/mojom/base/read_only_buffer.mojom"; import "services/network/public/mojom/cert_verifier_service.mojom"; -import "services/network/public/mojom/network_param.mojom"; // Parameters to specify how the net::CertVerifier and net::CertVerifyProc // objects should be instantiated. @@ -27,10 +26,6 @@ // isn't opened multiple times for NetworkContexts in the same profie. [EnableIf=is_chromeos_ash] string username_hash; - - // Initial additional certificates that will be used for certificate - // validation. - AdditionalCertificates? initial_additional_certificates; }; // Serialized copy of the Chrome Root store. @@ -59,7 +54,6 @@ // Gets a new CertVerifierService, which //net code can interface with using // cert_verifier::MojoCertVerifier. GetNewCertVerifier(pending_receiver<CertVerifierService> receiver, - pending_receiver<CertVerifierServiceUpdater>? updater, pending_remote<CertVerifierServiceClient> client, CertVerifierCreationParams? creation_params);
diff --git a/services/network/cert_verifier_with_trust_anchors.cc b/services/network/cert_verifier_with_trust_anchors.cc index 8c11f13..40028af 100644 --- a/services/network/cert_verifier_with_trust_anchors.cc +++ b/services/network/cert_verifier_with_trust_anchors.cc
@@ -9,8 +9,11 @@ #include "base/check_op.h" #include "base/functional/bind.h" #include "net/base/net_errors.h" +#include "net/cert/caching_cert_verifier.h" #include "net/cert/cert_verifier.h" -#include "net/cert/cert_verify_result.h" +#include "net/cert/cert_verify_proc.h" +#include "net/cert/coalescing_cert_verifier.h" +#include "net/cert/multi_threaded_cert_verifier.h" namespace network { @@ -35,6 +38,20 @@ std::move(completion_callback).Run(error); } +net::CertVerifier::Config ExtendTrustAnchorsAndTempCerts( + const net::CertVerifier::Config& config, + const net::CertificateList& trust_anchors, + const net::CertificateList& untrusted_authorities) { + net::CertVerifier::Config new_config = config; + new_config.additional_trust_anchors.insert( + new_config.additional_trust_anchors.begin(), trust_anchors.begin(), + trust_anchors.end()); + new_config.additional_untrusted_authorities.insert( + new_config.additional_untrusted_authorities.begin(), + untrusted_authorities.begin(), untrusted_authorities.end()); + return new_config; +} + } // namespace CertVerifierWithTrustAnchors::CertVerifierWithTrustAnchors( @@ -51,6 +68,23 @@ std::unique_ptr<net::CertVerifier> delegate) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); delegate_ = std::move(delegate); + delegate_->SetConfig(ExtendTrustAnchorsAndTempCerts( + orig_config_, trust_anchors_, untrusted_authorities_)); +} + +void CertVerifierWithTrustAnchors::SetAdditionalCerts( + const net::CertificateList& trust_anchors, + const net::CertificateList& untrusted_authorities) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (std::tie(trust_anchors, untrusted_authorities) == + std::tie(trust_anchors_, untrusted_authorities_)) + return; + trust_anchors_ = trust_anchors; + untrusted_authorities_ = untrusted_authorities; + if (!delegate_) + return; + delegate_->SetConfig(ExtendTrustAnchorsAndTempCerts( + orig_config_, trust_anchors_, untrusted_authorities_)); } int CertVerifierWithTrustAnchors::Verify( @@ -74,7 +108,9 @@ void CertVerifierWithTrustAnchors::SetConfig(const Config& config) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - delegate_->SetConfig(config); + orig_config_ = config; + delegate_->SetConfig(ExtendTrustAnchorsAndTempCerts( + orig_config_, trust_anchors_, untrusted_authorities_)); } void CertVerifierWithTrustAnchors::AddObserver(Observer* observer) {
diff --git a/services/network/cert_verifier_with_trust_anchors.h b/services/network/cert_verifier_with_trust_anchors.h index 925f3b84..e49fd5d 100644 --- a/services/network/cert_verifier_with_trust_anchors.h +++ b/services/network/cert_verifier_with_trust_anchors.h
@@ -24,8 +24,8 @@ namespace network { -// Wraps a net::CertVerifier to run a callback if the additional trust anchors -// configured by the ONC user policy are used. +// Wraps a net::CertVerifier to make it use the additional trust anchors +// configured by the ONC user policy. class COMPONENT_EXPORT(NETWORK_SERVICE) CertVerifierWithTrustAnchors : public net::CertVerifier { public: @@ -46,6 +46,11 @@ // this method. void InitializeOnIOThread(std::unique_ptr<net::CertVerifier> delegate); + // Sets the additional trust anchors and untrusted authorities to be + // considered as intermediates. + void SetAdditionalCerts(const net::CertificateList& trust_anchors, + const net::CertificateList& untrusted_authorities); + // CertVerifier: int Verify(const RequestParams& params, net::CertVerifyResult* verify_result, @@ -57,6 +62,9 @@ void RemoveObserver(Observer* observer) override; private: + net::CertVerifier::Config orig_config_; + net::CertificateList trust_anchors_; + net::CertificateList untrusted_authorities_; base::RepeatingClosure anchor_used_callback_; std::unique_ptr<CertVerifier> delegate_; THREAD_CHECKER(thread_checker_);
diff --git a/services/network/cert_verifier_with_trust_anchors_unittest.cc b/services/network/cert_verifier_with_trust_anchors_unittest.cc index e6727a9..16accf2 100644 --- a/services/network/cert_verifier_with_trust_anchors_unittest.cc +++ b/services/network/cert_verifier_with_trust_anchors_unittest.cc
@@ -16,10 +16,14 @@ #include "base/test/task_environment.h" #include "crypto/nss_util_internal.h" #include "net/base/test_completion_callback.h" +#include "net/cert/caching_cert_verifier.h" #include "net/cert/cert_net_fetcher.h" #include "net/cert/cert_verify_proc.h" +#include "net/cert/cert_verify_proc_builtin.h" #include "net/cert/cert_verify_result.h" +#include "net/cert/coalescing_cert_verifier.h" #include "net/cert/mock_cert_verifier.h" +#include "net/cert/multi_threaded_cert_verifier.h" #include "net/cert/x509_certificate.h" #include "net/log/net_log_with_source.h" #include "net/test/cert_test_util.h" @@ -28,6 +32,58 @@ namespace network { +// Wraps a net::MockCertVerifier. When SetConfig() is called with trust anchors, +// this sets |server_cert_| to pass cert verification using an additional trust +// anchor. Otherwise |server_cert_| wil fail cert verification with +// net::ERR_CERT_AUTHORITY_INVALID. +class WrappedMockCertVerifier : public net::CertVerifier { + public: + explicit WrappedMockCertVerifier( + scoped_refptr<net::X509Certificate> server_cert) + : server_cert_(std::move(server_cert)) { + mock_cert_verifier_.set_async(true); + } + + // net::CertVerifier implementation: + int Verify(const RequestParams& params, + net::CertVerifyResult* verify_result, + net::CompletionOnceCallback callback, + std::unique_ptr<Request>* out_req, + const net::NetLogWithSource& net_log) override { + return mock_cert_verifier_.Verify(params, verify_result, + std::move(callback), out_req, net_log); + } + void SetConfig(const Config& config) override { + mock_cert_verifier_.ClearRules(); + + int net_err; + net::CertVerifyResult verify_result; + if (config.additional_trust_anchors.empty()) { + net_err = net::ERR_CERT_AUTHORITY_INVALID; + } else { + net_err = net::OK; + verify_result.is_issued_by_additional_trust_anchor = true; + } + + verify_result.verified_cert = server_cert_; + verify_result.cert_status = net::MapNetErrorToCertStatus(net_err); + + mock_cert_verifier_.AddResultForCert(server_cert_, verify_result, net_err); + + mock_cert_verifier_.SetConfig(config); + } + void AddObserver(Observer* observer) override { + mock_cert_verifier_.AddObserver(observer); + } + void RemoveObserver(Observer* observer) override { + mock_cert_verifier_.RemoveObserver(observer); + } + + private: + scoped_refptr<net::X509Certificate> server_cert_; + net::MockCertVerifier mock_cert_verifier_; +}; + class CertVerifierWithTrustAnchorsTest : public testing::Test { public: CertVerifierWithTrustAnchorsTest() @@ -49,15 +105,13 @@ &CertVerifierWithTrustAnchorsTest::OnTrustAnchorUsed, base::Unretained(this))); - auto mock_cert_verifier = std::make_unique<net::MockCertVerifier>(); - mock_cert_verifier_ = mock_cert_verifier.get(); - mock_cert_verifier_->set_async(true); - mock_cert_verifier_->set_default_result(net::ERR_CERT_AUTHORITY_INVALID); - cert_verifier_->InitializeOnIOThread(std::move(mock_cert_verifier)); + cert_verifier_->InitializeOnIOThread( + std::make_unique<net::CachingCertVerifier>( + std::make_unique<net::CoalescingCertVerifier>( + std::make_unique<WrappedMockCertVerifier>(test_server_cert_)))); } void TearDown() override { - mock_cert_verifier_ = nullptr; // Destroy |cert_verifier_| before destroying the TaskEnvironment, otherwise // BrowserThread::CurrentlyOn checks fail. cert_verifier_.reset(); @@ -91,7 +145,7 @@ scoped_refptr<net::X509Certificate> test_server_cert_; net::CertificateList test_ca_cert_list_; std::unique_ptr<network::CertVerifierWithTrustAnchors> cert_verifier_; - raw_ptr<net::MockCertVerifier> mock_cert_verifier_; + scoped_refptr<net::CertVerifyProc> cert_verify_proc_; private: void OnTrustAnchorUsed() { trust_anchor_used_ = true; } @@ -119,14 +173,10 @@ } EXPECT_FALSE(WasTrustAnchorUsedAndReset()); - // Verify() again with the cert configured as non-policy provided trust - // anchor. + // Verify() again with the additional trust anchors. + cert_verifier_->SetAdditionalCerts(test_ca_cert_list_, + net::CertificateList()); { - net::CertVerifyResult mock_verify_result; - mock_verify_result.is_issued_by_additional_trust_anchor = false; - mock_verify_result.verified_cert = test_server_cert_; - mock_cert_verifier_->AddResultForCert(test_server_cert_, mock_verify_result, - net::OK); net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; @@ -137,16 +187,79 @@ error = callback.WaitForResult(); EXPECT_EQ(net::OK, error); } + EXPECT_TRUE(WasTrustAnchorUsedAndReset()); + + // Verify() again with the additional trust anchors will hit the cache. + cert_verifier_->SetAdditionalCerts(test_ca_cert_list_, + net::CertificateList()); + { + net::CertVerifyResult verify_result; + net::TestCompletionCallback callback; + std::unique_ptr<net::CertVerifier::Request> request; + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); + EXPECT_EQ(net::OK, error); + } + EXPECT_TRUE(WasTrustAnchorUsedAndReset()); + + // Verifying after removing the trust anchors should now fail. + cert_verifier_->SetAdditionalCerts(net::CertificateList(), + net::CertificateList()); + { + net::CertVerifyResult verify_result; + net::TestCompletionCallback callback; + std::unique_ptr<net::CertVerifier::Request> request; + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); + // Note: Changing the trust anchors should flush the cache. + ASSERT_EQ(net::ERR_IO_PENDING, error); + EXPECT_TRUE(request); + error = callback.WaitForResult(); + EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); + } + // The additional trust anchors were reset, thus |cert_verifier_| should not + // signal it's usage anymore. + EXPECT_FALSE(WasTrustAnchorUsedAndReset()); +} + +TEST_F(CertVerifierWithTrustAnchorsTest, + VerifyUsesAdditionalTrustAnchorsAfterConfigChange) { + // |test_server_cert_| is untrusted, so Verify() fails. + { + net::CertVerifyResult verify_result; + net::TestCompletionCallback callback; + std::unique_ptr<net::CertVerifier::Request> request; + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); + ASSERT_EQ(net::ERR_IO_PENDING, error); + EXPECT_TRUE(request); + error = callback.WaitForResult(); + EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); + } EXPECT_FALSE(WasTrustAnchorUsedAndReset()); - // Verify() again with the cert configured as an additional trust anchor. + // Verify() again with the additional trust anchors. + cert_verifier_->SetAdditionalCerts(test_ca_cert_list_, + net::CertificateList()); { - net::CertVerifyResult mock_verify_result; - mock_verify_result.is_issued_by_additional_trust_anchor = true; - mock_verify_result.verified_cert = test_server_cert_; - mock_cert_verifier_->ClearRules(); - mock_cert_verifier_->AddResultForCert(test_server_cert_, mock_verify_result, - net::OK); + net::CertVerifyResult verify_result; + net::TestCompletionCallback callback; + std::unique_ptr<net::CertVerifier::Request> request; + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); + ASSERT_EQ(net::ERR_IO_PENDING, error); + EXPECT_TRUE(request); + error = callback.WaitForResult(); + EXPECT_EQ(net::OK, error); + } + EXPECT_TRUE(WasTrustAnchorUsedAndReset()); + + // Change the configuration to enable SHA-1, which should still use the + // additional trust anchors. + net::CertVerifier::Config config; + config.enable_sha1_local_anchors = true; + cert_verifier_->SetConfig(config); + { net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request;
diff --git a/services/network/network_context.cc b/services/network/network_context.cc index 6edd2b51..0f4d9ae6 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc
@@ -608,6 +608,12 @@ socket_factory_ = std::make_unique<SocketFactory>( url_request_context_->net_log(), url_request_context_); +#if BUILDFLAG(IS_WIN) + if (params_->socket_brokers) { + socket_factory_->BindSocketBroker( + std::move(params_->socket_brokers->server)); + } +#endif resource_scheduler_ = std::make_unique<ResourceScheduler>(); if (base::FeatureList::IsEnabled(features::kNetworkServiceMemoryCache)) @@ -1471,6 +1477,25 @@ network_delegate_->set_enable_referrers(enable_referrers); } +#if BUILDFLAG(IS_CHROMEOS) +void NetworkContext::UpdateAdditionalCertificates( + mojom::AdditionalCertificatesPtr additional_certificates) { + if (!cert_verifier_with_trust_anchors_) { + CHECK(g_cert_verifier_for_testing); + return; + } + if (!additional_certificates) { + cert_verifier_with_trust_anchors_->SetAdditionalCerts( + net::CertificateList(), net::CertificateList()); + return; + } + + cert_verifier_with_trust_anchors_->SetAdditionalCerts( + additional_certificates->trust_anchors, + additional_certificates->all_certificates); +} +#endif // BUILDFLAG(IS_CHROMEOS) + #if BUILDFLAG(IS_CT_SUPPORTED) void NetworkContext::SetCTPolicy(mojom::CTPolicyPtr ct_policy) { if (!require_ct_delegate_) @@ -2439,12 +2464,11 @@ std::move(cert_verifier))); #if BUILDFLAG(IS_CHROMEOS) - // TODO(https://crbug.com/1477317): The TrustAnchorUsed callback should - // work on all platforms. (Also consider whether this wrapper is the best - // way to handle this or if it should be refactored.) cert_verifier_with_trust_anchors_ = new CertVerifierWithTrustAnchors(base::BindRepeating( &NetworkContext::TrustAnchorUsed, base::Unretained(this))); + UpdateAdditionalCertificates( + std::move(params_->initial_additional_certificates)); cert_verifier_with_trust_anchors_->InitializeOnIOThread( std::move(cert_verifier)); cert_verifier = base::WrapUnique(cert_verifier_with_trust_anchors_.get()); @@ -2754,10 +2778,10 @@ command_line->GetSwitchValueASCII(switches::kHostResolverRules)); #if BUILDFLAG(IS_WIN) - if (params_->socket_broker) { + if (params_->socket_brokers) { builder.set_client_socket_factory( std::make_unique<BrokeredClientSocketFactory>( - std::move(params_->socket_broker))); + std::move(params_->socket_brokers->client))); } #endif
diff --git a/services/network/network_context.h b/services/network/network_context.h index dca9e11a..7e6ae6f9 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h
@@ -316,6 +316,10 @@ mojom::NetworkConditionsPtr conditions) override; void SetAcceptLanguage(const std::string& new_accept_language) override; void SetEnableReferrers(bool enable_referrers) override; +#if BUILDFLAG(IS_CHROMEOS) + void UpdateAdditionalCertificates( + mojom::AdditionalCertificatesPtr additional_certificates) override; +#endif #if BUILDFLAG(IS_CT_SUPPORTED) void SetCTPolicy(mojom::CTPolicyPtr ct_policy) override; void MaybeEnqueueSCTReport(
diff --git a/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits.cc b/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits.cc index 38a2ec3..e39edd7b 100644 --- a/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits.cc +++ b/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits.cc
@@ -32,11 +32,23 @@ net::CertVerifier::Config>:: Read(cert_verifier::mojom::CertVerifierConfigDataView data, net::CertVerifier::Config* config) { + std::vector<scoped_refptr<net::X509Certificate>> additional_trust_anchors; + std::vector<scoped_refptr<net::X509Certificate>> + additional_untrusted_authorities; + if (!data.ReadAdditionalTrustAnchors(&additional_trust_anchors) || + !data.ReadAdditionalUntrustedAuthorities( + &additional_untrusted_authorities)) { + return false; + } + config->enable_rev_checking = data.enable_rev_checking(); config->require_rev_checking_local_anchors = data.require_rev_checking_local_anchors(); config->enable_sha1_local_anchors = data.enable_sha1_local_anchors(); config->disable_symantec_enforcement = data.disable_symantec_enforcement(); + config->additional_trust_anchors = std::move(additional_trust_anchors); + config->additional_untrusted_authorities = + std::move(additional_untrusted_authorities); return true; }
diff --git a/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits.h b/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits.h index c0f6077..f2fc57712 100644 --- a/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits.h +++ b/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits.h
@@ -57,6 +57,14 @@ const net::CertVerifier::Config& config) { return config.disable_symantec_enforcement; } + static const std::vector<scoped_refptr<net::X509Certificate>>& + additional_trust_anchors(const net::CertVerifier::Config& config) { + return config.additional_trust_anchors; + } + static const std::vector<scoped_refptr<net::X509Certificate>>& + additional_untrusted_authorities(const net::CertVerifier::Config& config) { + return config.additional_untrusted_authorities; + } static bool Read(cert_verifier::mojom::CertVerifierConfigDataView data, net::CertVerifier::Config* config);
diff --git a/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits_unittest.cc b/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits_unittest.cc index f4a99b3..8e28502b2 100644 --- a/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits_unittest.cc +++ b/services/network/public/cpp/cert_verifier/cert_verifier_mojom_traits_unittest.cc
@@ -39,6 +39,19 @@ } namespace { +bool CertificateListsEqual(const net::CertificateList& cert_list1, + const net::CertificateList& cert_list2) { + if (cert_list1.size() != cert_list2.size()) + return false; + + std::set<net::SHA256HashValue> fingerprints1, fingerprints2; + for (size_t i = 0; i < cert_list1.size(); i++) { + fingerprints1.insert(cert_list1[i]->CalculateChainFingerprint256()); + fingerprints2.insert(cert_list2[i]->CalculateChainFingerprint256()); + } + + return fingerprints1 == fingerprints2; +} bool ConfigsEqual(const net::CertVerifier::Config& config1, const net::CertVerifier::Config& config2) { @@ -52,6 +65,14 @@ config2.disable_symantec_enforcement)) return false; + if (!CertificateListsEqual(config1.additional_trust_anchors, + config2.additional_trust_anchors)) + return false; + + if (!CertificateListsEqual(config1.additional_untrusted_authorities, + config2.additional_untrusted_authorities)) + return false; + return true; } } // namespace @@ -79,4 +100,23 @@ ASSERT_TRUE(ConfigsEqual(config, out_config)); } +TEST(CertVerifierMojomTraitsTest, ConfigCRLAndAdditionalCerts) { + const base::FilePath certs_dir = net::GetTestCertsDirectory(); + + net::CertVerifier::Config config; + config.additional_trust_anchors.push_back( + net::ImportCertFromFile(certs_dir, "root_ca_cert.pem")); + config.additional_trust_anchors.push_back( + net::ImportCertFromFile(certs_dir, "2029_globalsign_com_cert.pem")); + + config.additional_untrusted_authorities.push_back( + net::ImportCertFromFile(certs_dir, "intermediate_ca_cert.pem")); + + net::CertVerifier::Config out_config; + + ASSERT_TRUE(mojo::test::SerializeAndDeserialize<mojom::CertVerifierConfig>( + config, out_config)); + ASSERT_TRUE(ConfigsEqual(config, out_config)); +} + } // namespace cert_verifier
diff --git a/services/network/public/mojom/cert_verifier_service.mojom b/services/network/public/mojom/cert_verifier_service.mojom index 3eb4444..bb9029a 100644 --- a/services/network/public/mojom/cert_verifier_service.mojom +++ b/services/network/public/mojom/cert_verifier_service.mojom
@@ -26,16 +26,8 @@ bool require_rev_checking_local_anchors; bool enable_sha1_local_anchors; bool disable_symantec_enforcement; -}; - -struct AdditionalCertificates { - // TODO(crbug.com/1477317): store these as bytestrings - - // List of untrusted certificates, which will be used during path building. - array<network.mojom.X509Certificate> all_certificates; - - // List of additional trust anchors. - array<network.mojom.X509Certificate> trust_anchors; + array<network.mojom.X509Certificate> additional_trust_anchors; + array<network.mojom.X509Certificate> additional_untrusted_authorities; }; // Allows the CertVerifierService to connect a new URLLoaderFactory if its @@ -68,15 +60,6 @@ SetConfig(CertVerifierConfig config); }; -// Updates a Cert Verifier with new parameters. -interface CertVerifierServiceUpdater { - // Called when trust parameters change for Cert Verification. All parameters - // will override any previously provided parameters that were provide (either - // via previous calls to UpdateCertVerifier or that were specified in - // cert_verifier.mojom.CertVerifierCreationParams. - UpdateAdditionalCertificates(AdditionalCertificates certificates); -}; - // Receives events from the CertVerifierService. interface CertVerifierServiceClient { // Called when the certificate verifier changes internal configuration.
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom index 536e3728..3428d3c 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom
@@ -159,6 +159,15 @@ ClearBadProxiesCache(); }; +[EnableIf=is_chromeos] +struct AdditionalCertificates { + // List of all additional certificates. + array<X509Certificate> all_certificates; + + // List of additional trust anchors. + array<X509Certificate> trust_anchors; +}; + // Sent by TrustedURLLoaderHeaderClient to perform modifications for a request. interface TrustedHeaderClient { // Allows modifying request headers before the request is sent. @@ -302,6 +311,15 @@ bool trigger_migration = false; }; +// Socket brokers used by the ClientSocketFactory for client sockets and +// SocketFactory for server sockets. +[EnableIf=is_win] +struct SocketBrokerRemotes { + pending_remote<SocketBroker> client; + pending_remote<SocketBroker> server; +}; + + // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. @@ -432,7 +450,7 @@ // Broker used by the network service sandbox to create sockets in // the browser. Set when the sandbox is enabled on Windows. [EnableIf=is_win] - pending_remote<SocketBroker>? socket_broker; + SocketBrokerRemotes? socket_brokers; // A service to fetch blind-signed auth tokens for IP protection. If this // is not set, then no tokens are available. @@ -471,6 +489,11 @@ // Contains a pipe to a CertVerifierService. CertVerifierServiceRemoteParams cert_verifier_params; + // Initial additional certificates that will be used for certificate + // validation. + [EnableIf=is_chromeos] + AdditionalCertificates? initial_additional_certificates; + // Parameters for constructing the cookie manager. CookieManagerParams? cookie_manager_params; @@ -1223,6 +1246,10 @@ // If false, the referrer of requests is never populated. SetEnableReferrers(bool enable_referrers); + // Updates the additional trust anchors for certificate verification. + [EnableIf=is_chromeos] + UpdateAdditionalCertificates(AdditionalCertificates? additional_certificates); + // Updates the CT policy to be used for requests. Only applies if the // NetworkContextParams set enforce_chrome_ct_policy to true. // TODO(rsleevi): Remove this once Chrome-specific policies are moved out
diff --git a/services/network/socket_factory.cc b/services/network/socket_factory.cc index 69f8ade..54ec55b 100644 --- a/services/network/socket_factory.cc +++ b/services/network/socket_factory.cc
@@ -18,6 +18,7 @@ #include "net/log/net_log.h" #include "net/socket/client_socket_factory.h" #include "net/socket/client_socket_handle.h" +#include "net/socket/tcp_server_socket.h" #include "net/ssl/ssl_config.h" #include "net/ssl/ssl_config_service.h" #include "net/url_request/url_request_context.h" @@ -93,8 +94,62 @@ const net::NetworkTrafficAnnotationTag& traffic_annotation, mojo::PendingReceiver<mojom::TCPServerSocket> receiver, mojom::NetworkContext::CreateTCPServerSocketCallback callback) { +#if BUILDFLAG(IS_WIN) + if (socket_broker_) { + socket_broker_->CreateTcpSocket( + local_addr.GetFamily(), + base::BindOnce(&SocketFactory::DidCompleteCreate, + weak_ptr_factory_.GetWeakPtr(), local_addr, + std::move(options), traffic_annotation, + std::move(receiver), std::move(callback))); + return; + } +#endif auto socket = std::make_unique<TCPServerSocket>(this, net_log_, traffic_annotation); + CreateTCPServerSocketHelper(std::move(socket), local_addr, std::move(options), + traffic_annotation, std::move(receiver), + std::move(callback)); +} + +#if BUILDFLAG(IS_WIN) +void SocketFactory::DidCompleteCreate( + const net::IPEndPoint& local_addr, + mojom::TCPServerSocketOptionsPtr options, + const net::NetworkTrafficAnnotationTag& traffic_annotation, + mojo::PendingReceiver<mojom::TCPServerSocket> receiver, + mojom::NetworkContext::CreateTCPServerSocketCallback callback, + network::TransferableSocket socket, + int result) { + if (result != net::OK) { + std::move(callback).Run(result, absl::nullopt); + return; + } + auto tcp_socket = + std::make_unique<net::TCPServerSocket>(net_log_, net::NetLogSource()); + tcp_socket->AdoptSocket(socket.TakeSocket()); + + auto tcp_server_socket = std::make_unique<TCPServerSocket>( + std::move(tcp_socket), 0, this, traffic_annotation); + + CreateTCPServerSocketHelper(std::move(tcp_server_socket), local_addr, + std::move(options), traffic_annotation, + std::move(receiver), std::move(callback)); +} + +void SocketFactory::BindSocketBroker( + mojo::PendingRemote<mojom::SocketBroker> pending_remote) { + socket_broker_.Bind(std::move(pending_remote)); +} +#endif + +void SocketFactory::CreateTCPServerSocketHelper( + std::unique_ptr<TCPServerSocket> socket, + const net::IPEndPoint& local_addr, + mojom::TCPServerSocketOptionsPtr options, + const net::NetworkTrafficAnnotationTag& traffic_annotation, + mojo::PendingReceiver<mojom::TCPServerSocket> receiver, + mojom::NetworkContext::CreateTCPServerSocketCallback callback) { #if BUILDFLAG(IS_CHROMEOS) if (options->connection_tracker) { socket->AttachConnectionTracker(std::move(options->connection_tracker));
diff --git a/services/network/socket_factory.h b/services/network/socket_factory.h index 490ee00..1938fae5 100644 --- a/services/network/socket_factory.h +++ b/services/network/socket_factory.h
@@ -26,6 +26,10 @@ #include "services/network/tcp_server_socket.h" #include "services/network/tls_socket_factory.h" +#if BUILDFLAG(IS_WIN) +#include "services/network/public/mojom/socket_broker.mojom.h" +#endif + namespace net { class ClientSocketFactory; class NetLog; @@ -104,12 +108,36 @@ TLSSocketFactory* tls_socket_factory() { return &tls_socket_factory_; } +#if BUILDFLAG(IS_WIN) + void BindSocketBroker( + mojo::PendingRemote<mojom::SocketBroker> pending_remote); +#endif + private: // TCPServerSocket::Delegate implementation: void OnAccept( std::unique_ptr<TCPConnectedSocket> socket, mojo::PendingReceiver<mojom::TCPConnectedSocket> receiver) override; + void CreateTCPServerSocketHelper( + std::unique_ptr<TCPServerSocket> socket, + const net::IPEndPoint& local_addr, + mojom::TCPServerSocketOptionsPtr options, + const net::NetworkTrafficAnnotationTag& traffic_annotation, + mojo::PendingReceiver<mojom::TCPServerSocket> receiver, + mojom::NetworkContext::CreateTCPServerSocketCallback callback); + +#if BUILDFLAG(IS_WIN) + void DidCompleteCreate( + const net::IPEndPoint& local_addr, + mojom::TCPServerSocketOptionsPtr options, + const net::NetworkTrafficAnnotationTag& traffic_annotation, + mojo::PendingReceiver<mojom::TCPServerSocket> receiver, + mojom::NetworkContext::CreateTCPServerSocketCallback callback, + network::TransferableSocket socket, + int result); +#endif + const raw_ptr<net::NetLog> net_log_; raw_ptr<net::ClientSocketFactory> client_socket_factory_; @@ -121,6 +149,12 @@ mojo::UniqueReceiverSet<mojom::TCPConnectedSocket> tcp_connected_socket_receiver_; mojo::UniqueReceiverSet<mojom::TCPBoundSocket> tcp_bound_socket_receivers_; + +#if BUILDFLAG(IS_WIN) + mojo::Remote<mojom::SocketBroker> socket_broker_; +#endif + + base::WeakPtrFactory<SocketFactory> weak_ptr_factory_{this}; }; } // namespace network
diff --git a/services/network/tcp_socket_unittest.cc b/services/network/tcp_socket_unittest.cc index a08102b..655de130 100644 --- a/services/network/tcp_socket_unittest.cc +++ b/services/network/tcp_socket_unittest.cc
@@ -42,6 +42,7 @@ #include "services/network/socket_factory.h" #include "services/network/tcp_connected_socket.h" #include "services/network/tcp_server_socket.h" +#include "services/network/test/test_socket_broker_impl.h" #include "testing/gtest/include/gtest/gtest.h" #if BUILDFLAG(IS_MAC) @@ -162,7 +163,7 @@ server_addr_(server_addr) {} ~TestServer() {} - void Start(uint32_t backlog) { + void Start(uint32_t backlog, bool should_fail_socket_creation = false) { int net_error = net::ERR_FAILED; base::RunLoop run_loop; auto options = mojom::TCPServerSocketOptions::New(); @@ -178,9 +179,23 @@ run_loop.Quit(); })); run_loop.Run(); - EXPECT_EQ(net::OK, net_error); + if (should_fail_socket_creation) { + EXPECT_EQ(net::ERR_CONNECTION_FAILED, net_error); + } else { + EXPECT_EQ(net::OK, net_error); + } } +#if BUILDFLAG(IS_WIN) + void StartWithBroker(uint32_t backlog, bool should_fail_socket_creation) { + socket_broker_impl_.SetConnectionFailure(should_fail_socket_creation); + mojo::Receiver<mojom::SocketBroker> receiver(&socket_broker_impl_); + factory_.BindSocketBroker(receiver.BindNewPipeAndPassRemote()); + + Start(backlog, should_fail_socket_creation); + } +#endif + // Accepts one connection. Upon successful completion, |callback| will be // invoked. void AcceptOneConnection(net::CompletionOnceCallback callback) { @@ -260,6 +275,10 @@ } } +#if BUILDFLAG(IS_WIN) + TestSocketBrokerImpl socket_broker_impl_; +#endif + std::unique_ptr<net::URLRequestContext> url_request_context_; SocketFactory factory_; mojo::Remote<mojom::TCPServerSocket> server_socket_; @@ -393,6 +412,18 @@ mojo::UniqueReceiverSet<mojom::TCPServerSocket> tcp_server_socket_receiver_; }; +#if BUILDFLAG(IS_WIN) +TEST_F(TCPSocketTest, BrokerCreateTCPServerSocketSuccess) { + TestServer server; + server.StartWithBroker(1 /*backlog*/, false /*fail_server_socket_creation*/); +} + +TEST_F(TCPSocketTest, BrokerCreateTCPServerSocketFailure) { + TestServer server; + server.StartWithBroker(1 /*backlog*/, true /*fail_server_socket_creation*/); +} +#endif // BUILDFLAG(IS_WIN) + TEST_F(TCPSocketTest, ReadAndWrite) { const struct TestData { absl::optional<net::IPEndPoint> client_addr;
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h index 97ae929f..a133f8b8 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h
@@ -147,6 +147,10 @@ mojom::NetworkConditionsPtr conditions) override {} void SetAcceptLanguage(const std::string& new_accept_language) override {} void SetEnableReferrers(bool enable_referrers) override {} +#if BUILDFLAG(IS_CHROMEOS) + void UpdateAdditionalCertificates( + mojom::AdditionalCertificatesPtr additional_certificates) override {} +#endif #if BUILDFLAG(IS_CT_SUPPORTED) void SetCTPolicy(mojom::CTPolicyPtr ct_policy) override {} void SetCTLogListAlwaysTimelyForTesting() override {}
diff --git a/services/proxy_resolver/BUILD.gn b/services/proxy_resolver/BUILD.gn index c5ef3e9a..69d59715 100644 --- a/services/proxy_resolver/BUILD.gn +++ b/services/proxy_resolver/BUILD.gn
@@ -59,12 +59,14 @@ "proxy_resolver_impl_unittest.cc", "proxy_resolver_v8_tracing_unittest.cc", "proxy_resolver_v8_unittest.cc", + "public/cpp/proxy_resolver_mojom_traits_unittests.cc", ] deps = [ ":lib", "//base", "//base/test:test_support", + "//mojo/public/cpp/test_support:test_utils", "//net:test_support", "//services/service_manager/public/cpp/test:test_support", "//testing/gmock",
diff --git a/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits.cc b/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits.cc index 601a13d..cf6b337 100644 --- a/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits.cc +++ b/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits.cc
@@ -11,14 +11,14 @@ bool StructTraits<proxy_resolver::mojom::ProxyInfoDataView, net::ProxyInfo>:: Read(proxy_resolver::mojom::ProxyInfoDataView data, net::ProxyInfo* out) { - std::vector<net::ProxyServer> proxy_servers; - if (!data.ReadProxyServers(&proxy_servers)) { + std::vector<net::ProxyChain> proxy_chains; + if (!data.ReadProxyChains(&proxy_chains)) { return false; } net::ProxyList proxy_list; - for (const auto& server : proxy_servers) { - proxy_list.AddProxyServer(server); + for (const auto& chain : proxy_chains) { + proxy_list.AddProxyChain(chain); } out->UseProxyList(proxy_list);
diff --git a/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits.h b/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits.h index 3b88f82..e5b2271 100644 --- a/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits.h +++ b/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits.h
@@ -15,9 +15,9 @@ template <> struct COMPONENT_EXPORT(PROXY_RESOLVER_CPP) StructTraits<proxy_resolver::mojom::ProxyInfoDataView, net::ProxyInfo> { - static const std::vector<net::ProxyServer>& proxy_servers( + static const std::vector<net::ProxyChain>& proxy_chains( const net::ProxyInfo& info) { - return info.proxy_list().GetAll(); + return info.proxy_list().AllChains(); } static bool Read(proxy_resolver::mojom::ProxyInfoDataView data,
diff --git a/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits_unittests.cc b/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits_unittests.cc new file mode 100644 index 0000000..f7783c8 --- /dev/null +++ b/services/proxy_resolver/public/cpp/proxy_resolver_mojom_traits_unittests.cc
@@ -0,0 +1,57 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <vector> + +#include "mojo/public/cpp/test_support/test_utils.h" +#include "net/base/proxy_chain.h" +#include "net/base/proxy_server.h" +#include "net/proxy_resolution/proxy_info.h" +#include "services/network/public/cpp/network_param_mojom_traits.h" +#include "services/network/public/mojom/network_param.mojom.h" +#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace network { + +TEST(ProxyInfo, SerializeAndDeserialize) { + std::vector<net::ProxyInfo> infos; + + net::ProxyInfo direct; + direct.UseDirect(); + infos.push_back(std::move(direct)); + + net::ProxyInfo single_proxy_server; + single_proxy_server.UseProxyServer(net::ProxyServer::FromSchemeHostAndPort( + net::ProxyServer::SCHEME_HTTPS, "foo1", 443)); + infos.push_back(std::move(single_proxy_server)); + + net::ProxyInfo single_proxy_chain; + single_proxy_chain.UseProxyChain(net::ProxyChain::FromSchemeHostAndPort( + net::ProxyServer::SCHEME_HTTPS, "foo1", 443)); + infos.push_back(std::move(single_proxy_chain)); + + net::ProxyInfo multi_proxy_chain; + multi_proxy_chain.UseProxyChain(net::ProxyChain({ + net::ProxyServer::FromSchemeHostAndPort(net::ProxyServer::SCHEME_HTTPS, + "foo1", 443), + net::ProxyServer::FromSchemeHostAndPort(net::ProxyServer::SCHEME_HTTPS, + "foo2", 443), + })); + infos.push_back(std::move(multi_proxy_chain)); + + for (const auto& original : infos) { + // Only the underlying ProxyList gets copied, so only use methods that pull + // from that here. + SCOPED_TRACE(original.proxy_chain().ToDebugString()); + EXPECT_TRUE(original.proxy_chain().IsValid()); + net::ProxyInfo copied; + EXPECT_TRUE( + mojo::test::SerializeAndDeserialize<proxy_resolver::mojom::ProxyInfo>( + original, copied)); + EXPECT_TRUE(original.proxy_list().Equals(copied.proxy_list())); + } +} + +} // namespace network
diff --git a/services/proxy_resolver/public/mojom/proxy_resolver.mojom b/services/proxy_resolver/public/mojom/proxy_resolver.mojom index d016703..68447461 100644 --- a/services/proxy_resolver/public/mojom/proxy_resolver.mojom +++ b/services/proxy_resolver/public/mojom/proxy_resolver.mojom
@@ -29,7 +29,7 @@ }; struct ProxyInfo { - array<network.mojom.ProxyServer> proxy_servers; + array<network.mojom.ProxyChain> proxy_chains; }; interface ProxyResolver {
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index 8190333f..edc38375 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -1703,7 +1703,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "brya", - "cros_img": "brya-release/R118-15604.42.0", + "cros_img": "brya-release/R119-15633.37.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests BRYA_RELEASE_BETA", @@ -1722,7 +1722,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "brya", - "cros_img": "brya-release/R119-15633.10.0", + "cros_img": "brya-release/R120-15662.4.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests BRYA_RELEASE_DEV", @@ -1759,7 +1759,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "brya", - "cros_img": "brya-release/R117-15572.63.2", + "cros_img": "brya-release/R118-15604.57.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests BRYA_RELEASE_STABLE", @@ -1778,7 +1778,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "dedede", - "cros_img": "dedede-release/R118-15604.42.0", + "cros_img": "dedede-release/R119-15633.37.0", "experiment_percentage": 100, "name": "lacros_all_tast_tests DEDEDE_RELEASE_BETA", "resultdb": { @@ -1796,7 +1796,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "dedede", - "cros_img": "dedede-release/R119-15633.10.0", + "cros_img": "dedede-release/R120-15656.0.0", "experiment_percentage": 100, "name": "lacros_all_tast_tests DEDEDE_RELEASE_DEV", "resultdb": { @@ -1831,7 +1831,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "dedede", - "cros_img": "dedede-release/R117-15572.63.0", + "cros_img": "dedede-release/R118-15604.57.0", "experiment_percentage": 100, "name": "lacros_all_tast_tests DEDEDE_RELEASE_STABLE", "resultdb": { @@ -1849,7 +1849,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "fizz", - "cros_img": "fizz-release/R118-15604.42.0", + "cros_img": "fizz-release/R119-15633.37.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests FIZZ_RELEASE_BETA", @@ -1868,7 +1868,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "fizz", - "cros_img": "fizz-release/R119-15633.10.0", + "cros_img": "fizz-release/R120-15662.4.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests FIZZ_RELEASE_DEV", @@ -1905,7 +1905,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "fizz", - "cros_img": "fizz-release/R117-15572.63.0", + "cros_img": "fizz-release/R118-15604.56.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests FIZZ_RELEASE_STABLE", @@ -1924,7 +1924,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "guybrush", - "cros_img": "guybrush-release/R118-15604.42.0", + "cros_img": "guybrush-release/R119-15633.37.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests GUYBRUSH_RELEASE_BETA", @@ -1943,7 +1943,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "guybrush", - "cros_img": "guybrush-release/R119-15626.0.0", + "cros_img": "guybrush-release/R120-15662.4.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests GUYBRUSH_RELEASE_DEV", @@ -1980,7 +1980,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "guybrush", - "cros_img": "guybrush-release/R117-15572.63.0", + "cros_img": "guybrush-release/R118-15604.57.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests GUYBRUSH_RELEASE_STABLE", @@ -1999,7 +1999,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "puff", - "cros_img": "puff-release/R118-15604.42.0", + "cros_img": "puff-release/R119-15633.37.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests PUFF_RELEASE_BETA", @@ -2018,7 +2018,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "puff", - "cros_img": "puff-release/R119-15633.10.0", + "cros_img": "puff-release/R120-15662.4.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests PUFF_RELEASE_DEV", @@ -2055,7 +2055,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "puff", - "cros_img": "puff-release/R117-15572.63.0", + "cros_img": "puff-release/R118-15604.57.0", "dut_pool": "chrome", "experiment_percentage": 100, "name": "lacros_all_tast_tests PUFF_RELEASE_STABLE", @@ -2106,7 +2106,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "jacuzzi", - "cros_img": "jacuzzi-release/R118-15604.42.0", + "cros_img": "jacuzzi-release/R119-15633.37.0", "experiment_percentage": 100, "name": "lacros_all_tast_tests JACUZZI_RELEASE_BETA", "resultdb": { @@ -2124,7 +2124,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "jacuzzi", - "cros_img": "jacuzzi-release/R119-15633.10.0", + "cros_img": "jacuzzi-release/R120-15662.4.0", "experiment_percentage": 100, "name": "lacros_all_tast_tests JACUZZI_RELEASE_DEV", "resultdb": { @@ -2159,7 +2159,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "jacuzzi", - "cros_img": "jacuzzi-release/R117-15572.63.0", + "cros_img": "jacuzzi-release/R118-15604.57.0", "experiment_percentage": 100, "name": "lacros_all_tast_tests JACUZZI_RELEASE_STABLE", "resultdb": {
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index 184d762..e96f57d 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -1064,7 +1064,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "touch_to_fill_junit_tests", - "test_id_prefix": "ninja://chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests/", + "test_id_prefix": "ninja://chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests/", "use_isolated_scripts_api": true }, { @@ -20558,7 +20558,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "touch_to_fill_junit_tests", - "test_id_prefix": "ninja://chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests/", + "test_id_prefix": "ninja://chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests/", "use_isolated_scripts_api": true }, { @@ -30063,7 +30063,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "touch_to_fill_junit_tests", - "test_id_prefix": "ninja://chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests/", + "test_id_prefix": "ninja://chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests/", "use_isolated_scripts_api": true }, {
diff --git a/testing/buildbot/chromium.cft.json b/testing/buildbot/chromium.cft.json index ed8bb6a8..5cb0e48 100644 --- a/testing/buildbot/chromium.cft.json +++ b/testing/buildbot/chromium.cft.json
@@ -1893,7 +1893,7 @@ ], "script": "//third_party/blink/tools/merge_web_test_results.py" }, - "name": "webdriver_tests_suite", + "name": "webdriver_wpt_tests", "resultdb": { "enable": true, "has_native_resultdb_integration": true
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 6cfb6ca..bac57ec 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -6126,9 +6126,9 @@ { "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_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -6138,8 +6138,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": { @@ -6276,9 +6276,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.filter;../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -6288,8 +6288,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": {
diff --git a/testing/buildbot/chromium.coverage.json b/testing/buildbot/chromium.coverage.json index c4365a56..98b2b304 100644 --- a/testing/buildbot/chromium.coverage.json +++ b/testing/buildbot/chromium.coverage.json
@@ -822,7 +822,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "touch_to_fill_junit_tests", - "test_id_prefix": "ninja://chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests/", + "test_id_prefix": "ninja://chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests/", "use_isolated_scripts_api": true }, { @@ -8122,7 +8122,7 @@ "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "touch_to_fill_junit_tests", - "test_id_prefix": "ninja://chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests/", + "test_id_prefix": "ninja://chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests/", "use_isolated_scripts_api": true }, { @@ -19662,7 +19662,7 @@ ], "script": "//third_party/blink/tools/merge_web_test_results.py" }, - "name": "webdriver_tests_suite", + "name": "webdriver_wpt_tests", "resultdb": { "enable": true, "has_native_resultdb_integration": true @@ -20480,9 +20480,9 @@ { "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_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -20492,8 +20492,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": { @@ -20630,9 +20630,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.filter;../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -20642,8 +20642,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": {
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index a7404a21..e712c34 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -43480,9 +43480,9 @@ { "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_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -43491,8 +43491,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": { @@ -43630,9 +43630,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.filter;../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -43641,8 +43641,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": { @@ -44939,9 +44939,9 @@ { "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_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -44950,8 +44950,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": { @@ -45089,9 +45089,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.filter;../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -45100,8 +45100,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": { @@ -45783,9 +45783,9 @@ { "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_v120.0.6099.8/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -45794,8 +45794,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": { @@ -48076,7 +48076,7 @@ ], "script": "//third_party/blink/tools/merge_web_test_results.py" }, - "name": "webdriver_tests_suite", + "name": "webdriver_wpt_tests", "resultdb": { "enable": true, "has_native_resultdb_integration": true @@ -48267,7 +48267,7 @@ ], "script": "//third_party/blink/tools/merge_web_test_results.py" }, - "name": "wpt_tests_suite", + "name": "chrome_wpt_tests", "resultdb": { "enable": true, "has_native_resultdb_integration": true
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 8db8ad57..9608dd8 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -6789,7 +6789,7 @@ ], "script": "//third_party/blink/tools/merge_web_test_results.py" }, - "name": "webdriver_tests_suite", + "name": "webdriver_wpt_tests", "resultdb": { "enable": true, "has_native_resultdb_integration": true
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index e962dc1..f6e093d5 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -16281,12 +16281,12 @@ { "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_v120.0.6099.8/test_ash_chrome", + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome", "--test-launcher-print-test-stdio=always", "--combine-ash-logs-on-bots", "--asan-symbolize-output" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -16296,8 +16296,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": { @@ -16451,12 +16451,12 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.filter;../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.8/test_ash_chrome", + "--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome", "--test-launcher-print-test-stdio=always", "--combine-ash-logs-on-bots", "--asan-symbolize-output" ], - "description": "Run with ash-chrome version 120.0.6099.8", + "description": "Run with ash-chrome version 120.0.6099.13", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -16466,8 +16466,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v120.0.6099.8", - "revision": "version:120.0.6099.8" + "location": "lacros_version_skew_tests_v120.0.6099.13", + "revision": "version:120.0.6099.13" } ], "dimensions": {
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index e3380038..d5ecf1d 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -1657,7 +1657,7 @@ "script": "//testing/run_pytype.py", }, "touch_to_fill_junit_tests": { - "label": "//chrome/browser/touch_to_fill/password_manager/android:touch_to_fill_junit_tests", + "label": "//chrome/browser/touch_to_fill/android:touch_to_fill_junit_tests", "type": "generated_script", }, "trace_processor_shell": {
diff --git a/testing/buildbot/internal.chromeos.fyi.json b/testing/buildbot/internal.chromeos.fyi.json index 607cfee4..f8b9889 100644 --- a/testing/buildbot/internal.chromeos.fyi.json +++ b/testing/buildbot/internal.chromeos.fyi.json
@@ -1285,7 +1285,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "octopus", - "cros_img": "octopus-release/R118-15604.42.0", + "cros_img": "octopus-release/R119-15633.37.0", "name": "lacros_fyi_tast_tests OCTOPUS_RELEASE_BETA", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_fyi_tast_tests", @@ -1296,7 +1296,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "octopus", - "cros_img": "octopus-release/R119-15633.10.0", + "cros_img": "octopus-release/R120-15662.4.0", "name": "lacros_fyi_tast_tests OCTOPUS_RELEASE_DEV", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_fyi_tast_tests", @@ -1318,7 +1318,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "octopus", - "cros_img": "octopus-release/R117-15572.63.0", + "cros_img": "octopus-release/R118-15604.57.0", "name": "lacros_fyi_tast_tests OCTOPUS_RELEASE_STABLE", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_fyi_tast_tests", @@ -1329,7 +1329,7 @@ { "autotest_name": "chromium", "cros_board": "octopus", - "cros_img": "octopus-release/R118-15604.42.0", + "cros_img": "octopus-release/R119-15633.37.0", "name": "ozone_unittests OCTOPUS_RELEASE_BETA", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1339,7 +1339,7 @@ { "autotest_name": "chromium", "cros_board": "octopus", - "cros_img": "octopus-release/R119-15633.10.0", + "cros_img": "octopus-release/R120-15662.4.0", "name": "ozone_unittests OCTOPUS_RELEASE_DEV", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1359,7 +1359,7 @@ { "autotest_name": "chromium", "cros_board": "octopus", - "cros_img": "octopus-release/R117-15572.63.0", + "cros_img": "octopus-release/R118-15604.57.0", "name": "ozone_unittests OCTOPUS_RELEASE_STABLE", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1376,7 +1376,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "hana", - "cros_img": "hana-release/R118-15604.42.0", + "cros_img": "hana-release/R119-15633.37.0", "name": "lacros_all_tast_tests HANA_RELEASE_BETA", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_all_tast_tests", @@ -1387,7 +1387,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "hana", - "cros_img": "hana-release/R119-15633.10.0", + "cros_img": "hana-release/R120-15662.4.0", "name": "lacros_all_tast_tests HANA_RELEASE_DEV", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_all_tast_tests", @@ -1409,7 +1409,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "hana", - "cros_img": "hana-release/R117-15572.63.0", + "cros_img": "hana-release/R118-15604.57.0", "name": "lacros_all_tast_tests HANA_RELEASE_STABLE", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_all_tast_tests", @@ -1420,7 +1420,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "strongbad", - "cros_img": "strongbad-release/R118-15604.42.0", + "cros_img": "strongbad-release/R119-15633.37.0", "name": "lacros_all_tast_tests STRONGBAD_RELEASE_BETA", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_all_tast_tests", @@ -1442,7 +1442,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "strongbad", - "cros_img": "strongbad-release/R117-15572.63.0", + "cros_img": "strongbad-release/R118-15604.57.0", "name": "lacros_all_tast_tests STRONGBAD_RELEASE_STABLE", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_all_tast_tests", @@ -1453,7 +1453,7 @@ { "autotest_name": "tast.lacros-from-gcs", "cros_board": "strongbad", - "cros_img": "strongbad-release/R119-15633.10.0", + "cros_img": "strongbad-release/R120-15662.4.0", "name": "lacros_all_tast_tests strongbad_RELEASE_DEV", "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", "test": "lacros_all_tast_tests", @@ -1464,7 +1464,7 @@ { "autotest_name": "chromium", "cros_board": "hana", - "cros_img": "hana-release/R118-15604.42.0", + "cros_img": "hana-release/R119-15633.37.0", "name": "ozone_unittests HANA_RELEASE_BETA", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1474,7 +1474,7 @@ { "autotest_name": "chromium", "cros_board": "hana", - "cros_img": "hana-release/R119-15633.10.0", + "cros_img": "hana-release/R120-15662.4.0", "name": "ozone_unittests HANA_RELEASE_DEV", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1494,7 +1494,7 @@ { "autotest_name": "chromium", "cros_board": "hana", - "cros_img": "hana-release/R117-15572.63.0", + "cros_img": "hana-release/R118-15604.57.0", "name": "ozone_unittests HANA_RELEASE_STABLE", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1504,7 +1504,7 @@ { "autotest_name": "chromium", "cros_board": "strongbad", - "cros_img": "strongbad-release/R118-15604.42.0", + "cros_img": "strongbad-release/R119-15633.37.0", "name": "ozone_unittests STRONGBAD_RELEASE_BETA", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1524,7 +1524,7 @@ { "autotest_name": "chromium", "cros_board": "strongbad", - "cros_img": "strongbad-release/R117-15572.63.0", + "cros_img": "strongbad-release/R118-15604.57.0", "name": "ozone_unittests STRONGBAD_RELEASE_STABLE", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1534,7 +1534,7 @@ { "autotest_name": "chromium", "cros_board": "strongbad", - "cros_img": "strongbad-release/R119-15633.10.0", + "cros_img": "strongbad-release/R120-15662.4.0", "name": "ozone_unittests strongbad_RELEASE_DEV", "test": "ozone_unittests", "test_id_prefix": "ninja://ui/ozone:ozone_unittests/", @@ -1544,7 +1544,7 @@ { "autotest_name": "chromium", "cros_board": "hana", - "cros_img": "hana-release/R118-15604.42.0", + "cros_img": "hana-release/R119-15633.37.0", "name": "viz_unittests HANA_RELEASE_BETA", "test": "viz_unittests", "test_id_prefix": "ninja://components/viz:viz_unittests/", @@ -1554,7 +1554,7 @@ { "autotest_name": "chromium", "cros_board": "hana", - "cros_img": "hana-release/R119-15633.10.0", + "cros_img": "hana-release/R120-15662.4.0", "name": "viz_unittests HANA_RELEASE_DEV", "test": "viz_unittests", "test_id_prefix": "ninja://components/viz:viz_unittests/", @@ -1574,7 +1574,7 @@ { "autotest_name": "chromium", "cros_board": "hana", - "cros_img": "hana-release/R117-15572.63.0", + "cros_img": "hana-release/R118-15604.57.0", "name": "viz_unittests HANA_RELEASE_STABLE", "test": "viz_unittests", "test_id_prefix": "ninja://components/viz:viz_unittests/", @@ -1584,7 +1584,7 @@ { "autotest_name": "chromium", "cros_board": "strongbad", - "cros_img": "strongbad-release/R118-15604.42.0", + "cros_img": "strongbad-release/R119-15633.37.0", "name": "viz_unittests STRONGBAD_RELEASE_BETA", "test": "viz_unittests", "test_id_prefix": "ninja://components/viz:viz_unittests/", @@ -1604,7 +1604,7 @@ { "autotest_name": "chromium", "cros_board": "strongbad", - "cros_img": "strongbad-release/R117-15572.63.0", + "cros_img": "strongbad-release/R118-15604.57.0", "name": "viz_unittests STRONGBAD_RELEASE_STABLE", "test": "viz_unittests", "test_id_prefix": "ninja://components/viz:viz_unittests/", @@ -1614,7 +1614,7 @@ { "autotest_name": "chromium", "cros_board": "strongbad", - "cros_img": "strongbad-release/R119-15633.10.0", + "cros_img": "strongbad-release/R120-15662.4.0", "name": "viz_unittests strongbad_RELEASE_DEV", "test": "viz_unittests", "test_id_prefix": "ninja://components/viz:viz_unittests/",
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 084fe57..11ec4aba 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -4636,7 +4636,7 @@ 'Mac FYI Retina ASAN (AMD)', ], }, - 'webdriver_tests_suite': { + 'webdriver_wpt_tests': { 'modifications': { 'Linux Tests (dbg)(1)': { 'args': [
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 60c705a..f1d08bd 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -4333,7 +4333,7 @@ ], }, }, - 'webdriver_tests_suite': { + 'webdriver_wpt_tests': { 'test': 'chrome_wpt_tests', 'results_handler': 'layout tests', 'mixins': [ @@ -5548,7 +5548,7 @@ }, 'wpt_web_tests': { - 'wpt_tests_suite': { + 'chrome_wpt_tests': { 'test': 'chrome_wpt_tests', 'results_handler': 'layout tests', 'args': [
diff --git a/testing/buildbot/tryserver.blink.json b/testing/buildbot/tryserver.blink.json index 72931f5..cdffc9b 100644 --- a/testing/buildbot/tryserver.blink.json +++ b/testing/buildbot/tryserver.blink.json
@@ -210,7 +210,7 @@ ], "script": "//third_party/blink/tools/merge_web_test_results.py" }, - "name": "webdriver_tests_suite", + "name": "webdriver_wpt_tests", "resultdb": { "enable": true, "has_native_resultdb_integration": true
diff --git a/testing/buildbot/tryserver.v8.json b/testing/buildbot/tryserver.v8.json index b620fe3..2261d1e 100644 --- a/testing/buildbot/tryserver.v8.json +++ b/testing/buildbot/tryserver.v8.json
@@ -208,7 +208,7 @@ ], "script": "//third_party/blink/tools/merge_web_test_results.py" }, - "name": "webdriver_tests_suite", + "name": "webdriver_wpt_tests", "resultdb": { "enable": true, "has_native_resultdb_integration": true
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index 9e427c25..3422554 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -86,16 +86,16 @@ }, 'LACROS_VERSION_SKEW_DEV': { 'identifier': 'Lacros version skew testing ash dev', - 'description': 'Run with ash-chrome version 120.0.6099.8', + 'description': 'Run with ash-chrome version 120.0.6099.13', 'args': [ - '--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.8/test_ash_chrome', + '--ash-chrome-path-override=../../lacros_version_skew_tests_v120.0.6099.13/test_ash_chrome', ], 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/linux-ash-chromium/x86_64/ash.zip', - 'location': 'lacros_version_skew_tests_v120.0.6099.8', - 'revision': 'version:120.0.6099.8', + 'location': 'lacros_version_skew_tests_v120.0.6099.13', + 'revision': 'version:120.0.6099.13', }, ], }, @@ -472,7 +472,7 @@ 'identifier': 'BRYA_RELEASE_DEV', 'skylab': { 'cros_board': 'brya', - 'cros_img': 'brya-release/R119-15633.10.0', + 'cros_img': 'brya-release/R120-15662.4.0', 'dut_pool': 'chrome', }, }, @@ -480,7 +480,7 @@ 'identifier': 'BRYA_RELEASE_BETA', 'skylab': { 'cros_board': 'brya', - 'cros_img': 'brya-release/R118-15604.42.0', + 'cros_img': 'brya-release/R119-15633.37.0', 'dut_pool': 'chrome', }, }, @@ -488,7 +488,7 @@ 'identifier': 'BRYA_RELEASE_STABLE', 'skylab': { 'cros_board': 'brya', - 'cros_img': 'brya-release/R117-15572.63.2', + 'cros_img': 'brya-release/R118-15604.57.0', 'dut_pool': 'chrome', }, }, @@ -503,21 +503,21 @@ 'identifier': 'DEDEDE_RELEASE_DEV', 'skylab': { 'cros_board': 'dedede', - 'cros_img': 'dedede-release/R119-15633.10.0', + 'cros_img': 'dedede-release/R120-15656.0.0', }, }, 'CROS_DEDEDE_RELEASE_BETA': { 'identifier': 'DEDEDE_RELEASE_BETA', 'skylab': { 'cros_board': 'dedede', - 'cros_img': 'dedede-release/R118-15604.42.0', + 'cros_img': 'dedede-release/R119-15633.37.0', }, }, 'CROS_DEDEDE_RELEASE_STABLE': { 'identifier': 'DEDEDE_RELEASE_STABLE', 'skylab': { 'cros_board': 'dedede', - 'cros_img': 'dedede-release/R117-15572.63.0', + 'cros_img': 'dedede-release/R118-15604.57.0', }, }, 'CROS_FIZZ_RELEASE_LKGM': { @@ -532,7 +532,7 @@ 'identifier': 'FIZZ_RELEASE_DEV', 'skylab': { 'cros_board': 'fizz', - 'cros_img': 'fizz-release/R119-15633.10.0', + 'cros_img': 'fizz-release/R120-15662.4.0', 'dut_pool': 'chrome', }, }, @@ -540,7 +540,7 @@ 'identifier': 'FIZZ_RELEASE_BETA', 'skylab': { 'cros_board': 'fizz', - 'cros_img': 'fizz-release/R118-15604.42.0', + 'cros_img': 'fizz-release/R119-15633.37.0', 'dut_pool': 'chrome', }, }, @@ -548,7 +548,7 @@ 'identifier': 'FIZZ_RELEASE_STABLE', 'skylab': { 'cros_board': 'fizz', - 'cros_img': 'fizz-release/R117-15572.63.0', + 'cros_img': 'fizz-release/R118-15604.56.0', 'dut_pool': 'chrome', }, }, @@ -564,7 +564,7 @@ 'identifier': 'GUYBRUSH_RELEASE_DEV', 'skylab': { 'cros_board': 'guybrush', - 'cros_img': 'guybrush-release/R119-15626.0.0', + 'cros_img': 'guybrush-release/R120-15662.4.0', 'dut_pool': 'chrome', }, }, @@ -572,7 +572,7 @@ 'identifier': 'GUYBRUSH_RELEASE_BETA', 'skylab': { 'cros_board': 'guybrush', - 'cros_img': 'guybrush-release/R118-15604.42.0', + 'cros_img': 'guybrush-release/R119-15633.37.0', 'dut_pool': 'chrome', }, }, @@ -580,7 +580,7 @@ 'identifier': 'GUYBRUSH_RELEASE_STABLE', 'skylab': { 'cros_board': 'guybrush', - 'cros_img': 'guybrush-release/R117-15572.63.0', + 'cros_img': 'guybrush-release/R118-15604.57.0', 'dut_pool': 'chrome', }, }, @@ -596,7 +596,7 @@ 'identifier': 'PUFF_RELEASE_DEV', 'skylab': { 'cros_board': 'puff', - 'cros_img': 'puff-release/R119-15633.10.0', + 'cros_img': 'puff-release/R120-15662.4.0', 'dut_pool': 'chrome', }, }, @@ -604,7 +604,7 @@ 'identifier': 'PUFF_RELEASE_BETA', 'skylab': { 'cros_board': 'puff', - 'cros_img': 'puff-release/R118-15604.42.0', + 'cros_img': 'puff-release/R119-15633.37.0', 'dut_pool': 'chrome', }, }, @@ -612,7 +612,7 @@ 'identifier': 'PUFF_RELEASE_STABLE', 'skylab': { 'cros_board': 'puff', - 'cros_img': 'puff-release/R117-15572.63.0', + 'cros_img': 'puff-release/R118-15604.57.0', 'dut_pool': 'chrome', }, }, @@ -638,21 +638,21 @@ 'identifier': 'HANA_RELEASE_DEV', 'skylab': { 'cros_board': 'hana', - 'cros_img': 'hana-release/R119-15633.10.0', + 'cros_img': 'hana-release/R120-15662.4.0', }, }, 'CROS_HANA_RELEASE_BETA': { 'identifier': 'HANA_RELEASE_BETA', 'skylab': { 'cros_board': 'hana', - 'cros_img': 'hana-release/R118-15604.42.0', + 'cros_img': 'hana-release/R119-15633.37.0', }, }, 'CROS_HANA_RELEASE_STABLE': { 'identifier': 'HANA_RELEASE_STABLE', 'skylab': { 'cros_board': 'hana', - 'cros_img': 'hana-release/R117-15572.63.0', + 'cros_img': 'hana-release/R118-15604.57.0', }, }, 'CROS_JACUZZI_RELEASE_LKGM': { @@ -666,14 +666,14 @@ 'identifier': 'JACUZZI_RELEASE_DEV', 'skylab': { 'cros_board': 'jacuzzi', - 'cros_img': 'jacuzzi-release/R119-15633.10.0', + 'cros_img': 'jacuzzi-release/R120-15662.4.0', }, }, 'CROS_JACUZZI_RELEASE_BETA': { 'identifier': 'JACUZZI_RELEASE_BETA', 'skylab': { 'cros_board': 'jacuzzi', - 'cros_img': 'jacuzzi-release/R118-15604.42.0', + 'cros_img': 'jacuzzi-release/R119-15633.37.0', }, }, 'CROS_JACUZZI_RELEASE_CHROME_FROM_TLS_ASH_LKGM': { @@ -687,7 +687,7 @@ 'identifier': 'JACUZZI_RELEASE_STABLE', 'skylab': { 'cros_board': 'jacuzzi', - 'cros_img': 'jacuzzi-release/R117-15572.63.0', + 'cros_img': 'jacuzzi-release/R118-15604.57.0', }, }, 'CROS_JACUZZI_PUBLIC_LKGM': { @@ -742,21 +742,21 @@ 'identifier': 'OCTOPUS_RELEASE_DEV', 'skylab': { 'cros_board': 'octopus', - 'cros_img': 'octopus-release/R119-15633.10.0', + 'cros_img': 'octopus-release/R120-15662.4.0', }, }, 'CROS_OCTOPUS_RELEASE_BETA': { 'identifier': 'OCTOPUS_RELEASE_BETA', 'skylab': { 'cros_board': 'octopus', - 'cros_img': 'octopus-release/R118-15604.42.0', + 'cros_img': 'octopus-release/R119-15633.37.0', }, }, 'CROS_OCTOPUS_RELEASE_STABLE': { 'identifier': 'OCTOPUS_RELEASE_STABLE', 'skylab': { 'cros_board': 'octopus', - 'cros_img': 'octopus-release/R117-15572.63.0', + 'cros_img': 'octopus-release/R118-15604.57.0', }, }, 'CROS_STRONGBAD_RELEASE_LKGM': { @@ -770,21 +770,21 @@ 'identifier': 'strongbad_RELEASE_DEV', 'skylab': { 'cros_board': 'strongbad', - 'cros_img': 'strongbad-release/R119-15633.10.0', + 'cros_img': 'strongbad-release/R120-15662.4.0', }, }, 'CROS_STRONGBAD_RELEASE_BETA': { 'identifier': 'STRONGBAD_RELEASE_BETA', 'skylab': { 'cros_board': 'strongbad', - 'cros_img': 'strongbad-release/R118-15604.42.0', + 'cros_img': 'strongbad-release/R119-15633.37.0', }, }, 'CROS_STRONGBAD_RELEASE_STABLE': { 'identifier': 'STRONGBAD_RELEASE_STABLE', 'skylab': { 'cros_board': 'strongbad', - 'cros_img': 'strongbad-release/R117-15572.63.0', + 'cros_img': 'strongbad-release/R118-15604.57.0', }, }, 'CROS_TROGDOR_RELEASE_ASH_LKGM': {
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 03aa0c4..8da9007 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -3411,11 +3411,8 @@ ], "experiments": [ { - "name": "Enabled", - "params": { - "critical_threshold_percentage": "1500" - }, - "enable_features": [ + "name": "Disabled", + "disable_features": [ "ChromeOSMemoryPressureSignalStudyNonArc" ] } @@ -8216,6 +8213,9 @@ ], "experiments": [ { + "name": "Default" + }, + { "name": "Enabled", "enable_features": [ "HitTestOpaqueness" @@ -16937,6 +16937,21 @@ ] } ], + "ShowNtpAtStartupAndroid": [ + { + "platforms": [ + "android" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "ShowNtpAtStartupAndroid" + ] + } + ] + } + ], "ShutdownConfirmationBubble": [ { "platforms": [ @@ -16952,35 +16967,6 @@ ] } ], - "SidePanelCompanionDesktopM116Plus": [ - { - "platforms": [ - "chromeos", - "chromeos_lacros", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "CSC_GlobalLensPanel_20231102", - "params": { - "open-companion-for-image-search": "false", - "open-companion-for-web-search": "false", - "open-contextual-lens-panel": "false", - "open-links-in-current-tab": "false" - }, - "enable_features": [ - "SidePanelCompanion", - "VisualSearchSuggestions" - ], - "disable_features": [ - "CompanionEnableNewBadgesInContextMenu" - ] - } - ] - } - ], "SidePanelJourneys": [ { "platforms": [
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn index fa19c69..064aeed 100644 --- a/third_party/android_deps/BUILD.gn +++ b/third_party/android_deps/BUILD.gn
@@ -1010,7 +1010,7 @@ if (!defined(material_design_target)) { android_aar_prebuilt("com_google_android_material_material_java") { aar_path = - "libs/com_google_android_material_material/material-1.7.0-alpha02.aar" + "libs/com_google_android_material_material/material-1.11.0-beta01.aar" info_path = "libs/com_google_android_material_material/com_google_android_material_material.info" enable_bytecode_checks = false @@ -1018,6 +1018,8 @@ # Please depend on //third_party/android_deps:material_design_java instead. visibility = [ "//third_party/android_deps:*" ] deps = [ + ":com_google_errorprone_error_prone_annotations_java", + "//third_party/androidx:androidx_activity_activity_java", "//third_party/androidx:androidx_annotation_annotation_experimental_java", "//third_party/androidx:androidx_annotation_annotation_java", "//third_party/androidx:androidx_appcompat_appcompat_java", @@ -1030,6 +1032,7 @@ "//third_party/androidx:androidx_fragment_fragment_java", "//third_party/androidx:androidx_lifecycle_lifecycle_runtime_java", "//third_party/androidx:androidx_recyclerview_recyclerview_java", + "//third_party/androidx:androidx_resourceinspection_resourceinspection_annotation_java", "//third_party/androidx:androidx_transition_transition_java", "//third_party/androidx:androidx_vectordrawable_vectordrawable_java", "//third_party/androidx:androidx_viewpager2_viewpager2_java",
diff --git a/third_party/android_deps/build.gradle b/third_party/android_deps/build.gradle index be856a90..e265962 100644 --- a/third_party/android_deps/build.gradle +++ b/third_party/android_deps/build.gradle
@@ -37,18 +37,27 @@ } // See https://github.com/google/guava/releases/tag/v32.1.0 -configurations.each { - if (it.name.startsWith('buildCompile')) { - it.attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "standard-jvm") - } else { - it.attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "android") +dependencies.constraints { + compile("com.google.guava:guava:32.1.3-android") { + attributes { + attribute( + TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, + objects.named(TargetJvmEnvironment, TargetJvmEnvironment.ANDROID)) + } + } + buildCompile("com.google.guava:guava:32.1.3-jre") { + attributes { + attribute( + TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, + objects.named(TargetJvmEnvironment, TargetJvmEnvironment.STANDARD_JVM)) + } } } dependencies { // Note about the configuration names: they are defined in buildSrc/ChromiumPlugin - compile 'com.google.android.material:material:1.7.0-alpha02' + compile 'com.google.android.material:material:1.11.0-beta01' compile 'com.google.android.play:feature-delivery:2.0.1' @@ -107,22 +116,8 @@ compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4" compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20" compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20" - compile("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") { - // See https://github.com/google/guava/releases/tag/v32.1.0 - attributes { - attribute( - TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, - objects.named(TargetJvmEnvironment, TargetJvmEnvironment.STANDARD_JVM)) - } - } - compile("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.6.4") { - // See https://github.com/google/guava/releases/tag/v32.1.0 - attributes { - attribute( - TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, - objects.named(TargetJvmEnvironment, TargetJvmEnvironment.STANDARD_JVM)) - } - } + compile "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" + compile "org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.6.4" // Needed by androidx.macrobenchmarks androidTestCompile "com.squareup.wire:wire-runtime-jvm:4.4.3"
diff --git a/third_party/android_deps/buildSrc/src/main/groovy/ChromiumDepGraph.groovy b/third_party/android_deps/buildSrc/src/main/groovy/ChromiumDepGraph.groovy index 21247f0..b39cb67 100644 --- a/third_party/android_deps/buildSrc/src/main/groovy/ChromiumDepGraph.groovy +++ b/third_party/android_deps/buildSrc/src/main/groovy/ChromiumDepGraph.groovy
@@ -288,12 +288,9 @@ licenseName: 'Apache 2.0'), ] - private static final Set<String> ALLOWED_EMPTY_DEPS = [ - // Bill of materials (BOM) deps are used to specify versions for other dependencies and don't have children or - // artifacts of their own. Add other such empty deps here when we encounter them. - 'org_jetbrains_kotlinx_kotlinx_coroutines_bom', - 'com_squareup_okio_okio_bom', - ] as Set + // Bill of materials (BOM) deps are used to specify versions for other dependencies and don't have children or + // artifacts of their own. Add other such empty deps here when we encounter them. + private static final Set<String> ALLOWED_EMPTY_DEPS = [] as Set // Local text versions of HTML licenses. This cannot replace PROPERTY_OVERRIDES because some libraries refer to // license templates such as https://opensource.org/licenses/MIT. @@ -478,7 +475,7 @@ childDependenciesWithArtifacts += childDependency.children } else { String childDepId = makeModuleId(childDependency.module) - if (childDepId !in ALLOWED_EMPTY_DEPS) { + if (!childDepId.endsWith("_bom") && childDepId !in ALLOWED_EMPTY_DEPS) { // BOM dependencies are deps that only specify other deps as dependencies but have no // artifact of their own. These typically have _bom at the end of their names but may also // be identified by looking at their pom.xml file. For more context see maven's doc:
diff --git a/third_party/android_deps/libs/com_google_android_material_material/README.chromium b/third_party/android_deps/libs/com_google_android_material_material/README.chromium index 8f8a5d87..c202e472 100644 --- a/third_party/android_deps/libs/com_google_android_material_material/README.chromium +++ b/third_party/android_deps/libs/com_google_android_material_material/README.chromium
@@ -1,7 +1,7 @@ Name: Material Components for Android Short Name: material URL: https://github.com/material-components/material-components-android -Version: 1.7.0-alpha02 +Version: 1.11.0-beta01 License: Android Software Development Kit License License File: LICENSE CPEPrefix: unknown
diff --git a/third_party/android_deps/libs/com_google_android_material_material/cipd.yaml b/third_party/android_deps/libs/com_google_android_material_material/cipd.yaml index 42afee4..a66f9de8 100644 --- a/third_party/android_deps/libs/com_google_android_material_material/cipd.yaml +++ b/third_party/android_deps/libs/com_google_android_material_material/cipd.yaml
@@ -3,8 +3,8 @@ # found in the LICENSE file. # To create CIPD package run the following command. -# cipd create --pkg-def cipd.yaml -tag version:2@1.7.0-alpha02.cr1 +# cipd create --pkg-def cipd.yaml -tag version:2@1.11.0-beta01.cr1 package: chromium/third_party/android_deps/libs/com_google_android_material_material description: "Material Components for Android" data: -- file: material-1.7.0-alpha02.aar +- file: material-1.11.0-beta01.aar
diff --git a/third_party/android_deps/libs/com_google_android_material_material/com_google_android_material_material.info b/third_party/android_deps/libs/com_google_android_material_material/com_google_android_material_material.info index 8e6edd59..1af2651 100644 --- a/third_party/android_deps/libs/com_google_android_material_material/com_google_android_material_material.info +++ b/third_party/android_deps/libs/com_google_android_material_material/com_google_android_material_material.info
@@ -14,25 +14,44 @@ "res/anim/design_bottom_sheet_slide_out.xml", "res/anim/design_snackbar_in.xml", "res/anim/design_snackbar_out.xml", + "res/anim/linear_indeterminate_line1_head_interpolator.xml", + "res/anim/linear_indeterminate_line1_tail_interpolator.xml", + "res/anim/linear_indeterminate_line2_head_interpolator.xml", + "res/anim/linear_indeterminate_line2_tail_interpolator.xml", + "res/anim/m3_bottom_sheet_slide_in.xml", + "res/anim/m3_bottom_sheet_slide_out.xml", + "res/anim/m3_motion_fade_enter.xml", + "res/anim/m3_motion_fade_exit.xml", + "res/anim/m3_side_sheet_enter_from_left.xml", + "res/anim/m3_side_sheet_enter_from_right.xml", + "res/anim/m3_side_sheet_exit_to_left.xml", + "res/anim/m3_side_sheet_exit_to_right.xml", "res/anim/mtrl_bottom_sheet_slide_in.xml", "res/anim/mtrl_bottom_sheet_slide_out.xml", "res/anim/mtrl_card_lowers_interpolator.xml", "res/anim-v21/design_bottom_sheet_slide_in.xml", "res/anim-v21/design_bottom_sheet_slide_out.xml", + "res/anim-v21/m3_bottom_sheet_slide_in.xml", + "res/anim-v21/m3_bottom_sheet_slide_out.xml", + "res/anim-v21/m3_side_sheet_enter_from_left.xml", + "res/anim-v21/m3_side_sheet_enter_from_right.xml", + "res/anim-v21/m3_side_sheet_exit_to_left.xml", + "res/anim-v21/m3_side_sheet_exit_to_right.xml", "res/anim-v21/mtrl_bottom_sheet_slide_in.xml", "res/anim-v21/mtrl_bottom_sheet_slide_out.xml", "res/animator/design_fab_hide_motion_spec.xml", "res/animator/design_fab_show_motion_spec.xml", - "res/animator/linear_indeterminate_line1_head_interpolator.xml", - "res/animator/linear_indeterminate_line1_tail_interpolator.xml", - "res/animator/linear_indeterminate_line2_head_interpolator.xml", - "res/animator/linear_indeterminate_line2_tail_interpolator.xml", "res/animator/m3_btn_elevated_btn_state_list_anim.xml", "res/animator/m3_btn_state_list_anim.xml", "res/animator/m3_card_elevated_state_list_anim.xml", "res/animator/m3_card_state_list_anim.xml", "res/animator/m3_chip_state_list_anim.xml", "res/animator/m3_elevated_chip_state_list_anim.xml", + "res/animator/m3_extended_fab_change_size_collapse_motion_spec.xml", + "res/animator/m3_extended_fab_change_size_expand_motion_spec.xml", + "res/animator/m3_extended_fab_hide_motion_spec.xml", + "res/animator/m3_extended_fab_show_motion_spec.xml", + "res/animator/m3_extended_fab_state_list_animator.xml", "res/animator/mtrl_btn_state_list_anim.xml", "res/animator/mtrl_btn_unelevated_state_list_anim.xml", "res/animator/mtrl_card_state_list_anim.xml", @@ -47,12 +66,14 @@ "res/animator/mtrl_fab_transformation_sheet_collapse_spec.xml", "res/animator/mtrl_fab_transformation_sheet_expand_spec.xml", "res/animator-v21/design_appbar_state_list_animator.xml", + "res/animator-v21/m3_appbar_state_list_animator.xml", "res/color/design_box_stroke_color.xml", "res/color/design_error.xml", "res/color/design_icon_tint.xml", "res/color/m3_appbar_overlay_color.xml", "res/color/m3_assist_chip_icon_tint_color.xml", "res/color/m3_assist_chip_stroke_color.xml", + "res/color/m3_bottom_sheet_drag_handle_color.xml", "res/color/m3_button_background_color_selector.xml", "res/color/m3_button_foreground_color_selector.xml", "res/color/m3_button_outline_color_selector.xml", @@ -63,6 +84,8 @@ "res/color/m3_card_foreground_color.xml", "res/color/m3_card_ripple_color.xml", "res/color/m3_card_stroke_color.xml", + "res/color/m3_checkbox_button_icon_tint.xml", + "res/color/m3_checkbox_button_tint.xml", "res/color/m3_chip_assist_text_color.xml", "res/color/m3_chip_background_color.xml", "res/color/m3_chip_ripple_color.xml", @@ -75,11 +98,15 @@ "res/color/m3_dark_primary_text_disable_only.xml", "res/color/m3_default_color_primary_text.xml", "res/color/m3_default_color_secondary_text.xml", + "res/color/m3_efab_ripple_color_selector.xml", "res/color/m3_elevated_chip_background_color.xml", + "res/color/m3_fab_efab_background_color_selector.xml", + "res/color/m3_fab_efab_foreground_color_selector.xml", + "res/color/m3_fab_ripple_color_selector.xml", "res/color/m3_filled_icon_button_container_color_selector.xml", - "res/color/m3_filled_icon_button_icon_color_selector.xml", "res/color/m3_highlighted_text.xml", "res/color/m3_hint_foreground.xml", + "res/color/m3_icon_button_icon_color_selector.xml", "res/color/m3_navigation_bar_item_with_indicator_icon_tint.xml", "res/color/m3_navigation_bar_item_with_indicator_label_tint.xml", "res/color/m3_navigation_bar_ripple_color_selector.xml", @@ -87,10 +114,13 @@ "res/color/m3_navigation_item_icon_tint.xml", "res/color/m3_navigation_item_ripple_color.xml", "res/color/m3_navigation_item_text_color.xml", + "res/color/m3_navigation_rail_item_with_indicator_icon_tint.xml", + "res/color/m3_navigation_rail_item_with_indicator_label_tint.xml", + "res/color/m3_navigation_rail_ripple_color_selector.xml", "res/color/m3_popupmenu_overlay_color.xml", "res/color/m3_primary_text_disable_only.xml", + "res/color/m3_radiobutton_button_tint.xml", "res/color/m3_radiobutton_ripple_tint.xml", - "res/color/m3_selection_control_button_tint.xml", "res/color/m3_selection_control_ripple_color_selector.xml", "res/color/m3_simple_item_ripple_color.xml", "res/color/m3_slider_active_track_color.xml", @@ -100,7 +130,11 @@ "res/color/m3_switch_thumb_tint.xml", "res/color/m3_switch_track_tint.xml", "res/color/m3_tabs_icon_color.xml", + "res/color/m3_tabs_icon_color_secondary.xml", "res/color/m3_tabs_ripple_color.xml", + "res/color/m3_tabs_ripple_color_secondary.xml", + "res/color/m3_tabs_text_color.xml", + "res/color/m3_tabs_text_color_secondary.xml", "res/color/m3_text_button_background_color_selector.xml", "res/color/m3_text_button_foreground_color_selector.xml", "res/color/m3_text_button_ripple_color_selector.xml", @@ -115,10 +149,10 @@ "res/color/m3_timepicker_clock_text_color.xml", "res/color/m3_timepicker_display_background_color.xml", "res/color/m3_timepicker_display_ripple_color.xml", - "res/color/m3_timepicker_display_stroke_color.xml", "res/color/m3_timepicker_display_text_color.xml", "res/color/m3_timepicker_secondary_text_button_ripple_color.xml", "res/color/m3_timepicker_secondary_text_button_text_color.xml", + "res/color/m3_timepicker_time_input_stroke_color.xml", "res/color/m3_tonal_button_ripple_color_selector.xml", "res/color/material_cursor_color.xml", "res/color/material_divider_color.xml", @@ -132,6 +166,16 @@ "res/color/material_on_surface_emphasis_high_type.xml", "res/color/material_on_surface_emphasis_medium.xml", "res/color/material_on_surface_stroke.xml", + "res/color/material_personalized__highlighted_text.xml", + "res/color/material_personalized__highlighted_text_inverse.xml", + "res/color/material_personalized_color_primary_text.xml", + "res/color/material_personalized_color_primary_text_inverse.xml", + "res/color/material_personalized_color_secondary_text.xml", + "res/color/material_personalized_color_secondary_text_inverse.xml", + "res/color/material_personalized_hint_foreground.xml", + "res/color/material_personalized_hint_foreground_inverse.xml", + "res/color/material_personalized_primary_inverse_text_disable_only.xml", + "res/color/material_personalized_primary_text_disable_only.xml", "res/color/material_slider_active_tick_marks_color.xml", "res/color/material_slider_active_track_color.xml", "res/color/material_slider_halo_color.xml", @@ -180,6 +224,7 @@ "res/color/mtrl_outlined_icon_tint.xml", "res/color/mtrl_outlined_stroke_color.xml", "res/color/mtrl_popupmenu_overlay_color.xml", + "res/color/mtrl_switch_thumb_icon_tint.xml", "res/color/mtrl_switch_thumb_tint.xml", "res/color/mtrl_switch_track_decoration_tint.xml", "res/color/mtrl_switch_track_tint.xml", @@ -202,6 +247,28 @@ "res/color-v31/m3_dynamic_highlighted_text.xml", "res/color-v31/m3_dynamic_hint_foreground.xml", "res/color-v31/m3_dynamic_primary_text_disable_only.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral12.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral17.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral22.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral24.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral4.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral6.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral87.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral92.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral94.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral96.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral98.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant12.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant17.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant22.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant24.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant4.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant6.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant87.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant92.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant94.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant96.xml", + "res/color-v31/m3_ref_palette_dynamic_neutral_variant98.xml", "res/drawable/avd_hide_password.xml", "res/drawable/avd_show_password.xml", "res/drawable/design_fab_background.xml", @@ -209,6 +276,8 @@ "res/drawable/design_ic_visibility_off.xml", "res/drawable/design_password_eye.xml", "res/drawable/design_snackbar_background.xml", + "res/drawable/ic_arrow_back_black_24.xml", + "res/drawable/ic_clear_black_24.xml", "res/drawable/ic_clock_black_24dp.xml", "res/drawable/ic_keyboard_black_24dp.xml", "res/drawable/ic_m3_chip_check.xml", @@ -218,6 +287,11 @@ "res/drawable/ic_mtrl_chip_checked_black.xml", "res/drawable/ic_mtrl_chip_checked_circle.xml", "res/drawable/ic_mtrl_chip_close_circle.xml", + "res/drawable/ic_search_black_24.xml", + "res/drawable/m3_avd_hide_password.xml", + "res/drawable/m3_avd_show_password.xml", + "res/drawable/m3_bottom_sheet_drag_handle.xml", + "res/drawable/m3_password_eye.xml", "res/drawable/m3_popupmenu_background_overlay.xml", "res/drawable/m3_tabs_line_indicator.xml", "res/drawable/m3_tabs_rounded_line_indicator.xml", @@ -229,12 +303,27 @@ "res/drawable/material_ic_keyboard_arrow_right_black_24dp.xml", "res/drawable/material_ic_menu_arrow_down_black_24dp.xml", "res/drawable/material_ic_menu_arrow_up_black_24dp.xml", + "res/drawable/mtrl_bottomsheet_drag_handle.xml", + "res/drawable/mtrl_checkbox_button.xml", + "res/drawable/mtrl_checkbox_button_checked_unchecked.xml", + "res/drawable/mtrl_checkbox_button_icon.xml", + "res/drawable/mtrl_checkbox_button_icon_checked_indeterminate.xml", + "res/drawable/mtrl_checkbox_button_icon_checked_unchecked.xml", + "res/drawable/mtrl_checkbox_button_icon_indeterminate_checked.xml", + "res/drawable/mtrl_checkbox_button_icon_indeterminate_unchecked.xml", + "res/drawable/mtrl_checkbox_button_icon_unchecked_checked.xml", + "res/drawable/mtrl_checkbox_button_icon_unchecked_indeterminate.xml", + "res/drawable/mtrl_checkbox_button_unchecked_checked.xml", "res/drawable/mtrl_dialog_background.xml", "res/drawable/mtrl_dropdown_arrow.xml", "res/drawable/mtrl_ic_arrow_drop_down.xml", "res/drawable/mtrl_ic_arrow_drop_up.xml", "res/drawable/mtrl_ic_cancel.xml", + "res/drawable/mtrl_ic_check_mark.xml", + "res/drawable/mtrl_ic_checkbox_checked.xml", + "res/drawable/mtrl_ic_checkbox_unchecked.xml", "res/drawable/mtrl_ic_error.xml", + "res/drawable/mtrl_ic_indeterminate.xml", "res/drawable/mtrl_navigation_bar_item_background.xml", "res/drawable/mtrl_popupmenu_background.xml", "res/drawable/mtrl_popupmenu_background_overlay.xml", @@ -255,8 +344,6 @@ "res/drawable-v21/m3_tabs_background.xml", "res/drawable-v21/material_cursor_drawable.xml", "res/drawable-v21/mtrl_navigation_bar_item_background.xml", - "res/drawable-v23/m3_appbar_background.xml", - "res/drawable-v23/m3_popupmenu_background_overlay.xml", "res/drawable-v23/m3_radiobutton_ripple.xml", "res/drawable-v23/m3_selection_control_ripple.xml", "res/drawable-v23/m3_tabs_background.xml", @@ -302,6 +389,7 @@ "res/layout/m3_alert_dialog_actions.xml", "res/layout/m3_alert_dialog_title.xml", "res/layout/m3_auto_complete_simple_item.xml", + "res/layout/m3_side_sheet_dialog.xml", "res/layout/material_radial_view_group.xml", "res/layout/mtrl_alert_dialog.xml", "res/layout/mtrl_alert_dialog_actions.xml", @@ -313,6 +401,8 @@ "res/layout/mtrl_layout_snackbar.xml", "res/layout/mtrl_layout_snackbar_include.xml", "res/layout/mtrl_navigation_rail_item.xml", + "res/layout/mtrl_search_bar.xml", + "res/layout/mtrl_search_view.xml", "res/layout-sw600dp-v13/design_layout_snackbar.xml", "res/layout-sw600dp-v13/mtrl_layout_snackbar.xml", "res/values/values.xml", @@ -407,10 +497,11 @@ "res/values-v24/values-v24.xml", "res/values-v28/values-v28.xml", "res/values-v31/values-v31.xml", + "res/values-v34/values-v34.xml", "res/values-vi/values-vi.xml", "res/values-w320dp-land-v13/values-w320dp-land-v13.xml", "res/values-w360dp-port-v13/values-w360dp-port-v13.xml", - "res/values-w480dp-port-v13/values-w480dp-port-v13.xml", + "res/values-w400dp-port-v13/values-w400dp-port-v13.xml", "res/values-w600dp-land-v13/values-w600dp-land-v13.xml", "res/values-zh-rCN/values-zh-rCN.xml", "res/values-zh-rHK/values-zh-rHK.xml",
diff --git a/third_party/android_prebuilts/README.chromium b/third_party/android_prebuilts/README.chromium new file mode 100644 index 0000000..40c3d30 --- /dev/null +++ b/third_party/android_prebuilts/README.chromium
@@ -0,0 +1,15 @@ +Name: Android Prebuilt Build Tools +URL: https://android.googlesource.com/platform/prebuilts/build-tools +Version: N/A +Revision: 673c20b524a83b662d8c1057fd3eec8fd0f93f9d +License: GPL 2 or later +License File: build_tools/LICENSE-GPL-3.0 +Security Critical: no +Shipped: no + +Description: +A repository that contains Android's Prebuilt Build Tools + +This repository is used by Codesearch pipeline to extract Java compilation +units. The only used binary is `common/framework/javac_extractor.jar`. +
diff --git a/third_party/angle b/third_party/angle index 9a7e8b7..1bb2c5e 160000 --- a/third_party/angle +++ b/third_party/angle
@@ -1 +1 @@ -Subproject commit 9a7e8b7bb17fdd3c88c3b1f26f0c605135654ee0 +Subproject commit 1bb2c5ece1de58658c5f2e5f26d0b309d95924f7
diff --git a/third_party/blink/public/devtools_protocol/browser_protocol.pdl b/third_party/blink/public/devtools_protocol/browser_protocol.pdl index e990423..f71a974 100644 --- a/third_party/blink/public/devtools_protocol/browser_protocol.pdl +++ b/third_party/blink/public/devtools_protocol/browser_protocol.pdl
@@ -11615,13 +11615,18 @@ SignIn SignUp - # Whether the dialog shown is an account chooser or an auto re-authentication dialog. + # The types of FedCM dialogs. type DialogType extends string enum AccountChooser AutoReauthn ConfirmIdpLogin + # The buttons on the FedCM dialog. + type DialogButton extends string + enum + ConfirmIdpLoginContinue + # Corresponds to IdentityRequestAccount type Account extends object properties @@ -11661,11 +11666,10 @@ string dialogId integer accountIndex - # Only valid if the dialog type is ConfirmIdpLogin. Acts as if the user had - # clicked the continue button. - command confirmIdpLogin + command clickDialogButton parameters string dialogId + DialogButton dialogButton command dismissDialog parameters
diff --git a/third_party/blink/public/mojom/storage_access/storage_access_handle.mojom b/third_party/blink/public/mojom/storage_access/storage_access_handle.mojom index 51cbe24..7697e392 100644 --- a/third_party/blink/public/mojom/storage_access/storage_access_handle.mojom +++ b/third_party/blink/public/mojom/storage_access/storage_access_handle.mojom
@@ -4,11 +4,12 @@ module blink.mojom; -import "third_party/blink/public/mojom/indexeddb/indexeddb.mojom"; -import "third_party/blink/public/mojom/locks/lock_manager.mojom"; +import "third_party/blink/public/mojom/blob/blob_url_store.mojom"; import "third_party/blink/public/mojom/cache_storage/cache_storage.mojom"; import "third_party/blink/public/mojom/file_system_access/file_system_access_directory_handle.mojom"; import "third_party/blink/public/mojom/file_system_access/file_system_access_error.mojom"; +import "third_party/blink/public/mojom/indexeddb/indexeddb.mojom"; +import "third_party/blink/public/mojom/locks/lock_manager.mojom"; // A LocalDOMWindow with a third-party StorageKey in the renderer can bind this // on a RenderFrameHost in the browser to access storage for the first-party @@ -36,4 +37,7 @@ // Returns estimated quota usage for first-party storage. // TODO(crbug.com/1500556): These should never be negative so consider uint64. Estimate() => (int64 current_usage, int64 current_quota, bool success); + + // Binds a BlobURLStore with access to first-party storage. + BindBlobStorage(pending_associated_receiver<BlobURLStore> receiver); };
diff --git a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom index 1e9895807..7d49e6f 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
@@ -4061,6 +4061,10 @@ kWebAppManifestIdField = 4722, kStorageAccessAPI_requestStorageAccess_BeyondCookies_estimate = 4723, kStorageAccessAPI_requestStorageAccess_BeyondCookies_estimate_Use = 4724, + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL = 4725, + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL_Use = 4726, + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL = 4727, + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL_Use = 4728, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/public/mojom/webid/federated_auth_request_automation.mojom b/third_party/blink/public/mojom/webid/federated_auth_request_automation.mojom index e1e5072..ab5bf690 100644 --- a/third_party/blink/public/mojom/webid/federated_auth_request_automation.mojom +++ b/third_party/blink/public/mojom/webid/federated_auth_request_automation.mojom
@@ -4,6 +4,10 @@ module blink.test.mojom; +enum DialogButton { + kConfirmIdpLoginContinue, +}; + // Provides a way for tests without chromedriver support to execute certain FedCM commands. // See https://fedidcg.github.io/FedCM/#automation. interface FederatedAuthRequestAutomation { @@ -19,6 +23,6 @@ // Dismisses the current dialog, if one is open. DismissFedCmDialog() => (bool success); - // Accepts the IDP login confirmation dialog, if one is open. - ConfirmIdpLogin() => (bool success); + // Clicks on a button in the current dialog, if one is open. + ClickFedCmDialogButton(DialogButton dialog_button) => (bool success); };
diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni index f61fee3..59e40d43 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -3248,6 +3248,8 @@ generated_enumeration_sources_for_testing_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_virtual_sensor_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_virtual_sensor_type.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_dialog_button.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_dialog_button.h", ] generated_interface_sources_for_testing_in_modules = [
diff --git a/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc b/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc index a8a90e9..856ad58 100644 --- a/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc +++ b/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc
@@ -202,12 +202,9 @@ break; case CSSPropertyID::kGridTemplateColumns: case CSSPropertyID::kGridTemplateRows: - if (RuntimeEnabledFeatures:: - CSSGridTemplatePropertyInterpolationEnabled()) { - applicable_types->push_back( - std::make_unique<CSSGridTemplatePropertyInterpolationType>( - used_property)); - } + applicable_types->push_back( + std::make_unique<CSSGridTemplatePropertyInterpolationType>( + used_property)); break; case CSSPropertyID::kContainIntrinsicWidth: case CSSPropertyID::kContainIntrinsicHeight:
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index 69698ff..363621d 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -1949,7 +1949,6 @@ default_value: "auto", keywords: ["auto", "first", "last"], typedom_types: ["Keyword"], - runtime_flag: "CSSBaselineSource", }, { name: "border-bottom-color",
diff --git a/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc b/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc index ff390e2..6e0d993 100644 --- a/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc +++ b/third_party/blink/renderer/core/css/parser/css_parser_fast_paths.cc
@@ -1166,7 +1166,6 @@ case CSSPropertyID::kAll: return false; // Only accepts css-wide keywords case CSSPropertyID::kBaselineSource: - DCHECK(RuntimeEnabledFeatures::CSSBaselineSourceEnabled()); return value_id == CSSValueID::kAuto || value_id == CSSValueID::kFirst || value_id == CSSValueID::kLast; case CSSPropertyID::kBorderCollapse:
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc index 1f8ab01..cd63749 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc
@@ -3006,12 +3006,12 @@ if (layout_object.IsSVGChild()) { return TransformHelper::ComputeReferenceBox(layout_object); } - if (layout_object.IsBox()) { - const auto& layout_box = To<LayoutBox>(layout_object); - if (pixel_snap_box == kUsePixelSnappedBox) { - return gfx::RectF(layout_box.PixelSnappedBorderBoxRect()); + if (const auto* layout_box = DynamicTo<LayoutBox>(layout_object)) { + if (pixel_snap_box == kDontUsePixelSnappedBox || + RuntimeEnabledFeatures::ReferenceBoxNoPixelSnappingEnabled()) { + return gfx::RectF(layout_box->PhysicalBorderBoxRect()); } - return gfx::RectF(layout_box.PhysicalBorderBoxRect()); + return gfx::RectF(layout_box->DeprecatedPixelSnappedBorderBoxRect()); } return gfx::RectF(); }
diff --git a/third_party/blink/renderer/core/editing/compare_positions.cc b/third_party/blink/renderer/core/editing/compare_positions.cc index e9f3677..5d49b7b1 100644 --- a/third_party/blink/renderer/core/editing/compare_positions.cc +++ b/third_party/blink/renderer/core/editing/compare_positions.cc
@@ -34,104 +34,6 @@ constexpr int kInvalidOffset = -1; -template <typename Traversal> -int16_t SlowComparePositions(const Node* container_a, - int offset_a, - const Node* container_b, - int offset_b, - bool* disconnected) { - DCHECK(container_a); - DCHECK(container_b); - - if (disconnected) - *disconnected = false; - - if (!container_a) - return -1; - if (!container_b) - return 1; - - // see DOM2 traversal & range section 2.5 - - // case 1: both points have the same container - if (container_a == container_b) { - if (offset_a == offset_b) - return 0; // A is equal to B - if (offset_a < offset_b) - return -1; // A is before B - return 1; // A is after B - } - - // case 2: node C (container B or an ancestor) is a child node of A - const Node* c = container_b; - while (c && Traversal::Parent(*c) != container_a) - c = Traversal::Parent(*c); - if (c) { - int offset_c = 0; - Node* n = Traversal::FirstChild(*container_a); - while (n != c && offset_c < offset_a) { - offset_c++; - n = Traversal::NextSibling(*n); - } - - if (offset_a <= offset_c) - return -1; // A is before B - return 1; // A is after B - } - - // case 3: node C (container A or an ancestor) is a child node of B - c = container_a; - while (c && Traversal::Parent(*c) != container_b) - c = Traversal::Parent(*c); - if (c) { - int offset_c = 0; - Node* n = Traversal::FirstChild(*container_b); - while (n != c && offset_c < offset_b) { - offset_c++; - n = Traversal::NextSibling(*n); - } - - if (offset_c < offset_b) - return -1; // A is before B - return 1; // A is after B - } - - // case 4: containers A & B are siblings, or children of siblings - // ### we need to do a traversal here instead - Node* common_ancestor = Traversal::CommonAncestor(*container_a, *container_b); - if (!common_ancestor) { - if (disconnected) - *disconnected = true; - return 0; - } - const Node* child_a = container_a; - while (child_a && Traversal::Parent(*child_a) != common_ancestor) - child_a = Traversal::Parent(*child_a); - if (!child_a) - child_a = common_ancestor; - const Node* child_b = container_b; - while (child_b && Traversal::Parent(*child_b) != common_ancestor) - child_b = Traversal::Parent(*child_b); - if (!child_b) - child_b = common_ancestor; - - if (child_a == child_b) - return 0; // A is equal to B - - Node* n = Traversal::FirstChild(*common_ancestor); - while (n) { - if (n == child_a) - return -1; // A is before B - if (n == child_b) - return 1; // A is after B - n = Traversal::NextSibling(*n); - } - - // Should never reach this point. - NOTREACHED(); - return 0; -} - // The `Comparator` class implements `ComparePositions()` logic. template <typename Traversal> class Comparator { @@ -459,11 +361,6 @@ const Node* container_b, int offset_b, bool* disconnected) { - if (!RuntimeEnabledFeatures::FastComparePositionsEnabled()) { - return SlowComparePositions<NodeTraversal>( - container_a, offset_a, container_b, offset_b, disconnected); - } - return Comparator<NodeTraversal>::ComparePositions( container_a, offset_a, container_b, offset_b, disconnected); } @@ -473,55 +370,12 @@ const Node* container_b, int offset_b, bool* disconnected) { - if (!RuntimeEnabledFeatures::FastComparePositionsEnabled()) { - return SlowComparePositions<FlatTreeTraversal>( - container_a, offset_a, container_b, offset_b, disconnected); - } - return Comparator<FlatTreeTraversal>::ComparePositions( container_a, offset_a, container_b, offset_b, disconnected); } -// Note: We should not this function outside this file. -// Compare two positions, taking into account the possibility that one or both -// could be inside a shadow tree. Only works for non-null values. -int16_t SlowComparePositions(const Position& a, const Position& b) { - DCHECK(a.IsNotNull()); - DCHECK(b.IsNotNull()); - const TreeScope* common_scope = Position::CommonAncestorTreeScope(a, b); - - DCHECK(common_scope); - if (!common_scope) - return 0; - - Node* node_a = common_scope->AncestorInThisScope(a.ComputeContainerNode()); - DCHECK(node_a); - bool has_descendent_a = node_a != a.ComputeContainerNode(); - int offset_a = has_descendent_a ? 0 : a.ComputeOffsetInContainerNode(); - - Node* node_b = common_scope->AncestorInThisScope(b.ComputeContainerNode()); - DCHECK(node_b); - bool has_descendent_b = node_b != b.ComputeContainerNode(); - int offset_b = has_descendent_b ? 0 : b.ComputeOffsetInContainerNode(); - - int16_t bias = 0; - if (node_a == node_b) { - if (has_descendent_a) - bias = 1; - else if (has_descendent_b) - bias = -1; - } - - int16_t result = - ComparePositionsInDOMTree(node_a, offset_a, node_b, offset_b); - return result ? result : bias; -} - int16_t ComparePositions(const Position& position_a, const Position& position_b) { - if (!RuntimeEnabledFeatures::FastComparePositionsEnabled()) - return SlowComparePositions(position_a, position_b); - DCHECK(position_a.IsNotNull()); DCHECK(position_b.IsNotNull()); @@ -577,28 +431,11 @@ return ComparePositions(a.DeepEquivalent(), b.DeepEquivalent()); } -// Note: We should not this function outside this file. -int16_t SlowComparePositions(const PositionInFlatTree& position_a, - const PositionInFlatTree& position_b) { - DCHECK(position_a.IsNotNull()); - DCHECK(position_b.IsNotNull()); - - Node* container_a = position_a.ComputeContainerNode(); - Node* container_b = position_b.ComputeContainerNode(); - int offset_a = position_a.ComputeOffsetInContainerNode(); - int offset_b = position_b.ComputeOffsetInContainerNode(); - return ComparePositionsInFlatTree(container_a, offset_a, container_b, - offset_b); -} - int16_t ComparePositions(const PositionInFlatTree& position_a, const PositionInFlatTree& position_b) { DCHECK(position_a.IsNotNull()); DCHECK(position_b.IsNotNull()); - if (!RuntimeEnabledFeatures::FastComparePositionsEnabled()) - return SlowComparePositions(position_a, position_b); - Node* const container_a = position_a.ComputeContainerNode(); Node* const container_b = position_b.ComputeContainerNode();
diff --git a/third_party/blink/renderer/core/fileapi/public_url_manager.cc b/third_party/blink/renderer/core/fileapi/public_url_manager.cc index 8ef03ea0..18d9a84 100644 --- a/third_party/blink/renderer/core/fileapi/public_url_manager.cc +++ b/third_party/blink/renderer/core/fileapi/public_url_manager.cc
@@ -144,6 +144,21 @@ } } +PublicURLManager::PublicURLManager( + ExecutionContext* execution_context, + mojo::PendingAssociatedRemote<mojom::blink::BlobURLStore> + frame_url_store_remote) + : ExecutionContextLifecycleObserver(execution_context), + frame_url_store_(execution_context), + worker_url_store_(execution_context) { + if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) { + execution_context_type_ = ExecutionContextIdForHistogram::kFrame; + } + frame_url_store_.Bind( + std::move(frame_url_store_remote), + execution_context->GetTaskRunner(TaskType::kFileReading)); +} + mojom::blink::BlobURLStore& PublicURLManager::GetBlobURLStore() { DCHECK_NE(frame_url_store_.is_bound(), worker_url_store_.is_bound()); if (frame_url_store_.is_bound()) {
diff --git a/third_party/blink/renderer/core/fileapi/public_url_manager.h b/third_party/blink/renderer/core/fileapi/public_url_manager.h index 8b3365f..da8e71b 100644 --- a/third_party/blink/renderer/core/fileapi/public_url_manager.h +++ b/third_party/blink/renderer/core/fileapi/public_url_manager.h
@@ -63,6 +63,12 @@ public: explicit PublicURLManager(ExecutionContext*); + // This constructor is for the Storage Access API, other users should use the + // constructor above which will select the correct BlobURLStore to use. + explicit PublicURLManager( + ExecutionContext*, + mojo::PendingAssociatedRemote<mojom::blink::BlobURLStore>); + // Generates a new Blob URL and registers the URLRegistrable to the // corresponding URLRegistry with the Blob URL. Returns the serialization // of the Blob URL.
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc index a687d49f..f1d4c501 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -2431,9 +2431,13 @@ } } -void LocalDOMWindow::DidBufferLoadWhileInBackForwardCache(size_t num_bytes) { +void LocalDOMWindow::DidBufferLoadWhileInBackForwardCache( + bool update_process_wide_count, + size_t num_bytes) { total_bytes_buffered_while_in_back_forward_cache_ += num_bytes; - BackForwardCacheBufferLimitTracker::Get().DidBufferBytes(num_bytes); + if (update_process_wide_count) { + BackForwardCacheBufferLimitTracker::Get().DidBufferBytes(num_bytes); + } } bool LocalDOMWindow::credentialless() const {
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.h b/third_party/blink/renderer/core/frame/local_dom_window.h index 227c37b..2ab203c 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.h +++ b/third_party/blink/renderer/core/frame/local_dom_window.h
@@ -506,7 +506,8 @@ // Called when a network request buffered an additional `num_bytes` while this // frame is in back-forward cache. - void DidBufferLoadWhileInBackForwardCache(size_t num_bytes); + void DidBufferLoadWhileInBackForwardCache(bool update_process_wide_count, + size_t num_bytes); // Whether the window is credentialless or not. bool credentialless() const;
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index f6e4c60..9443d25 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -3093,8 +3093,11 @@ GetBackForwardCacheControllerHostRemote().EvictFromBackForwardCache(reason); } -void LocalFrame::DidBufferLoadWhileInBackForwardCache(size_t num_bytes) { - DomWindow()->DidBufferLoadWhileInBackForwardCache(num_bytes); +void LocalFrame::DidBufferLoadWhileInBackForwardCache( + bool update_process_wide_count, + size_t num_bytes) { + DomWindow()->DidBufferLoadWhileInBackForwardCache(update_process_wide_count, + num_bytes); } void LocalFrame::SetScaleFactor(float scale_factor) {
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h index 85f8e32..64ec1a3 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -263,7 +263,8 @@ // BackForwardCacheLoaderHelperImpl::Delegate: void EvictFromBackForwardCache( mojom::blink::RendererEvictionReason reason) override; - void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) override; + void DidBufferLoadWhileInBackForwardCache(bool update_process_wide_count, + size_t num_bytes) override; void DidChangeThemeColor(bool update_theme_color_cache); void DidChangeBackgroundColor(SkColor4f background_color, bool color_adjust);
diff --git a/third_party/blink/renderer/core/html/forms/menu_list_inner_element.cc b/third_party/blink/renderer/core/html/forms/menu_list_inner_element.cc index cf031299..ce44315 100644 --- a/third_party/blink/renderer/core/html/forms/menu_list_inner_element.cc +++ b/third_party/blink/renderer/core/html/forms/menu_list_inner_element.cc
@@ -28,7 +28,7 @@ style_builder.SetFlexShrink(1); // min-width: 0; is needed for correct shrinking. style_builder.SetMinWidth(Length::Fixed(0)); - if (parent_style.ApplyControlFixedSize()) { + if (parent_style.ApplyControlFixedSize(OwnerShadowHost())) { style_builder.SetHasLineIfEmpty(true); } style_builder.SetOverflowX(EOverflow::kHidden);
diff --git a/third_party/blink/renderer/core/html/html_script_element.idl b/third_party/blink/renderer/core/html/html_script_element.idl index 2f2fad82..e211c30 100644 --- a/third_party/blink/renderer/core/html/html_script_element.idl +++ b/third_party/blink/renderer/core/html/html_script_element.idl
@@ -45,7 +45,7 @@ [Reflect] attribute DOMString integrity; // https://html.spec.whatwg.org/multipage/scripting.html#dom-script-supports - [RuntimeEnabled=ScriptElementSupports, CallWith=ScriptState, Measure] static boolean supports(DOMString type); + [CallWith=ScriptState, Measure] static boolean supports(DOMString type); // https://html.spec.whatwg.org/multipage/scripting.html#dom-script-blocking [SameObject, PutForwards=value] readonly attribute DOMTokenList blocking;
diff --git a/third_party/blink/renderer/core/layout/inline/line_breaker.cc b/third_party/blink/renderer/core/layout/inline/line_breaker.cc index f353bc1..f9ab19c2 100644 --- a/third_party/blink/renderer/core/layout/inline/line_breaker.cc +++ b/third_party/blink/renderer/core/layout/inline/line_breaker.cc
@@ -3453,9 +3453,8 @@ HandleEmptyText(items[current_.item_index], line_info); } } else { - // When rewinding all items, use |results[0].start_offset|. - const InlineItemResult& first_remove = item_results[new_end]; - current_ = first_remove.Start(); + // Rewinding all items. + current_ = line_info->Start(); trailing_whitespace_ = WhitespaceState::kLeading; maybe_have_end_overhang_ = false; }
diff --git a/third_party/blink/renderer/core/layout/intrinsic_sizing_info.h b/third_party/blink/renderer/core/layout/intrinsic_sizing_info.h index 1c0db672..663bcda 100644 --- a/third_party/blink/renderer/core/layout/intrinsic_sizing_info.h +++ b/third_party/blink/renderer/core/layout/intrinsic_sizing_info.h
@@ -18,6 +18,10 @@ return {gfx::SizeF(), gfx::SizeF(), false, false}; } + bool IsNone() const { + return !has_width && !has_height && aspect_ratio.IsEmpty(); + } + // Because they are using float instead of LayoutUnit, we can't use // PhysicalSize here. gfx::SizeF size;
diff --git a/third_party/blink/renderer/core/layout/layout_block_flow_hot.cc b/third_party/blink/renderer/core/layout/layout_block_flow_hot.cc index 96965f9..212368b 100644 --- a/third_party/blink/renderer/core/layout/layout_block_flow_hot.cc +++ b/third_party/blink/renderer/core/layout/layout_block_flow_hot.cc
@@ -30,6 +30,17 @@ return true; } + // https://drafts.csswg.org/css-align/#distribution-block + // All values other than normal force the block container to establish an + // independent formatting context. + if (RuntimeEnabledFeatures::AlignContentForBlocksEnabled()) { + if (StyleRef().AlignContent().GetPosition() != ContentPosition::kNormal || + StyleRef().AlignContent().Distribution() != + ContentDistributionType::kDefault) { + return true; + } + } + if (IsRenderedLegend()) return true;
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index 8baf483..4708bb16 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -1261,7 +1261,7 @@ return kIndefiniteSize; const Element& element = *To<Element>(GetNode()); - const bool apply_fixed_size = StyleRef().ApplyControlFixedSize(); + const bool apply_fixed_size = StyleRef().ApplyControlFixedSize(&element); const auto* select = DynamicTo<HTMLSelectElement>(element); if (UNLIKELY(select && select->UsesMenuList())) { return apply_fixed_size ? MenuListIntrinsicInlineSize(*select, *this) @@ -1315,7 +1315,7 @@ return ThemePartIntrinsicSize(*this, WebThemeEngine::kPartRadio).block_size; } - if (!StyleRef().ApplyControlFixedSize()) { + if (!StyleRef().ApplyControlFixedSize(GetNode())) { return kIndefiniteSize; } if (const auto* select = DynamicTo<HTMLSelectElement>(GetNode())) {
diff --git a/third_party/blink/renderer/core/layout/layout_box.h b/third_party/blink/renderer/core/layout/layout_box.h index d116bac..edc8e58 100644 --- a/third_party/blink/renderer/core/layout/layout_box.h +++ b/third_party/blink/renderer/core/layout/layout_box.h
@@ -281,8 +281,9 @@ // TODO(crbug.com/962299): This method snaps to pixels incorrectly because // PhysicalLocation() is not the correct paint offset. - gfx::Rect PixelSnappedBorderBoxRect() const { + gfx::Rect DeprecatedPixelSnappedBorderBoxRect() const { NOT_DESTROYED(); + DCHECK(!RuntimeEnabledFeatures::ReferenceBoxNoPixelSnappingEnabled()); return gfx::Rect(PixelSnappedBorderBoxSize(PhysicalLocation())); } // TODO(crbug.com/962299): This method is only correct when |offset| is the @@ -291,10 +292,6 @@ NOT_DESTROYED(); return ToPixelSnappedSize(Size().ToLayoutSize(), offset.ToLayoutPoint()); } - gfx::Rect BorderBoundingBox() const final { - NOT_DESTROYED(); - return PixelSnappedBorderBoxRect(); - } // The content area of the box (excludes padding - and intrinsic padding for // table cells, etc... - and scrollbars and border).
diff --git a/third_party/blink/renderer/core/layout/layout_box_model_object.h b/third_party/blink/renderer/core/layout/layout_box_model_object.h index 87e40ec..a5f06d0 100644 --- a/third_party/blink/renderer/core/layout/layout_box_model_object.h +++ b/third_party/blink/renderer/core/layout/layout_box_model_object.h
@@ -162,10 +162,6 @@ virtual void UpdateFromStyle(); - // This will work on inlines to return the bounding box of all of the lines' - // border boxes. - virtual gfx::Rect BorderBoundingBox() const = 0; - virtual PhysicalRect VisualOverflowRect() const = 0; // Returns the visual overflow rect, expanded to the area affected by any
diff --git a/third_party/blink/renderer/core/layout/layout_image.cc b/third_party/blink/renderer/core/layout/layout_image.cc index 38223be..d55ab3f 100644 --- a/third_party/blink/renderer/core/layout/layout_image.cc +++ b/third_party/blink/renderer/core/layout/layout_image.cc
@@ -345,13 +345,12 @@ } bool LayoutImage::CanApplyObjectViewBox() const { - auto* svg_image = EmbeddedSVGImage(); - if (!svg_image) + if (!EmbeddedSVGImage()) { return true; - - // Only apply object-view-box if the image has both intrinsic width/height. - IntrinsicSizingInfo info; - svg_image->GetIntrinsicSizingInfo(info); + } + // Only apply object-view-box if the image has both natural width/height. + const IntrinsicSizingInfo info = + image_resource_->GetNaturalDimensions(StyleRef().EffectiveZoom()); return info.has_width && info.has_height; } @@ -360,24 +359,22 @@ NOT_DESTROYED(); DCHECK(!ShouldApplySizeContainment()); if (!OverrideIntrinsicSizingInfo(intrinsic_sizing_info)) { - if (SVGImage* svg_image = EmbeddedSVGImage()) { - svg_image->GetIntrinsicSizingInfo(intrinsic_sizing_info); + if (EmbeddedSVGImage()) { + intrinsic_sizing_info = + image_resource_->GetNaturalDimensions(StyleRef().EffectiveZoom()); - // Scale for the element's effective zoom (which includes scaling for - // device scale) is already applied when computing the view box. If the - // element has no view box then it needs to be explicitly applied here. if (auto view_box_size = ComputeObjectViewBoxSizeForIntrinsicSizing()) { DCHECK(intrinsic_sizing_info.has_width); DCHECK(intrinsic_sizing_info.has_height); intrinsic_sizing_info.size = *view_box_size; - } else { - intrinsic_sizing_info.size.Scale(StyleRef().EffectiveZoom()); } - // Handle zoom & vertical writing modes here, as the embedded SVG document - // doesn't know about them. - if (StyleRef().GetObjectFit() != EObjectFit::kScaleDown) - intrinsic_sizing_info.size.Scale(ImageDevicePixelRatio()); + // The value returned by LayoutImageResource will be in zoomed CSS + // pixels, but for the 'scale-down' object-fit value we want "zoomed + // device pixels", so undo the DPR part here. + if (StyleRef().GetObjectFit() == EObjectFit::kScaleDown) { + intrinsic_sizing_info.size.InvScale(ImageDevicePixelRatio()); + } return; }
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.cc b/third_party/blink/renderer/core/layout/layout_image_resource.cc index a3f8c33..6ea668f 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.cc +++ b/third_party/blink/renderer/core/layout/layout_image_resource.cc
@@ -31,6 +31,7 @@ #include "third_party/blink/public/resources/grit/blink_image_resources.h" #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/layout/intrinsic_sizing_info.h" #include "third_party/blink/renderer/core/layout/layout_image.h" #include "third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h" #include "third_party/blink/renderer/platform/graphics/placeholder_image.h" @@ -38,6 +39,23 @@ namespace blink { +namespace { + +gfx::SizeF ApplyClampedZoom(gfx::SizeF size, float multiplier) { + // Don't let images that have a width/height >= 1 shrink below 1 when zoomed. + gfx::SizeF minimum_size(size.width() > 0 ? 1 : 0, size.height() > 0 ? 1 : 0); + size.Scale(multiplier); + if (size.width() < minimum_size.width()) { + size.set_width(minimum_size.width()); + } + if (size.height() < minimum_size.height()) { + size.set_height(minimum_size.height()); + } + return size; +} + +} // namespace + LayoutImageResource::LayoutImageResource() : layout_object_(nullptr), cached_image_(nullptr) {} @@ -115,25 +133,42 @@ return cached_image_->ForceOrientationIfNecessary(respect_orientation); } +IntrinsicSizingInfo LayoutImageResource::GetNaturalDimensions( + float multiplier) const { + if (!cached_image_ || !cached_image_->IsSizeAvailable() || + !cached_image_->HasImage()) { + return IntrinsicSizingInfo::None(); + } + IntrinsicSizingInfo sizing_info; + Image& image = *cached_image_->GetImage(); + if (auto* svg_image = DynamicTo<SVGImage>(image)) { + if (!svg_image->GetIntrinsicSizingInfo(sizing_info)) { + sizing_info = IntrinsicSizingInfo::None(); + } + } else { + sizing_info.size = gfx::SizeF(image.Size(ImageOrientation())); + sizing_info.aspect_ratio = sizing_info.size; + } + if (multiplier != 1 && HasIntrinsicSize()) { + sizing_info.size = ApplyClampedZoom(sizing_info.size, multiplier); + } + if (auto* layout_image = DynamicTo<LayoutImage>(*layout_object_)) { + sizing_info.size.Scale(layout_image->ImageDevicePixelRatio()); + } + return sizing_info; +} + gfx::SizeF LayoutImageResource::ImageSize(float multiplier) const { if (!cached_image_) return gfx::SizeF(); gfx::SizeF size(cached_image_->IntrinsicSize( LayoutObject::ShouldRespectImageOrientation(layout_object_))); if (multiplier != 1 && HasIntrinsicSize()) { - // Don't let images that have a width/height >= 1 shrink below 1 when - // zoomed. - gfx::SizeF minimum_size(size.width() > 0 ? 1 : 0, - size.height() > 0 ? 1 : 0); - size.Scale(multiplier); - if (size.width() < minimum_size.width()) - size.set_width(minimum_size.width()); - if (size.height() < minimum_size.height()) - size.set_height(minimum_size.height()); + size = ApplyClampedZoom(size, multiplier); } - if (layout_object_ && layout_object_->IsLayoutImage() && size.width() && - size.height()) - size.Scale(To<LayoutImage>(layout_object_.Get())->ImageDevicePixelRatio()); + if (auto* layout_image = DynamicTo<LayoutImage>(*layout_object_)) { + size.Scale(layout_image->ImageDevicePixelRatio()); + } return size; }
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.h b/third_party/blink/renderer/core/layout/layout_image_resource.h index 00d2b65..4ea86ff 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource.h
@@ -35,6 +35,7 @@ namespace blink { class LayoutObject; +struct IntrinsicSizingInfo; class CORE_EXPORT LayoutImageResource : public GarbageCollected<LayoutImageResource> { @@ -72,6 +73,7 @@ // Default size is effective when this is LayoutImageResourceStyleImage. virtual gfx::SizeF ImageSizeWithDefaultSize(float multiplier, const gfx::SizeF&) const; + virtual IntrinsicSizingInfo GetNaturalDimensions(float multiplier) const; virtual RespectImageOrientationEnum ImageOrientation() const; virtual WrappedImagePtr ImagePtr() const { return cached_image_.Get(); }
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc index 09171b045..845ea40 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc
@@ -28,6 +28,7 @@ #include "third_party/blink/renderer/core/layout/layout_image_resource_style_image.h" +#include "third_party/blink/renderer/core/layout/intrinsic_sizing_info.h" #include "third_party/blink/renderer/core/layout/layout_replaced.h" #include "third_party/blink/renderer/core/layout/list/layout_list_marker_image.h" #include "third_party/blink/renderer/core/style/style_fetched_image.h" @@ -87,6 +88,15 @@ LayoutObject::ShouldRespectImageOrientation(layout_object_)); } +IntrinsicSizingInfo LayoutImageResourceStyleImage::GetNaturalDimensions( + float multiplier) const { + // Always respect the orientation of opaque origin images to avoid leaking + // image data. Otherwise pull orientation from the layout object's style. + RespectImageOrientationEnum respect_orientation = + LayoutObject::ShouldRespectImageOrientation(layout_object_); + return style_image_->GetNaturalSizingInfo(multiplier, respect_orientation); +} + RespectImageOrientationEnum LayoutImageResourceStyleImage::ImageOrientation() const { // Always respect the orientation of opaque origin images to avoid leaking
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h index 095e273a..8206e2bd 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h
@@ -53,6 +53,7 @@ gfx::SizeF ImageSize(float multiplier) const override; gfx::SizeF ImageSizeWithDefaultSize(float multiplier, const gfx::SizeF&) const override; + IntrinsicSizingInfo GetNaturalDimensions(float multiplier) const override; RespectImageOrientationEnum ImageOrientation() const override; WrappedImagePtr ImagePtr() const override { return style_image_->Data(); }
diff --git a/third_party/blink/renderer/core/layout/layout_inline.h b/third_party/blink/renderer/core/layout/layout_inline.h index 041be9c..3be5b60 100644 --- a/third_party/blink/renderer/core/layout/layout_inline.h +++ b/third_party/blink/renderer/core/layout/layout_inline.h
@@ -318,12 +318,6 @@ PositionWithAffinity PositionForPoint(const PhysicalOffset&) const override; - gfx::Rect BorderBoundingBox() const final { - NOT_DESTROYED(); - gfx::Rect bounding_box = ToEnclosingRect(PhysicalLinesBoundingBox()); - return gfx::Rect(bounding_box.size()); - } - void DirtyLinesFromChangedChild(LayoutObject*) final; // TODO(leviw): This should probably be an int. We don't snap equivalent lines
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc index 8418806..9b925f2 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc
@@ -307,7 +307,7 @@ } if (child.IsTextControlPlaceholder()) { - if (Style().ApplyControlFixedSize()) { + if (Style().ApplyControlFixedSize(Node().GetDOMNode())) { continue; } } @@ -3314,7 +3314,7 @@ const wtf_size_t kTextBlockIndex = 0u; LogicalSize available_size = ChildAvailableSize(); - bool apply_fixed_size = Style().ApplyControlFixedSize(); + bool apply_fixed_size = Style().ApplyControlFixedSize(Node().GetDOMNode()); if (container_builder_.Children().size() > 0 && apply_fixed_size) { // The placeholder should have the width same as "editing-view-port" // element, which is the first grandchild of the text control.
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index 08e20bc..75b92bf 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -293,7 +293,7 @@ else inline_size += border_padding.InlineSum(); - const bool apply_form_sizing = style.ApplyControlFixedSize(); + const bool apply_form_sizing = style.ApplyControlFixedSize(node); if (block_node.IsTextControl() && apply_form_sizing) { return inline_size; }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc index 659476de..20d1ff0 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc
@@ -37,7 +37,6 @@ #include "third_party/blink/renderer/core/layout/svg/transformed_hit_test_location.h" #include "third_party/blink/renderer/core/paint/clip_path_clipper.h" #include "third_party/blink/renderer/core/paint/svg_image_painter.h" -#include "third_party/blink/renderer/core/svg/graphics/svg_image.h" #include "third_party/blink/renderer/core/svg/svg_image_element.h" #include "third_party/blink/renderer/core/svg/svg_length_functions.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" @@ -95,46 +94,42 @@ if (!width_is_auto && !height_is_auto) return gfx::SizeF(style_size.x(), style_size.y()); - gfx::SizeF intrinsic_size; - bool has_intrinsic_ratio = true; + const gfx::SizeF kDefaultObjectSize(LayoutReplaced::kDefaultWidth, + LayoutReplaced::kDefaultHeight); + IntrinsicSizingInfo sizing_info; if (HasOverriddenIntrinsicSize()) { - intrinsic_size.SetSize(LayoutReplaced::kDefaultWidth, - LayoutReplaced::kDefaultHeight); + sizing_info.size = kDefaultObjectSize; + sizing_info.aspect_ratio = sizing_info.size; } else { - ImageResourceContent* cached_image = image_resource_->CachedImage(); - if (!cached_image || cached_image->ErrorOccurred() || - !cached_image->IsSizeAvailable()) { + if (!image_resource_->HasImage() || image_resource_->ErrorOccurred()) { return gfx::SizeF(style_size.x(), style_size.y()); } - - RespectImageOrientationEnum respect_orientation = - LayoutObject::ShouldRespectImageOrientation(this); - intrinsic_size = cached_image->GetImage()->SizeAsFloat(respect_orientation); - if (auto* svg_image = DynamicTo<SVGImage>(cached_image->GetImage())) { - IntrinsicSizingInfo intrinsic_sizing_info; - has_intrinsic_ratio &= - svg_image->GetIntrinsicSizingInfo(intrinsic_sizing_info); - has_intrinsic_ratio &= !intrinsic_sizing_info.aspect_ratio.IsEmpty(); - } + sizing_info = image_resource_->GetNaturalDimensions(1); } - if (width_is_auto && height_is_auto) - return intrinsic_size; + const gfx::SizeF concrete_object_size = + ConcreteObjectSize(sizing_info, kDefaultObjectSize); + if (width_is_auto && height_is_auto) { + return concrete_object_size; + } + const bool has_intrinsic_ratio = !sizing_info.aspect_ratio.IsEmpty(); if (height_is_auto) { if (has_intrinsic_ratio) { - return gfx::SizeF(style_size.x(), - ResolveHeightForRatio(style_size.x(), intrinsic_size)); + return gfx::SizeF( + style_size.x(), + ResolveHeightForRatio(style_size.x(), sizing_info.aspect_ratio)); } - return gfx::SizeF(style_size.x(), intrinsic_size.height()); + return gfx::SizeF(style_size.x(), concrete_object_size.height()); } DCHECK(width_is_auto); if (has_intrinsic_ratio) { - return gfx::SizeF(ResolveWidthForRatio(style_size.y(), intrinsic_size), - style_size.y()); + return gfx::SizeF( + ResolveWidthForRatio(style_size.y(), sizing_info.aspect_ratio), + style_size.y()); } - return gfx::SizeF(intrinsic_size.width(), style_size.y()); + return gfx::SizeF(concrete_object_size.width(), style_size.y()); } bool LayoutSVGImage::UpdateBoundingBox() {
diff --git a/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_impl.cc b/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_impl.cc index 6337b04..33bcf6c 100644 --- a/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_impl.cc +++ b/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_impl.cc
@@ -20,10 +20,12 @@ } void BackForwardCacheLoaderHelperImpl::DidBufferLoadWhileInBackForwardCache( + bool update_process_wide_count, size_t num_bytes) { if (!delegate_) return; - delegate_->DidBufferLoadWhileInBackForwardCache(num_bytes); + delegate_->DidBufferLoadWhileInBackForwardCache(update_process_wide_count, + num_bytes); } void BackForwardCacheLoaderHelperImpl::Detach() {
diff --git a/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_impl.h b/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_impl.h index 02ab7d0..7e0ef3da 100644 --- a/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_impl.h +++ b/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_impl.h
@@ -29,14 +29,17 @@ // buffered for back-forward cache in the delegate and in the process. Note // that `num_bytes` is the amount of additional bytes that are newly // buffered, on top of any previously buffered bytes for this delegate. - virtual void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) = 0; + virtual void DidBufferLoadWhileInBackForwardCache( + bool update_process_wide_count, + size_t num_bytes) = 0; }; explicit BackForwardCacheLoaderHelperImpl(Delegate& delegate); void EvictFromBackForwardCache( mojom::blink::RendererEvictionReason reason) override; - void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) override; + void DidBufferLoadWhileInBackForwardCache(bool update_process_wide_count, + size_t num_bytes) override; void Detach() override; void Trace(Visitor*) const override;
diff --git a/third_party/blink/renderer/core/loader/loader_factory_for_frame.cc b/third_party/blink/renderer/core/loader/loader_factory_for_frame.cc index e7e6453..839f294 100644 --- a/third_party/blink/renderer/core/loader/loader_factory_for_frame.cc +++ b/third_party/blink/renderer/core/loader/loader_factory_for_frame.cc
@@ -198,8 +198,8 @@ return std::make_unique<BackgroundURLLoader>( std::move(web_background_resource_fetch_assets), GetCorsExemptHeaderList(), freezable_task_runner, - unfreezable_task_runner, std::move(throttles), - GetBackgroundCodeCacheHost()); + unfreezable_task_runner, back_forward_cache_loader_helper, + std::move(throttles), GetBackgroundCodeCacheHost()); } }
diff --git a/third_party/blink/renderer/core/paint/paint_layer.cc b/third_party/blink/renderer/core/paint/paint_layer.cc index afce2122..7f8277b 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.cc +++ b/third_party/blink/renderer/core/paint/paint_layer.cc
@@ -1814,7 +1814,19 @@ } gfx::RectF PaintLayer::BackdropFilterReferenceBox() const { - return gfx::RectF(GetLayoutObject().BorderBoundingBox()); + if (const auto* layout_inline = DynamicTo<LayoutInline>(GetLayoutObject())) { + return RuntimeEnabledFeatures::ReferenceBoxNoPixelSnappingEnabled() + ? gfx::RectF( + gfx::SizeF(layout_inline->PhysicalLinesBoundingBox().size)) + : gfx::RectF( + ToEnclosingRect(layout_inline->PhysicalLinesBoundingBox()) + .size()); + } + + const auto* layout_box = GetLayoutBox(); + return RuntimeEnabledFeatures::ReferenceBoxNoPixelSnappingEnabled() + ? gfx::RectF(layout_box->PhysicalBorderBoxRect()) + : gfx::RectF(layout_box->DeprecatedPixelSnappedBorderBoxRect()); } gfx::RRectF PaintLayer::BackdropFilterBounds() const {
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index 958d6875..34410a8 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -2617,6 +2617,20 @@ StyleType() == kPseudoIdBackdrop; } +bool ComputedStyle::ApplyControlFixedSize(const Node* node) const { + if (FieldSizing() == EFieldSizing::kFixed) { + return true; + } + if (!node) { + return false; + } + const auto* control = DynamicTo<HTMLFormControlElement>(node); + if (!control) { + control = DynamicTo<HTMLFormControlElement>(node->OwnerShadowHost()); + } + return control && control->GetAutofillState() != WebAutofillState::kNotFilled; +} + ComputedStyleBuilder::ComputedStyleBuilder(const ComputedStyle& style) : ComputedStyleBuilderBase(style) {}
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 11553d52..9a8e2a8 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -2396,10 +2396,10 @@ OverflowClipMargin()->GetMargin() != LayoutUnit()); } - // Field-sizing utility function - bool ApplyControlFixedSize() const { - return FieldSizing() == EFieldSizing::kFixed; - } + // Field-sizing utility function: + // Returns true if field-sizing:fixed or node's owner form control is + // autofilled. + bool ApplyControlFixedSize(const Node* node) const; private: bool IsInlineSizeContainer() const {
diff --git a/third_party/blink/renderer/core/style/style_fetched_image.cc b/third_party/blink/renderer/core/style/style_fetched_image.cc index ffa4609..65f8123 100644 --- a/third_party/blink/renderer/core/style/style_fetched_image.cc +++ b/third_party/blink/renderer/core/style/style_fetched_image.cc
@@ -205,9 +205,7 @@ if (!svg_image->GetIntrinsicSizingInfo(intrinsic_sizing_info)) { return false; } - return intrinsic_sizing_info.has_width || - intrinsic_sizing_info.has_height || - !intrinsic_sizing_info.aspect_ratio.IsEmpty(); + return !intrinsic_sizing_info.IsNone(); } return image.HasIntrinsicSize(); }
diff --git a/third_party/blink/renderer/core/view_transition/view_transition.cc b/third_party/blink/renderer/core/view_transition/view_transition.cc index 69de9fa..79109c3 100644 --- a/third_party/blink/renderer/core/view_transition/view_transition.cc +++ b/third_party/blink/renderer/core/view_transition/view_transition.cc
@@ -44,6 +44,24 @@ return next_document_tag++; } +absl::optional<Vector<String>> FilterTypes( + const absl::optional<Vector<String>>& types) { + absl::optional<Vector<String>> result; + if (!types) { + return result; + } + + result.emplace(); + for (const auto& type : *types) { + String lower = type.LowerASCII(); + if (lower == "none" || lower.StartsWith("-ua-")) { + continue; + } + result->push_back(type); + } + return result; +} + } // namespace ViewTransition::ScopedPauseRendering::ScopedPauseRendering( @@ -134,7 +152,7 @@ *document->GetExecutionContext(), *this, update_dom_callback)), - types_(types) { + types_(FilterTypes(types)) { CHECK(RuntimeEnabledFeatures::ViewTransitionTypesEnabled() || !types_); if (auto* originating_element = document_->documentElement()) { originating_element->ActiveViewTransitionStateChanged();
diff --git a/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc b/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc index c172d2e..c73c29e 100644 --- a/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc +++ b/third_party/blink/renderer/core/view_transition/view_transition_style_tracker.cc
@@ -1208,11 +1208,14 @@ LayoutUnit(entry_size->blockSize())) : PhysicalSize(LayoutUnit(entry_size->blockSize()), LayoutUnit(entry_size->inlineSize())); - } else if (auto* box_model = DynamicTo<LayoutBoxModelObject>(layout_object)) { + } else if (auto* layout_inline = DynamicTo<LayoutInline>(layout_object)) { border_box_size_in_css_space = - PhysicalSize(box_model->BorderBoundingBox().size()); - // Size BorderBoundingBox is in Layout space, we need to convert to CSS - // space. + RuntimeEnabledFeatures::ReferenceBoxNoPixelSnappingEnabled() + ? layout_inline->PhysicalLinesBoundingBox().size + : PhysicalSize( + ToEnclosingRect(layout_inline->PhysicalLinesBoundingBox()) + .size()); + // Convert to CSS pixels instead of layout pixels. border_box_size_in_css_space.Scale(1.f / device_pixel_ratio_); }
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.cc b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.cc index 0752b97..b93556e 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.cc
@@ -529,9 +529,12 @@ } void DedicatedWorkerGlobalScope::DidBufferLoadWhileInBackForwardCache( + bool update_process_wide_count, size_t num_bytes) { total_bytes_buffered_while_in_back_forward_cache_ += num_bytes; - BackForwardCacheBufferLimitTracker::Get().DidBufferBytes(num_bytes); + if (update_process_wide_count) { + BackForwardCacheBufferLimitTracker::Get().DidBufferBytes(num_bytes); + } } void DedicatedWorkerGlobalScope::SetIsInBackForwardCache(
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h index ea842d2b..13885938 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h +++ b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h
@@ -136,7 +136,8 @@ // Implements BackForwardCacheLoaderHelperImpl::Delegate. void EvictFromBackForwardCache( mojom::blink::RendererEvictionReason reason) override; - void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) override; + void DidBufferLoadWhileInBackForwardCache(bool update_process_wide_count, + size_t num_bytes) override; // Called by the bindings (dedicated_worker_global_scope.idl). const String name() const;
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h index ab191e4..094fe4f 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h
@@ -94,7 +94,8 @@ // BackForwardCacheLoaderHelperImpl::Delegate void EvictFromBackForwardCache( mojom::blink::RendererEvictionReason reason) override {} - void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) override {} + void DidBufferLoadWhileInBackForwardCache(bool update_process_wide_count, + size_t num_bytes) override {} // Returns true when the WorkerOrWorkletGlobalScope is closing (e.g. via // WorkerGlobalScope#close() method). If this returns true, the worker is
diff --git a/third_party/blink/renderer/modules/compression/compression_format.cc b/third_party/blink/renderer/modules/compression/compression_format.cc index a21bb7c..f4eb7d7b 100644 --- a/third_party/blink/renderer/modules/compression/compression_format.cc +++ b/third_party/blink/renderer/modules/compression/compression_format.cc
@@ -16,8 +16,7 @@ return CompressionFormat::kGzip; } else if (format == "deflate") { return CompressionFormat::kDeflate; - } else if (format == "deflate-raw" && - RuntimeEnabledFeatures::DeflateRawCompressionFormatEnabled()) { + } else if (format == "deflate-raw") { return CompressionFormat::kDeflateRaw; }
diff --git a/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.cc b/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.cc index 73a34cdae..a0deb1e 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.cc +++ b/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.cc
@@ -12,6 +12,7 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_dialog_button.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/wtf/functional.h" @@ -166,32 +167,45 @@ } // static -ScriptPromise InternalsFedCm::confirmIdpLogin(ScriptState* script_state, - Internals&) { +ScriptPromise InternalsFedCm::clickFedCmDialogButton( + ScriptState* script_state, + Internals&, + const V8DialogButton& v8_button) { mojo::Remote<test::mojom::blink::FederatedAuthRequestAutomation> federated_auth_request_automation = CreateFedAuthRequestAutomation(script_state); auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); ScriptPromise promise = resolver->Promise(); + + test::mojom::blink::DialogButton button; + switch (v8_button.AsEnum()) { + case V8DialogButton::Enum::kConfirmIdpLoginContinue: + button = test::mojom::blink::DialogButton::kConfirmIdpLoginContinue; + break; + } + // Get the interface so `federated_auth_request_automation` can be moved // below. test::mojom::blink::FederatedAuthRequestAutomation* raw_federated_auth_request_automation = federated_auth_request_automation.get(); - raw_federated_auth_request_automation->ConfirmIdpLogin(WTF::BindOnce( - // While we only really need |resolver|, we also take the - // mojo::Remote<> so that it remains alive after this function exits. - [](ScriptPromiseResolver* resolver, - mojo::Remote<test::mojom::blink::FederatedAuthRequestAutomation>, - bool success) { - if (success) { - resolver->Resolve(); - } else { - resolver->Reject(); - } - }, - WrapPersistent(resolver), std::move(federated_auth_request_automation))); + raw_federated_auth_request_automation->ClickFedCmDialogButton( + button, + WTF::BindOnce( + // While we only really need |resolver|, we also take the + // mojo::Remote<> so that it remains alive after this function exits. + [](ScriptPromiseResolver* resolver, + mojo::Remote<test::mojom::blink::FederatedAuthRequestAutomation>, + bool success) { + if (success) { + resolver->Resolve(); + } else { + resolver->Reject(); + } + }, + WrapPersistent(resolver), + std::move(federated_auth_request_automation))); return promise; }
diff --git a/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.h b/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.h index 310a2e08..9b5d535 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.h +++ b/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.h
@@ -13,6 +13,7 @@ class Internals; class ScriptPromise; class ScriptState; +class V8DialogButton; class InternalsFedCm { STATIC_ONLY(InternalsFedCm); @@ -25,7 +26,9 @@ int account_index, ExceptionState&); static ScriptPromise dismissFedCmDialog(ScriptState*, Internals&); - static ScriptPromise confirmIdpLogin(ScriptState*, Internals&); + static ScriptPromise clickFedCmDialogButton(ScriptState*, + Internals&, + const V8DialogButton& button); }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.idl b/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.idl index b7f2cb6..2ce6f96 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.idl +++ b/third_party/blink/renderer/modules/credentialmanagement/testing/internals_fed_cm.idl
@@ -2,6 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// This should match the DialogButton enum in browser_protocol.pdl +enum DialogButton { + "ConfirmIdpLoginContinue", +}; + [ ImplementedAs=InternalsFedCm ] partial interface Internals { @@ -9,5 +14,5 @@ [CallWith=ScriptState] Promise<DOMString> getFedCmTitle(); [CallWith=ScriptState, RaisesException] Promise<void> selectFedCmAccount(long accountIndex); [CallWith=ScriptState] Promise<void> dismissFedCmDialog(); - [CallWith=ScriptState] Promise<void> confirmIdpLogin(); + [CallWith=ScriptState] Promise<void> clickFedCmDialogButton(DialogButton dialogButton); };
diff --git a/third_party/blink/renderer/modules/mediarecorder/key_frame_request_processor_unittest.cc b/third_party/blink/renderer/modules/mediarecorder/key_frame_request_processor_unittest.cc index 573474492..1a0d816 100644 --- a/third_party/blink/renderer/modules/mediarecorder/key_frame_request_processor_unittest.cc +++ b/third_party/blink/renderer/modules/mediarecorder/key_frame_request_processor_unittest.cc
@@ -52,7 +52,7 @@ TEST_F(KeyFrameRequestProcessorClockTest, CountIntervalSuggestsKeyframesPeriodically) { - KeyFrameRequestProcessor processor(2); + KeyFrameRequestProcessor processor(2u); OnKeyFrame(processor); ASSERT_FALSE(OnFrameAndShouldRequestKeyFrame(processor)); ASSERT_FALSE(OnFrameAndShouldRequestKeyFrame(processor));
diff --git a/third_party/blink/renderer/modules/mediarecorder/video_track_recorder_unittest.cc b/third_party/blink/renderer/modules/mediarecorder/video_track_recorder_unittest.cc index 890d84e..403e342 100644 --- a/third_party/blink/renderer/modules/mediarecorder/video_track_recorder_unittest.cc +++ b/third_party/blink/renderer/modules/mediarecorder/video_track_recorder_unittest.cc
@@ -728,7 +728,7 @@ TEST_P(VideoTrackRecorderTestParam, KeyFramesGeneratedWithIntervalCount) { // Configure 3 delta frames for every key frame. - InitializeRecorder(testing::get<0>(GetParam()), /*keyframe_config=*/3); + InitializeRecorder(testing::get<0>(GetParam()), /*keyframe_config=*/3u); auto frame = media::VideoFrame::CreateBlackFrame(kTrackRecorderTestSize[0]); auto origin = base::TimeTicks::Now();
diff --git a/third_party/blink/renderer/modules/ml/webnn/ml_graph_test_mojo.cc b/third_party/blink/renderer/modules/ml/webnn/ml_graph_test_mojo.cc index 717ab42..756f3660 100644 --- a/third_party/blink/renderer/modules/ml/webnn/ml_graph_test_mojo.cc +++ b/third_party/blink/renderer/modules/ml/webnn/ml_graph_test_mojo.cc
@@ -3185,14 +3185,14 @@ using blink = blink_mojom::Operand::DataType; { SplitTester{.input = {.type = v8::kFloat32, .dimensions = {2, 2}}, - .splits = 2, + .splits = 2u, .expected = {{.type = blink::kFloat32, .dimensions = {1, 2}}, {.type = blink::kFloat32, .dimensions = {1, 2}}}} .Test(*this, scope, builder); } { SplitTester{.input = {.type = v8::kFloat32, .dimensions = {2, 2}}, - .splits = 2, + .splits = 2u, .axis = 1, .expected = {{.type = blink::kFloat32, .dimensions = {2, 1}}, {.type = blink::kFloat32, .dimensions = {2, 1}}}}
diff --git a/third_party/blink/renderer/modules/storage_access/storage_access_handle.cc b/third_party/blink/renderer/modules/storage_access/storage_access_handle.cc index 0837fc5..807d308 100644 --- a/third_party/blink/renderer/modules/storage_access/storage_access_handle.cc +++ b/third_party/blink/renderer/modules/storage_access/storage_access_handle.cc
@@ -7,6 +7,7 @@ #include "third_party/blink/public/common/features.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_storage_estimate.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_storage_usage_details.h" +#include "third_party/blink/renderer/core/fileapi/blob.h" #include "third_party/blink/renderer/core/frame/navigator.h" #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.h" @@ -48,6 +49,16 @@ "The estimate function for Quota was not requested when storage access " "handle was initialized."; +// static +const char StorageAccessHandle::kCreateObjectURLNotRequested[] = + "The createObjectURL function for Blob Stoage was not requested when " + "storage access handle was initialized."; + +// static +const char StorageAccessHandle::kRevokeObjectURLNotRequested[] = + "The revokeObjectURL function for Blob Stoage was not requested when " + "storage access handle was initialized."; + namespace { void EstimateImplAfterRemoteEstimate(ScriptPromiseResolver* resolver, @@ -122,6 +133,16 @@ WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_estimate); } + if (storage_access_types_->createObjectURL()) { + window.CountUse( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL); + } + if (storage_access_types_->revokeObjectURL()) { + window.CountUse( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL); + } if (storage_access_types_->all() || storage_access_types_->sessionStorage()) { InitSessionStorage(); } @@ -143,6 +164,11 @@ if (storage_access_types_->all() || storage_access_types_->estimate()) { InitQuota(); } + if (storage_access_types_->all() || + storage_access_types_->createObjectURL() || + storage_access_types_->revokeObjectURL()) { + InitBlobStorage(); + } } void StorageAccessHandle::Trace(Visitor* visitor) const { @@ -153,6 +179,7 @@ visitor->Trace(indexed_db_); visitor->Trace(locks_); visitor->Trace(caches_); + visitor->Trace(blob_storage_); ScriptWrappable::Trace(visitor); Supplement<LocalDOMWindow>::Trace(visitor); } @@ -272,8 +299,9 @@ WrapPersistent(resolver))); } -ScriptPromise StorageAccessHandle::estimate(ScriptState* script_state, - ExceptionState& exception_state) { +ScriptPromise StorageAccessHandle::estimate( + ScriptState* script_state, + ExceptionState& exception_state) const { ScriptPromiseResolver* resolver = MakeGarbageCollected<ScriptPromiseResolver>( script_state, exception_state.GetContext()); ScriptPromise promise = resolver->Promise(); @@ -295,6 +323,39 @@ return promise; } +String StorageAccessHandle::createObjectURL( + Blob* blob, + ExceptionState& exception_state) const { + if (!storage_access_types_->all() && + !storage_access_types_->createObjectURL()) { + exception_state.ThrowSecurityError(kCreateObjectURLNotRequested); + return ""; + } + GetSupplementable()->CountUse( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL_Use); + GetSupplementable()->CountUse(WebFeature::kCreateObjectURLBlob); + CHECK(blob); + return blob_storage_->RegisterURL(blob); +} + +void StorageAccessHandle::revokeObjectURL( + const String& url, + ExceptionState& exception_state) const { + if (!storage_access_types_->all() && + !storage_access_types_->revokeObjectURL()) { + exception_state.ThrowSecurityError(kRevokeObjectURLNotRequested); + return; + } + GetSupplementable()->CountUse( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL_Use); + KURL resolved_url(NullURL(), url); + GetSupplementable()->GetExecutionContext()->RemoveURLFromMemoryCache( + resolved_url); + blob_storage_->Revoke(resolved_url); +} + void StorageAccessHandle::InitSessionStorage() { LocalDOMWindow* window = GetSupplementable(); if (!window->GetSecurityOrigin()->CanAccessSessionStorage()) { @@ -333,7 +394,7 @@ } HeapMojoRemote<mojom::blink::StorageAccessHandle>& -StorageAccessHandle::GetRemote() { +StorageAccessHandle::InitRemote() { if (!remote_) { mojo::PendingRemote<mojom::blink::StorageAccessHandle> remote; GetSupplementable() @@ -351,13 +412,12 @@ if (!GetSupplementable()->GetSecurityOrigin()->CanAccessDatabase()) { return; } - HeapMojoRemote<mojom::blink::StorageAccessHandle>& remote = GetRemote(); - if (!remote) { + if (!InitRemote()) { return; } - indexed_db_ = MakeGarbageCollected<IDBFactory>(GetSupplementable()); mojo::PendingRemote<mojom::blink::IDBFactory> indexed_db_remote; - remote->BindIndexedDB(indexed_db_remote.InitWithNewPipeAndPassReceiver()); + remote_->BindIndexedDB(indexed_db_remote.InitWithNewPipeAndPassReceiver()); + indexed_db_ = MakeGarbageCollected<IDBFactory>(GetSupplementable()); indexed_db_->SetRemote(std::move(indexed_db_remote)); } @@ -365,13 +425,12 @@ if (!GetSupplementable()->GetSecurityOrigin()->CanAccessLocks()) { return; } - HeapMojoRemote<mojom::blink::StorageAccessHandle>& remote = GetRemote(); - if (!remote) { + if (!InitRemote()) { return; } - locks_ = MakeGarbageCollected<LockManager>(*GetSupplementable()->navigator()); mojo::PendingRemote<mojom::blink::LockManager> locks_remote; - remote->BindLocks(locks_remote.InitWithNewPipeAndPassReceiver()); + remote_->BindLocks(locks_remote.InitWithNewPipeAndPassReceiver()); + locks_ = MakeGarbageCollected<LockManager>(*GetSupplementable()->navigator()); locks_->SetManager(std::move(locks_remote), GetSupplementable()->GetExecutionContext()); } @@ -380,8 +439,7 @@ if (!GetSupplementable()->GetSecurityOrigin()->CanAccessCacheStorage()) { return; } - HeapMojoRemote<mojom::blink::StorageAccessHandle>& remote = GetRemote(); - if (!remote) { + if (!InitRemote()) { return; } mojo::PendingRemote<mojom::blink::CacheStorage> cache_remote; @@ -396,7 +454,7 @@ if (!GetSupplementable()->GetSecurityOrigin()->CanAccessFileSystem()) { return; } - GetRemote(); + InitRemote(); // Nothing else to init as getDirectory is an async function not a handle. } @@ -404,8 +462,23 @@ if (GetSupplementable()->GetSecurityOrigin()->IsOpaque()) { return; } - GetRemote(); + InitRemote(); // Nothing else to init as all Quota usage is via async functions. } +void StorageAccessHandle::InitBlobStorage() { + if (GetSupplementable()->GetSecurityOrigin()->IsOpaque()) { + return; + } + if (!InitRemote()) { + return; + } + mojo::PendingAssociatedRemote<mojom::blink::BlobURLStore> blob_storage_remote; + remote_->BindBlobStorage( + blob_storage_remote.InitWithNewEndpointAndPassReceiver()); + blob_storage_ = MakeGarbageCollected<PublicURLManager>( + GetSupplementable()->GetExecutionContext(), + std::move(blob_storage_remote)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/modules/storage_access/storage_access_handle.h b/third_party/blink/renderer/modules/storage_access/storage_access_handle.h index 33795e8..04648773 100644 --- a/third_party/blink/renderer/modules/storage_access/storage_access_handle.h +++ b/third_party/blink/renderer/modules/storage_access/storage_access_handle.h
@@ -8,6 +8,7 @@ #include "mojo/public/cpp/bindings/pending_remote.h" #include "third_party/blink/public/mojom/storage_access/storage_access_handle.mojom-blink.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_storage_access_types.h" +#include "third_party/blink/renderer/core/fileapi/public_url_manager.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/modules/cache_storage/cache_storage.h" #include "third_party/blink/renderer/modules/indexeddb/idb_factory.h" @@ -21,6 +22,7 @@ namespace blink { +class Blob; class ExceptionState; class MODULES_EXPORT StorageAccessHandle final @@ -37,6 +39,8 @@ static const char kCachesNotRequested[]; static const char kGetDirectoryNotRequested[]; static const char kEstimateNotRequested[]; + static const char kCreateObjectURLNotRequested[]; + static const char kRevokeObjectURLNotRequested[]; explicit StorageAccessHandle(LocalDOMWindow& window, const StorageAccessTypes* storage_access_types); @@ -50,17 +54,21 @@ ScriptPromise getDirectory(ScriptState* script_state, ExceptionState& exception_state) const; ScriptPromise estimate(ScriptState* script_state, - ExceptionState& exception_state); + ExceptionState& exception_state) const; + String createObjectURL(Blob* blob, ExceptionState& exception_state) const; + void revokeObjectURL(const String& url, + ExceptionState& exception_state) const; private: void InitSessionStorage(); void InitLocalStorage(); - HeapMojoRemote<mojom::blink::StorageAccessHandle>& GetRemote(); + HeapMojoRemote<mojom::blink::StorageAccessHandle>& InitRemote(); void InitIndexedDB(); void InitLocks(); void InitCaches(); void InitGetDirectory(); void InitQuota(); + void InitBlobStorage(); void GetDirectoryImpl(ScriptPromiseResolver* resolver) const; @@ -71,6 +79,7 @@ Member<IDBFactory> indexed_db_; Member<LockManager> locks_; Member<CacheStorage> caches_; + Member<PublicURLManager> blob_storage_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/storage_access/storage_access_handle.idl b/third_party/blink/renderer/modules/storage_access/storage_access_handle.idl index a8f3cce..8f6fae6 100644 --- a/third_party/blink/renderer/modules/storage_access/storage_access_handle.idl +++ b/third_party/blink/renderer/modules/storage_access/storage_access_handle.idl
@@ -11,7 +11,8 @@ [LogActivity=GetterOnly, RaisesException=Getter] readonly attribute CacheStorage caches; [CallWith=ScriptState, LogActivity, RaisesException] Promise<FileSystemDirectoryHandle> getDirectory(); [CallWith=ScriptState, LogActivity, RaisesException] Promise<StorageEstimate> estimate(); - // TODO(crbug.com/1484966): Add blob storage + [LogActivity, RaisesException] DOMString createObjectURL(Blob blob); + [LogActivity, RaisesException] void revokeObjectURL(DOMString url); // TODO(crbug.com/1484966): Add broadcast channel // TODO(crbug.com/1484966): Add shared worker }; \ No newline at end of file
diff --git a/third_party/blink/renderer/modules/storage_access/storage_access_handle_test.cc b/third_party/blink/renderer/modules/storage_access/storage_access_handle_test.cc index 9ba5ddc..e55e778 100644 --- a/third_party/blink/renderer/modules/storage_access/storage_access_handle_test.cc +++ b/third_party/blink/renderer/modules/storage_access/storage_access_handle_test.cc
@@ -18,17 +18,27 @@ namespace blink { class StorageAccessHandleTest - : public testing::TestWithParam< - testing::tuple<bool, bool, bool, bool, bool, bool, bool, bool>> { + : public testing::TestWithParam<testing::tuple<bool, + bool, + bool, + bool, + bool, + bool, + bool, + bool, + bool, + bool>> { public: bool all() { return std::get<0>(GetParam()); } - bool session_storage() { return std::get<1>(GetParam()); } - bool local_storage() { return std::get<2>(GetParam()); } - bool indexed_db() { return std::get<3>(GetParam()); } + bool sessionStorage() { return std::get<1>(GetParam()); } + bool localStorage() { return std::get<2>(GetParam()); } + bool indexedDB() { return std::get<3>(GetParam()); } bool locks() { return std::get<4>(GetParam()); } bool caches() { return std::get<5>(GetParam()); } bool getDirectory() { return std::get<6>(GetParam()); } bool estimate() { return std::get<7>(GetParam()); } + bool createObjectURL() { return std::get<8>(GetParam()); } + bool revokeObjectURL() { return std::get<9>(GetParam()); } LocalDOMWindow* getLocalDOMWindow() { test::ScopedMockedURLLoad scoped_mocked_url_load_root( @@ -49,13 +59,15 @@ StorageAccessTypes* storage_access_types = MakeGarbageCollected<StorageAccessTypes>(); storage_access_types->setAll(all()); - storage_access_types->setSessionStorage(session_storage()); - storage_access_types->setLocalStorage(local_storage()); - storage_access_types->setIndexedDB(indexed_db()); + storage_access_types->setSessionStorage(sessionStorage()); + storage_access_types->setLocalStorage(localStorage()); + storage_access_types->setIndexedDB(indexedDB()); storage_access_types->setLocks(locks()); storage_access_types->setCaches(caches()); storage_access_types->setGetDirectory(getDirectory()); storage_access_types->setEstimate(estimate()); + storage_access_types->setCreateObjectURL(createObjectURL()); + storage_access_types->setRevokeObjectURL(revokeObjectURL()); StorageAccessHandle* storage_access_handle = MakeGarbageCollected<StorageAccessHandle>(*window, storage_access_types); EXPECT_TRUE(window->document()->IsUseCounted( @@ -68,17 +80,17 @@ window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_sessionStorage), - session_storage()); + sessionStorage()); EXPECT_EQ( window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_localStorage), - local_storage()); + localStorage()); EXPECT_EQ( window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_indexedDB), - indexed_db()); + indexedDB()); EXPECT_EQ(window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_locks), @@ -98,6 +110,16 @@ WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_estimate), estimate()); + EXPECT_EQ( + window->document()->IsUseCounted( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL), + createObjectURL()); + EXPECT_EQ( + window->document()->IsUseCounted( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL), + revokeObjectURL()); EXPECT_FALSE(window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_sessionStorage_Use)); @@ -119,14 +141,20 @@ EXPECT_FALSE(window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_estimate_Use)); + EXPECT_FALSE(window->document()->IsUseCounted( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL_Use)); + EXPECT_FALSE(window->document()->IsUseCounted( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL_Use)); { V8TestingScope scope; storage_access_handle->sessionStorage(scope.GetExceptionState()); EXPECT_EQ(scope.GetExceptionState().CodeAs<DOMExceptionCode>(), - (all() || session_storage()) ? DOMExceptionCode::kNoError - : DOMExceptionCode::kSecurityError); + (all() || sessionStorage()) ? DOMExceptionCode::kNoError + : DOMExceptionCode::kSecurityError); EXPECT_EQ(scope.GetExceptionState().Message(), - (all() || session_storage()) + (all() || sessionStorage()) ? nullptr : StorageAccessHandle::kSessionStorageNotRequested); } @@ -134,10 +162,10 @@ V8TestingScope scope; storage_access_handle->localStorage(scope.GetExceptionState()); EXPECT_EQ(scope.GetExceptionState().CodeAs<DOMExceptionCode>(), - (all() || local_storage()) ? DOMExceptionCode::kNoError - : DOMExceptionCode::kSecurityError); + (all() || localStorage()) ? DOMExceptionCode::kNoError + : DOMExceptionCode::kSecurityError); EXPECT_EQ(scope.GetExceptionState().Message(), - (all() || local_storage()) + (all() || localStorage()) ? nullptr : StorageAccessHandle::kLocalStorageNotRequested); } @@ -145,10 +173,10 @@ V8TestingScope scope; storage_access_handle->indexedDB(scope.GetExceptionState()); EXPECT_EQ(scope.GetExceptionState().CodeAs<DOMExceptionCode>(), - (all() || indexed_db()) ? DOMExceptionCode::kNoError - : DOMExceptionCode::kSecurityError); + (all() || indexedDB()) ? DOMExceptionCode::kNoError + : DOMExceptionCode::kSecurityError); EXPECT_EQ(scope.GetExceptionState().Message(), - (all() || indexed_db()) + (all() || indexedDB()) ? nullptr : StorageAccessHandle::kIndexedDBNotRequested); } @@ -207,21 +235,44 @@ StorageAccessHandle::kEstimateNotRequested); } } + { + V8TestingScope scope; + storage_access_handle->createObjectURL( + Blob::Create(scope.GetExecutionContext()), scope.GetExceptionState()); + EXPECT_EQ(scope.GetExceptionState().CodeAs<DOMExceptionCode>(), + (all() || createObjectURL()) ? DOMExceptionCode::kNoError + : DOMExceptionCode::kSecurityError); + EXPECT_EQ(scope.GetExceptionState().Message(), + (all() || createObjectURL()) + ? nullptr + : StorageAccessHandle::kCreateObjectURLNotRequested); + } + { + V8TestingScope scope; + storage_access_handle->revokeObjectURL("", scope.GetExceptionState()); + EXPECT_EQ(scope.GetExceptionState().CodeAs<DOMExceptionCode>(), + (all() || revokeObjectURL()) ? DOMExceptionCode::kNoError + : DOMExceptionCode::kSecurityError); + EXPECT_EQ(scope.GetExceptionState().Message(), + (all() || revokeObjectURL()) + ? nullptr + : StorageAccessHandle::kRevokeObjectURLNotRequested); + } EXPECT_EQ( window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_sessionStorage_Use), - all() || session_storage()); + all() || sessionStorage()); EXPECT_EQ( window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_localStorage_Use), - all() || local_storage()); + all() || localStorage()); EXPECT_EQ( window->document()->IsUseCounted( WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_indexedDB_Use), - all() || indexed_db()); + all() || indexedDB()); EXPECT_EQ( window->document()->IsUseCounted( WebFeature:: @@ -242,32 +293,54 @@ WebFeature:: kStorageAccessAPI_requestStorageAccess_BeyondCookies_estimate_Use), all() || estimate()); + EXPECT_EQ( + window->document()->IsUseCounted( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL_Use), + all() || createObjectURL()); + EXPECT_EQ( + window->document()->IsUseCounted( + WebFeature:: + kStorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL_Use), + all() || revokeObjectURL()); } // Test all handles. INSTANTIATE_TEST_SUITE_P( /*no prefix*/, StorageAccessHandleTest, - testing::ValuesIn( - std::vector<std::tuple<bool, bool, bool, bool, bool, bool, bool, bool>>{ - // Nothing: - {false, false, false, false, false, false, false, false}, - // All: - {true, false, false, false, false, false, false, false}, - // Session Storage: - {false, true, false, false, false, false, false, false}, - // Local Storage: - {false, false, true, false, false, false, false, false}, - // IndexedDB: - {false, false, false, true, false, false, false, false}, - // Web Locks: - {false, false, false, false, true, false, false, false}, - // Cache Storage: - {false, false, false, false, false, true, false, false}, - // Origin Private File System: - {false, false, false, false, false, false, true, false}, - // Quota: - {false, false, false, false, false, false, false, true}, - })); + testing::ValuesIn(std::vector<std::tuple<bool, + bool, + bool, + bool, + bool, + bool, + bool, + bool, + bool, + bool>>{ + // Nothing: + {false, false, false, false, false, false, false, false, false, false}, + // All: + {true, false, false, false, false, false, false, false, false, false}, + // Session Storage: + {false, true, false, false, false, false, false, false, false, false}, + // Local Storage: + {false, false, true, false, false, false, false, false, false, false}, + // IndexedDB: + {false, false, false, true, false, false, false, false, false, false}, + // Web Locks: + {false, false, false, false, true, false, false, false, false, false}, + // Cache Storage: + {false, false, false, false, false, true, false, false, false, false}, + // Origin Private File System: + {false, false, false, false, false, false, true, false, false, false}, + // Quota: + {false, false, false, false, false, false, false, true, false, false}, + // createObjectURL: + {false, false, false, false, false, false, false, false, true, false}, + // revokeObjectURL: + {false, false, false, false, false, false, false, false, false, true}, + })); } // namespace blink
diff --git a/third_party/blink/renderer/modules/storage_access/storage_access_types.idl b/third_party/blink/renderer/modules/storage_access/storage_access_types.idl index 8cd23d3..78c69ade 100644 --- a/third_party/blink/renderer/modules/storage_access/storage_access_types.idl +++ b/third_party/blink/renderer/modules/storage_access/storage_access_types.idl
@@ -11,7 +11,8 @@ boolean caches = false; boolean getDirectory = false; boolean estimate = false; - // TODO(crbug.com/1484966): Add blob storage + boolean createObjectURL = false; + boolean revokeObjectURL = false; // TODO(crbug.com/1484966): Add broadcast channel // TODO(crbug.com/1484966): Add shared worker };
diff --git a/third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.cc b/third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.cc index 1fd75b78..df6a42a 100644 --- a/third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.cc +++ b/third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.cc
@@ -55,4 +55,9 @@ return total_bytes_buffered_ <= max_buffered_bytes_per_process_; } +size_t BackForwardCacheBufferLimitTracker::total_bytes_buffered_for_testing() { + base::AutoLock lock(lock_); + return total_bytes_buffered_; +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.h b/third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.h index 3bcf5cc8..81b8ec4d 100644 --- a/third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.h +++ b/third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.h
@@ -30,6 +30,8 @@ bool IsUnderPerProcessBufferLimit() LOCKS_EXCLUDED(lock_); + size_t total_bytes_buffered_for_testing() LOCKS_EXCLUDED(lock_); + BackForwardCacheBufferLimitTracker(BackForwardCacheBufferLimitTracker&) = delete;
diff --git a/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc b/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc index 23ea5b5..ef59f73 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc
@@ -1013,7 +1013,6 @@ Iterator offset_end) { DCHECK(offset_begin != offset_end); Iterator current_offset = offset_begin; - float total_space = 0.0; if (UNLIKELY(current_offset->offset == StartIndex())) { // Enter this branch if the previous item's direction is RTL and current // item's direction is LTR. In this case, spacing cannot be added to the @@ -1116,10 +1115,9 @@ } } run->width_ += total_space_for_run; - total_space += total_space_for_run; } DCHECK(current_offset == offset_end); // Check if all offsets are consumed. - width_ += total_space; + // `width_` will be updated in `RecalcCharacterPositions()`. } scoped_refptr<ShapeResult> ShapeResult::UnapplyAutoSpacing( @@ -1990,6 +1988,7 @@ } character_position_->start_offset_ = start_offset; + character_position_->width_ = width_ = run_advance; } void ShapeResult::EnsurePositionData() const { @@ -1997,7 +1996,7 @@ return; character_position_ = - std::make_unique<CharacterPositionData>(num_characters_, width_); + std::make_unique<CharacterPositionData>(num_characters_); RecalcCharacterPositions(); }
diff --git a/third_party/blink/renderer/platform/fonts/shaping/shape_result.h b/third_party/blink/renderer/platform/fonts/shaping/shape_result.h index a0800d5..770f2e1 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shape_result.h +++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result.h
@@ -459,8 +459,8 @@ USING_FAST_MALLOC(CharacterPositionData); public: - CharacterPositionData(unsigned num_characters, float width) - : data_(num_characters), width_(width) {} + explicit CharacterPositionData(unsigned num_characters) + : data_(num_characters) {} ShapeResultCharacterData& operator[](unsigned index) { return data_[index]; @@ -534,7 +534,10 @@ const Vector<scoped_refptr<RunInfo>>& RunsOrParts() const { return runs_; } unsigned StartIndexOffsetForRun() const { return 0; } - float width_; + // The total width. This is the sum of `RunInfo::width_`. + // It's mutable because `RecalcCharacterPositions()` recalculates this. + // This should be in sync with `CharacterPositionData::width_`. + mutable float width_; // Only used by CachingWordShapeIterator and stored here for memory reduction // reasons. See https://crbug.com/955776
diff --git a/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h b/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h index 636ce56..91206c3 100644 --- a/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h +++ b/third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h
@@ -33,26 +33,6 @@ kMaxValue = kREMOVED_JXL, }; - // Categories for the JPEG color space histogram. Synced with 'JpegColorSpace' - // in src/tools/metrics/histograms/enums.xml. These values are persisted to - // logs. Entries should not be renumbered and numeric values should never be - // reused. - enum class JpegColorSpace { - kUnknown = 0, - kGrayscale = 1, - kRGB = 2, - kCMYK = 3, - kYCCK = 4, - kYCbCr410 = 5, - kYCbCr411 = 6, - kYCbCr420 = 7, - kYCbCr422 = 8, - kYCbCr440 = 9, - kYCbCr444 = 10, - kYCbCrOther = 11, - kMaxValue = kYCbCrOther, - }; - // |type| is the return value of ImageDecoder::FilenameExtension(). static DecodedImageType StringToDecodedImageType(const String& type);
diff --git a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc index ab924e5f..061e962 100644 --- a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc
@@ -124,52 +124,6 @@ subsampling == cc::YUVSubsampling::k420; } -// Extracts the JPEG color space of an image for UMA purposes given |info| which -// is assumed to have gone through a jpeg_read_header(). When the color space is -// YCbCr, we also extract the chroma subsampling. The caveat is that the -// extracted color space is really libjpeg_turbo's guess. According to -// libjpeg.txt, "[t]he JPEG color space, unfortunately, is something of a guess -// since the JPEG standard proper does not provide a way to record it. In -// practice most files adhere to the JFIF or Adobe conventions, and the decoder -// will recognize these correctly." -blink::BitmapImageMetrics::JpegColorSpace ExtractUMAJpegColorSpace( - const jpeg_decompress_struct& info) { - switch (info.jpeg_color_space) { - case JCS_GRAYSCALE: - return blink::BitmapImageMetrics::JpegColorSpace::kGrayscale; - case JCS_RGB: - return blink::BitmapImageMetrics::JpegColorSpace::kRGB; - case JCS_CMYK: - return blink::BitmapImageMetrics::JpegColorSpace::kCMYK; - case JCS_YCCK: - return blink::BitmapImageMetrics::JpegColorSpace::kYCCK; - case JCS_YCbCr: - switch (YuvSubsampling(info)) { - case cc::YUVSubsampling::k444: - return blink::BitmapImageMetrics::JpegColorSpace::kYCbCr444; - case cc::YUVSubsampling::k422: - return blink::BitmapImageMetrics::JpegColorSpace::kYCbCr422; - case cc::YUVSubsampling::k411: - return blink::BitmapImageMetrics::JpegColorSpace::kYCbCr411; - case cc::YUVSubsampling::k440: - return blink::BitmapImageMetrics::JpegColorSpace::kYCbCr440; - case cc::YUVSubsampling::k420: - return blink::BitmapImageMetrics::JpegColorSpace::kYCbCr420; - case cc::YUVSubsampling::k410: - return blink::BitmapImageMetrics::JpegColorSpace::kYCbCr410; - case cc::YUVSubsampling::kUnknown: - return blink::BitmapImageMetrics::JpegColorSpace::kYCbCrOther; - } - default: - return blink::BitmapImageMetrics::JpegColorSpace::kUnknown; - } -} - -void CountJpegColorSpace( - blink::BitmapImageMetrics::JpegColorSpace color_space) { - UMA_HISTOGRAM_ENUMERATION("Blink.ImageDecoders.Jpeg.ColorSpace", color_space); -} - // Rounds |size| to the smallest multiple of |alignment| that is greater than or // equal to |size|. // Note that base::bits::Align is not used here because the alignment is not @@ -724,7 +678,6 @@ case kJpegDone: // Finish decompression. - CountJpegColorSpace(ExtractUMAJpegColorSpace(info_)); if (info_.jpeg_color_space != JCS_GRAYSCALE && decoder_->IsAllDataReceived()) { static constexpr char kType[] = "Jpeg";
diff --git a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc index 1f7c12b7..b26df31a 100644 --- a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc
@@ -430,44 +430,18 @@ struct ColorSpaceTestParam { std::string file; bool expected_success = false; - BitmapImageMetrics::JpegColorSpace expected_color_space; bool expect_yuv_decoding = false; gfx::Size expected_uv_size; }; void PrintTo(const ColorSpaceTestParam& param, std::ostream* os) { *os << "{\"" << param.file << "\", " << param.expected_success << "," - << static_cast<int>(param.expected_color_space) << "," << param.expected_uv_size.ToString() << "," << param.expect_yuv_decoding << "}"; } class ColorSpaceTest : public ::testing::TestWithParam<ColorSpaceTestParam> {}; -// Tests that the JPEG color space/subsampling is recorded correctly as a UMA -// for a variety of images. When the decode fails, no UMA should be recorded. -TEST_P(ColorSpaceTest, CorrectColorSpaceUMARecorded) { - base::HistogramTester histogram_tester; - scoped_refptr<SharedBuffer> data = - ReadFile(("/images/resources/" + GetParam().file).c_str()); - ASSERT_TRUE(data); - - std::unique_ptr<ImageDecoder> decoder = CreateJPEGDecoder(); - decoder->SetData(data.get(), true); - - ImageFrame* frame = decoder->DecodeFrameBufferAtIndex(0); - ASSERT_TRUE(frame); - - if (GetParam().expected_success) { - ASSERT_FALSE(decoder->Failed()); - histogram_tester.ExpectUniqueSample("Blink.ImageDecoders.Jpeg.ColorSpace", - GetParam().expected_color_space, 1); - } else { - ASSERT_TRUE(decoder->Failed()); - histogram_tester.ExpectTotalCount("Blink.ImageDecoders.Jpeg.ColorSpace", 0); - } -} - // Tests YUV decoding path with different color encodings (and chroma // subsamplings if applicable). TEST_P(ColorSpaceTest, YuvDecode) { @@ -513,50 +487,35 @@ } const ColorSpaceTest::ParamType kColorSpaceTestParams[] = { - {"cs-uma-grayscale.jpg", true, - BitmapImageMetrics::JpegColorSpace::kGrayscale}, - {"cs-uma-rgb.jpg", true, BitmapImageMetrics::JpegColorSpace::kRGB}, + {"cs-uma-grayscale.jpg", true}, + {"cs-uma-rgb.jpg", true}, // Each component is in a separate scan. Should not make a difference. - {"cs-uma-rgb-non-interleaved.jpg", true, - BitmapImageMetrics::JpegColorSpace::kRGB}, - {"cs-uma-cmyk.jpg", true, BitmapImageMetrics::JpegColorSpace::kCMYK}, + {"cs-uma-rgb-non-interleaved.jpg", true}, + {"cs-uma-cmyk.jpg", true}, // 4 components/no markers, so we expect libjpeg_turbo to guess CMYK. - {"cs-uma-cmyk-no-jfif-or-adobe-markers.jpg", true, - BitmapImageMetrics::JpegColorSpace::kCMYK}, + {"cs-uma-cmyk-no-jfif-or-adobe-markers.jpg", true}, // 4 components are not legal in JFIF, but we expect libjpeg_turbo to guess // CMYK. - {"cs-uma-cmyk-jfif-marker.jpg", true, - BitmapImageMetrics::JpegColorSpace::kCMYK}, - {"cs-uma-ycck.jpg", true, BitmapImageMetrics::JpegColorSpace::kYCCK}, + {"cs-uma-cmyk-jfif-marker.jpg", true}, + {"cs-uma-ycck.jpg", true}, // Contains CMYK data but uses a bad Adobe color transform, so libjpeg_turbo // will guess YCCK. - {"cs-uma-cmyk-unknown-transform.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCCK}, - {"cs-uma-ycbcr-410.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr410, false}, - {"cs-uma-ycbcr-411.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr411, false}, - {"cs-uma-ycbcr-420.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, gfx::Size(32, 32)}, + {"cs-uma-cmyk-unknown-transform.jpg", true}, + {"cs-uma-ycbcr-410.jpg", true, false}, + {"cs-uma-ycbcr-411.jpg", true, false}, + {"cs-uma-ycbcr-420.jpg", true, true, gfx::Size(32, 32)}, // Each component is in a separate scan. Should not make a difference. - {"cs-uma-ycbcr-420-non-interleaved.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, gfx::Size(32, 32)}, + {"cs-uma-ycbcr-420-non-interleaved.jpg", true, true, gfx::Size(32, 32)}, // 3 components/both JFIF and Adobe markers, so we expect libjpeg_turbo to // guess YCbCr. - {"cs-uma-ycbcr-420-both-jfif-adobe.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr420, true, gfx::Size(32, 32)}, - {"cs-uma-ycbcr-422.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr422, true, gfx::Size(32, 64)}, - {"cs-uma-ycbcr-440.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr440, false}, - {"cs-uma-ycbcr-444.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr444, true, gfx::Size(64, 64)}, + {"cs-uma-ycbcr-420-both-jfif-adobe.jpg", true, true, gfx::Size(32, 32)}, + {"cs-uma-ycbcr-422.jpg", true, true, gfx::Size(32, 64)}, + {"cs-uma-ycbcr-440.jpg", true, false}, + {"cs-uma-ycbcr-444.jpg", true, true, gfx::Size(64, 64)}, // Contains RGB data but uses a bad Adobe color transform, so libjpeg_turbo // will guess YCbCr. - {"cs-uma-rgb-unknown-transform.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCr444, true, gfx::Size(64, 64)}, - {"cs-uma-ycbcr-other.jpg", true, - BitmapImageMetrics::JpegColorSpace::kYCbCrOther, false}, + {"cs-uma-rgb-unknown-transform.jpg", true, true, gfx::Size(64, 64)}, + {"cs-uma-ycbcr-other.jpg", true, false}, // Contains only 2 components. We expect the decode to fail and not produce // any samples. {"cs-uma-two-channels-jfif-marker.jpg", false}};
diff --git a/third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h b/third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h index b7ed382..192f92d 100644 --- a/third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h +++ b/third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h
@@ -25,7 +25,9 @@ // Called when a network request buffered an additional `num_bytes` while the // in back-forward cache. May be called multiple times. - virtual void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) = 0; + virtual void DidBufferLoadWhileInBackForwardCache( + bool update_process_wide_count, + size_t num_bytes) = 0; virtual void Detach() = 0;
diff --git a/third_party/blink/renderer/platform/loader/fetch/response_body_loader.cc b/third_party/blink/renderer/platform/loader/fetch/response_body_loader.cc index 0b7b7fb..f105d98 100644 --- a/third_party/blink/renderer/platform/loader/fetch/response_body_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/response_body_loader.cc
@@ -488,7 +488,7 @@ if (!back_forward_cache_loader_helper_) return; back_forward_cache_loader_helper_->DidBufferLoadWhileInBackForwardCache( - num_bytes); + /*update_process_wide_count=*/true, num_bytes); } void ResponseBodyLoader::Start() {
diff --git a/third_party/blink/renderer/platform/loader/fetch/response_body_loader_test.cc b/third_party/blink/renderer/platform/loader/fetch/response_body_loader_test.cc index d6ca667..d047008 100644 --- a/third_party/blink/renderer/platform/loader/fetch/response_body_loader_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/response_body_loader_test.cc
@@ -33,7 +33,8 @@ void EvictFromBackForwardCache( mojom::blink::RendererEvictionReason reason) override {} - void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) override {} + void DidBufferLoadWhileInBackForwardCache(bool update_process_wide_count, + size_t num_bytes) override {} void Detach() override {} };
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.cc index ea2f5fb..c1e92fb 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.cc
@@ -21,6 +21,8 @@ #include "third_party/blink/public/platform/web_background_resource_fetch_assets.h" #include "third_party/blink/public/platform/web_url_error.h" #include "third_party/blink/public/platform/web_url_response.h" +#include "third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.h" +#include "third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h" #include "third_party/blink/renderer/platform/loader/fetch/background_code_cache_host.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_utils.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" @@ -157,6 +159,7 @@ const Vector<String>& cors_exempt_header_list, scoped_refptr<base::SingleThreadTaskRunner> freezable_task_runner, scoped_refptr<base::SingleThreadTaskRunner> unfreezable_task_runner, + BackForwardCacheLoaderHelper* back_forward_cache_loader_helper, Vector<std::unique_ptr<URLLoaderThrottle>> throttles, scoped_refptr<BackgroundCodeCacheHost> background_code_cache_host) : background_resource_fetch_context_( @@ -166,13 +169,19 @@ unfreezable_task_runner_(std::move(unfreezable_task_runner)), background_task_runner_( background_resource_fetch_context_->GetTaskRunner()), + back_forward_cache_loader_helper_( + std::make_unique<WeakPersistent<BackForwardCacheLoaderHelper>>( + back_forward_cache_loader_helper)), throttles_(std::move(throttles)), background_code_cache_host_(std::move(background_code_cache_host)) { DETACH_FROM_SEQUENCE(background_sequence_checker_); } - ~Context() = default; - + ~Context() { + // WeakPersistent must be destructed in the original thread. + unfreezable_task_runner_->DeleteSoon( + FROM_HERE, std::move(back_forward_cache_loader_helper_)); + } scoped_refptr<base::SingleThreadTaskRunner> unfreezable_task_runner() const { DCHECK_CALLED_ON_VALID_SEQUENCE(main_thread_sequence_checker_); return unfreezable_task_runner_; @@ -470,11 +479,48 @@ void EvictFromBackForwardCacheOnBackground( mojom::blink::RendererEvictionReason reason) { DCHECK_CALLED_ON_VALID_SEQUENCE(background_sequence_checker_); - // TODDO(crbug.com/1379780): Implement this. + PostCrossThreadTask(*unfreezable_task_runner_, FROM_HERE, + CrossThreadBindOnce(&Context::EvictFromBackForwardCache, + scoped_refptr(this), reason)); + } + void EvictFromBackForwardCache(mojom::blink::RendererEvictionReason reason) { + DCHECK_CALLED_ON_VALID_SEQUENCE(main_thread_sequence_checker_); + if (back_forward_cache_loader_helper_ && + *back_forward_cache_loader_helper_) { + (*back_forward_cache_loader_helper_)->EvictFromBackForwardCache(reason); + } } void DidBufferLoadWhileInBackForwardCacheOnBackground(size_t num_bytes) { DCHECK_CALLED_ON_VALID_SEQUENCE(background_sequence_checker_); - // TODDO(crbug.com/1379780): Implement this. + // Need to update the process wide count in the background thread. + BackForwardCacheBufferLimitTracker::Get().DidBufferBytes(num_bytes); + PostCrossThreadTask( + *unfreezable_task_runner_, FROM_HERE, + CrossThreadBindOnce(&Context::DidBufferLoadWhileInBackForwardCache, + scoped_refptr(this), num_bytes)); + } + void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) { + DCHECK_CALLED_ON_VALID_SEQUENCE(main_thread_sequence_checker_); + if (freeze_mode_ != LoaderFreezeMode::kBufferIncoming) { + // This happens when the page was restored from BFCache, and + // Context::Freeze(LoaderFreezeMode::kNone) was called in the main thread, + // but Context::FreezeOnBackground(LoaderFreezeMode::kNone) was not called + // in the background thread when MojoURLLoaderClient::BodyBuffer received + // the data. In that case, we need to decrease the process-wide total + // byte count tracked by BackForwardCacheBufferLimitTracker because we + // have updated it in DidBufferLoadWhileInBackForwardCacheOnBackground(). + BackForwardCacheBufferLimitTracker::Get() + .DidRemoveFrameOrWorkerFromBackForwardCache(num_bytes); + return; + } + if (back_forward_cache_loader_helper_ && + *back_forward_cache_loader_helper_) { + // We updated the process wide count in the background thread, so setting + // `update_process_wide_count` to false. + (*back_forward_cache_loader_helper_) + ->DidBufferLoadWhileInBackForwardCache( + /*update_process_wide_count=*/false, num_bytes); + } } scoped_refptr<WebBackgroundResourceFetchAssets> @@ -488,6 +534,10 @@ const scoped_refptr<base::SingleThreadTaskRunner> unfreezable_task_runner_; const scoped_refptr<base::SequencedTaskRunner> background_task_runner_; + std::unique_ptr<WeakPersistent<BackForwardCacheLoaderHelper>> + back_forward_cache_loader_helper_ + GUARDED_BY_CONTEXT(main_thread_sequence_checker_); + Vector<std::unique_ptr<URLLoaderThrottle>> throttles_ GUARDED_BY_CONTEXT(main_thread_sequence_checker_); @@ -531,6 +581,7 @@ const Vector<String>& cors_exempt_header_list, scoped_refptr<base::SingleThreadTaskRunner> freezable_task_runner, scoped_refptr<base::SingleThreadTaskRunner> unfreezable_task_runner, + BackForwardCacheLoaderHelper* back_forward_cache_loader_helper, Vector<std::unique_ptr<URLLoaderThrottle>> throttles, scoped_refptr<BackgroundCodeCacheHost> background_code_cache_host) : context_(base::MakeRefCounted<Context>( @@ -538,6 +589,7 @@ cors_exempt_header_list, std::move(freezable_task_runner), std::move(unfreezable_task_runner), + back_forward_cache_loader_helper, std::move(throttles), std::move(background_code_cache_host))) { CHECK(IsMainThread());
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.h b/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.h index c383fd1..96590fb 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.h +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.h
@@ -19,11 +19,12 @@ namespace blink { +class BackForwardCacheLoaderHelper; class BackgroundCodeCacheHost; -class WebBackgroundResourceFetchAssets; class URLLoaderClient; class ResourceRequestHead; struct ResourceLoaderOptions; +class WebBackgroundResourceFetchAssets; // BackgroundURLLoader is used to fetch a resource request on a background // thread. Used only when BackgroundResourceFetch feature is enabled. @@ -50,6 +51,7 @@ const Vector<String>& cors_exempt_header_list, scoped_refptr<base::SingleThreadTaskRunner> freezable_task_runner, scoped_refptr<base::SingleThreadTaskRunner> unfreezable_task_runner, + BackForwardCacheLoaderHelper* back_forward_cache_loader_helper, Vector<std::unique_ptr<URLLoaderThrottle>> throttles, scoped_refptr<BackgroundCodeCacheHost> background_code_cache_host); ~BackgroundURLLoader() override;
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader_unittest.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader_unittest.cc index c16b0da..32e853b0 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader_unittest.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader_unittest.cc
@@ -6,9 +6,11 @@ #include <deque> #include "base/memory/ref_counted.h" +#include "base/strings/string_number_conversions.h" #include "base/task/single_thread_task_runner.h" #include "base/task/thread_pool.h" #include "base/test/bind.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/threading/thread_restrictions.h" #include "mojo/public/cpp/bindings/pending_receiver.h" @@ -22,10 +24,15 @@ #include "services/network/public/mojom/url_response_head.mojom.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/mojom/navigation/renderer_eviction_reason.mojom-blink.h" #include "third_party/blink/public/platform/resource_load_info_notifier_wrapper.h" #include "third_party/blink/public/platform/web_background_resource_fetch_assets.h" +#include "third_party/blink/public/platform/web_runtime_features.h" #include "third_party/blink/public/platform/web_url_error.h" #include "third_party/blink/public/platform/web_url_response.h" +#include "third_party/blink/renderer/platform/back_forward_cache_buffer_limit_tracker.h" +#include "third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h" #include "third_party/blink/renderer/platform/loader/fetch/background_code_cache_host.h" #include "third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader_client.h" #include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h" @@ -39,8 +46,10 @@ namespace blink { namespace { -const char kTestURL[] = "http://example.com/"; -const char kRedirectedURL[] = "http://example.com/redirected"; +constexpr char kTestURL[] = "http://example.com/"; +constexpr char kRedirectedURL[] = "http://example.com/redirected"; +constexpr int kMaxBufferedBytesPerProcess = 1000; +constexpr std::string kTestBodyString = "test data."; using LoadStartCallback = base::OnceCallback<void( mojo::PendingReceiver<network::mojom::URLLoader>, @@ -57,7 +66,7 @@ } mojo::ScopedDataPipeConsumerHandle CreateTestBody() { - return CreateDataPipeConsumerHandleFilledWithString("test data."); + return CreateDataPipeConsumerHandleFilledWithString(kTestBodyString); } mojo_base::BigBuffer CreateTestCachedMetaData() { @@ -78,6 +87,38 @@ return response; } +class FakeBackForwardCacheLoaderHelper : public BackForwardCacheLoaderHelper { + public: + FakeBackForwardCacheLoaderHelper() = default; + ~FakeBackForwardCacheLoaderHelper() = default; + + void EvictFromBackForwardCache( + mojom::blink::RendererEvictionReason reason) override { + evicted_reason_ = reason; + } + void DidBufferLoadWhileInBackForwardCache(bool update_process_wide_count, + size_t num_bytes) override { + EXPECT_FALSE(update_process_wide_count); + total_bytes_buffered_while_in_back_forward_cache_ += num_bytes; + } + void Detach() override {} + void Trace(Visitor* visitor) const override { + BackForwardCacheLoaderHelper::Trace(visitor); + } + + const absl::optional<mojom::blink::RendererEvictionReason>& evicted_reason() + const { + return evicted_reason_; + } + size_t total_bytes_buffered_while_in_back_forward_cache() const { + return total_bytes_buffered_while_in_back_forward_cache_; + } + + private: + absl::optional<mojom::blink::RendererEvictionReason> evicted_reason_; + size_t total_bytes_buffered_while_in_back_forward_cache_ = 0; +}; + class FakeURLLoaderFactory : public network::SharedURLLoaderFactory { public: // This SharedURLLoaderFactory is cloned and passed to the background thread @@ -333,6 +374,7 @@ base::MakeRefCounted<scheduler::FakeTaskRunner>()), unfreezable_task_runner_( base::MakeRefCounted<scheduler::FakeTaskRunner>()) {} + BackgroundResourceFecherTest(const BackgroundResourceFecherTest&) = delete; BackgroundResourceFecherTest& operator=(const BackgroundResourceFecherTest&) = delete; @@ -342,6 +384,20 @@ void SetUp() override { background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner({}); + WebRuntimeFeatures::EnableBackForwardCache(true); + feature_list_.InitWithFeaturesAndParameters( + {{blink::features::kLoadingTasksUnfreezable, + {{"max_buffered_bytes_per_process", + base::NumberToString(kMaxBufferedBytesPerProcess)}}}}, + {}); + bfcache_loader_helper_ = + MakeGarbageCollected<FakeBackForwardCacheLoaderHelper>(); + } + void TearDown() override { + // Need to run tasks to avoid memory leak. + task_environment_.RunUntilIdle(); + unfreezable_task_runner_->RunUntilIdle(); + freezable_task_runner_->RunUntilIdle(); } protected: @@ -368,6 +424,7 @@ std::move(background_resource_fetch_assets), /*cors_exempt_header_list=*/Vector<String>(), freezable_task_runner_, unfreezable_task_runner_, + bfcache_loader_helper_, Vector<std::unique_ptr<URLLoaderThrottle>>(), /*background_code_cache_host=*/nullptr); background_url_loader->LoadAsynchronously( @@ -388,6 +445,7 @@ scoped_refptr<scheduler::FakeTaskRunner> freezable_task_runner_; scoped_refptr<scheduler::FakeTaskRunner> unfreezable_task_runner_; base::test::TaskEnvironment task_environment_; + Persistent<FakeBackForwardCacheLoaderHelper> bfcache_loader_helper_; private: class TestPlatformForRedirects final : public TestingPlatformSupport { @@ -398,6 +456,7 @@ }; ScopedTestingPlatformSupport<TestPlatformForRedirects> platform_; + base::test::ScopedFeatureList feature_list_; }; TEST_F(BackgroundResourceFecherTest, SimpleRequest) { @@ -557,6 +616,7 @@ std::move(background_resource_fetch_assets), /*cors_exempt_header_list=*/Vector<String>(), freezable_task_runner_, unfreezable_task_runner_, + /*back_forward_cache_loader_helper=*/nullptr, Vector<std::unique_ptr<URLLoaderThrottle>>(), /*background_code_cache_host*/ nullptr); FakeURLLoaderClient client(freezable_task_runner_); @@ -700,6 +760,144 @@ EXPECT_FALSE(client.did_finish()); } +TEST_F(BackgroundResourceFecherTest, BufferIncomingFreezeAndResume) { + FakeURLLoaderClient client(freezable_task_runner_); + auto background_url_loader = + CreateBackgroundURLLoaderAndStart(CreateTestRequest(), &client); + + background_url_loader->Freeze(LoaderFreezeMode::kBufferIncoming); + + mojo::Remote<network::mojom::URLLoaderClient> loader_client_remote( + std::move(loader_client_pending_remote_)); + loader_client_remote->OnReceiveResponse(CreateTestResponse(), + CreateTestBody(), + /*cached_metadata=*/absl::nullopt); + loader_client_remote->OnTransferSizeUpdated(10); + loader_client_remote->OnComplete(network::URLLoaderCompletionStatus(net::OK)); + + // Call RunUntilIdle() to receive Mojo IPC. + task_environment_.RunUntilIdle(); + + EXPECT_EQ(kTestBodyString.size(), BackForwardCacheBufferLimitTracker::Get() + .total_bytes_buffered_for_testing()); + EXPECT_TRUE( + BackForwardCacheBufferLimitTracker::Get().IsUnderPerProcessBufferLimit()); + + // Methods of `bfcache_loader_helper_` must called at + // `unfreezable_task_runner_`. + EXPECT_FALSE(bfcache_loader_helper_->evicted_reason()); + EXPECT_EQ(0u, bfcache_loader_helper_ + ->total_bytes_buffered_while_in_back_forward_cache()); + unfreezable_task_runner_->RunUntilIdle(); + EXPECT_FALSE(bfcache_loader_helper_->evicted_reason()); + EXPECT_EQ(kTestBodyString.size(), + bfcache_loader_helper_ + ->total_bytes_buffered_while_in_back_forward_cache()); + + // Restore from BFCache. + BackForwardCacheBufferLimitTracker::Get() + .DidRemoveFrameOrWorkerFromBackForwardCache( + bfcache_loader_helper_ + ->total_bytes_buffered_while_in_back_forward_cache()); + background_url_loader->Freeze(LoaderFreezeMode::kNone); + task_environment_.RunUntilIdle(); + freezable_task_runner_->RunUntilIdle(); + EXPECT_TRUE(client.response()); + EXPECT_TRUE(client.response_body()); + EXPECT_THAT(client.transfer_size_diffs(), testing::ElementsAreArray({10})); + EXPECT_TRUE(client.did_finish()); + EXPECT_FALSE(client.error()); +} + +TEST_F(BackgroundResourceFecherTest, + BufferIncomingFreezeExceedMaxBufferedBytesPerProcess) { + FakeURLLoaderClient client(freezable_task_runner_); + auto background_url_loader = + CreateBackgroundURLLoaderAndStart(CreateTestRequest(), &client); + + background_url_loader->Freeze(LoaderFreezeMode::kBufferIncoming); + constexpr size_t kBodySize = kMaxBufferedBytesPerProcess + 1; + mojo::Remote<network::mojom::URLLoaderClient> loader_client_remote( + std::move(loader_client_pending_remote_)); + loader_client_remote->OnReceiveResponse( + CreateTestResponse(), + CreateDataPipeConsumerHandleFilledWithString(std::string(kBodySize, '*')), + /*cached_metadata=*/absl::nullopt); + loader_client_remote->OnTransferSizeUpdated(kBodySize); + loader_client_remote->OnComplete(network::URLLoaderCompletionStatus(net::OK)); + + // Call RunUntilIdle() to receive Mojo IPC. + task_environment_.RunUntilIdle(); + + EXPECT_FALSE( + BackForwardCacheBufferLimitTracker::Get().IsUnderPerProcessBufferLimit()); + + EXPECT_EQ(kBodySize, BackForwardCacheBufferLimitTracker::Get() + .total_bytes_buffered_for_testing()); + + // Methods of `bfcache_loader_helper_` must called at + // `unfreezable_task_runner_`. + EXPECT_FALSE(bfcache_loader_helper_->evicted_reason()); + EXPECT_EQ(0u, bfcache_loader_helper_ + ->total_bytes_buffered_while_in_back_forward_cache()); + unfreezable_task_runner_->RunUntilIdle(); + EXPECT_THAT(bfcache_loader_helper_->evicted_reason(), + mojom::blink::RendererEvictionReason::kNetworkExceedsBufferLimit); + EXPECT_EQ(kBodySize, + bfcache_loader_helper_ + ->total_bytes_buffered_while_in_back_forward_cache()); + + // Reset BackForwardCacheBufferLimitTracker not to interfere other tests. + BackForwardCacheBufferLimitTracker::Get() + .DidRemoveFrameOrWorkerFromBackForwardCache( + bfcache_loader_helper_ + ->total_bytes_buffered_while_in_back_forward_cache()); +} + +TEST_F(BackgroundResourceFecherTest, + BufferIncomingFreezeAndResumeBeforeExecutingUnfreezableTask) { + FakeURLLoaderClient client(freezable_task_runner_); + auto background_url_loader = + CreateBackgroundURLLoaderAndStart(CreateTestRequest(), &client); + + background_url_loader->Freeze(LoaderFreezeMode::kBufferIncoming); + + mojo::Remote<network::mojom::URLLoaderClient> loader_client_remote( + std::move(loader_client_pending_remote_)); + loader_client_remote->OnReceiveResponse(CreateTestResponse(), + CreateTestBody(), + /*cached_metadata=*/absl::nullopt); + loader_client_remote->OnTransferSizeUpdated(10); + loader_client_remote->OnComplete(network::URLLoaderCompletionStatus(net::OK)); + + // Call RunUntilIdle() to receive Mojo IPC. + task_environment_.RunUntilIdle(); + + // Restore from BFCache before running tasks in `unfreezable_task_runner_`. + background_url_loader->Freeze(LoaderFreezeMode::kNone); + + // The BackForwardCacheBufferLimitTracker must be updated by the task in + // `unfreezable_task_runner_`. + EXPECT_EQ(kTestBodyString.size(), BackForwardCacheBufferLimitTracker::Get() + .total_bytes_buffered_for_testing()); + unfreezable_task_runner_->RunUntilIdle(); + EXPECT_EQ(0u, BackForwardCacheBufferLimitTracker::Get() + .total_bytes_buffered_for_testing()); + + // Methods of `bfcache_loader_helper_` must not be called. + EXPECT_FALSE(bfcache_loader_helper_->evicted_reason()); + EXPECT_EQ(0u, bfcache_loader_helper_ + ->total_bytes_buffered_while_in_back_forward_cache()); + + task_environment_.RunUntilIdle(); + freezable_task_runner_->RunUntilIdle(); + EXPECT_TRUE(client.response()); + EXPECT_TRUE(client.response_body()); + EXPECT_THAT(client.transfer_size_diffs(), testing::ElementsAreArray({10})); + EXPECT_TRUE(client.did_finish()); + EXPECT_FALSE(client.error()); +} + TEST_F(BackgroundResourceFecherTest, ChangePriority) { FakeURLLoaderClient client(freezable_task_runner_); auto background_url_loader =
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client_unittest.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client_unittest.cc index c410bfc..c0bd574 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client_unittest.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client_unittest.cc
@@ -167,7 +167,8 @@ void EvictFromBackForwardCache( mojom::blink::RendererEvictionReason reason) override {} - void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) override {} + void DidBufferLoadWhileInBackForwardCache(bool update_process_wide_count, + size_t num_bytes) override {} void Detach() override {} };
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader.cc index 9f76cecd..f4b9e64 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader.cc
@@ -299,7 +299,8 @@ back_forward_cache_loader_helper_), base::BindRepeating( &BackForwardCacheLoaderHelper::DidBufferLoadWhileInBackForwardCache, - back_forward_cache_loader_helper_)); + back_forward_cache_loader_helper_, + /*update_process_wide_count=*/true)); if (freeze_mode_ != LoaderFreezeMode::kNone) { resource_request_sender_->Freeze(LoaderFreezeMode::kStrict);
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index d0781ed..0d1ac0e 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -291,6 +291,11 @@ base_feature: "none", }, { + // crbug.com/1500511 + name: "AlignContentForBlocks", + status: "test", + }, + { name: "AllowContentInitiatedDataUrlNavigations", base_feature: "none", }, @@ -811,10 +816,6 @@ status: "stable", }, { - name: "CSSBaselineSource", - status: "stable", - }, - { // Support CSS Values Level 4 calc simplification and serialization // as specified in the specs below. // https://drafts.csswg.org/css-values-4/#calc-simplification @@ -908,11 +909,6 @@ base_feature: "none", }, { - name: "CSSGridTemplatePropertyInterpolation", - status: "stable", - base_feature: "none", - }, - { // This needs to be kept as a runtime flag as long as we need to forcibly // disable it for WebView on Android versions older than P. See // https://crrev.com/f311a84728272e30979432e8474089b3db3c67df @@ -1287,11 +1283,6 @@ status: "test", }, { - name: "DeflateRawCompressionFormat", - status: "stable", - base_feature: "none", - }, - { name: "DelayOutOfViewportLazyImages", public: true, status: "experimental", @@ -1639,10 +1630,6 @@ base_feature: "none", }, { - name: "FastComparePositions", - status: "stable", - }, - { name: "FastPositionIterator", // Not enabled due to a RTL issue. crbug.com/1421016. }, @@ -3167,6 +3154,10 @@ status: {"Android": "", "default": "stable"}, }, { + name: "ReferenceBoxNoPixelSnapping", + status: "stable", + }, + { name: "RegionCapture", status: {"Android": "", "default": "stable"}, base_feature: "none", @@ -3326,11 +3317,6 @@ base_feature: "none", }, { - name: "ScriptElementSupports", - status: "stable", - base_feature: "none", - }, - { name: "ScriptingMediaFeature", status: "stable", },
diff --git a/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py b/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py index d534557..0273ac3d 100644 --- a/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py +++ b/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py
@@ -28,6 +28,7 @@ import collections import contextlib +import hashlib import logging import uuid from pathlib import PurePosixPath @@ -47,7 +48,11 @@ from blinkpy.common.host import Host from blinkpy.common.memoized import memoized from blinkpy.common.path_finder import PathFinder -from blinkpy.web_tests.models.testharness_results import is_all_pass_test_result +from blinkpy.web_tests.models.testharness_results import ( + is_all_pass_test_result, + is_testharness_output, + is_wdspec_output, +) from blinkpy.web_tests.models.test_expectations import TestExpectationsCache from blinkpy.web_tests.models.typ_types import ResultType from blinkpy.web_tests.port.base import Port @@ -467,25 +472,38 @@ """ if path is None: return cls(cls._IMPLICIT_EXTRA_RESULT, path, is_extra_result=True) - - assert fs.exists(path), path + " does not exist" - if path.endswith('.txt'): - try: - content = fs.read_text_file(path) - is_extra_result = not content or is_all_pass_test_result( - content) - except UnicodeDecodeError as e: - is_extra_result = False - # Unfortunately, we may read the file twice, once in text mode - # and once in binary mode. - return cls(fs.sha1(path), path, is_extra_result) - - if path.endswith('.png') and is_reftest: + assert fs.exists(path), f'{path!r} does not exist' + if path.endswith(f'.png') and is_reftest: return cls('', path, is_extra_result=True) - return cls(fs.sha1(path), - path, - is_extra_result=(not fs.read_binary_file(path))) + with fs.open_binary_file_for_reading(path) as baseline_file: + contents = baseline_file.read() + + is_extra_result = not contents + if path.endswith('.txt'): + try: + contents_text = contents.decode() + if is_testharness_output(contents_text) or is_wdspec_output( + contents_text): + # Canonicalize the representation of a testharness/wdspec + # baselines with insignificant whitespace. + # + # TODO(crbug.com/1482887): Digest the parsed testharness + # results to be fully independent of formatting. + # + # TODO(crbug.com/1482887): Consider making the serialized + # representation between `run_web_tests.py`'s + # `testharnessreport.js` and `format_testharness_baseline()` + # consistent. + contents_text = contents_text.strip() + if is_all_pass_test_result(contents_text): + is_extra_result = True + contents = contents_text.encode() + except UnicodeDecodeError: + is_extra_result = False + + digest = hashlib.sha1(contents).hexdigest() + return cls(digest, path, is_extra_result) def __eq__(self, other): if other is None:
diff --git a/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py b/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py index 1b7e0eb..e4c77fb1 100644 --- a/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py +++ b/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py
@@ -28,6 +28,7 @@ import json import optparse +import textwrap import unittest from blinkpy.common.checkout.baseline_optimizer import BaselineOptimizer, ResultDigest @@ -922,6 +923,29 @@ ResultDigest.from_file( self.fs, '/failures/baz-expected.txt').is_extra_result) + def test_canonicalize_testharness(self): + self.fs.write_text_file( + '/platform/x/failures/baz-expected.txt', + textwrap.dedent("""\ + This is a testharness.js-based test. + [FAIL] failing subtest + Harness: the test ran to completion. + """)) + self.fs.write_text_file( + '/failures/baz-expected.txt', + textwrap.dedent("""\ + + This is a testharness.js-based test. + [FAIL] failing subtest + Harness: the test ran to completion. + + + """)) + self.assertEqual( + ResultDigest.from_file(self.fs, + '/platform/x/failures/baz-expected.txt'), + ResultDigest.from_file(self.fs, '/failures/baz-expected.txt')) + def test_empty_result(self): self.assertFalse( ResultDigest.from_file(
diff --git a/third_party/blink/tools/blinkpy/common/config/builders.json b/third_party/blink/tools/blinkpy/common/config/builders.json index fc92eec..ce8a0c0 100644 --- a/third_party/blink/tools/blinkpy/common/config/builders.json +++ b/third_party/blink/tools/blinkpy/common/config/builders.json
@@ -61,7 +61,7 @@ "specifiers": ["Chrome", "Release"], "is_try_builder": true, "steps": { - "wpt_tests_suite (with patch)": {} + "chrome_wpt_tests (with patch)": {} } }, "linux-blink-rel": { @@ -86,7 +86,7 @@ "not_site_per_process_blink_wpt_tests (with patch)": { "flag_specific": "disable-site-isolation-trials" }, - "webdriver_tests_suite (with patch)": { + "webdriver_wpt_tests (with patch)": { "product": "chrome" } },
diff --git a/third_party/blink/tools/blinkpy/w3c/wpt_results_processor.py b/third_party/blink/tools/blinkpy/w3c/wpt_results_processor.py index e73a32e..c744f15 100644 --- a/third_party/blink/tools/blinkpy/w3c/wpt_results_processor.py +++ b/third_party/blink/tools/blinkpy/w3c/wpt_results_processor.py
@@ -269,7 +269,8 @@ sink: Optional[ResultSinkReporter] = None, test_name_prefix: str = '', failure_threshold: Optional[int] = None, - crash_timeout_threshold: Optional[int] = None): + crash_timeout_threshold: Optional[int] = None, + reset_results: bool = False): self.fs = fs self.port = port self.artifacts_dir = artifacts_dir @@ -300,6 +301,7 @@ } self.failure_threshold = failure_threshold or math.inf self.crash_timeout_threshold = crash_timeout_threshold or math.inf + self.reset_results = reset_results assert self.failure_threshold > 0 assert self.crash_timeout_threshold > 0 @@ -661,21 +663,29 @@ actual_text = None actual_subpath = self.port.output_filename( result.name, test_failures.FILENAME_SUFFIX_ACTUAL, '.txt') + expected_subpath = self.port.output_filename( + result.name, test_failures.FILENAME_SUFFIX_EXPECTED, '.txt') if result.testharness_results: actual_text = format_testharness_baseline( result.get_result(), '/html/dom/reflection' in result.name) artifacts.CreateArtifact('actual_text', actual_subpath, actual_text.encode()) + if self.reset_results and self._iteration == 0 and result.actual not in { + ResultType.Crash, + ResultType.Timeout, + }: + source = self.fs.join(self.artifacts_dir, actual_subpath) + dest = self.fs.join(self.port.baseline_version_dir(), + expected_subpath) + self.fs.maybe_make_directory(self.fs.dirname(dest)) + self.fs.copyfile(source, dest) expected_text = self.port.expected_text(result.name) - expected_subpath = self.port.output_filename( - result.name, test_failures.FILENAME_SUFFIX_EXPECTED, '.txt') if expected_text: expected_text = expected_text.decode().strip() + '\n' artifacts.CreateArtifact('expected_text', expected_subpath, expected_text.encode()) - if not actual_text or not expected_text: return diff_content = unified_diff(expected_text, actual_text, @@ -766,7 +776,11 @@ artifacts_base_dir=self.fs.basename( self.artifacts_dir)) image_diff_stats = None - if result.actual not in [ResultType.Pass, ResultType.Skip]: + # Dump output for `--reset-results`, even if the test passes, as the + # current port may fall back to a failing port. + if self.reset_results or result.actual not in [ + ResultType.Pass, ResultType.Skip + ]: if result.test_type in {'testharness', 'wdspec'}: self._write_text_results(result, artifacts) screenshots = (extra or {}).get('reftest_screenshots') or []
diff --git a/third_party/blink/tools/blinkpy/w3c/wpt_results_processor_unittest.py b/third_party/blink/tools/blinkpy/w3c/wpt_results_processor_unittest.py index 7f7249b..aa9d2e8 100644 --- a/third_party/blink/tools/blinkpy/w3c/wpt_results_processor_unittest.py +++ b/third_party/blink/tools/blinkpy/w3c/wpt_results_processor_unittest.py
@@ -26,7 +26,7 @@ self.host.port_factory = MockPortFactory(self.host) self.fs = self.host.filesystem self.path_finder = PathFinder(self.fs) - port = self.host.port_factory.get() + port = self.host.port_factory.get('test-linux-trusty') # Create a testing manifest containing any test files that we # might interact with. @@ -564,6 +564,28 @@ 'layout-test-results', 'external', 'wpt', 'variant_foo=baz-actual.txt'))) + def test_extract_text_reset_results(self): + self.processor.reset_results = True + with self.fs.patch_builtins(): + self._event(action='test_start', test='/variant.html?foo=baz') + self._event(action='test_status', + test='/variant.html?foo=baz', + subtest='passing subtest', + status='PASS') + self._event(action='test_end', + test='/variant.html?foo=baz', + status='OK') + self.assertEqual( + self.fs.read_text_file( + self.path_finder.path_from_web_tests( + 'platform', 'test-linux-trusty', 'external', 'wpt', + 'variant_foo=baz-expected.txt')), + textwrap.dedent("""\ + This is a testharness.js-based test. + [PASS] passing subtest + Harness: the test ran to completion. + """)) + def test_extract_screenshots(self): self._event(action='test_start', test='/reftest.html') self._event(action='test_end',
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/ios.py b/third_party/blink/tools/blinkpy/web_tests/port/ios.py index fdbc366..fd4c834 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/ios.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/ios.py
@@ -11,6 +11,7 @@ from blinkpy.web_tests.port.ios_simulator_server_process import IOSSimulatorServerProcess from blinkpy.web_tests.port import base from blinkpy.web_tests.port import driver +from blinkpy.web_tests.port import mac _log = logging.getLogger(__name__) @@ -27,7 +28,8 @@ FALLBACK_PATHS = {} - FALLBACK_PATHS['ios16-simulator'] = ['ios'] + FALLBACK_PATHS['ios16-simulator'] = ( + ['ios'] + mac.MacPort.latest_platform_fallback_path()) BUILD_REQUIREMENTS_URL = 'https://chromium.googlesource.com/chromium/src/+/main/docs/ios/build_instructions.md'
diff --git a/third_party/blink/tools/blinkpy/wpt_tests/wpt_adapter.py b/third_party/blink/tools/blinkpy/wpt_tests/wpt_adapter.py index 64134e4..6f323b3 100644 --- a/third_party/blink/tools/blinkpy/wpt_tests/wpt_adapter.py +++ b/third_party/blink/tools/blinkpy/wpt_tests/wpt_adapter.py
@@ -27,7 +27,7 @@ from blinkpy.web_tests.models.test_expectations import TestExpectations from blinkpy.web_tests.port import factory from blinkpy.wpt_tests.product import make_product_registry -from blinkpy.wpt_tests.test_loader import TestLoader +from blinkpy.wpt_tests.test_loader import TestLoader, wpt_url_to_blink_test path_finder.bootstrap_wpt_imports() import mozlog @@ -538,7 +538,7 @@ TestLoader.install(self.port, self._expectations) stack.enter_context( - self.process_and_upload_results(runner_options, tmp_dir)) + self.process_and_upload_results(runner_options)) self.port.setup_test_run() # Start Xvfb, if necessary. stack.callback(self.port.clean_up_test_run) # Changing the CWD is not ideal, but necessary for `wptserve` to @@ -601,15 +601,15 @@ json.dump(run_info, file_handle) @contextlib.contextmanager - def process_and_upload_results(self, runner_options: argparse.Namespace, - tmp_dir: str): + def process_and_upload_results(self, runner_options: argparse.Namespace): artifacts_dir = self.port.artifacts_directory() processor = WPTResultsProcessor( self.fs, self.port, artifacts_dir=artifacts_dir, failure_threshold=self.failure_threshold, - crash_timeout_threshold=self.crash_timeout_threshold) + crash_timeout_threshold=self.crash_timeout_threshold, + reset_results=self.options.reset_results) with processor.stream_results() as events: runner_options.log.add_handler(events.put) yield @@ -622,67 +622,23 @@ self.port.show_results_html_file( self.fs.join(artifacts_dir, 'results.html')) if self.options.reset_results: - self._reset_results(runner_options, tmp_dir) + self._optimize(runner_options) - def _reset_results(self, runner_options: argparse.Namespace, tmp_dir: str): - properties_path = self.fs.join(tmp_dir, 'update_properties.json') - with self.fs.open_text_file_for_writing( - properties_path) as properties_file: - json.dump(self._choose_update_properties(), properties_file) - + def _optimize(self, runner_options: argparse.Namespace): blink_tool_path = self.finder.path_from_blink_tools('blink_tool.py') command = [ blink_tool_path, - 'update-metadata', - f'--report={runner_options.log_wptreport[0].name}', - f'--update-properties={properties_path}', - '--min-samples=1', - '--no-trigger-jobs', + 'optimize-baselines', '--no-manifest-update', ] if self.options.verbose: command.append('--verbose') - command.extend(f'--exclude={exclude}' - for exclude in runner_options.exclude) - command.extend(runner_options.include) + command.extend( + wpt_url_to_blink_test(f'/{url}') for url in runner_options.include) exit_code = BlinkTool(blink_tool_path).main(command) if exit_code != exit_codes.OK_EXIT_STATUS: - logger.error( - f'Failed to update expectations (exit code: {exit_code})') - - def _choose_update_properties(self): - # Attempt to emulate the behavior of `run_web_tests.py --reset-results`, - # which places new `*-expected.txt` under: - # `web_tests/(flag-specific/*/)?(virtual/*/)?` - # - # Modeling this behavior with `update-metadata` is complicated because - # updating the generic baselines may or may not cause virtual or - # flag-specific suites to inherit them, depending on whether or not - # those suites have existing baselines themselves. - # - # Therefore, use the following heuristics: - # 1. For the prototypical case where the test behavior is the same - # everywhere, `run_wpt_tests.py --reset-results` with the implied - # `product=content_shell` and `flag_specific=""` should add or - # remove unconditional expectations. - # 2. Virtual suites are often designed to induce different behavior - # (through enabling/disabling different features), so always use - # it as an update property. Most tests never run in a virtual - # suite, so (2) should not substantially interfere with (1). - # 3. Using a non-default `--product=...` or `--flag-specific=...` - # should only update expectations for that product/flag-specific - # suite, like `run_web_tests.py --reset-results --flag-specific`. - # Product should also be mutually exclusive with the other update - # properties, as (currently) only `content_shell` runs virtual or - # flag-specific suites. - primary_properties = [] - if self.port.driver_name() == self.port.CONTENT_SHELL_NAME: - primary_properties.append('virtual_suite') - if self.options.flag_specific: - primary_properties.append('flag_specific') - else: - primary_properties.append('product') - return {'properties': primary_properties} + logger.error('Failed to optimize baselines during results reset ' + f'(exit code: {exit_code})') def _load_entry_point():
diff --git a/third_party/blink/web_tests/IOSTestExpectations b/third_party/blink/web_tests/IOSTestExpectations index 55e853f..30142e6 100644 --- a/third_party/blink/web_tests/IOSTestExpectations +++ b/third_party/blink/web_tests/IOSTestExpectations
@@ -218,3 +218,42 @@ crbug.com/1496147 [ iOS16-simulator ] fast/forms/select-popup/popup-menu-appearance-empty.html [ Failure ] crbug.com/1496147 [ iOS16-simulator ] fast/forms/select-popup/popup-menu-multiline-title.html [ Failure ] crbug.com/1496147 [ iOS16-simulator ] fast/forms/select-popup/popup-menu-update-from-element.html [ Failure ] + +# Some printing tests need rebaseline. +crbug.com/1432082 [ iOS16-simulator ] paint/printing/print-box-shadow.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] paint/printing/print-text-shadow.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/3d-rotate-under-perspective.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/absolute-position-headers-and-footers.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/avoid-setting-header-offset-on-header.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/composited-thead-tfoot-repeat.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/ellipsis-printing-style.html [ Crash ] +crbug.com/1432082 [ iOS16-simulator ] printing/fixed-positioned-headers-and-footers-inside-transform.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/forced-break-tree-dump-only.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/iframe-print.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/iframe-svg-in-object-print.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/list-item-with-empty-first-line.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/multi-page-background.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/multicol-2-pages.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/offscreencanvas-webgl-printing.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/page-count-relayout-shrink.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/page-orientation-propagated.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/page-orientation.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/quirks-percentage-height-body.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/quirks-percentage-height.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/return-from-printing-mode.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/simultaneous-position-float-change.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/single-line-must-not-be-split-into-two-pages.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/standards-percentage-heights.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/subframes-percentage-height.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/tfoot-repeats-at-bottom-of-each-page-multiple-tables.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/tfoot-repeats-at-bottom-of-each-page.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/thead-repeat-in-nested-table.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/thead-repeats-at-top-of-each-page-multiple-tables.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/thead-repeats-at-top-of-each-page.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/thead-repeats-with-translucent-text-and-borders.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/thead-tfoot-containing-svg-repeat-extra-pages.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/thead-tfoot-containing-svg-repeat.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/thead-under-multicol.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/webgl-repeated-printing-preservedrawingbuffer.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/webgl-repeated-printing.html [ Failure ] +crbug.com/1432082 [ iOS16-simulator ] printing/width-overflow.html [ Failure ]
diff --git a/third_party/blink/web_tests/NeverFixTests b/third_party/blink/web_tests/NeverFixTests index 34445fa..b643a87 100644 --- a/third_party/blink/web_tests/NeverFixTests +++ b/third_party/blink/web_tests/NeverFixTests
@@ -2074,6 +2074,8 @@ [ Chrome ] wpt_internal/bluetooth/* [ Skip ] [ Chrome ] external/wpt/fledge/* [ Skip ] [ Chrome ] wpt_internal/import-maps/* [ Skip ] +# many failures in the folders below, skip for now +crbug.com/1499775 [ Chrome ] external/wpt/html/cross-origin-opener-policy/* [ Skip ] [ Chrome ] external/wpt/speculation-rules/prerender/* [ Skip ] [ Chrome ] external/wpt/speculation-rules/prerender/credentialed-prerender-not-opt-in.html [ Pass ] [ Chrome ] external/wpt/speculation-rules/prerender/csp-script-src-self.html [ Pass ] @@ -2084,12 +2086,6 @@ [ Chrome ] external/wpt/speculation-rules/prerender/response-code-non-successful.html?code=402 [ Pass ] [ Chrome ] external/wpt/speculation-rules/prerender/response-code-non-successful.html?code=500 [ Pass ] [ Chrome ] external/wpt/speculation-rules/prerender/response-code-successful.html?code=202 [ Pass ] - -crbug.com/1499775 [ Chrome ] external/wpt/html/cross-origin-opener-policy/iframe-popup-same-origin-allow-popups-to-same-origin-allow-popups.https.html?7-8 [ Skip ] # harness error -crbug.com/1499775 [ Chrome ] external/wpt/html/cross-origin-opener-policy/iframe-popup-same-origin-allow-popups-to-same-origin.https.html?5-6 [ Skip ] # harness error -crbug.com/1499775 [ Chrome ] external/wpt/html/cross-origin-opener-policy/iframe-popup-same-origin-to-unsafe-none.https.html?7-8 [ Skip ] # harness error -crbug.com/1499775 [ Chrome ] external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup-to-soap.https.html?3-4 [ Skip ] # harness error -crbug.com/1499775 [ Chrome ] external/wpt/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup-to-soap.https.html?5-6 [ Skip ] # harness error crbug.com/1499775 [ Chrome ] external/wpt/notifications/getnotifications-across-processes.https.window.html [ Skip ] crbug.com/1499775 [ Chrome ] external/wpt/screen-orientation/lock-sandboxed-iframe.html [ Skip ] crbug.com/1499775 [ Chrome ] wpt_internal/webmidi/loopback-receive.https.html [ Skip ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 6904b950..6450f43 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -2663,6 +2663,8 @@ crbug.com/626703 [ Mac ] virtual/webcodecs-without-task-runner-with-custom-deleter/external/wpt/webcodecs/videoDecoder-codec-specific.https.any.worker.html?h265_hevc [ Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 external/wpt/html/semantics/forms/the-input-element/input-type-checkbox-switch.tentative.window.html [ Failure ] +crbug.com/626703 external/wpt/html/semantics/selectors/pseudo-classes/input-checkbox-switch.tentative.window.html [ Failure ] crbug.com/626703 external/wpt/css/css-backgrounds/background-origin/origin-border-box.html [ Failure ] crbug.com/626703 external/wpt/css/css-backgrounds/background-origin/origin-border-box_with_position.html [ Failure ] crbug.com/626703 external/wpt/css/css-backgrounds/background-origin/origin-border-box_with_radius.html [ Failure ] @@ -2778,7 +2780,6 @@ crbug.com/626703 [ Mac13 ] virtual/fsa-locking-scheme/external/wpt/fs/FileSystemBaseHandle-IndexedDB.https.any.worker.html [ Timeout ] crbug.com/626703 [ Mac13 ] virtual/third-party-storage-partitioning/external/wpt/IndexedDB/idb-explicit-commit.any.worker.html [ Timeout ] crbug.com/626703 [ Win10.20h2 ] virtual/threaded/external/wpt/css/css-backgrounds/background-attachment-margin-root-001.html [ Failure ] -crbug.com/626703 external/wpt/css/css-align/blocks/align-content-block-001.html [ Failure ] crbug.com/626703 external/wpt/css/css-align/blocks/align-content-block-002.html [ Failure ] crbug.com/626703 external/wpt/css/css-align/blocks/align-content-block-003.html [ Failure ] crbug.com/626703 external/wpt/css/css-align/blocks/align-content-block-004.html [ Failure ] @@ -7137,6 +7138,7 @@ crbug.com/1499775 [ Chrome ] external/wpt/css/css-color/filters-under-will-change-opacity.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-contain/contain-layout-ink-overflow-019.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-contain/contain-layout-overflow-001.html [ Failure ] # Reftest image failure +crbug.com/1499775 [ Chrome ] external/wpt/css/css-contain/content-visibility/content-visibility-vs-scrollIntoView-001.html [ Failure ] crbug.com/1499775 [ Chrome ] external/wpt/css/css-counter-styles/korean-hangul-formal/counter-korean-hangul-formal.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-counter-styles/korean-hanja-formal/counter-korean-hanja-formal.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-counter-styles/simp-chinese-informal/counter-simp-chinese-informal.html [ Failure ] # Reftest image failure @@ -7161,16 +7163,19 @@ crbug.com/1499775 [ Chrome ] external/wpt/css/css-fonts/size-adjust-unicode-range-system-fallback.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-inline/initial-letter/initial-letter-block-position-drop-over-ruby-tall.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-inline/initial-letter/initial-letter-block-position-margins-rtl.html [ Failure ] # Reftest image failure -crbug.com/1499775 [ Chrome ] external/wpt/css/css-inline/initial-letter/initial-letter-float-001.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-inline/text-box-trim/text-box-trim-half-leading-inline-box-001.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-inline/text-box-trim/text-box-trim-half-leading-inline-box-002.html [ Failure ] # Reftest image failure +crbug.com/1499775 [ Chrome ] external/wpt/css/css-inline/initial-letter/Initial-letter-breaking-rtl.html [ Failure ] +crbug.com/1499775 [ Chrome ] external/wpt/css/css-inline/initial-letter/initial-letter-block-position-margins-vrl.html [ Failure ] crbug.com/1499775 [ Chrome ] external/wpt/css/css-lists/content-property/marker-text-matches-lower-greek.html [ Failure ] # Reftest image failure +crbug.com/1499775 [ Chrome ] external/wpt/css/css-masking/clip-path/clip-path-inline-006.html [ Failure ] crbug.com/1499775 [ Chrome ] external/wpt/css/css-masking/clip-path/clip-path-inline-001.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-masking/clip-path/clip-path-inline-004.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-masking/clip-path/clip-path-inline-010.html [ Failure ] # pass on wpt.fyi crbug.com/1499775 [ Chrome ] external/wpt/css/css-masking/mask-image/mask-opacity-1e.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-multicol/multicol-fill-auto-block-children-002.xht [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-multicol/multicol-width-ch-001.xht [ Failure ] # Reftest image failure +crbug.com/1499775 [ Chrome ] external/wpt/css/css-multicol/getclientrects-001.html [ Failure ] crbug.com/1499775 [ Chrome ] external/wpt/css/css-overflow/scrollbar-gutter-002.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-overflow/scrollbar-gutter-vertical-lr-002.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-overflow/scrollbar-gutter-vertical-rl-002.html [ Failure ] # Reftest image failure @@ -7183,6 +7188,9 @@ crbug.com/1499775 [ Chrome ] external/wpt/css/css-pseudo/first-line-with-inline-block.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-pseudo/highlight-cascade-008.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-ruby/block-ruby-003.html [ Failure ] # Reftest image failure +crbug.com/1499775 [ Chrome ] external/wpt/css/css-ruby/ruby-text-combine-upright-001a.html [ Failure ] +crbug.com/1499775 [ Chrome ] external/wpt/css/css-shapes/shape-outside/values/shape-margin-001.html [ Failure ] +crbug.com/1499775 [ Chrome ] external/wpt/css/css-shapes/shape-outside/values/shape-outside-polygon-004.html [ Failure ] crbug.com/1499775 [ Chrome ] external/wpt/css/css-text-decor/text-decoration-subelements-002.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-text-decor/text-emphasis-color-property-001.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/css/css-text-decor/text-emphasis-color-property-001a.html [ Failure ] # Reftest image failure @@ -7253,6 +7261,7 @@ crbug.com/1499775 [ Chrome ] external/wpt/css/selectors/invalidation/fullscreen-pseudo-class-in-has.html [ Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/css/selectors/invalidation/modal-pseudo-class-in-has.html [ Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/css/selectors/modal-pseudo-class.html [ Timeout ] +crbug.com/1499775 [ Chrome ] external/wpt/css/selectors/remove-hovered-element.html [ Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/dom/events/scrolling/input-text-scroll-event-when-using-arrow-keys.html [ Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/event-timing/event-click-visibilitychange.html [ Skip Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/eventsource/eventsource-request-cancellation.window.any.html [ Failure ] # Flaky output @@ -7321,6 +7330,7 @@ crbug.com/1499775 [ Chrome ] external/wpt/html/semantics/embedded-content/the-object-element/object-events.html [ Skip Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/html/semantics/forms/the-selectlist-element/selectlist-explicit-size.tentative.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking.tentative.html [ Failure ] # Reftest image failure +crbug.com/1499775 [ Chrome ] external/wpt/html/semantics/invokers/invoketarget-fullscreen-behavior.tentative.html [ Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/html/semantics/popovers/popover-open-overflow-display.tentative.html [ Failure ] # Reftest image failure crbug.com/1499775 [ Chrome ] external/wpt/html/semantics/popovers/popover-top-layer-combinations.html [ Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/html/semantics/popovers/popover-top-layer-interactions.html [ Timeout ] @@ -7374,6 +7384,7 @@ crbug.com/1499775 [ Chrome ] external/wpt/webrtc-stats/hardware-capability-stats.https.html [ Skip Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/websockets/send-many-64K-messages-with-backpressure.any.sharedworker.html?wpt_flags=h2 [ Skip Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/websockets/stream/tentative/backpressure-send.any.sharedworker.html?wpt_flags=h2 [ Skip Timeout ] +crbug.com/1499775 [ Chrome ] external/wpt/webvtt/rendering/cues-with-video/processing-model/audio_has_no_subtitles.html [ Failure ] crbug.com/1499775 [ Chrome ] external/wpt/webxr/dom-overlay/ar_dom_overlay.https.html [ Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/webxr/dom-overlay/ar_dom_overlay_hit_test.https.html [ Timeout ] crbug.com/1499775 [ Chrome ] external/wpt/webxr/dom-overlay/nested_fullscreen.https.html [ Timeout ]
diff --git a/third_party/blink/web_tests/TestLists/background-resource-fetch b/third_party/blink/web_tests/TestLists/background-resource-fetch index 3e42214..175a9a15 100644 --- a/third_party/blink/web_tests/TestLists/background-resource-fetch +++ b/third_party/blink/web_tests/TestLists/background-resource-fetch
@@ -4,6 +4,7 @@ external/wpt/cookies external/wpt/cors external/wpt/fetch +external/wpt/html/browsers/browsing-the-web/back-forward-cache external/wpt/loading external/wpt/mimesniff external/wpt/mixed-content
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/crashtests/overflow-wrap-anywhere-crash.html b/third_party/blink/web_tests/external/wpt/css/css-text/crashtests/overflow-wrap-anywhere-crash.html new file mode 100644 index 0000000..11625fe1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/crashtests/overflow-wrap-anywhere-crash.html
@@ -0,0 +1,28 @@ +<!DOCTYPE html> +<style> +body { + overflow-wrap: anywhere; +} +.post-footer-line-2 { + position: absolute; + letter-spacing: 1mm; + font-size: 0px; +} +.post-labels a { + padding: 8px 17px; + font-size: 10px; + margin: 5px 30px 5px -30px; +} +</style> +<div> + <div class='post-footer-line-2'> + <span class='post-labels'> + Etykiety: + <a>hunter</a>, + <a>miski</a>, + <a>pies</a>, + <a>recenzja</a>, + <a>test</a> + </span> + </div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/text-autospace/text-autospace-break-001-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text/text-autospace/text-autospace-break-001-ref.html index 80c8271..130c89f 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-text/text-autospace/text-autospace-break-001-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/css-text/text-autospace/text-autospace-break-001-ref.html
@@ -16,4 +16,5 @@ <div class="test"><span>国国国国<br>1国</span></div> <div class="test"><span>XXXX<br>国X</span></div> <div class="test"><span>1111<br>国1</span></div> + <div class="test">国<span>国X<br>国</span></div> </div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/text-autospace/text-autospace-break-001.html b/third_party/blink/web_tests/external/wpt/css/css-text/text-autospace/text-autospace-break-001.html index 003833c..5af0e1f 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-text/text-autospace/text-autospace-break-001.html +++ b/third_party/blink/web_tests/external/wpt/css/css-text/text-autospace/text-autospace-break-001.html
@@ -18,4 +18,5 @@ <div class="test"><span>国国国国1国</span></div> <div class="test"><span>XXXX国X</span></div> <div class="test"><span>1111国1</span></div> + <div class="test">国<span>国X国</span></div> </div>
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/css-reference-large-svg-filter-ref.html b/third_party/blink/web_tests/external/wpt/css/filter-effects/css-reference-large-svg-filter-ref.html new file mode 100644 index 0000000..21c33ea --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/css-reference-large-svg-filter-ref.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> +<head> + <title>CSS Filter References Large SVG Filter Effect Reference</title> + <link rel="author" title="Michael Ludwig" href="mailto:michaelludwig@google.com"> + <link rel="help" href="https://crbug.com/1466359"> +</head> +<body> +<div style="width: 200px; height: 200px; background-color: green;"></div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/css-reference-large-svg-filter.html b/third_party/blink/web_tests/external/wpt/css/filter-effects/css-reference-large-svg-filter.html new file mode 100644 index 0000000..0750fd7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/css-reference-large-svg-filter.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> +<head> + <title>CSS Filter References Large SVG Filter Effect</title> + <link rel="author" title="Michael Ludwig" href="mailto:michaelludwig@google.com"> + <link rel="help" href="https://crbug.com/1466359"> + <link rel="match" href="css-reference-large-svg-filter-ref.html"> + <meta name="assert" content="The test passes if a green square is visible."> + + <style> + html { + filter: url(#full_page_filter) + } + </style> +</head> +<body> + <div style="position: absolute;left: -100000px">Offscreen content increasing size of HTML body.</div> + <div style="width: 200px; height: 200px; background-color: green;"></div> + + <svg xmlns="http://www.w3.org/2000/svg"> + <filter x="0" y="0" width="999999" height="99999" id="full_page_filter"> + <feComponentTransfer> + <feFuncR type="identity" exponent="3"></feFuncR> + <feFuncG type="identity" exponent="3"></feFuncG> + <feFuncB type="identity" exponent="3"></feFuncB> + </feComponentTransfer> + </filter> + </svg> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/dom/observable/tentative/observable-constructor.any.js b/third_party/blink/web_tests/external/wpt/dom/observable/tentative/observable-constructor.any.js index 9e5a044b..09538df 100644 --- a/third_party/blink/web_tests/external/wpt/dom/observable/tentative/observable-constructor.any.js +++ b/third_party/blink/web_tests/external/wpt/dom/observable/tentative/observable-constructor.any.js
@@ -134,6 +134,10 @@ // originally included: // https://github.com/web-platform-tests/wpt/blob/0246526ca46ef4e5eae8b8e4a87dd905c40f5326/dom/observable/tentative/observable-ctor.any.js#L123-L137. +// TODO(domfarolino): Add a test asserting that `Subscriber#signal` != the +// actual `AbortSignal` passed into `subscribe()`. See +// https://github.com/web-platform-tests/wpt/pull/42219#discussion_r1361243283. + test(() => { const results = []; @@ -192,7 +196,7 @@ // TODO(https://github.com/WICG/observable/issues/76): Assert // `subscriber.closed` is true, if we add that attribute. // assert_true(subscriber.closed, "subscriber is closed after error"); - subscriber.next(); + subscriber.next(3); subscriber.complete(); }); @@ -321,3 +325,73 @@ assert_equals(errorReported.error, error, "Error object is equivalent"); }, "Errors thrown by initializer function after subscriber is closed by " + "completion are reported"); + +test(() => { + const error1 = new Error("error 1"); + const error2 = new Error("error 2"); + const results = []; + let errorReported = null; + + self.addEventListener("error", e => errorReported = e, { once: true }); + + const source = new Observable((subscriber) => { + subscriber.next(1); + subscriber.next(2); + subscriber.error(error1); + throw error2; + }); + + source.subscribe({ + next: (x) => results.push(x), + error: (error) => results.push(error), + complete: () => assert_unreached("complete should not be called"), + }); + + assert_array_equals( + results, + [1, 2, error1], + "should emit values synchronously, but not nexted values after error" + ); + + assert_true(errorReported !== null, "Exception was reported to global"); + assert_true(errorReported.message.includes("error 2"), "Error message matches"); + assert_greater_than(errorReported.lineno, 0, "Error lineno is greater than 0"); + assert_greater_than(errorReported.colno, 0, "Error lineno is greater than 0"); + assert_equals(errorReported.error, error2, "Error object is equivalent"); +}, "Errors thrown by initializer function after subscriber is closed by " + + "error are reported"); + +test(() => { + const error1 = new Error("error 1"); + const error2 = new Error("error 2"); + const results = []; + let errorReported = null; + + self.addEventListener("error", e => errorReported = e, { once: true }); + + const source = new Observable((subscriber) => { + subscriber.next(1); + subscriber.next(2); + subscriber.error(error1); + subscriber.error(error2); + }); + + source.subscribe({ + next: (x) => results.push(x), + error: (error) => results.push(error), + complete: () => assert_unreached("complete should not be called"), + }); + + assert_array_equals( + results, + [1, 2, error1], + "should emit values synchronously, but not nexted values after error" + ); + + assert_true(errorReported !== null, "Exception was reported to global"); + assert_true(errorReported.message.includes("error 2"), "Error message matches"); + assert_greater_than(errorReported.lineno, 0, "Error lineno is greater than 0"); + assert_greater_than(errorReported.colno, 0, "Error lineno is greater than 0"); + assert_equals(errorReported.error, error2, "Error object is equivalent"); +}, "Errors pushed by initializer function after subscriber is closed by " + + "error are reported");
diff --git a/third_party/blink/web_tests/external/wpt/fledge/tentative/TODO b/third_party/blink/web_tests/external/wpt/fledge/tentative/TODO index 8359113..8a416f1 100644 --- a/third_party/blink/web_tests/external/wpt/fledge/tentative/TODO +++ b/third_party/blink/web_tests/external/wpt/fledge/tentative/TODO
@@ -1,6 +1,18 @@ Need tests for (likely not a complete list): * directFromSellerSignals. + * The expected order when both responses use the same ad slot is currently + undefined. However, we are in the process of resolving this matter by + implementing a LIFO approach, as outlined in progress at + crrev.com/c/4930438. Once this solution is in place, a test case will be + created by fetching two different URLs with signals that share the same + ad slot. + * After adding new test cases for the component auction, test the + directFromSellerSignals function with component auctions. Consider to + set up one auction in the top frame and two component auctions. Send + three fetch requests to retrieve three different AdAuctionSignals + headers. Ensure that you use three different seller origins for the + auctions and a different one for the buyer origin. * All generateBid() and scoreAd() input parameters. * All interest group fields (passed to auction, have effect on auction). Very few fields covered.
diff --git a/third_party/blink/web_tests/external/wpt/fledge/tentative/component-ads.https.window.js b/third_party/blink/web_tests/external/wpt/fledge/tentative/component-ads.https.window.js index fb590455..719a645b 100644 --- a/third_party/blink/web_tests/external/wpt/fledge/tentative/component-ads.https.window.js +++ b/third_party/blink/web_tests/external/wpt/fledge/tentative/component-ads.https.window.js
@@ -16,7 +16,7 @@ `component_ad_${id}`) } -// Returns a component ad render URL that fetches the correspondinding component ad +// Returns a component ad render URL that fetches the corresponding component ad // tracker URL. function createComponentAdRenderURL(uuid, id) { return createRenderURL(
diff --git a/third_party/blink/web_tests/external/wpt/fledge/tentative/direct-from-seller-signals.https.window.js b/third_party/blink/web_tests/external/wpt/fledge/tentative/direct-from-seller-signals.https.window.js new file mode 100644 index 0000000..0c40fb5e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/fledge/tentative/direct-from-seller-signals.https.window.js
@@ -0,0 +1,489 @@ +// META: script=/resources/testdriver.js +// META: script=/common/utils.js +// META: script=resources/fledge-util.sub.js +// META: script=/common/subset-tests.js +// META: timeout=long +// META: variant=?1-5 +// META: variant=?6-10 +// META: variant=?11-15 +// META: variant=?16-20 +// META: variant=?21-last + +"use strict;" + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/0'} + ); +}, 'Test directFromSellerSignals with empty Ad-Auction-Signals header.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/1', + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/1' } + ); +}, 'Test directFromSellerSignals with only sellerSignals.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + 'auctionSignals/2', /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/2' } + ); +}, 'Test directFromSellerSignals with only auctionSignals.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, 'perBuyerSignals/3'), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/3' } + ); +}, 'Test directFromSellerSignals with only perBuyerSignals.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/4' } + ); +}, 'Test directFromSellerSignals with sellerSignals, auctionSignals and perBuyerSignals.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/1', + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/1' } + ); + + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + 'auctionSignals/2', /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/2' } + ); +}, 'Test directFromSellerSignals with single fetch and multiple auctions'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + const ad_slot = Promise.resolve('adSlot/4'); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: ad_slot } + ); +}, 'Test directFromSellerSignals with resolved promise ad slot.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await joinInterestGroup(test, uuid); + + const adSlot = Promise.reject(new Error('This is a rejected promise.')); + let auctionConfig = + { seller: window.location.origin, + interestGroupBuyers: [window.location.origin], + resolveToConfig: true, + decisionLogicURL: createDecisionScriptURL(uuid), + directFromSellerSignalsHeaderAdSlot: adSlot }; + + let result = await navigator.runAdAuction(auctionConfig).catch(() => new runAdAuctionRejected()); + assert_true(result instanceof runAdAuctionRejected); +}, 'Test directFromSellerSignals with rejected promise ad slot.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + const validator = directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'); + let reportResult = `if (!(${validator.reportResultSuccessCondition})) { + sendReportTo('${createSellerReportURL(uuid, 'error')}'); + return false; + } + ${validator.reportResult}`; + let reportWin = `if (!(${validator.reportWinSuccessCondition})) { + sendReportTo('${createBidderReportURL(uuid, 'error')}'); + return false; + } + ${validator.reportWin}`; + let decisionScriptURLParams = { scoreAd : validator.scoreAd, + reportResult : reportResult }; + let biddingScriptURLParams = { generateBid : validator.generateBid, + reportWin : reportWin }; + let interestGroupOverrides = + { biddingLogicURL: createBiddingScriptURL(biddingScriptURLParams) }; + await joinInterestGroup(test, uuid, interestGroupOverrides); + + let adSlotResolve = null; + const adSlotPromise = new Promise((resolve, reject) => { adSlotResolve = resolve }); + let auctionConfig = + { seller: window.location.origin, + interestGroupBuyers: [window.location.origin], + resolveToConfig: true, + decisionLogicURL: createDecisionScriptURL(uuid, decisionScriptURLParams), + directFromSellerSignalsHeaderAdSlot: adSlotPromise }; + let resultPromise = navigator.runAdAuction(auctionConfig); + + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + adSlotResolve('adSlot/4'); + let result = await resultPromise; + createAndNavigateFencedFrame(test, result); + await waitForObservedRequests(uuid, [createSellerReportURL(uuid), createBidderReportURL(uuid)]); +}, 'Test directFromSellerSignals that runAdAuction will wait until the promise of fetch is resolved.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/5', + 'auctionSignals/5', /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/5' } + ); +}, 'Test directFromSellerSignals with mismatched perBuyerSignals.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': '*' }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/5', + 'auctionSignals/5', /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/5' } + ); +}, 'Test directFromSellerSignals does not support wildcard for buyerOrigin of perBuyerSignals.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/non-exist' } + ); +}, 'Test directFromSellerSignals with non-existent adSlot.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: null } + ); +}, 'Test directFromSellerSignals with null directFromSellerSignalsHeaderAdSlot.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + [createSellerReportURL(uuid), createBidderReportURL(uuid)] + ); +}, 'Test directFromSellerSignals with no directFromSellerSignalsHeaderAdSlot.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Negative-Test-Option': 'HTTP Error' }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot' } + ); +}, 'Test directFromSellerSignals with HTTP error.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Negative-Test-Option': 'No Ad-Auction-Signals Header' }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot' } + ); +}, 'Test directFromSellerSignals with no returned Ad-Auction-Signals Header.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Negative-Test-Option': 'Invalid Json' }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot' } + ); +}, 'Test directFromSellerSignals with invalid json in Ad-Auction-Signals header.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + let codeToInsert = directFromSellerSignalsValidatorCode( + uuid, /*expectedSellerSignals=*/null, + /*expectedAuctionSignals=*/null, /*expectedPerBuyerSignals=*/null); + codeToInsert.decisionScriptURLOrigin = OTHER_ORIGIN1; + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + await runReportTest( + test, uuid, codeToInsert, + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/4', + seller: OTHER_ORIGIN1 } + ); +}, 'Test directFromSellerSignals with different fetch and seller origins.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + let codeToInsert = directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'); + codeToInsert.decisionScriptURLOrigin = OTHER_ORIGIN1; + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }, OTHER_ORIGIN1); + await runReportTest( + test, uuid, codeToInsert, + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/4', + seller: OTHER_ORIGIN1 } + ); +}, 'Test directFromSellerSignals with same fetch and seller origins.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + let iframe = await createIframe(test, OTHER_ORIGIN1); + await runInFrame(test, iframe, `await joinInterestGroup(test_instance, "${uuid}");`); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': OTHER_ORIGIN1 }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid, '1', OTHER_ORIGIN1)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/4', + interestGroupBuyers: [OTHER_ORIGIN1] } + ); +}, 'Test directFromSellerSignals different interest group owner origin from top frame.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + let iframe = await createIframe(test, OTHER_ORIGIN1); + await runInFrame( + test, iframe, + `runReportTest( + test, "${uuid}", + directFromSellerSignalsValidatorCode( + "${uuid}", 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'), + // expectedReportUrls + [createSellerReportURL("${uuid}"), createBidderReportURL("${uuid}")], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/4' })`); +}, 'Test directFromSellerSignals with fetching in top frame and running auction in iframe.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + let iframe = await createIframe(test, OTHER_ORIGIN1); + await runInFrame( + test, iframe, + `await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin }); + runReportTest( + test, "${uuid}", + directFromSellerSignalsValidatorCode( + "${uuid}", 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'), + // expectedReportUrls + [createSellerReportURL("${uuid}"), createBidderReportURL("${uuid}", '1', OTHER_ORIGIN1)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/4', + interestGroupBuyers: [OTHER_ORIGIN1] })`); +}, 'Test directFromSellerSignals with fetching and running auction in the same iframe.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + let iframe1 = await createIframe(test, OTHER_ORIGIN1); + let iframe2 = await createIframe(test, OTHER_ORIGIN2); + await runInFrame( + test, iframe1, + `await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin });`); + await runInFrame( + test, iframe2, + `runReportTest( + test, "${uuid}", + directFromSellerSignalsValidatorCode( + "${uuid}", 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'), + // expectedReportUrls + [createSellerReportURL("${uuid}"), createBidderReportURL("${uuid}", '1', OTHER_ORIGIN1)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/4', + interestGroupBuyers: [OTHER_ORIGIN1] })`); +}, 'Test directFromSellerSignals with fetching in iframe 1 and running auction in iframe 2.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + let iframe = await createIframe(test, OTHER_ORIGIN1); + await runInFrame( + test, iframe, + `await fetchDirectFromSellerSignals({ 'Buyer-Origin': window.location.origin });`); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals/4', + 'auctionSignals/4', 'perBuyerSignals/4'), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot/4'} + ); +}, 'Test directFromSellerSignals with fetching in iframe and running auction in top frame.'); + +subsetTest(promise_test, async test => { + const uuid = generateUuid(test); + await fetchDirectFromSellerSignals({ 'Negative-Test-Option': 'Network Error' }); + await runReportTest( + test, uuid, + directFromSellerSignalsValidatorCode( + uuid, 'sellerSignals', + 'auctionSignals', /*expectedPerBuyerSignals=*/null), + // expectedReportUrls + [createSellerReportURL(uuid), createBidderReportURL(uuid)], + // renderURLOverride + null, + // auctionConfigOverrides + { directFromSellerSignalsHeaderAdSlot: 'adSlot' } + ); +}, 'Test directFromSellerSignals with network error.');
diff --git a/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/decision-logic.sub.py b/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/decision-logic.sub.py index d5ecd2db8..39a4fed 100644 --- a/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/decision-logic.sub.py +++ b/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/decision-logic.sub.py
@@ -36,7 +36,7 @@ if error != b"no-scoreAd": body += b""" function scoreAd(adMetadata, bid, auctionConfig, trustedScoringSignals, - browserSignals) { + browserSignals, directFromSellerSignals) { // Don't bid on interest group with the wrong uuid. This is to prevent // left over interest groups from other tests from affecting auction // results.
diff --git a/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/direct-from-seller-signals.py b/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/direct-from-seller-signals.py new file mode 100644 index 0000000..0f9e29d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/direct-from-seller-signals.py
@@ -0,0 +1,125 @@ +import json + +# Script to return hardcoded "Ad-Auction-Signals" header to test header-based +# directFromSellerSignals. Requires a "Sec-Ad-Auction-Fetch" header with value +# of b"?1" in the request, otherwise returns a 400 response. +# +# Header "Negative-Test-Option" is used to return some specific hardcoded +# response for some negative test cases. +# +# For all positive test cases, header "Buyer-Origin" is required to be the +# origin in perBuyerSignals, otherwise return 400 response. +def main(request, response): + # Append CORS headers if needed. + if b"origin" in request.headers: + response.headers.set(b"Access-Control-Allow-Origin", + request.headers.get(b"origin")) + + if b"credentials" in request.headers: + response.headers.set(b"Access-Control-Allow-Credentials", + request.headers.get(b"credentials")) + + # Handle CORS preflight requests. + if request.method == u"OPTIONS": + if not b"Access-Control-Request-Method" in request.headers: + response.status = (400, b"Bad Request") + response.headers.set(b"Content-Type", b"text/plain") + return "Failed to get access-control-request-method in preflight!" + + if not b"Access-Control-Request-Headers" in request.headers: + response.status = (400, b"Bad Request") + response.headers.set(b"Content-Type", b"text/plain") + return "Failed to get access-control-request-headers in preflight!" + + response.headers.set(b"Access-Control-Allow-Methods", + request.headers[b"Access-Control-Request-Method"]) + + response.headers.set(b"Access-Control-Allow-Headers", + request.headers[b"Access-Control-Request-Headers"]) + + response.status = (204, b"No Content") + return + + # Return 400 if there is no "Sec-Ad-Auction-Fetch" header. + if ("Sec-Ad-Auction-Fetch" not in request.headers or + request.headers.get("Sec-Ad-Auction-Fetch") != b"?1"): + response.status = (400, b"Bad Request") + response.headers.set(b"Content-Type", b"text/plain") + return "Failed to get Sec-Ad-Auction-Fetch in headers or its value is not \"?1\"." + + # Return 500 to test http error. + if ("Negative-Test-Option" in request.headers and + request.headers.get("Negative-Test-Option") == b"HTTP Error"): + response.status = (500, b"Internal Error") + response.headers.set(b"Content-Type", b"text/plain") + return "Test http error with 500 response." + + # Return 200 but without "Ad-Auction-Signals" header. + if ("Negative-Test-Option" in request.headers and + request.headers.get("Negative-Test-Option") == b"No Ad-Auction-Signals Header"): + response.status = (200, b"OK") + response.headers.set(b"Content-Type", b"text/plain") + return "Test 200 response without \"Ad-Auction-Signals\" header." + + # Return 200 but with invalid json in "Ad-Auction-Signals" header. + if ("Negative-Test-Option" in request.headers and + request.headers.get("Negative-Test-Option") == b"Invalid Json"): + response.status = (200, b"OK") + response.headers.set("Ad-Auction-Signals", b"[{\"adSlot\": \"adSlot\", \"sellerSignals\": \"sellerSignals\", \"auctionSignals\":}]") + response.headers.set(b"Content-Type", b"text/plain") + return "Test 200 response with invalid json in \"Ad-Auction-Signals\" header." + + # Return 404 but with valid "Ad-Auction-Signals" header to test network error. + if ("Negative-Test-Option" in request.headers and + request.headers.get("Negative-Test-Option") == b"Network Error"): + response.status = (404, b"Not Found") + adAuctionSignals = json.dumps( + [{ + "adSlot": "adSlot", + "sellerSignals": "sellerSignals", + "auctionSignals": "auctionSignals" + }]) + response.headers.set("Ad-Auction-Signals", adAuctionSignals) + response.headers.set(b"Content-Type", b"text/plain") + return "Test network error with 400 response code and valid \"Ad-Auction-Signals\" header." + + # For positive test cases, buyer-origin is required, otherwise return 400. + if "Buyer-Origin" not in request.headers: + response.status = (400, "Bad Request") + response.headers.set(b"Content-Type", b"text/plain") + return "Failed to get Buyer-Origin in headers." + + response.status = (200, b"OK") + buyerOrigin = request.headers.get("Buyer-Origin").decode('utf-8') + adAuctionSignals = json.dumps( + [{ + "adSlot": "adSlot/0", + }, + { + "adSlot": "adSlot/1", + "sellerSignals": "sellerSignals/1", + }, + { + "adSlot": "adSlot/2", + "auctionSignals": "auctionSignals/2", + }, + { + "adSlot": "adSlot/3", + "perBuyerSignals": { buyerOrigin: "perBuyerSignals/3" } + }, + { + "adSlot": "adSlot/4", + "sellerSignals": "sellerSignals/4", + "auctionSignals": "auctionSignals/4", + "perBuyerSignals": { buyerOrigin: "perBuyerSignals/4" } + }, + { + "adSlot": "adSlot/5", + "sellerSignals": "sellerSignals/5", + "auctionSignals": "auctionSignals/5", + "perBuyerSignals": { "mismatchOrigin": "perBuyerSignals/5" } + }]) + + response.headers.set("Ad-Auction-Signals", adAuctionSignals) + response.headers.set(b"Content-Type", b"text/plain") + return
diff --git a/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/fledge-util.sub.js b/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/fledge-util.sub.js index b547c3c..1e5b75a 100644 --- a/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/fledge-util.sub.js +++ b/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/fledge-util.sub.js
@@ -16,7 +16,7 @@ const TRUSTED_SCORING_SIGNALS_URL = `${BASE_URL}resources/trusted-scoring-signals.py`; -// Other origins that should all be distint from the main frame origin +// Other origins that should all be distinct from the main frame origin // that the tests start with. const OTHER_ORIGIN1 = 'https://{{hosts[alt][]}}:{{ports[https][0]}}'; const OTHER_ORIGIN2 = 'https://{{hosts[alt][]}}:{{ports[https][1]}}'; @@ -68,6 +68,11 @@ return createTrackerURL(origin, uuid, `track_post`, `seller_beacon_${id}`); } +function createDirectFromSellerSignalsURL(origin = window.location.origin) { + let url = new URL(`${origin}${BASE_PATH}resources/direct-from-seller-signals.py`); + return url.toString(); +} + // Generates a UUID and registers a cleanup method with the test fixture to // request a URL from the request tracking script that clears all data // associated with the generated uuid when requested. @@ -259,6 +264,9 @@ await navigator.leaveAdInterestGroup(interestGroup); } +// A type tag to identify a promise is handled correctly when rejected. +function runAdAuctionRejected() { } + // Runs a FLEDGE auction and returns the result. By default, the seller is the // current frame's origin, and the only buyer is as well. The seller script // rejects bids for URLs that don't contain "uuid" (to avoid running into issues @@ -362,8 +370,11 @@ // `codeToInsert` is a JS object that contains the following fields to control // the code generated for the auction worklet: // scoreAd - function body for scoreAd() seller worklet function +// reportResultSuccessCondition - Success condition to trigger reportResult() // reportResult - function body for reportResult() seller worklet function // generateBid - function body for generateBid() buyer worklet function +// reportWinSuccessCondition - Success condition to trigger reportWin() +// decisionScriptURLOrigin - Origin of decision script URL // reportWin - function body for reportWin() buyer worklet function // // Additionally the following fields can be added to check for errors during the @@ -377,16 +388,20 @@ // `renderURLOverride` allows the ad URL of the joined InterestGroup to // to be set by the caller. // +// `auctionConfigOverrides` may be used to override fields in the auction +// configuration. +// // Requesting error report URLs causes waitForObservedRequests() to throw // rather than hang. async function runReportTest(test, uuid, codeToInsert, expectedReportURLs, - renderURLOverride) { + renderURLOverride, auctionConfigOverrides) { let scoreAd = codeToInsert.scoreAd; let reportResultSuccessCondition = codeToInsert.reportResultSuccessCondition; let reportResult = codeToInsert.reportResult; let generateBid = codeToInsert.generateBid; let reportWinSuccessCondition = codeToInsert.reportWinSuccessCondition; let reportWin = codeToInsert.reportWin; + let decisionScriptURLOrigin = codeToInsert.decisionScriptURLOrigin; if (reportResultSuccessCondition) { reportResult = `if (!(${reportResultSuccessCondition})) { @@ -406,6 +421,10 @@ else decisionScriptURLParams.error = 'no-reportResult'; + if (decisionScriptURLOrigin !== undefined) { + decisionScriptURLParams.origin = decisionScriptURLOrigin; + } + if (reportWinSuccessCondition) { reportWin = `if (!(${reportWinSuccessCondition})) { sendReportTo('${createBidderReportURL(uuid, 'error')}'); @@ -430,9 +449,16 @@ interestGroupOverrides.ads = [{ renderURL: renderURLOverride }] await joinInterestGroup(test, uuid, interestGroupOverrides); - await runBasicFledgeAuctionAndNavigate( - test, uuid, - { decisionLogicURL: createDecisionScriptURL(uuid, decisionScriptURLParams) }); + + if (auctionConfigOverrides === undefined) { + auctionConfigOverrides = + { decisionLogicURL: createDecisionScriptURL(uuid, decisionScriptURLParams) }; + } else if (auctionConfigOverrides.decisionLogicURL === undefined) { + auctionConfigOverrides.decisionLogicURL = + createDecisionScriptURL(uuid, decisionScriptURLParams); + } + + await runBasicFledgeAuctionAndNavigate(test, uuid, auctionConfigOverrides); await waitForObservedRequests(uuid, expectedReportURLs); } @@ -551,3 +577,66 @@ await runInFrame(test, topLeveWindow, `await joinInterestGroup(test_instance, "${uuid}", ${interestGroup})`); } + +// Fetch directFromSellerSignals from seller and check header +// 'Ad-Auction-Signals' is hidden from documents. +async function fetchDirectFromSellerSignals(headers_content, origin) { + const response = await fetch( + createDirectFromSellerSignalsURL(origin), + { adAuctionHeaders: true, headers: headers_content }); + + if (!('Negative-Test-Option' in headers_content)) { + assert_equals( + response.status, + 200, + 'Failed to fetch directFromSellerSignals: ' + await response.text()); + } + assert_false( + response.headers.has('Ad-Auction-Signals'), + 'Header "Ad-Auction-Signals" should be hidden from documents.'); +} + +// Generate directFromSellerSignals evaluation code for different worklets and +// pass to `runReportTest()` as `codeToInsert`. +function directFromSellerSignalsValidatorCode(uuid, expectedSellerSignals, + expectedAuctionSignals, expectedPerBuyerSignals) { + expectedSellerSignals = JSON.stringify(expectedSellerSignals); + expectedAuctionSignals = JSON.stringify(expectedAuctionSignals); + expectedPerBuyerSignals = JSON.stringify(expectedPerBuyerSignals); + + return { + // Seller worklets + scoreAd: + `if (directFromSellerSignals === null || + directFromSellerSignals.sellerSignals !== ${expectedSellerSignals} || + directFromSellerSignals.auctionSignals !== ${expectedAuctionSignals} || + Object.keys(directFromSellerSignals).length != 2) { + throw 'Failed to get expected directFromSellerSignals in scoreAd(): ' + + JSON.stringify(directFromSellerSignals); + }`, + reportResultSuccessCondition: + `directFromSellerSignals !== null && + directFromSellerSignals.sellerSignals === ${expectedSellerSignals} && + directFromSellerSignals.auctionSignals === ${expectedAuctionSignals} && + Object.keys(directFromSellerSignals).length == 2`, + reportResult: + `sendReportTo("${createSellerReportURL(uuid)}");`, + + // Bidder worklets + generateBid: + `if (directFromSellerSignals === null || + directFromSellerSignals.perBuyerSignals !== ${expectedPerBuyerSignals} || + directFromSellerSignals.auctionSignals !== ${expectedAuctionSignals} || + Object.keys(directFromSellerSignals).length != 2) { + throw 'Failed to get expected directFromSellerSignals in generateBid(): ' + + JSON.stringify(directFromSellerSignals); + }`, + reportWinSuccessCondition: + `directFromSellerSignals !== null && + directFromSellerSignals.perBuyerSignals === ${expectedPerBuyerSignals} && + directFromSellerSignals.auctionSignals === ${expectedAuctionSignals} && + Object.keys(directFromSellerSignals).length == 2`, + reportWin: + `sendReportTo("${createBidderReportURL(uuid)}");`, + }; +}
diff --git a/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/trusted-bidding-signals.py b/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/trusted-bidding-signals.py index 16272af..b8e7c9f 100644 --- a/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/trusted-bidding-signals.py +++ b/third_party/blink/web_tests/external/wpt/fledge/tentative/resources/trusted-bidding-signals.py
@@ -2,7 +2,7 @@ from urllib.parse import unquote_plus from fledge.tentative.resources.fledge_http_server_util import headersToAscii -# Script to generate trusted bidding signals. The responses depends on the +# Script to generate trusted bidding signals. The response depends on the # keys and interestGroupNames - some result in entire response failures, others # affect only their own value. Keys are preferentially used over # interestGroupName, since keys are composible, but some tests need to cover
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt index 26fc548b..eaf5f6b 100644 --- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt +++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt
@@ -1,29 +1,22 @@ This is a testharness.js-based test. +Found 54 tests; 31 PASS, 23 FAIL, 0 TIMEOUT, 0 NOTRUN. [PASS] initialize global state -[FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #1: network scope1->scope2 (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code +[PASS] Case #1: network scope1->scope2 (classic DedicatedWorker) +[PASS] Case #1: network scope1->scope2 (module DedicatedWorker) [FAIL] Case #1: network scope1->scope2 (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code + assert_equals: expected "the worker script was served from network" but got "sw2 saw the request for the worker script" [FAIL] Case #1: network scope1->scope2 (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (module SharedWorker) - assert_unreached: Worker error Reached unreachable code + assert_equals: expected "the worker script was served from network" but got "sw2 saw the request for the worker script" +[PASS] Case #2: network scope1->out-scope (classic DedicatedWorker) +[PASS] Case #2: network scope1->out-scope (module DedicatedWorker) +[PASS] Case #2: network scope1->out-scope (classic SharedWorker) +[PASS] Case #2: network scope1->out-scope (module SharedWorker) [FAIL] Case #3: sw scope1->scope2 (classic DedicatedWorker) assert_unreached: Worker error Reached unreachable code [FAIL] Case #3: sw scope1->scope2 (module DedicatedWorker) assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (module SharedWorker) - assert_unreached: Worker error Reached unreachable code +[PASS] Case #3: sw scope1->scope2 (classic SharedWorker) +[PASS] Case #3: sw scope1->scope2 (module SharedWorker) [FAIL] Case #4: sw scope1->out-scope (classic DedicatedWorker) assert_unreached: Worker error Reached unreachable code [FAIL] Case #4: sw scope1->out-scope (module DedicatedWorker) @@ -31,6 +24,50 @@ [PASS] Case #4: sw scope1->out-scope (classic SharedWorker) [PASS] Case #4: sw scope1->out-scope (module SharedWorker) [PASS] cleanup global state +[FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker, importScripts()) + assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/scope2/import-scripts-echo.py" but got "importScripts: served from network (scope2/)" +[FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/scope2/simple.txt" but got "fetch(): a simple text file (scope2/)\\n" +[PASS] Case #1: network scope1->scope2 (classic DedicatedWorker, location.href) +[PASS] Case #1: network scope1->scope2 (module DedicatedWorker, importScripts()) +[FAIL] Case #1: network scope1->scope2 (module DedicatedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/scope2/simple.txt" but got "fetch(): a simple text file (scope2/)\\n" +[PASS] Case #1: network scope1->scope2 (module DedicatedWorker, location.href) +[FAIL] Case #1: network scope1->scope2 (classic SharedWorker, importScripts()) + assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/scope2/import-scripts-echo.py" but got "sw2 saw importScripts from the worker: /service-workers/service-worker/resources/subdir/import-scripts-echo.py" +[FAIL] Case #1: network scope1->scope2 (classic SharedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/scope2/simple.txt" but got "fetch(): sw2 saw the fetch from the worker: /service-workers/service-worker/resources/subdir/simple.txt" +[FAIL] Case #1: network scope1->scope2 (classic SharedWorker, location.href) + assert_equals: location.href expected "https://web-platform.test:8444/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py" but got "https://web-platform.test:8444/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py?greeting=sw2%20saw%20the%20request%20for%20the%20worker%20script" +[PASS] Case #1: network scope1->scope2 (module SharedWorker, importScripts()) +[FAIL] Case #1: network scope1->scope2 (module SharedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/scope2/simple.txt" but got "fetch(): sw2 saw the fetch from the worker: /service-workers/service-worker/resources/subdir/simple.txt" +[FAIL] Case #1: network scope1->scope2 (module SharedWorker, location.href) + assert_equals: location.href expected "https://web-platform.test:8444/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py" but got "https://web-platform.test:8444/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py?greeting=sw2%20saw%20the%20request%20for%20the%20worker%20script" +[FAIL] Case #2: network scope1->out-scope (classic DedicatedWorker, importScripts()) + assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/import-scripts-echo.py" but got "importScripts: served from network" +[FAIL] Case #2: network scope1->out-scope (classic DedicatedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" +[PASS] Case #2: network scope1->out-scope (classic DedicatedWorker, location.href) +[PASS] Case #2: network scope1->out-scope (module DedicatedWorker, importScripts()) +[FAIL] Case #2: network scope1->out-scope (module DedicatedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" +[PASS] Case #2: network scope1->out-scope (module DedicatedWorker, location.href) +[FAIL] Case #2: network scope1->out-scope (classic SharedWorker, importScripts()) + assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/import-scripts-echo.py" but got "importScripts: served from network" +[FAIL] Case #2: network scope1->out-scope (classic SharedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" +[PASS] Case #2: network scope1->out-scope (classic SharedWorker, location.href) +[PASS] Case #2: network scope1->out-scope (module SharedWorker, importScripts()) +[FAIL] Case #2: network scope1->out-scope (module SharedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" +[PASS] Case #2: network scope1->out-scope (module SharedWorker, location.href) +[PASS] Case #3: sw scope1->scope2 (classic SharedWorker, importScripts()) +[PASS] Case #3: sw scope1->scope2 (classic SharedWorker, fetch()) +[PASS] Case #3: sw scope1->scope2 (classic SharedWorker, location.href) +[PASS] Case #3: sw scope1->scope2 (module SharedWorker, importScripts()) +[PASS] Case #3: sw scope1->scope2 (module SharedWorker, fetch()) +[PASS] Case #3: sw scope1->scope2 (module SharedWorker, location.href) [FAIL] Case #4: sw scope1->out-scope (classic SharedWorker, importScripts()) assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/import-scripts-echo.py" but got "importScripts: served from network" [FAIL] Case #4: sw scope1->out-scope (classic SharedWorker, fetch())
diff --git a/third_party/blink/web_tests/external/wpt/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html b/third_party/blink/web_tests/external/wpt/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html index 944b98c..ecc364c 100644 --- a/third_party/blink/web_tests/external/wpt/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html +++ b/third_party/blink/web_tests/external/wpt/storage-access-api/resources/storage-access-beyond-cookies-iframe-iframe.html
@@ -100,6 +100,44 @@ } break; } + case "blobStorage": { + const handle = await document.requestStorageAccess({createObjectURL: true, revokeObjectURL: true}); + let blob = await fetch(atob(id)).then( + (response) => response.text(), + () => ""); + if (blob != "TEST") { + message = "Blob storage should be readable in this context"; + } + URL.revokeObjectURL(atob(id)); + blob = await fetch(atob(id)).then( + (response) => response.text(), + () => ""); + if (blob != "TEST") { + message = "Handle should not override window blob storage"; + } + handle.revokeObjectURL(atob(id)); + blob = await fetch(atob(id)).then( + (response) => response.text(), + () => ""); + if (blob != "") { + message = "No first-party blob access"; + } + const url = handle.createObjectURL(new Blob(["TEST2"])); + blob = await fetch(url).then( + (response) => response.text(), + () => ""); + if (blob != "TEST2") { + message = "A blob url created via the handle should be readable"; + } + handle.revokeObjectURL(url); + blob = await fetch(url).then( + (response) => response.text(), + () => ""); + if (blob != "") { + message = "A blob url removed via the handle should be cleared"; + } + break; + } default: { message = "Unexpected type " + type; break;
diff --git a/third_party/blink/web_tests/external/wpt/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html b/third_party/blink/web_tests/external/wpt/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html index ae2dddd..193ddd2 100644 --- a/third_party/blink/web_tests/external/wpt/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html +++ b/third_party/blink/web_tests/external/wpt/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html
@@ -62,6 +62,15 @@ } break; } + case "blobStorage": { + const blob = await fetch(atob(id)).then( + (response) => response.text(), + () => ""); + if (blob != "") { + message = "Cross-site first-party blob storage should be empty"; + } + break; + } default: { message = "Unexpected type " + type; break;
diff --git a/third_party/blink/web_tests/external/wpt/storage-access-api/storage-access-beyond-cookies.blobStorage.tentative.sub.https.window.js b/third_party/blink/web_tests/external/wpt/storage-access-api/storage-access-beyond-cookies.blobStorage.tentative.sub.https.window.js new file mode 100644 index 0000000..6ef0bd0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/storage-access-api/storage-access-beyond-cookies.blobStorage.tentative.sub.https.window.js
@@ -0,0 +1,31 @@ +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js + +'use strict'; + +// Here's the set-up for this test: +// Step 1 (top-frame) Set up listener for "HasAccess" message. +// Step 2 (top-frame) Add data to first-party blob storage. +// Step 3 (top-frame) Embed an iframe that's cross-site with top-frame. +// Step 4 (sub-frame) Try to use storage access API and read first-party data. +// Step 5 (sub-frame) Embed an iframe that's same-origin with top-frame. +// Step 6 (sub-sub-frame) Try to use storage access API and read first-party data. +// Step 7 (sub-sub-frame) Send "HasAccess for blobStorage" message to top-frame. +// Step 8 (top-frame) Receive "HasAccess for blobStorage" message and cleanup. + +async_test(t => { + // Step 1 + window.addEventListener("message", t.step_func(e => { + // Step 8 + assert_equals(e.data, "HasAccess for blobStorage", "Storage Access API should be accessible and return first-party data"); + t.done(); + })); + + // Step 2 + const id = btoa(URL.createObjectURL(new Blob(["TEST"]))); + + // Step 3 + let iframe = document.createElement("iframe"); + iframe.src = "https://{{hosts[alt][]}}:{{ports[https][0]}}/storage-access-api/resources/storage-access-beyond-cookies-iframe.sub.html?type=blobStorage&id="+id; + document.body.appendChild(iframe); +}, "Verify StorageAccessAPIBeyondCookies for Blob Storage");
diff --git a/third_party/blink/web_tests/external/wpt/xhr/send-authentication-basic-setrequestheader-existing-session-expected.txt b/third_party/blink/web_tests/external/wpt/xhr/send-authentication-basic-setrequestheader-existing-session-expected.txt deleted file mode 100644 index ff04260..0000000 --- a/third_party/blink/web_tests/external/wpt/xhr/send-authentication-basic-setrequestheader-existing-session-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -[FAIL] XMLHttpRequest: send() - "Basic" authenticated request using setRequestHeader() when there is an existing session - assert_true: responseText should contain the right user and password expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/xhr/send-authentication-cors-basic-setrequestheader-expected.txt b/third_party/blink/web_tests/external/wpt/xhr/send-authentication-cors-basic-setrequestheader-expected.txt deleted file mode 100644 index 875090f..0000000 --- a/third_party/blink/web_tests/external/wpt/xhr/send-authentication-cors-basic-setrequestheader-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -[FAIL] XMLHttpRequest: send() - "Basic" authenticated CORS request using setRequestHeader() (expects to succeed) - Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://www1.web-platform.test:8001/xhr/resources/auth2/corsenabled.py'. -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/xhr/send-authentication-cors-setrequestheader-no-cred-expected.txt b/third_party/blink/web_tests/external/wpt/xhr/send-authentication-cors-setrequestheader-no-cred-expected.txt index 749556b..928bfca 100644 --- a/third_party/blink/web_tests/external/wpt/xhr/send-authentication-cors-setrequestheader-no-cred-expected.txt +++ b/third_party/blink/web_tests/external/wpt/xhr/send-authentication-cors-setrequestheader-no-cred-expected.txt
@@ -1,6 +1,5 @@ This is a testharness.js-based test. -[FAIL] CORS request with setRequestHeader auth to URL accepting Authorization header - Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://www1.web-platform.test:8001/xhr/resources/auth7/corsenabled.py'. +[PASS] CORS request with setRequestHeader auth to URL accepting Authorization header [FAIL] CORS request with setRequestHeader auth to URL NOT accepting Authorization header Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://www1.web-platform.test:8001/xhr/resources/auth8/corsenabled-no-authorize.py'. Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/fast/forms/select/menulist-field-sizing-autofill.html b/third_party/blink/web_tests/fast/forms/select/menulist-field-sizing-autofill.html new file mode 100644 index 0000000..deadfa4 --- /dev/null +++ b/third_party/blink/web_tests/fast/forms/select/menulist-field-sizing-autofill.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<link rel="help" href="https://github.com/whatwg/html/pull/9903"> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> + +<style> +#target { field-sizing: content; } +</style> +<select id="reference"><option><option>foo<option>bar<option>foobar</select> +<select id="target"><option><option>foo<option>bar<option>foobar</select> + +<script> +test(() => { + assert_less_than(target.offsetWidth, reference.offsetWidth); + internals.setSuggestedValue(target, 'foobar'); + assert_equals(target.offsetWidth, reference.offsetWidth); +}, 'field-sizing:content is not applied to autofilled controls'); +</script> +
diff --git a/third_party/blink/web_tests/fast/forms/text/text-field-sizing-autofill.html b/third_party/blink/web_tests/fast/forms/text/text-field-sizing-autofill.html new file mode 100644 index 0000000..65a9efc --- /dev/null +++ b/third_party/blink/web_tests/fast/forms/text/text-field-sizing-autofill.html
@@ -0,0 +1,21 @@ +<!DOCTYPE html> +<link rel="help" href="https://github.com/whatwg/html/pull/9903"> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> + +<style> +#target { field-sizing: content; } +</style> +<input id="reference"> +<input id="target"> + +<script> +test(() => { + assert_less_than(target.offsetWidth, reference.offsetWidth); + internals.setSuggestedValue(target, 'suggested quick brown fox jumps'); + assert_equals(target.offsetWidth, reference.offsetWidth); + internals.setSuggestedValue(target, 's'); + assert_equals(target.offsetWidth, reference.offsetWidth); +}, 'field-sizing:content is not applied to autofilled controls'); +</script> +
diff --git a/third_party/blink/web_tests/fast/forms/textarea/textarea-field-sizing-autofill.html b/third_party/blink/web_tests/fast/forms/textarea/textarea-field-sizing-autofill.html new file mode 100644 index 0000000..7867615 --- /dev/null +++ b/third_party/blink/web_tests/fast/forms/textarea/textarea-field-sizing-autofill.html
@@ -0,0 +1,21 @@ +<!DOCTYPE html> +<link rel="help" href="https://github.com/whatwg/html/pull/9903"> +<script src="../../../resources/testharness.js"></script> +<script src="../../../resources/testharnessreport.js"></script> + +<style> +#target { field-sizing: content; } +</style> +<textarea id="reference"></textarea> +<textarea id="target"></textarea> + +<script> +test(() => { + assert_less_than(target.offsetWidth, reference.offsetWidth); + internals.setSuggestedValue(target, 'suggested quick brown fox jumps'); + assert_equals(target.offsetWidth, reference.offsetWidth); + internals.setSuggestedValue(target, 's'); + assert_equals(target.offsetWidth, reference.offsetWidth); +}, 'field-sizing:content is not applied to autofilled controls'); +</script> +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/fedcm/fedcm-confirm-idp-login.js b/third_party/blink/web_tests/http/tests/inspector-protocol/fedcm/fedcm-confirm-idp-login.js index 9b242123..11bc426 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/fedcm/fedcm-confirm-idp-login.js +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/fedcm/fedcm-confirm-idp-login.js
@@ -33,7 +33,7 @@ testRunner.fail("Wrong dialog type"); return; } - dp.FedCm.confirmIdpLogin({dialogId: msg.params.dialogId}); + dp.FedCm.clickDialogButton({dialogId: msg.params.dialogId, dialogButton: "ConfirmIdpLoginContinue"}); // Now wait for the account chooser dialog. msg = await dp.FedCm.onceDialogShown();
diff --git a/third_party/blink/web_tests/platform/linux-chrome/external/wpt/css/css-fonts/generic-family-keywords-003-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/css/css-fonts/generic-family-keywords-003-expected.txt new file mode 100644 index 0000000..9b827b7 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/css/css-fonts/generic-family-keywords-003-expected.txt
@@ -0,0 +1,16 @@ +This is a testharness.js-based test. +[PASS] @font-face matching for quoted and unquoted serif (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted sans-serif (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted cursive (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted fantasy (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted monospace (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted system-ui (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted emoji (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted math (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted fangsong (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted ui-serif (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted ui-sans-serif (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted ui-monospace (drawing text in a canvas) +[PASS] @font-face matching for quoted and unquoted ui-rounded (drawing text in a canvas) +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux-chrome/external/wpt/css/css-scroll-snap/selection-target-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/css/css-scroll-snap/selection-target-expected.txt new file mode 100644 index 0000000..f8b5a955 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/css/css-scroll-snap/selection-target-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +[PASS] Test scrolling into view when typing +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/not-send-after-abort.tentative.https.window-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/not-send-after-abort.tentative.https.window-expected.txt new file mode 100644 index 0000000..2e0a803 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/not-send-after-abort.tentative.https.window-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = Uncaught SyntaxError: Identifier 'MessageQueue' has already been declared +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/send-multiple-with-activate-after.tentative.https.window-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/send-multiple-with-activate-after.tentative.https.window-expected.txt new file mode 100644 index 0000000..2e0a803 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/send-multiple-with-activate-after.tentative.https.window-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = Uncaught SyntaxError: Identifier 'MessageQueue' has already been declared +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/send-multiple.tentative.https.window-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/send-multiple.tentative.https.window-expected.txt new file mode 100644 index 0000000..2e0a803 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/fetch-later/send-on-discard/send-multiple.tentative.https.window-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = Uncaught SyntaxError: Identifier 'MessageQueue' has already been declared +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/stale-while-revalidate/fetch.any.worker-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/stale-while-revalidate/fetch.any.worker-expected.txt new file mode 100644 index 0000000..23d2e62 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/fetch/stale-while-revalidate/fetch.any.worker-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +[FAIL] Second fetch returns same response +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux-chrome/external/wpt/navigation-api/navigation-activation/activation-after-bfcache-cross-origin-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/navigation-api/navigation-activation/activation-after-bfcache-cross-origin-expected.txt new file mode 100644 index 0000000..fa3fd9c --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/navigation-api/navigation-activation/activation-after-bfcache-cross-origin-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +[PRECONDITION_FAILED] navigation.activation must be updated when restored from bfcache + Could have been BFCached but actually wasn't +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux-chrome/external/wpt/navigation-api/navigation-activation/activation-after-bfcache-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/navigation-api/navigation-activation/activation-after-bfcache-expected.txt new file mode 100644 index 0000000..fa3fd9c --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/external/wpt/navigation-api/navigation-activation/activation-after-bfcache-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +[PRECONDITION_FAILED] navigation.activation must be updated when restored from bfcache + Could have been BFCached but actually wasn't +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux-chrome/wpt_internal/websocket-cookies/third-party-cookie-blocked.https-expected.txt b/third_party/blink/web_tests/platform/linux-chrome/wpt_internal/websocket-cookies/third-party-cookie-blocked.https-expected.txt new file mode 100644 index 0000000..cacdec7 --- /dev/null +++ b/third_party/blink/web_tests/platform/linux-chrome/wpt_internal/websocket-cookies/third-party-cookie-blocked.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +[FAIL] Test third-party cookie blocking for WebSockets +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/platform/linux/virtual/plz-dedicated-worker/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt b/third_party/blink/web_tests/platform/linux/virtual/plz-dedicated-worker/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt index eb174529..7347362 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/plz-dedicated-worker/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt +++ b/third_party/blink/web_tests/platform/linux/virtual/plz-dedicated-worker/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt
@@ -1,34 +1,79 @@ This is a testharness.js-based test. +Found 66 tests; 40 PASS, 26 FAIL, 0 TIMEOUT, 0 NOTRUN. [PASS] initialize global state [FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code + assert_equals: expected "the worker script was served from network" but got "sw2 saw the request for the worker script" [FAIL] Case #1: network scope1->scope2 (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code + assert_equals: expected "the worker script was served from network" but got "sw2 saw the request for the worker script" [FAIL] Case #1: network scope1->scope2 (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code + assert_equals: expected "the worker script was served from network" but got "sw2 saw the request for the worker script" [FAIL] Case #1: network scope1->scope2 (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (module SharedWorker) - assert_unreached: Worker error Reached unreachable code + assert_equals: expected "the worker script was served from network" but got "sw2 saw the request for the worker script" +[PASS] Case #2: network scope1->out-scope (classic DedicatedWorker) +[PASS] Case #2: network scope1->out-scope (module DedicatedWorker) +[PASS] Case #2: network scope1->out-scope (classic SharedWorker) +[PASS] Case #2: network scope1->out-scope (module SharedWorker) +[PASS] Case #3: sw scope1->scope2 (classic DedicatedWorker) +[PASS] Case #3: sw scope1->scope2 (module DedicatedWorker) +[PASS] Case #3: sw scope1->scope2 (classic SharedWorker) +[PASS] Case #3: sw scope1->scope2 (module SharedWorker) [PASS] Case #4: sw scope1->out-scope (classic DedicatedWorker) [PASS] Case #4: sw scope1->out-scope (module DedicatedWorker) [PASS] Case #4: sw scope1->out-scope (classic SharedWorker) [PASS] Case #4: sw scope1->out-scope (module SharedWorker) [PASS] cleanup global state +[FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker, importScripts()) + assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/scope2/import-scripts-echo.py" but got "sw2 saw importScripts from the worker: /service-workers/service-worker/resources/subdir/import-scripts-echo.py" +[FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/scope2/simple.txt" but got "fetch(): sw2 saw the fetch from the worker: /service-workers/service-worker/resources/subdir/simple.txt" +[FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker, location.href) + assert_equals: location.href expected "https://web-platform.test:8444/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py" but got "https://web-platform.test:8444/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py?greeting=sw2%20saw%20the%20request%20for%20the%20worker%20script" +[PASS] Case #1: network scope1->scope2 (module DedicatedWorker, importScripts()) +[FAIL] Case #1: network scope1->scope2 (module DedicatedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/scope2/simple.txt" but got "fetch(): sw2 saw the fetch from the worker: /service-workers/service-worker/resources/subdir/simple.txt" +[FAIL] Case #1: network scope1->scope2 (module DedicatedWorker, location.href) + assert_equals: location.href expected "https://web-platform.test:8444/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py" but got "https://web-platform.test:8444/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py?greeting=sw2%20saw%20the%20request%20for%20the%20worker%20script" +[FAIL] Case #1: network scope1->scope2 (classic SharedWorker, importScripts()) + assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/scope2/import-scripts-echo.py" but got "sw2 saw importScripts from the worker: /service-workers/service-worker/resources/subdir/import-scripts-echo.py" +[FAIL] Case #1: network scope1->scope2 (classic SharedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/scope2/simple.txt" but got "fetch(): sw2 saw the fetch from the worker: /service-workers/service-worker/resources/subdir/simple.txt" +[FAIL] Case #1: network scope1->scope2 (classic SharedWorker, location.href) + assert_equals: location.href expected "https://web-platform.test:8444/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py" but got "https://web-platform.test:8444/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py?greeting=sw2%20saw%20the%20request%20for%20the%20worker%20script" +[PASS] Case #1: network scope1->scope2 (module SharedWorker, importScripts()) +[FAIL] Case #1: network scope1->scope2 (module SharedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/scope2/simple.txt" but got "fetch(): sw2 saw the fetch from the worker: /service-workers/service-worker/resources/subdir/simple.txt" +[FAIL] Case #1: network scope1->scope2 (module SharedWorker, location.href) + assert_equals: location.href expected "https://web-platform.test:8444/service-workers/service-worker/resources/scope2/worker_interception_redirect_webworker.py" but got "https://web-platform.test:8444/service-workers/service-worker/resources/subdir/worker_interception_redirect_webworker.py?greeting=sw2%20saw%20the%20request%20for%20the%20worker%20script" +[FAIL] Case #2: network scope1->out-scope (classic DedicatedWorker, importScripts()) + assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/import-scripts-echo.py" but got "importScripts: served from network" +[FAIL] Case #2: network scope1->out-scope (classic DedicatedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" +[PASS] Case #2: network scope1->out-scope (classic DedicatedWorker, location.href) +[PASS] Case #2: network scope1->out-scope (module DedicatedWorker, importScripts()) +[FAIL] Case #2: network scope1->out-scope (module DedicatedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" +[PASS] Case #2: network scope1->out-scope (module DedicatedWorker, location.href) +[FAIL] Case #2: network scope1->out-scope (classic SharedWorker, importScripts()) + assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/import-scripts-echo.py" but got "importScripts: served from network" +[FAIL] Case #2: network scope1->out-scope (classic SharedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" +[PASS] Case #2: network scope1->out-scope (classic SharedWorker, location.href) +[PASS] Case #2: network scope1->out-scope (module SharedWorker, importScripts()) +[FAIL] Case #2: network scope1->out-scope (module SharedWorker, fetch()) + assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" +[PASS] Case #2: network scope1->out-scope (module SharedWorker, location.href) +[PASS] Case #3: sw scope1->scope2 (classic DedicatedWorker, importScripts()) +[PASS] Case #3: sw scope1->scope2 (classic DedicatedWorker, fetch()) +[PASS] Case #3: sw scope1->scope2 (classic DedicatedWorker, location.href) +[PASS] Case #3: sw scope1->scope2 (module DedicatedWorker, importScripts()) +[PASS] Case #3: sw scope1->scope2 (module DedicatedWorker, fetch()) +[PASS] Case #3: sw scope1->scope2 (module DedicatedWorker, location.href) +[PASS] Case #3: sw scope1->scope2 (classic SharedWorker, importScripts()) +[PASS] Case #3: sw scope1->scope2 (classic SharedWorker, fetch()) +[PASS] Case #3: sw scope1->scope2 (classic SharedWorker, location.href) +[PASS] Case #3: sw scope1->scope2 (module SharedWorker, importScripts()) +[PASS] Case #3: sw scope1->scope2 (module SharedWorker, fetch()) +[PASS] Case #3: sw scope1->scope2 (module SharedWorker, location.href) [FAIL] Case #4: sw scope1->out-scope (classic DedicatedWorker, importScripts()) assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/import-scripts-echo.py" but got "importScripts: served from network" [FAIL] Case #4: sw scope1->out-scope (classic DedicatedWorker, fetch())
diff --git a/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt b/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt deleted file mode 100644 index 26fc548b..0000000 --- a/third_party/blink/web_tests/platform/mac-mac11-arm64/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt +++ /dev/null
@@ -1,44 +0,0 @@ -This is a testharness.js-based test. -[PASS] initialize global state -[FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #1: network scope1->scope2 (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #1: network scope1->scope2 (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #1: network scope1->scope2 (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #4: sw scope1->out-scope (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #4: sw scope1->out-scope (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[PASS] Case #4: sw scope1->out-scope (classic SharedWorker) -[PASS] Case #4: sw scope1->out-scope (module SharedWorker) -[PASS] cleanup global state -[FAIL] Case #4: sw scope1->out-scope (classic SharedWorker, importScripts()) - assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/import-scripts-echo.py" but got "importScripts: served from network" -[FAIL] Case #4: sw scope1->out-scope (classic SharedWorker, fetch()) - assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" -[PASS] Case #4: sw scope1->out-scope (classic SharedWorker, location.href) -[PASS] Case #4: sw scope1->out-scope (module SharedWorker, importScripts()) -[FAIL] Case #4: sw scope1->out-scope (module SharedWorker, fetch()) - assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\\n" -[PASS] Case #4: sw scope1->out-scope (module SharedWorker, location.href) -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/platform/mac-mac11/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt b/third_party/blink/web_tests/platform/mac-mac11/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt deleted file mode 100644 index 5555a5f..0000000 --- a/third_party/blink/web_tests/platform/mac-mac11/external/wpt/service-workers/service-worker/worker-interception-redirect.https-expected.txt +++ /dev/null
@@ -1,44 +0,0 @@ -This is a testharness.js-based test. -[PASS] initialize global state -[FAIL] Case #1: network scope1->scope2 (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #1: network scope1->scope2 (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #1: network scope1->scope2 (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #1: network scope1->scope2 (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #2: network scope1->out-scope (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (classic SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #3: sw scope1->scope2 (module SharedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #4: sw scope1->out-scope (classic DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[FAIL] Case #4: sw scope1->out-scope (module DedicatedWorker) - assert_unreached: Worker error Reached unreachable code -[PASS] Case #4: sw scope1->out-scope (classic SharedWorker) -[PASS] Case #4: sw scope1->out-scope (module SharedWorker) -[PASS] cleanup global state -[FAIL] Case #4: sw scope1->out-scope (classic SharedWorker, importScripts()) - assert_equals: expected "sw1 saw importScripts from the worker: /service-workers/service-worker/resources/import-scripts-echo.py" but got "importScripts: served from network" -[FAIL] Case #4: sw scope1->out-scope (classic SharedWorker, fetch()) - assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\n" -[PASS] Case #4: sw scope1->out-scope (classic SharedWorker, location.href) -[PASS] Case #4: sw scope1->out-scope (module SharedWorker, importScripts()) -[FAIL] Case #4: sw scope1->out-scope (module SharedWorker, fetch()) - assert_equals: expected "fetch(): sw1 saw the fetch from the worker: /service-workers/service-worker/resources/simple.txt" but got "fetch(): a simple text file\n" -[PASS] Case #4: sw scope1->out-scope (module SharedWorker, location.href) -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/resources/testdriver-vendor.js b/third_party/blink/web_tests/resources/testdriver-vendor.js index e041e0fa..fbee782 100644 --- a/third_party/blink/web_tests/resources/testdriver-vendor.js +++ b/third_party/blink/web_tests/resources/testdriver-vendor.js
@@ -542,8 +542,8 @@ return internals.dismissFedCmDialog(); } - window.test_driver_internal.confirm_idp_login = async function() { - return internals.confirmIdpLogin(); + window.test_driver_internal.click_fedcm_dialog_button = async function(dialog_button) { + return internals.clickFedCmDialogButton(dialog_button); } window.test_driver_internal.create_virtual_sensor = function(
diff --git a/third_party/blink/web_tests/virtual/saa-beyond-cookies-disabled/external/wpt/storage-access-api/storage-access-beyond-cookies.blobStorage.tentative.sub.https.window-expected.txt b/third_party/blink/web_tests/virtual/saa-beyond-cookies-disabled/external/wpt/storage-access-api/storage-access-beyond-cookies.blobStorage.tentative.sub.https.window-expected.txt new file mode 100644 index 0000000..61b5b7b --- /dev/null +++ b/third_party/blink/web_tests/virtual/saa-beyond-cookies-disabled/external/wpt/storage-access-api/storage-access-beyond-cookies.blobStorage.tentative.sub.https.window-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +[FAIL] Verify StorageAccessAPIBeyondCookies for Blob Storage + assert_equals: Storage Access API should be accessible and return first-party data expected "HasAccess for blobStorage" but got "Unable to load handle in same-origin context for blobStorage" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/wpt_internal/storage-access-api/resources/storage-access-origin-trial-iframe.html b/third_party/blink/web_tests/wpt_internal/storage-access-api/resources/storage-access-origin-trial-iframe.html index 4557dd9..3e589fa 100644 --- a/third_party/blink/web_tests/wpt_internal/storage-access-api/resources/storage-access-origin-trial-iframe.html +++ b/third_party/blink/web_tests/wpt_internal/storage-access-api/resources/storage-access-origin-trial-iframe.html
@@ -22,6 +22,8 @@ await handle.caches.keys(); await handle.getDirectory(); await handle.estimate(); + const url = handle.createObjectURL(new Blob(["TEST"])); + handle.revokeObjectURL(url); } catch (_) { message = "NoAccess"; }
diff --git a/third_party/blink/web_tests/wpt_internal/view-transition-types/view-transition-types-reserved-ref.html b/third_party/blink/web_tests/wpt_internal/view-transition-types/view-transition-types-reserved-ref.html new file mode 100644 index 0000000..9bd8dff --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/view-transition-types/view-transition-types-reserved-ref.html
@@ -0,0 +1,24 @@ +<!DOCTYPE html> +<title>View transitions: active-view-transition reserved keywords (ref)</title> +<link rel="help" href="https://www.w3.org/TR/css-transitions-2/"> +<link rel="author" href="mailto:vmpstr@chromium.org"> +<style> + +.test { + width: 100px; + height: 100px; + background: green; +} +#container { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-gap: 10px; +} +body { background: lightpink; } +</style> + +<div id="container"> + <div class="test"></div> + <div class="test"></div> + <div class="test"></div> +</div>
diff --git a/third_party/blink/web_tests/wpt_internal/view-transition-types/view-transition-types-reserved.html b/third_party/blink/web_tests/wpt_internal/view-transition-types/view-transition-types-reserved.html new file mode 100644 index 0000000..7bbbe5b --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/view-transition-types/view-transition-types-reserved.html
@@ -0,0 +1,69 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<title>View transitions: active-view-transition reserved keywords</title> +<link rel="help" href="https://www.w3.org/TR/css-transitions-2/"> +<link rel="author" href="mailto:vmpstr@chromium.org"> +<link rel="match" href="view-transition-types-reserved-ref.html"> + +<script src="/common/reftest-wait.js"></script> +<style> + +html:active-view-transition(foo) #positive1 { background: green; } +html:active-view-transition(none, NoNe) #negative1 { background: red; } +html:active-view-transition(-ua-foo, -UA-foo) #negative2 { background: red; } + +.test { + width: 100px; + height: 100px; +} +#positive1 { view-transition-name: positive1; background: red } +#negative1 { view-transition-name: negative1; background: green } +#negative2 { view-transition-name: negative2; background: green } + +#container { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-gap: 10px; +} + +html::view-transition-group(*) { + animation-play-state: paused; +} + +html::view-transition-new(*) { + animation: unset; + opacity: 0; +} + +html::view-transition-old(*) { + animation: unset; + opacity: 1; +} + +html::view-transition-group(root) { + display: none; +} + +html::view-transition { background: red; } +/* also test this type of construct */ +html:active-view-transition(*)::view-transition { background: lightpink } +</style> + +<div id="container"> + <div class="test" id="positive1"></div> + <div class="test" id="negative1"></div> + <div class="test" id="negative2"></div> +</div> + +<script> +failIfNot(document.startViewTransition, "Missing document.startViewTransition"); + +function runTest() { + let transition = document.startViewTransition({ + type: ["-ua-foo", "none", "foo", "NoNe", "-UA-foo"] + }); + transition.ready.then(takeScreenshot); +} +onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest)); +</script> +</html>
diff --git a/third_party/catapult b/third_party/catapult index 84fb1a2..5a57691 160000 --- a/third_party/catapult +++ b/third_party/catapult
@@ -1 +1 @@ -Subproject commit 84fb1a2dd0db549933ae487a763ce77d6bcb171a +Subproject commit 5a57691454ee8bae85c8b856ed9d03db951ede14
diff --git a/third_party/chromite b/third_party/chromite index eacd3aa..598bf5a 160000 --- a/third_party/chromite +++ b/third_party/chromite
@@ -1 +1 @@ -Subproject commit eacd3aac0c2cd69a4040c450f09a6d8133b38791 +Subproject commit 598bf5a6d5e4b97107e8d4528dec0c3c011bf038
diff --git a/third_party/dawn b/third_party/dawn index cb10a35..691b305 160000 --- a/third_party/dawn +++ b/third_party/dawn
@@ -1 +1 @@ -Subproject commit cb10a354ea6d051457c2912563f0da4288f3351f +Subproject commit 691b30570104591a5a4870bffb1e40a7e0c133fa
diff --git a/third_party/depot_tools b/third_party/depot_tools index a83e690..3a66263 160000 --- a/third_party/depot_tools +++ b/third_party/depot_tools
@@ -1 +1 @@ -Subproject commit a83e6906622848185f5eb4e974ec35586dfe5043 +Subproject commit 3a66263cd2e68e3085d4563fb61fa53a51caee21
diff --git a/third_party/devtools-frontend-internal b/third_party/devtools-frontend-internal index 108ae7c..f86b29c 160000 --- a/third_party/devtools-frontend-internal +++ b/third_party/devtools-frontend-internal
@@ -1 +1 @@ -Subproject commit 108ae7ce925d5b6a4691eee6f6e5bafe9e41b8bc +Subproject commit f86b29c9164948f7084ad112ff18c81597da2dd1
diff --git a/third_party/devtools-frontend/src b/third_party/devtools-frontend/src index fd66b84..c4b8331 160000 --- a/third_party/devtools-frontend/src +++ b/third_party/devtools-frontend/src
@@ -1 +1 @@ -Subproject commit fd66b840a076b7c161543dc94828ee2ce0bcc4c1 +Subproject commit c4b83319a573ccd35afe6ab9993ecef075eb2150
diff --git a/third_party/libvpx/README.chromium b/third_party/libvpx/README.chromium index 285a6e53..1341461 100644 --- a/third_party/libvpx/README.chromium +++ b/third_party/libvpx/README.chromium
@@ -1,7 +1,7 @@ Name: libvpx URL: https://chromium.googlesource.com/webm/libvpx Version: N/A -Revision: 424723dc025ce451dab9568239a46b18d0919b4d +Revision: 0d3ef6ffd22bda0ba1ec1bf9c7a24852e4a1d111 CPEPrefix: cpe:/a:webmproject:libvpx:1.13.1 License: BSD License File: source/libvpx/LICENSE
diff --git a/third_party/libvpx/source/config/ios/arm-neon/vpx_config.asm b/third_party/libvpx/source/config/ios/arm-neon/vpx_config.asm index d9f27ea..cae979c 100644 --- a/third_party/libvpx/source/config/ios/arm-neon/vpx_config.asm +++ b/third_party/libvpx/source/config/ios/arm-neon/vpx_config.asm
@@ -20,6 +20,7 @@ .equ HAVE_NEON , 1 .equ HAVE_NEON_DOTPROD , 0 .equ HAVE_NEON_I8MM , 0 +.equ HAVE_SVE , 0 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/ios/arm-neon/vpx_config.h b/third_party/libvpx/source/config/ios/arm-neon/vpx_config.h index f0b367f..524ade7b 100644 --- a/third_party/libvpx/source/config/ios/arm-neon/vpx_config.h +++ b/third_party/libvpx/source/config/ios/arm-neon/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 1 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/ios/arm64/vpx_config.asm b/third_party/libvpx/source/config/ios/arm64/vpx_config.asm index 6d651bab..93f23af 100644 --- a/third_party/libvpx/source/config/ios/arm64/vpx_config.asm +++ b/third_party/libvpx/source/config/ios/arm64/vpx_config.asm
@@ -20,6 +20,7 @@ .equ HAVE_NEON , 1 .equ HAVE_NEON_DOTPROD , 1 .equ HAVE_NEON_I8MM , 1 +.equ HAVE_SVE , 1 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/ios/arm64/vpx_config.h b/third_party/libvpx/source/config/ios/arm64/vpx_config.h index 9eab8fd..7fd76e9 100644 --- a/third_party/libvpx/source/config/ios/arm64/vpx_config.h +++ b/third_party/libvpx/source/config/ios/arm64/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 1 #define HAVE_NEON_DOTPROD 1 #define HAVE_NEON_I8MM 1 +#define HAVE_SVE 1 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/arm-neon-cpu-detect/vpx_config.asm b/third_party/libvpx/source/config/linux/arm-neon-cpu-detect/vpx_config.asm index f212f911..be8b95fe 100644 --- a/third_party/libvpx/source/config/linux/arm-neon-cpu-detect/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/arm-neon-cpu-detect/vpx_config.asm
@@ -19,6 +19,7 @@ .equ HAVE_NEON , 1 .equ HAVE_NEON_DOTPROD , 0 .equ HAVE_NEON_I8MM , 0 +.equ HAVE_SVE , 0 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/linux/arm-neon-cpu-detect/vpx_config.h b/third_party/libvpx/source/config/linux/arm-neon-cpu-detect/vpx_config.h index 041f978..2795965 100644 --- a/third_party/libvpx/source/config/linux/arm-neon-cpu-detect/vpx_config.h +++ b/third_party/libvpx/source/config/linux/arm-neon-cpu-detect/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 1 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/arm-neon-highbd/vpx_config.asm b/third_party/libvpx/source/config/linux/arm-neon-highbd/vpx_config.asm index 162f2cd..2234002 100644 --- a/third_party/libvpx/source/config/linux/arm-neon-highbd/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/arm-neon-highbd/vpx_config.asm
@@ -19,6 +19,7 @@ .equ HAVE_NEON , 1 .equ HAVE_NEON_DOTPROD , 0 .equ HAVE_NEON_I8MM , 0 +.equ HAVE_SVE , 0 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/linux/arm-neon-highbd/vpx_config.h b/third_party/libvpx/source/config/linux/arm-neon-highbd/vpx_config.h index 0f4ff22..98113cf 100644 --- a/third_party/libvpx/source/config/linux/arm-neon-highbd/vpx_config.h +++ b/third_party/libvpx/source/config/linux/arm-neon-highbd/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 1 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/arm-neon/vpx_config.asm b/third_party/libvpx/source/config/linux/arm-neon/vpx_config.asm index 83c9778..4858a5cc 100644 --- a/third_party/libvpx/source/config/linux/arm-neon/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/arm-neon/vpx_config.asm
@@ -19,6 +19,7 @@ .equ HAVE_NEON , 1 .equ HAVE_NEON_DOTPROD , 0 .equ HAVE_NEON_I8MM , 0 +.equ HAVE_SVE , 0 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/linux/arm-neon/vpx_config.h b/third_party/libvpx/source/config/linux/arm-neon/vpx_config.h index f0b367f..524ade7b 100644 --- a/third_party/libvpx/source/config/linux/arm-neon/vpx_config.h +++ b/third_party/libvpx/source/config/linux/arm-neon/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 1 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/arm/vpx_config.asm b/third_party/libvpx/source/config/linux/arm/vpx_config.asm index e3c3e69..a96f04d 100644 --- a/third_party/libvpx/source/config/linux/arm/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/arm/vpx_config.asm
@@ -19,6 +19,7 @@ .equ HAVE_NEON , 0 .equ HAVE_NEON_DOTPROD , 0 .equ HAVE_NEON_I8MM , 0 +.equ HAVE_SVE , 0 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/linux/arm/vpx_config.h b/third_party/libvpx/source/config/linux/arm/vpx_config.h index b1237623..36b136b 100644 --- a/third_party/libvpx/source/config/linux/arm/vpx_config.h +++ b/third_party/libvpx/source/config/linux/arm/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/arm64-highbd/vpx_config.asm b/third_party/libvpx/source/config/linux/arm64-highbd/vpx_config.asm index 3a7b4aff3..8fd3212 100644 --- a/third_party/libvpx/source/config/linux/arm64-highbd/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/arm64-highbd/vpx_config.asm
@@ -19,6 +19,7 @@ .equ HAVE_NEON , 1 .equ HAVE_NEON_DOTPROD , 1 .equ HAVE_NEON_I8MM , 1 +.equ HAVE_SVE , 1 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/linux/arm64-highbd/vpx_config.h b/third_party/libvpx/source/config/linux/arm64-highbd/vpx_config.h index 82ef2af7..8c8fedb 100644 --- a/third_party/libvpx/source/config/linux/arm64-highbd/vpx_config.h +++ b/third_party/libvpx/source/config/linux/arm64-highbd/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 1 #define HAVE_NEON_DOTPROD 1 #define HAVE_NEON_I8MM 1 +#define HAVE_SVE 1 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/arm64/vpx_config.asm b/third_party/libvpx/source/config/linux/arm64/vpx_config.asm index 840d5b7..df773c24 100644 --- a/third_party/libvpx/source/config/linux/arm64/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/arm64/vpx_config.asm
@@ -19,6 +19,7 @@ .equ HAVE_NEON , 1 .equ HAVE_NEON_DOTPROD , 1 .equ HAVE_NEON_I8MM , 1 +.equ HAVE_SVE , 1 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/linux/arm64/vpx_config.h b/third_party/libvpx/source/config/linux/arm64/vpx_config.h index 9eab8fd..7fd76e9 100644 --- a/third_party/libvpx/source/config/linux/arm64/vpx_config.h +++ b/third_party/libvpx/source/config/linux/arm64/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 1 #define HAVE_NEON_DOTPROD 1 #define HAVE_NEON_I8MM 1 +#define HAVE_SVE 1 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/generic/vpx_config.asm b/third_party/libvpx/source/config/linux/generic/vpx_config.asm index 6bb1bd0..bbba6ce 100644 --- a/third_party/libvpx/source/config/linux/generic/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/generic/vpx_config.asm
@@ -19,6 +19,7 @@ .equ HAVE_NEON , 0 .equ HAVE_NEON_DOTPROD , 0 .equ HAVE_NEON_I8MM , 0 +.equ HAVE_SVE , 0 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/linux/generic/vpx_config.h b/third_party/libvpx/source/config/linux/generic/vpx_config.h index e57e0fb..959a351 100644 --- a/third_party/libvpx/source/config/linux/generic/vpx_config.h +++ b/third_party/libvpx/source/config/linux/generic/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/ia32/vpx_config.asm b/third_party/libvpx/source/config/linux/ia32/vpx_config.asm index d18edd5d..6236e61 100644 --- a/third_party/libvpx/source/config/linux/ia32/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/ia32/vpx_config.asm
@@ -16,6 +16,7 @@ %define HAVE_NEON 0 %define HAVE_NEON_DOTPROD 0 %define HAVE_NEON_I8MM 0 +%define HAVE_SVE 0 %define HAVE_MIPS32 0 %define HAVE_DSPR2 0 %define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/ia32/vpx_config.h b/third_party/libvpx/source/config/linux/ia32/vpx_config.h index a7d7ffd..1263633 100644 --- a/third_party/libvpx/source/config/linux/ia32/vpx_config.h +++ b/third_party/libvpx/source/config/linux/ia32/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/loongarch/vpx_config.h b/third_party/libvpx/source/config/linux/loongarch/vpx_config.h index 591d59d..48ceaf7 100644 --- a/third_party/libvpx/source/config/linux/loongarch/vpx_config.h +++ b/third_party/libvpx/source/config/linux/loongarch/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/mips64el/vpx_config.h b/third_party/libvpx/source/config/linux/mips64el/vpx_config.h index e3c1c11..f8df3a4 100644 --- a/third_party/libvpx/source/config/linux/mips64el/vpx_config.h +++ b/third_party/libvpx/source/config/linux/mips64el/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/mipsel/vpx_config.h b/third_party/libvpx/source/config/linux/mipsel/vpx_config.h index 308bb7b..27b886f 100644 --- a/third_party/libvpx/source/config/linux/mipsel/vpx_config.h +++ b/third_party/libvpx/source/config/linux/mipsel/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 1 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/ppc64/vpx_config.asm b/third_party/libvpx/source/config/linux/ppc64/vpx_config.asm index 5aee4f1..cf14597 100644 --- a/third_party/libvpx/source/config/linux/ppc64/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/ppc64/vpx_config.asm
@@ -19,6 +19,7 @@ .equ HAVE_NEON , 0 .equ HAVE_NEON_DOTPROD , 0 .equ HAVE_NEON_I8MM , 0 +.equ HAVE_SVE , 0 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/linux/ppc64/vpx_config.h b/third_party/libvpx/source/config/linux/ppc64/vpx_config.h index f0c2029f..8be04cc 100644 --- a/third_party/libvpx/source/config/linux/ppc64/vpx_config.h +++ b/third_party/libvpx/source/config/linux/ppc64/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/x64/vpx_config.asm b/third_party/libvpx/source/config/linux/x64/vpx_config.asm index e161a77..df0d7b61 100644 --- a/third_party/libvpx/source/config/linux/x64/vpx_config.asm +++ b/third_party/libvpx/source/config/linux/x64/vpx_config.asm
@@ -16,6 +16,7 @@ %define HAVE_NEON 0 %define HAVE_NEON_DOTPROD 0 %define HAVE_NEON_I8MM 0 +%define HAVE_SVE 0 %define HAVE_MIPS32 0 %define HAVE_DSPR2 0 %define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/linux/x64/vpx_config.h b/third_party/libvpx/source/config/linux/x64/vpx_config.h index 57fd067..7a069b8 100644 --- a/third_party/libvpx/source/config/linux/x64/vpx_config.h +++ b/third_party/libvpx/source/config/linux/x64/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/mac/ia32/vpx_config.asm b/third_party/libvpx/source/config/mac/ia32/vpx_config.asm index d18edd5d..6236e61 100644 --- a/third_party/libvpx/source/config/mac/ia32/vpx_config.asm +++ b/third_party/libvpx/source/config/mac/ia32/vpx_config.asm
@@ -16,6 +16,7 @@ %define HAVE_NEON 0 %define HAVE_NEON_DOTPROD 0 %define HAVE_NEON_I8MM 0 +%define HAVE_SVE 0 %define HAVE_MIPS32 0 %define HAVE_DSPR2 0 %define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/mac/ia32/vpx_config.h b/third_party/libvpx/source/config/mac/ia32/vpx_config.h index a7d7ffd..1263633 100644 --- a/third_party/libvpx/source/config/mac/ia32/vpx_config.h +++ b/third_party/libvpx/source/config/mac/ia32/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/mac/x64/vpx_config.asm b/third_party/libvpx/source/config/mac/x64/vpx_config.asm index e161a77..df0d7b61 100644 --- a/third_party/libvpx/source/config/mac/x64/vpx_config.asm +++ b/third_party/libvpx/source/config/mac/x64/vpx_config.asm
@@ -16,6 +16,7 @@ %define HAVE_NEON 0 %define HAVE_NEON_DOTPROD 0 %define HAVE_NEON_I8MM 0 +%define HAVE_SVE 0 %define HAVE_MIPS32 0 %define HAVE_DSPR2 0 %define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/mac/x64/vpx_config.h b/third_party/libvpx/source/config/mac/x64/vpx_config.h index 57fd067..7a069b8 100644 --- a/third_party/libvpx/source/config/mac/x64/vpx_config.h +++ b/third_party/libvpx/source/config/mac/x64/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/nacl/vpx_config.h b/third_party/libvpx/source/config/nacl/vpx_config.h index e57e0fb..959a351 100644 --- a/third_party/libvpx/source/config/nacl/vpx_config.h +++ b/third_party/libvpx/source/config/nacl/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/vpx_version.h b/third_party/libvpx/source/config/vpx_version.h index fdef007..3a0fa4d0 100644 --- a/third_party/libvpx/source/config/vpx_version.h +++ b/third_party/libvpx/source/config/vpx_version.h
@@ -2,8 +2,8 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 13 #define VERSION_PATCH 1 -#define VERSION_EXTRA "500-g424723dc0" +#define VERSION_EXTRA "510-g0d3ef6ffd" #define VERSION_PACKED \ ((VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | (VERSION_PATCH)) -#define VERSION_STRING_NOSP "v1.13.1-500-g424723dc0" -#define VERSION_STRING " v1.13.1-500-g424723dc0" +#define VERSION_STRING_NOSP "v1.13.1-510-g0d3ef6ffd" +#define VERSION_STRING " v1.13.1-510-g0d3ef6ffd"
diff --git a/third_party/libvpx/source/config/win/arm64-highbd/vpx_config.asm b/third_party/libvpx/source/config/win/arm64-highbd/vpx_config.asm index 6db2fd49..b2d66f49 100644 --- a/third_party/libvpx/source/config/win/arm64-highbd/vpx_config.asm +++ b/third_party/libvpx/source/config/win/arm64-highbd/vpx_config.asm
@@ -20,6 +20,7 @@ .equ HAVE_NEON , 1 .equ HAVE_NEON_DOTPROD , 1 .equ HAVE_NEON_I8MM , 1 +.equ HAVE_SVE , 1 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0
diff --git a/third_party/libvpx/source/config/win/arm64-highbd/vpx_config.h b/third_party/libvpx/source/config/win/arm64-highbd/vpx_config.h index 892d582..4ebb325 100644 --- a/third_party/libvpx/source/config/win/arm64-highbd/vpx_config.h +++ b/third_party/libvpx/source/config/win/arm64-highbd/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 1 #define HAVE_NEON_DOTPROD 1 #define HAVE_NEON_I8MM 1 +#define HAVE_SVE 1 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/win/ia32/vpx_config.asm b/third_party/libvpx/source/config/win/ia32/vpx_config.asm index 3954d87c..3d13c73 100644 --- a/third_party/libvpx/source/config/win/ia32/vpx_config.asm +++ b/third_party/libvpx/source/config/win/ia32/vpx_config.asm
@@ -16,6 +16,7 @@ %define HAVE_NEON 0 %define HAVE_NEON_DOTPROD 0 %define HAVE_NEON_I8MM 0 +%define HAVE_SVE 0 %define HAVE_MIPS32 0 %define HAVE_DSPR2 0 %define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/win/ia32/vpx_config.h b/third_party/libvpx/source/config/win/ia32/vpx_config.h index 94f6578..a49bebd 100644 --- a/third_party/libvpx/source/config/win/ia32/vpx_config.h +++ b/third_party/libvpx/source/config/win/ia32/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/win/x64/vpx_config.asm b/third_party/libvpx/source/config/win/x64/vpx_config.asm index 57da387..57f333cf 100644 --- a/third_party/libvpx/source/config/win/x64/vpx_config.asm +++ b/third_party/libvpx/source/config/win/x64/vpx_config.asm
@@ -16,6 +16,7 @@ %define HAVE_NEON 0 %define HAVE_NEON_DOTPROD 0 %define HAVE_NEON_I8MM 0 +%define HAVE_SVE 0 %define HAVE_MIPS32 0 %define HAVE_DSPR2 0 %define HAVE_MSA 0
diff --git a/third_party/libvpx/source/config/win/x64/vpx_config.h b/third_party/libvpx/source/config/win/x64/vpx_config.h index 2f10c726..8fd7e00 100644 --- a/third_party/libvpx/source/config/win/x64/vpx_config.h +++ b/third_party/libvpx/source/config/win/x64/vpx_config.h
@@ -28,6 +28,7 @@ #define HAVE_NEON 0 #define HAVE_NEON_DOTPROD 0 #define HAVE_NEON_I8MM 0 +#define HAVE_SVE 0 #define HAVE_MIPS32 0 #define HAVE_DSPR2 0 #define HAVE_MSA 0
diff --git a/third_party/libvpx/source/libvpx b/third_party/libvpx/source/libvpx index 424723d..0d3ef6f 160000 --- a/third_party/libvpx/source/libvpx +++ b/third_party/libvpx/source/libvpx
@@ -1 +1 @@ -Subproject commit 424723dc025ce451dab9568239a46b18d0919b4d +Subproject commit 0d3ef6ffd22bda0ba1ec1bf9c7a24852e4a1d111
diff --git a/third_party/perfetto b/third_party/perfetto index ed90e27..978c458 160000 --- a/third_party/perfetto +++ b/third_party/perfetto
@@ -1 +1 @@ -Subproject commit ed90e2735442263d54f02f2aa7410762f653d9c8 +Subproject commit 978c4586ae203718174455aa228b39d1f07defe3
diff --git a/third_party/rust/Cargo.lock b/third_party/rust/Cargo.lock index f1e2640..43fa47de 100644 --- a/third_party/rust/Cargo.lock +++ b/third_party/rust/Cargo.lock
@@ -100,7 +100,7 @@ [[package]] name = "cxx" -version = "1.0.107" +version = "1.0.110" dependencies = [ "cxxbridge-macro", "link-cplusplus", @@ -108,7 +108,7 @@ [[package]] name = "cxxbridge-cmd" -version = "1.0.107" +version = "1.0.110" dependencies = [ "clap", "codespan-reporting", @@ -119,7 +119,7 @@ [[package]] name = "cxxbridge-macro" -version = "1.0.107" +version = "1.0.110" dependencies = [ "proc-macro2", "quote",
diff --git a/third_party/rust/cxx/v1/BUILD.gn b/third_party/rust/cxx/v1/BUILD.gn index a407cd4..77e43522 100644 --- a/third_party/rust/cxx/v1/BUILD.gn +++ b/third_party/rust/cxx/v1/BUILD.gn
@@ -160,7 +160,7 @@ # Unit tests skipped. Generate with --with-tests to include them. build_native_rust_unit_tests = false edition = "2021" - cargo_pkg_version = "1.0.107" + cargo_pkg_version = "1.0.110" cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>" cargo_pkg_name = "cxx" cargo_pkg_description = "Safe interop between Rust and C++"
diff --git a/third_party/rust/cxx/v1/README.chromium b/third_party/rust/cxx/v1/README.chromium index 179d61d..61fec20 100644 --- a/third_party/rust/cxx/v1/README.chromium +++ b/third_party/rust/cxx/v1/README.chromium
@@ -1,9 +1,9 @@ Name: cxx URL: https://crates.io/crates/cxx Description: Safe interop between Rust and C++ -Version: 1.0.107 +Version: 1.0.110 Security Critical: yes Shipped: yes License: Apache 2.0 License File: -Revision: 51ded1be5e27c2c1eac145064af3ccc41ea056bf +Revision: 306019c5a7434aa7424a83720a09c40e1ea12343
diff --git a/third_party/rust/cxx/v1/crate/.cargo_vcs_info.json b/third_party/rust/cxx/v1/crate/.cargo_vcs_info.json index 92efaa41..27a93fc 100644 --- a/third_party/rust/cxx/v1/crate/.cargo_vcs_info.json +++ b/third_party/rust/cxx/v1/crate/.cargo_vcs_info.json
@@ -1,6 +1,6 @@ { "git": { - "sha1": "51ded1be5e27c2c1eac145064af3ccc41ea056bf" + "sha1": "306019c5a7434aa7424a83720a09c40e1ea12343" }, "path_in_vcs": "" } \ No newline at end of file
diff --git a/third_party/rust/cxx/v1/crate/.github/workflows/buck2.yml b/third_party/rust/cxx/v1/crate/.github/workflows/buck2.yml new file mode 100644 index 0000000..9231e34 --- /dev/null +++ b/third_party/rust/cxx/v1/crate/.github/workflows/buck2.yml
@@ -0,0 +1,30 @@ +name: Buck2 + +on: + push: + workflow_dispatch: + schedule: [cron: "40 1,13 * * *"] + +permissions: + contents: read + +jobs: + buck2: + name: Buck2 on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}} + runs-on: ${{matrix.os}}-latest + strategy: + fail-fast: false + matrix: + os: [ubuntu, macos, windows] + timeout-minutes: 45 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rust-src + - uses: dtolnay/install-buck2@latest + - name: Update buck2-prelude submodule + run: git submodule update --init --remote --no-fetch --depth 1 --single-branch tools/buck/prelude + - run: buck2 run demo + - run: buck2 build ... + - run: buck2 test ...
diff --git a/third_party/rust/cxx/v1/crate/.github/workflows/ci.yml b/third_party/rust/cxx/v1/crate/.github/workflows/ci.yml index d3c5233..720e918 100644 --- a/third_party/rust/cxx/v1/crate/.github/workflows/ci.yml +++ b/third_party/rust/cxx/v1/crate/.github/workflows/ci.yml
@@ -42,7 +42,7 @@ - name: Enable symlinks (windows) if: matrix.os == 'windows' run: git config --global core.symlinks true - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{matrix.rust}} @@ -70,34 +70,13 @@ env: RUSTFLAGS: --cfg compile_error_if_alloc --cfg cxx_experimental_no_alloc ${{env.RUSTFLAGS}} - buck: - name: Buck2 on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}} - runs-on: ${{matrix.os}}-latest - if: github.event_name != 'pull_request' - strategy: - fail-fast: false - matrix: - os: [ubuntu, macos, windows] - timeout-minutes: 45 - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - with: - components: rust-src - - uses: dtolnay/install-buck2@latest - - name: Update buck2-prelude submodule - run: git submodule update --init --remote --no-fetch --depth 1 --single-branch tools/buck/prelude - - run: buck2 run demo - - run: buck2 build ... - - run: buck2 test ... - reindeer: name: Reindeer runs-on: ubuntu-latest if: github.event_name != 'pull_request' timeout-minutes: 45 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: components: rust-src @@ -117,7 +96,7 @@ os: [ubuntu, macos, windows] timeout-minutes: 45 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install lld run: sudo apt-get install lld if: matrix.os == 'ubuntu' @@ -134,18 +113,38 @@ runs-on: ubuntu-latest timeout-minutes: 45 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - run: cargo generate-lockfile -Z minimal-versions - run: cargo check --locked --workspace + doc: + name: Documentation + needs: pre_ci + if: needs.pre_ci.outputs.continue + runs-on: ubuntu-latest + timeout-minutes: 45 + env: + RUSTDOCFLAGS: -Dwarnings + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rust-src + - uses: dtolnay/install@cargo-docs-rs + - run: cargo docs-rs + - run: cargo docs-rs -p cxx-build + - run: cargo docs-rs -p cxx-gen + - run: cargo docs-rs -p cxxbridge-flags + - run: cargo docs-rs -p cxxbridge-macro + clippy: name: Clippy runs-on: ubuntu-latest if: github.event_name != 'pull_request' timeout-minutes: 45 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly with: components: clippy, rust-src @@ -158,7 +157,7 @@ if: github.event_name != 'pull_request' timeout-minutes: 45 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install clang-tidy run: sudo apt-get install clang-tidy-11 - name: Run clang-tidy @@ -170,6 +169,6 @@ if: github.event_name != 'pull_request' timeout-minutes: 45 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/install@cargo-outdated - run: cargo outdated --workspace --exit-code 1
diff --git a/third_party/rust/cxx/v1/crate/.github/workflows/install.yml b/third_party/rust/cxx/v1/crate/.github/workflows/install.yml new file mode 100644 index 0000000..025fe23 --- /dev/null +++ b/third_party/rust/cxx/v1/crate/.github/workflows/install.yml
@@ -0,0 +1,18 @@ +name: Install + +on: + workflow_dispatch: + schedule: [cron: "40 1 * * *"] + push: {tags: ['*']} + +permissions: {} + +env: + RUSTFLAGS: -Dwarnings + +jobs: + install: + name: Install + uses: dtolnay/.github/.github/workflows/check_install.yml@master + with: + crate: cxxbridge-cmd
diff --git a/third_party/rust/cxx/v1/crate/.github/workflows/site.yml b/third_party/rust/cxx/v1/crate/.github/workflows/site.yml index b9cfd27..555be195 100644 --- a/third_party/rust/cxx/v1/crate/.github/workflows/site.yml +++ b/third_party/rust/cxx/v1/crate/.github/workflows/site.yml
@@ -17,7 +17,7 @@ contents: write timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/install@mdbook - run: mdbook --version
diff --git a/third_party/rust/cxx/v1/crate/Cargo.toml b/third_party/rust/cxx/v1/crate/Cargo.toml index 26be3135..abcdac8 100644 --- a/third_party/rust/cxx/v1/crate/Cargo.toml +++ b/third_party/rust/cxx/v1/crate/Cargo.toml
@@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.60" name = "cxx" -version = "1.0.107" +version = "1.0.110" authors = ["David Tolnay <dtolnay@gmail.com>"] links = "cxxbridge1" exclude = [ @@ -52,6 +52,7 @@ visibility = [\"//visibility:public\"], ) """ +deps = [":cxx_cc"] gen_build_script = false [package.metadata.bazel.extra_aliased_targets] @@ -69,13 +70,13 @@ doc-scrape-examples = false [dependencies.cxxbridge-macro] -version = "=1.0.107" +version = "=1.0.110" [dependencies.link-cplusplus] version = "1.0.9" [dev-dependencies.cxx-build] -version = "=1.0.107" +version = "=1.0.110" [dev-dependencies.cxx-gen] version = "0.7" @@ -90,24 +91,22 @@ version = "1.0.81" features = ["diff"] -# Removed for Chromium build. -#[build-dependencies.cc] -#version = "1.0.79" +# Removed for Chromium build +# [build-dependencies.cc] +# version = "1.0.79" -# Removed for Chromium build. -#[build-dependencies.cxxbridge-flags] -#version = "=1.0.107" -#default-features = false +# Removed for Chromium build +# [build-dependencies.cxxbridge-flags] +# version = "=1.0.110" +# default-features = false [features] alloc = [] -# Removed for Chromium build. -#"c++14" = ["cxxbridge-flags/c++14"] -#"c++17" = ["cxxbridge-flags/c++17"] -#"c++20" = ["cxxbridge-flags/c++20"] +# "c++14" = ["cxxbridge-flags/c++14"] +# "c++17" = ["cxxbridge-flags/c++17"] +# "c++20" = ["cxxbridge-flags/c++20"] default = [ "std", - # Removed for Chromium build. - #"cxxbridge-flags/default", + # "cxxbridge-flags/default", ] std = ["alloc"]
diff --git a/third_party/rust/cxx/v1/crate/Cargo.toml.orig b/third_party/rust/cxx/v1/crate/Cargo.toml.orig index 0f7ff96d6..36b7177 100644 --- a/third_party/rust/cxx/v1/crate/Cargo.toml.orig +++ b/third_party/rust/cxx/v1/crate/Cargo.toml.orig
@@ -1,109 +1,69 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies. -# -# If you are reading this file be aware that the original Cargo.toml -# will likely look very different (and much more reasonable). -# See Cargo.toml.orig for the original contents. - [package] -edition = "2021" -rust-version = "1.60" name = "cxx" -version = "1.0.107" +version = "1.0.110" authors = ["David Tolnay <dtolnay@gmail.com>"] -links = "cxxbridge1" -exclude = [ - "/demo", - "/gen", - "/syntax", - "/third-party", - "/tools/buck/prelude", -] +categories = ["development-tools::ffi", "api-bindings", "no-std"] description = "Safe interop between Rust and C++" -homepage = "https://cxx.rs" documentation = "https://docs.rs/cxx" -readme = "README.md" -keywords = [ - "ffi", - "c++", -] -categories = [ - "development-tools::ffi", - "api-bindings", - "no-std", -] +edition = "2021" +exclude = ["/demo", "/gen", "/syntax", "/third-party", "/tools/buck/prelude"] +homepage = "https://cxx.rs" +keywords = ["ffi", "c++"] license = "MIT OR Apache-2.0" +links = "cxxbridge1" repository = "https://github.com/dtolnay/cxx" +rust-version = "1.60" -[package.metadata.bazel] -additive_build_file_content = """ -cc_library( - name = \"cxx_cc\", - srcs = [\"src/cxx.cc\"], - hdrs = [\"include/cxx.h\"], - include_prefix = \"rust\", - includes = [\"include\"], - linkstatic = True, - strip_include_prefix = \"include\", - visibility = [\"//visibility:public\"], -) -""" -gen_build_script = false +[features] +default = ["std", "cxxbridge-flags/default"] # c++11 +"c++14" = ["cxxbridge-flags/c++14"] +"c++17" = ["cxxbridge-flags/c++17"] +"c++20" = ["cxxbridge-flags/c++20"] +alloc = [] +std = ["alloc"] -[package.metadata.bazel.extra_aliased_targets] -cxx_cc = "cxx_cc" +[dependencies] +cxxbridge-macro = { version = "=1.0.110", path = "macro" } +link-cplusplus = "1.0.9" -[package.metadata.docs.rs] -rustdoc-args = [ - "--cfg", - "doc_cfg", - "--generate-link-to-definition", -] -targets = ["x86_64-unknown-linux-gnu"] +[build-dependencies] +cc = "1.0.79" +cxxbridge-flags = { version = "=1.0.110", path = "flags", default-features = false } + +[dev-dependencies] +cxx-build = { version = "=1.0.110", path = "gen/build" } +cxx-gen = { version = "0.7", path = "gen/lib" } +cxx-test-suite = { version = "0", path = "tests/ffi" } +rustversion = "1.0.13" +trybuild = { version = "1.0.81", features = ["diff"] } [lib] doc-scrape-examples = false -[dependencies.cxxbridge-macro] -version = "=1.0.107" +[workspace] +members = ["demo", "flags", "gen/build", "gen/cmd", "gen/lib", "macro", "tests/ffi"] -[dependencies.link-cplusplus] -version = "1.0.9" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"] -[dev-dependencies.cxx-build] -version = "=1.0.107" +[package.metadata.bazel] +additive_build_file_content = """ +cc_library( + name = "cxx_cc", + srcs = ["src/cxx.cc"], + hdrs = ["include/cxx.h"], + include_prefix = "rust", + includes = ["include"], + linkstatic = True, + strip_include_prefix = "include", + visibility = ["//visibility:public"], +) +""" +deps = [":cxx_cc"] +extra_aliased_targets = { cxx_cc = "cxx_cc" } +gen_build_script = false -[dev-dependencies.cxx-gen] -version = "0.7" - -[dev-dependencies.cxx-test-suite] -version = "0" - -[dev-dependencies.rustversion] -version = "1.0.13" - -[dev-dependencies.trybuild] -version = "1.0.81" -features = ["diff"] - -[build-dependencies.cc] -version = "1.0.79" - -[build-dependencies.cxxbridge-flags] -version = "=1.0.107" -default-features = false - -[features] -alloc = [] -"c++14" = ["cxxbridge-flags/c++14"] -"c++17" = ["cxxbridge-flags/c++17"] -"c++20" = ["cxxbridge-flags/c++20"] -default = [ - "std", - "cxxbridge-flags/default", -] -std = ["alloc"] +[patch.crates-io] +cxx = { path = "." } +cxx-build = { path = "gen/build" }
diff --git a/third_party/rust/cxx/v1/crate/WORKSPACE b/third_party/rust/cxx/v1/crate/WORKSPACE index 5a022789..28c93a3 100644 --- a/third_party/rust/cxx/v1/crate/WORKSPACE +++ b/third_party/rust/cxx/v1/crate/WORKSPACE
@@ -4,8 +4,8 @@ http_archive( name = "rules_rust", - sha256 = "9d04e658878d23f4b00163a72da3db03ddb451273eb347df7d7c50838d698f49", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.26.0/rules_rust-v0.26.0.tar.gz"], + sha256 = "6357de5982dd32526e02278221bb8d6aa45717ba9bbacf43686b130aa2c72e1e", + urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.30.0/rules_rust-v0.30.0.tar.gz"], ) load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") @@ -13,7 +13,7 @@ rules_rust_dependencies() rust_register_toolchains( - versions = ["1.72.0"], + versions = ["1.73.0"], ) load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
diff --git a/third_party/rust/cxx/v1/crate/book/src/build/other.md b/third_party/rust/cxx/v1/crate/book/src/build/other.md index af835e65..c0c6e91 100644 --- a/third_party/rust/cxx/v1/crate/book/src/build/other.md +++ b/third_party/rust/cxx/v1/crate/book/src/build/other.md
@@ -48,6 +48,12 @@ choose between using the Rust toolchain (`rustc`) or the C++ toolchain which you may already have extensively tuned. +The generated C++ code and the Rust code generated by the procedural macro both +depend on each other. Simple examples may only require one or the other, but in +general your linking will need to handle both directions. For some linkers, such +as llvm-ld, this is not a problem at all. For others, such as GNU ld, flags like +`--start-lib`/`--end-lib` may help. + Rust does not generate simple standalone `.o` files, so you can't just throw the Rust-generated code into your existing C++ toolchain linker. Instead you need to choose one of these options:
diff --git a/third_party/rust/cxx/v1/crate/build.rs b/third_party/rust/cxx/v1/crate/build.rs index 2b51f89..ee7c7ad 100644 --- a/third_party/rust/cxx/v1/crate/build.rs +++ b/third_party/rust/cxx/v1/crate/build.rs
@@ -1,25 +1,28 @@ use std::env; -use std::path::Path; +use std::path::{Path, PathBuf}; use std::process::Command; fn main() { - // Removed for Chromium build. - // cc::Build::new() - // .file("src/cxx.cc") - // .cpp(true) - // .cpp_link_stdlib(None) // linked via link-cplusplus crate - // .flag_if_supported(cxxbridge_flags::STD) - // .warnings_into_errors(cfg!(deny_warnings)) - // .compile("cxxbridge1"); + // Removed for Chromium build + //let manifest_dir_opt = env::var_os("CARGO_MANIFEST_DIR").map(PathBuf::from); + //let manifest_dir = manifest_dir_opt.as_deref().unwrap_or(Path::new("")); - // println!("cargo:rerun-if-changed=src/cxx.cc"); - // println!("cargo:rerun-if-changed=include/cxx.h"); - // println!("cargo:rustc-cfg=built_with_cargo"); + //cc::Build::new() + //.file(manifest_dir.join("src/cxx.cc")) + //.cpp(true) + //.cpp_link_stdlib(None) // linked via link-cplusplus crate + //.flag_if_supported(cxxbridge_flags::STD) + //.warnings_into_errors(cfg!(deny_warnings)) + //.compile("cxxbridge1"); - // if let Some(manifest_dir) = env::var_os("CARGO_MANIFEST_DIR") { - // let cxx_h = Path::new(&manifest_dir).join("include").join("cxx.h"); - // println!("cargo:HEADER={}", cxx_h.to_string_lossy()); - // } + //println!("cargo:rerun-if-changed=src/cxx.cc"); + //println!("cargo:rerun-if-changed=include/cxx.h"); + //println!("cargo:rustc-cfg=built_with_cargo"); + + //if let Some(manifest_dir) = &manifest_dir_opt { + //let cxx_h = manifest_dir.join("include").join("cxx.h"); + //println!("cargo:HEADER={}", cxx_h.to_string_lossy()); + //} if let Some(rustc) = rustc_version() { if rustc.minor < 60 {
diff --git a/third_party/rust/cxx/v1/crate/src/cxx.cc b/third_party/rust/cxx/v1/crate/src/cxx.cc index f57a708b..bacf3f7 100644 --- a/third_party/rust/cxx/v1/crate/src/cxx.cc +++ b/third_party/rust/cxx/v1/crate/src/cxx.cc
@@ -271,17 +271,11 @@ return const_cast<char *>(this->data()) + this->size(); } -CXX_CPP_EXPORT String::const_iterator String::begin() const noexcept { - return this->cbegin(); -} +CXX_CPP_EXPORT String::const_iterator String::begin() const noexcept { return this->cbegin(); } -CXX_CPP_EXPORT String::const_iterator String::end() const noexcept { - return this->cend(); -} +CXX_CPP_EXPORT String::const_iterator String::end() const noexcept { return this->cend(); } -CXX_CPP_EXPORT String::const_iterator String::cbegin() const noexcept { - return this->data(); -} +CXX_CPP_EXPORT String::const_iterator String::cbegin() const noexcept { return this->data(); } CXX_CPP_EXPORT String::const_iterator String::cend() const noexcept { return this->data() + this->size(); @@ -326,9 +320,7 @@ CXX_CPP_EXPORT Str::Str() noexcept { cxxbridge1$str$new(this); } -CXX_CPP_EXPORT Str::Str(const String &s) noexcept { - cxxbridge1$str$ref(this, &s); -} +CXX_CPP_EXPORT Str::Str(const String &s) noexcept { cxxbridge1$str$ref(this, &s); } static void initStr(Str *self, const char *ptr, std::size_t len) { if (!cxxbridge1$str$from(self, ptr, len)) { @@ -336,9 +328,7 @@ } } -CXX_CPP_EXPORT Str::Str(const std::string &s) { - initStr(this, s.data(), s.length()); -} +CXX_CPP_EXPORT Str::Str(const std::string &s) { initStr(this, s.data(), s.length()); } CXX_CPP_EXPORT Str::Str(const char *s) { assert(s != nullptr); @@ -356,29 +346,19 @@ return std::string(this->data(), this->size()); } -CXX_CPP_EXPORT const char *Str::data() const noexcept { - return cxxbridge1$str$ptr(this); -} +CXX_CPP_EXPORT const char *Str::data() const noexcept { return cxxbridge1$str$ptr(this); } -CXX_CPP_EXPORT std::size_t Str::size() const noexcept { - return cxxbridge1$str$len(this); -} +CXX_CPP_EXPORT std::size_t Str::size() const noexcept { return cxxbridge1$str$len(this); } CXX_CPP_EXPORT std::size_t Str::length() const noexcept { return this->size(); } CXX_CPP_EXPORT bool Str::empty() const noexcept { return this->size() == 0; } -CXX_CPP_EXPORT Str::const_iterator Str::begin() const noexcept { - return this->cbegin(); -} +CXX_CPP_EXPORT Str::const_iterator Str::begin() const noexcept { return this->cbegin(); } -CXX_CPP_EXPORT Str::const_iterator Str::end() const noexcept { - return this->cend(); -} +CXX_CPP_EXPORT Str::const_iterator Str::end() const noexcept { return this->cend(); } -CXX_CPP_EXPORT Str::const_iterator Str::cbegin() const noexcept { - return this->data(); -} +CXX_CPP_EXPORT Str::const_iterator Str::cbegin() const noexcept { return this->data(); } CXX_CPP_EXPORT Str::const_iterator Str::cend() const noexcept { return this->data() + this->size(); @@ -389,9 +369,7 @@ std::equal(this->begin(), this->end(), rhs.begin()); } -CXX_CPP_EXPORT bool Str::operator!=(const Str &rhs) const noexcept { - return !(*this == rhs); -} +CXX_CPP_EXPORT bool Str::operator!=(const Str &rhs) const noexcept { return !(*this == rhs); } CXX_CPP_EXPORT bool Str::operator<(const Str &rhs) const noexcept { return std::lexicographical_compare(this->begin(), this->end(), rhs.begin(), @@ -415,13 +393,9 @@ } } -CXX_CPP_EXPORT bool Str::operator>(const Str &rhs) const noexcept { - return rhs < *this; -} +CXX_CPP_EXPORT bool Str::operator>(const Str &rhs) const noexcept { return rhs < *this; } -CXX_CPP_EXPORT bool Str::operator>=(const Str &rhs) const noexcept { - return rhs <= *this; -} +CXX_CPP_EXPORT bool Str::operator>=(const Str &rhs) const noexcept { return rhs <= *this; } CXX_CPP_EXPORT void Str::swap(Str &rhs) noexcept { using std::swap; @@ -433,14 +407,11 @@ return os; } -CXX_CPP_EXPORT void sliceInit(void *self, const void *ptr, - std::size_t len) noexcept { +CXX_CPP_EXPORT void sliceInit(void *self, const void *ptr, std::size_t len) noexcept { cxxbridge1$slice$new(self, ptr, len); } -CXX_CPP_EXPORT void *slicePtr(const void *self) noexcept { - return cxxbridge1$slice$ptr(self); -} +CXX_CPP_EXPORT void *slicePtr(const void *self) noexcept { return cxxbridge1$slice$ptr(self); } CXX_CPP_EXPORT std::size_t sliceLen(const void *self) noexcept { return cxxbridge1$slice$len(self); @@ -545,7 +516,7 @@ return *this; } -CXX_CPP_EXPORT Error &Error::operator=(Error &&other) & noexcept { +CXX_CPP_EXPORT Error &Error::operator=(Error &&other) &noexcept { std::exception::operator=(std::move(other)); delete[] this->msg; this->msg = other.msg; @@ -574,8 +545,7 @@ } // namespace repr extern "C" { -CXX_RS_EXPORT repr::PtrLen cxxbridge1$exception(const char *, - std::size_t len) noexcept; +CXX_RS_EXPORT repr::PtrLen cxxbridge1$exception(const char *, std::size_t len) noexcept; } namespace detail { @@ -601,11 +571,11 @@ void operator()(const std::string &) noexcept; }; -void Fail::operator()(const char *catch$) noexcept { +CXX_CPP_EXPORT void Fail::operator()(const char *catch$) noexcept { throw$ = cxxbridge1$exception(catch$, std::strlen(catch$)); } -void Fail::operator()(const std::string &catch$) noexcept { +CXX_CPP_EXPORT void Fail::operator()(const std::string &catch$) noexcept { throw$ = cxxbridge1$exception(catch$.data(), catch$.length()); } } // namespace detail @@ -653,71 +623,70 @@ } // namespace #define STD_VECTOR_OPS(RUST_TYPE, CXX_TYPE) \ - CXX_RS_EXPORT std::vector<CXX_TYPE> \ - *cxxbridge1$std$vector$##RUST_TYPE##$new() noexcept { \ + CXX_RS_EXPORT std::vector<CXX_TYPE> *cxxbridge1$std$vector$##RUST_TYPE##$new() noexcept { \ return new std::vector<CXX_TYPE>(); \ } \ - CXX_RS_EXPORT std::size_t cxxbridge1$std$vector$##RUST_TYPE##$size( \ + CXX_RS_EXPORT std::size_t cxxbridge1$std$vector$##RUST_TYPE##$size( \ const std::vector<CXX_TYPE> &s) noexcept { \ return s.size(); \ } \ - CXX_RS_EXPORT CXX_TYPE *cxxbridge1$std$vector$##RUST_TYPE##$get_unchecked( \ + CXX_RS_EXPORT CXX_TYPE *cxxbridge1$std$vector$##RUST_TYPE##$get_unchecked( \ std::vector<CXX_TYPE> *s, std::size_t pos) noexcept { \ return &(*s)[pos]; \ } \ - CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$null( \ + CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$null( \ std::unique_ptr<std::vector<CXX_TYPE>> *ptr) noexcept { \ new (ptr) std::unique_ptr<std::vector<CXX_TYPE>>(); \ } \ - CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$raw( \ + CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$raw( \ std::unique_ptr<std::vector<CXX_TYPE>> *ptr, \ std::vector<CXX_TYPE> *raw) noexcept { \ new (ptr) std::unique_ptr<std::vector<CXX_TYPE>>(raw); \ } \ - CXX_RS_EXPORT const std::vector<CXX_TYPE> \ + CXX_RS_EXPORT const std::vector<CXX_TYPE> \ *cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$get( \ const std::unique_ptr<std::vector<CXX_TYPE>> &ptr) noexcept { \ return ptr.get(); \ } \ - CXX_RS_EXPORT std::vector<CXX_TYPE> \ + CXX_RS_EXPORT std::vector<CXX_TYPE> \ *cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$release( \ std::unique_ptr<std::vector<CXX_TYPE>> &ptr) noexcept { \ return ptr.release(); \ } \ - CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$drop( \ + CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$drop( \ std::unique_ptr<std::vector<CXX_TYPE>> *ptr) noexcept { \ ptr->~unique_ptr(); \ } #define STD_VECTOR_TRIVIAL_OPS(RUST_TYPE, CXX_TYPE) \ - CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$push_back( \ + CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$push_back( \ std::vector<CXX_TYPE> *v, CXX_TYPE *value) noexcept { \ v->push_back(std::move(*value)); \ destroy(value); \ } \ - CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$pop_back( \ - std::vector<CXX_TYPE> *v, CXX_TYPE *out) noexcept { \ + CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$pop_back(std::vector<CXX_TYPE> *v, \ + CXX_TYPE *out) noexcept { \ new (out) CXX_TYPE(std::move(v->back())); \ v->pop_back(); \ } #define RUST_VEC_EXTERNS(RUST_TYPE, CXX_TYPE) \ - CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$new( \ + CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$new( \ rust::Vec<CXX_TYPE> *ptr) noexcept; \ - CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$drop( \ + CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$drop( \ rust::Vec<CXX_TYPE> *ptr) noexcept; \ - CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$len( \ + CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$len( \ const rust::Vec<CXX_TYPE> *ptr) noexcept; \ - CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity( \ + CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity( \ const rust::Vec<CXX_TYPE> *ptr) noexcept; \ - CXX_RS_EXPORT const CXX_TYPE *cxxbridge1$rust_vec$##RUST_TYPE##$data( \ + CXX_RS_EXPORT const CXX_TYPE *cxxbridge1$rust_vec$##RUST_TYPE##$data( \ const rust::Vec<CXX_TYPE> *ptr) noexcept; \ - CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total( \ + CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total( \ rust::Vec<CXX_TYPE> *ptr, std::size_t new_cap) noexcept; \ - CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$set_len( \ - rust::Vec<CXX_TYPE> *ptr, std::size_t len) noexcept; \ - CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$truncate( \ - rust::Vec<CXX_TYPE> *ptr, std::size_t len) noexcept; + CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$set_len(rust::Vec<CXX_TYPE> *ptr, \ + std::size_t len) noexcept; \ + CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$truncate(rust::Vec<CXX_TYPE> *ptr, \ + std::size_t len) noexcept; #define RUST_VEC_OPS(RUST_TYPE, CXX_TYPE) \ template <> \
diff --git a/third_party/rust/cxx/v1/crate/src/lib.rs b/third_party/rust/cxx/v1/crate/src/lib.rs index 4039101..9c22811 100644 --- a/third_party/rust/cxx/v1/crate/src/lib.rs +++ b/third_party/rust/cxx/v1/crate/src/lib.rs
@@ -364,14 +364,19 @@ //! </table> #![no_std] -#![doc(html_root_url = "https://docs.rs/cxx/1.0.107")] +#![doc(html_root_url = "https://docs.rs/cxx/1.0.110")] +#![cfg_attr(doc_cfg, feature(doc_cfg))] #![deny( improper_ctypes, improper_ctypes_definitions, missing_docs, unsafe_op_in_unsafe_fn )] -#![cfg_attr(doc_cfg, feature(doc_cfg))] +#![warn( + clippy::alloc_instead_of_core, + clippy::std_instead_of_alloc, + clippy::std_instead_of_core +)] #![allow(non_camel_case_types)] #![allow( clippy::cast_possible_truncation,
diff --git a/third_party/rust/cxx/v1/crate/src/lossy.rs b/third_party/rust/cxx/v1/crate/src/lossy.rs index 8ccf0f9..0140392a 100644 --- a/third_party/rust/cxx/v1/crate/src/lossy.rs +++ b/third_party/rust/cxx/v1/crate/src/lossy.rs
@@ -2,7 +2,7 @@ use core::fmt::{self, Write as _}; use core::str; -pub fn display(mut bytes: &[u8], f: &mut fmt::Formatter) -> fmt::Result { +pub(crate) fn display(mut bytes: &[u8], f: &mut fmt::Formatter) -> fmt::Result { loop { match str::from_utf8(bytes) { Ok(valid) => return f.write_str(valid), @@ -21,7 +21,7 @@ } } -pub fn debug(mut bytes: &[u8], f: &mut fmt::Formatter) -> fmt::Result { +pub(crate) fn debug(mut bytes: &[u8], f: &mut fmt::Formatter) -> fmt::Result { f.write_char('"')?; while !bytes.is_empty() {
diff --git a/third_party/rust/cxx/v1/crate/src/result.rs b/third_party/rust/cxx/v1/crate/src/result.rs index ba77858..e93c8e6 100644 --- a/third_party/rust/cxx/v1/crate/src/result.rs +++ b/third_party/rust/cxx/v1/crate/src/result.rs
@@ -12,7 +12,7 @@ #[repr(C)] #[derive(Copy, Clone)] -pub struct PtrLen { +pub(crate) struct PtrLen { pub ptr: NonNull<u8>, pub len: usize, }
diff --git a/third_party/rust/cxx/v1/crate/src/sip.rs b/third_party/rust/cxx/v1/crate/src/sip.rs index 9e1d050a..4ce0923e 100644 --- a/third_party/rust/cxx/v1/crate/src/sip.rs +++ b/third_party/rust/cxx/v1/crate/src/sip.rs
@@ -17,7 +17,7 @@ /// (e.g., `collections::HashMap` uses it by default). /// /// See: <https://131002.net/siphash> -pub struct SipHasher13 { +pub(crate) struct SipHasher13 { k0: u64, k1: u64, length: usize, // how many bytes we've processed @@ -110,7 +110,7 @@ impl SipHasher13 { /// Creates a new `SipHasher13` with the two initial keys set to 0. - pub fn new() -> Self { + pub(crate) fn new() -> Self { Self::new_with_keys(0, 0) }
diff --git a/third_party/rust/cxx/v1/crate/tests/BUCK b/third_party/rust/cxx/v1/crate/tests/BUCK index 3985860..3e9aba70 100644 --- a/third_party/rust/cxx/v1/crate/tests/BUCK +++ b/third_party/rust/cxx/v1/crate/tests/BUCK
@@ -1,5 +1,11 @@ +load("//tools/buck:build_mode.bzl", "build_mode") load("//tools/buck:rust_cxx_bridge.bzl", "rust_cxx_bridge") +build_mode( + name = "build_mode", + cell = native.get_cell_name(), +) + rust_test( name = "test", srcs = ["test.rs"], @@ -8,6 +14,7 @@ ":ffi", "//:cxx", ], + remote_execution_action_key_providers = ":build_mode", ) rust_library(
diff --git a/third_party/rust/cxx/v1/crate/tests/ui/unpin_impl.stderr b/third_party/rust/cxx/v1/crate/tests/ui/unpin_impl.stderr index ea541a4..888d64fb 100644 --- a/third_party/rust/cxx/v1/crate/tests/ui/unpin_impl.stderr +++ b/third_party/rust/cxx/v1/crate/tests/ui/unpin_impl.stderr
@@ -1,9 +1,3 @@ -error[E0282]: type annotations needed - --> tests/ui/unpin_impl.rs:4:14 - | -4 | type Opaque; - | ^^^^^^ cannot infer type - error[E0283]: type annotations needed --> tests/ui/unpin_impl.rs:4:14 |
diff --git a/third_party/rust/cxx/v1/crate/tools/buck/build_mode.bzl b/third_party/rust/cxx/v1/crate/tools/buck/build_mode.bzl new file mode 100644 index 0000000..aeff498 --- /dev/null +++ b/third_party/rust/cxx/v1/crate/tools/buck/build_mode.bzl
@@ -0,0 +1,14 @@ +load("@prelude//:build_mode.bzl", "BuildModeInfo") + +def _build_mode_impl(ctx: AnalysisContext) -> list[Provider]: + return [ + DefaultInfo(), + BuildModeInfo(cell = ctx.attrs.cell), + ] + +build_mode = rule( + impl = _build_mode_impl, + attrs = { + "cell": attrs.string(), + }, +)
diff --git a/third_party/rust/cxx/v1/crate/tools/buck/toolchains/BUCK b/third_party/rust/cxx/v1/crate/tools/buck/toolchains/BUCK index 25d135a..e120a29 100644 --- a/third_party/rust/cxx/v1/crate/tools/buck/toolchains/BUCK +++ b/third_party/rust/cxx/v1/crate/tools/buck/toolchains/BUCK
@@ -1,6 +1,7 @@ load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain") load("@prelude//toolchains:genrule.bzl", "system_genrule_toolchain") load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain") +load("@prelude//toolchains:remote_test_execution.bzl", "remote_test_execution_toolchain") load("@prelude//toolchains:rust.bzl", "system_rust_toolchain") system_cxx_toolchain( @@ -34,3 +35,8 @@ doctests = True, visibility = ["PUBLIC"], ) + +remote_test_execution_toolchain( + name = "remote_test_execution", + visibility = ["PUBLIC"], +)
diff --git a/third_party/rust/cxx/v1/patches/0001-Remove-cc-and-env-usage-from-build.rs-in-cxx.patch b/third_party/rust/cxx/v1/patches/0001-Remove-cc-and-env-usage-from-build.rs-in-cxx.patch index 1a7db5f..cfc33e0 100644 --- a/third_party/rust/cxx/v1/patches/0001-Remove-cc-and-env-usage-from-build.rs-in-cxx.patch +++ b/third_party/rust/cxx/v1/patches/0001-Remove-cc-and-env-usage-from-build.rs-in-cxx.patch
@@ -1,33 +1,34 @@ -From 05e110996d93b6c172460b75eda69f1530b8e0a6 Mon Sep 17 00:00:00 2001 -From: Collin Baker <collinbaker@chromium.org> -Date: Wed, 8 Jun 2022 14:28:57 -0400 -Subject: [PATCH 1/4] Remove cc and env usage from build.rs in cxx +From 869775e6d3e7a076d120146ca346b0738043bcae Mon Sep 17 00:00:00 2001 +From: Adrian Taylor <adetaylor@chromium.org> +Date: Wed, 8 Nov 2023 16:58:53 +0000 +Subject: [PATCH 1/4] Remove cc and cxxbridge_flags from build.rs. -Signed-off-by: Collin Baker <collinbaker@chromium.org> +Change-Id: Ia27cc1eb203f30a47b166b37c3049c42f4deef84 --- - third_party/rust/cxx/v1/crate/Cargo.toml | 21 +++++++++-------- - third_party/rust/cxx/v1/crate/build.rs | 29 ++++++++++++------------ - 2 files changed, 27 insertions(+), 23 deletions(-) + third_party/rust/cxx/v1/crate/Cargo.toml | 20 +++++++------- + third_party/rust/cxx/v1/crate/build.rs | 33 ++++++++++++------------ + 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/third_party/rust/cxx/v1/crate/Cargo.toml b/third_party/rust/cxx/v1/crate/Cargo.toml -index 8a4f33e49131b..02dbc29ab0ba1 100644 +index 10d6edf33a157..abcdac8751a94 100644 --- a/third_party/rust/cxx/v1/crate/Cargo.toml +++ b/third_party/rust/cxx/v1/crate/Cargo.toml -@@ -63,20 +63,23 @@ version = "1.0" - version = "1.0.52" +@@ -91,20 +91,22 @@ version = "1.0.13" + version = "1.0.81" features = ["diff"] -[build-dependencies.cc] --version = "1.0.49" -+# Removed for Chromium build. +-version = "1.0.79" ++# Removed for Chromium build +# [build-dependencies.cc] -+# version = "1.0.49" ++# version = "1.0.79" -[build-dependencies.cxxbridge-flags] --version = "=1.0.68" +-version = "=1.0.110" -default-features = false ++# Removed for Chromium build +# [build-dependencies.cxxbridge-flags] -+# version = "=1.0.68" ++# version = "=1.0.110" +# default-features = false [features] @@ -35,59 +36,62 @@ -"c++14" = ["cxxbridge-flags/c++14"] -"c++17" = ["cxxbridge-flags/c++17"] -"c++20" = ["cxxbridge-flags/c++20"] -+# Removed for Chromium build. +# "c++14" = ["cxxbridge-flags/c++14"] +# "c++17" = ["cxxbridge-flags/c++17"] +# "c++20" = ["cxxbridge-flags/c++20"] default = [ "std", - "cxxbridge-flags/default", -+ # Removed for Chromium build. + # "cxxbridge-flags/default", ] std = ["alloc"] diff --git a/third_party/rust/cxx/v1/crate/build.rs b/third_party/rust/cxx/v1/crate/build.rs -index a953639aa6338..1ec1dcf3215a2 100644 +index afcfea3b081fd..ee7c7ad4094c2 100644 --- a/third_party/rust/cxx/v1/crate/build.rs +++ b/third_party/rust/cxx/v1/crate/build.rs -@@ -3,22 +3,23 @@ use std::path::Path; +@@ -3,25 +3,26 @@ use std::path::{Path, PathBuf}; use std::process::Command; fn main() { +- let manifest_dir_opt = env::var_os("CARGO_MANIFEST_DIR").map(PathBuf::from); +- let manifest_dir = manifest_dir_opt.as_deref().unwrap_or(Path::new("")); ++ // Removed for Chromium build ++ //let manifest_dir_opt = env::var_os("CARGO_MANIFEST_DIR").map(PathBuf::from); ++ //let manifest_dir = manifest_dir_opt.as_deref().unwrap_or(Path::new("")); + - cc::Build::new() -- .file("src/cxx.cc") +- .file(manifest_dir.join("src/cxx.cc")) - .cpp(true) - .cpp_link_stdlib(None) // linked via link-cplusplus crate - .flag_if_supported(cxxbridge_flags::STD) - .warnings_into_errors(cfg!(deny_warnings)) - .compile("cxxbridge1"); -+ // Removed for Chromium build. -+ // cc::Build::new() -+ // .file("src/cxx.cc") -+ // .cpp(true) -+ // .cpp_link_stdlib(None) // linked via link-cplusplus crate -+ // .flag_if_supported(cxxbridge_flags::STD) -+ // .warnings_into_errors(cfg!(deny_warnings)) -+ // .compile("cxxbridge1"); ++ //cc::Build::new() ++ //.file(manifest_dir.join("src/cxx.cc")) ++ //.cpp(true) ++ //.cpp_link_stdlib(None) // linked via link-cplusplus crate ++ //.flag_if_supported(cxxbridge_flags::STD) ++ //.warnings_into_errors(cfg!(deny_warnings)) ++ //.compile("cxxbridge1"); - println!("cargo:rerun-if-changed=src/cxx.cc"); - println!("cargo:rerun-if-changed=include/cxx.h"); - println!("cargo:rustc-cfg=built_with_cargo"); -+ // println!("cargo:rerun-if-changed=src/cxx.cc"); -+ // println!("cargo:rerun-if-changed=include/cxx.h"); -+ // println!("cargo:rustc-cfg=built_with_cargo"); ++ //println!("cargo:rerun-if-changed=src/cxx.cc"); ++ //println!("cargo:rerun-if-changed=include/cxx.h"); ++ //println!("cargo:rustc-cfg=built_with_cargo"); -- if let Some(manifest_dir) = env::var_os("CARGO_MANIFEST_DIR") { -- let cxx_h = Path::new(&manifest_dir).join("include").join("cxx.h"); +- if let Some(manifest_dir) = &manifest_dir_opt { +- let cxx_h = manifest_dir.join("include").join("cxx.h"); - println!("cargo:HEADER={}", cxx_h.to_string_lossy()); - } -+ // if let Some(manifest_dir) = env::var_os("CARGO_MANIFEST_DIR") { -+ // let cxx_h = Path::new(&manifest_dir).join("include").join("cxx.h"); -+ // println!("cargo:HEADER={}", cxx_h.to_string_lossy()); -+ // } ++ //if let Some(manifest_dir) = &manifest_dir_opt { ++ //let cxx_h = manifest_dir.join("include").join("cxx.h"); ++ //println!("cargo:HEADER={}", cxx_h.to_string_lossy()); ++ //} if let Some(rustc) = rustc_version() { - if rustc.minor < 48 { + if rustc.minor < 60 { -- -2.36.1.255.ge46751e96f-goog +2.42.0.869.gea05f2083d-goog
diff --git a/third_party/rust/cxx/v1/patches/0002-Remove-executable-bit-from-build.js.patch b/third_party/rust/cxx/v1/patches/0002-Remove-executable-bit-from-build.js.patch index fd465e4..7b52502 100644 --- a/third_party/rust/cxx/v1/patches/0002-Remove-executable-bit-from-build.js.patch +++ b/third_party/rust/cxx/v1/patches/0002-Remove-executable-bit-from-build.js.patch
@@ -1,9 +1,9 @@ -From 29dd29972c20a19087e8b0482509542bfb59edd2 Mon Sep 17 00:00:00 2001 -From: danakj <danakj@chromium.org> -Date: Fri, 29 Oct 2021 17:02:29 -0400 -Subject: [PATCH 2/4] Remove executable bit from build.js +From 0b3dd0c355b0be484f87b64b305415e4131e5a3f Mon Sep 17 00:00:00 2001 +From: Adrian Taylor <adetaylor@chromium.org> +Date: Wed, 8 Nov 2023 16:59:08 +0000 +Subject: [PATCH 2/4] Remove executable bit from JS file -Signed-off-by: Collin Baker <collinbaker@chromium.org> +Change-Id: I3665b8a18fea653c61e0f9663ded100d5482921e --- third_party/rust/cxx/v1/crate/book/build.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) @@ -13,5 +13,5 @@ old mode 100755 new mode 100644 -- -2.36.1.255.ge46751e96f-goog +2.42.0.869.gea05f2083d-goog
diff --git a/third_party/rust/cxx/v1/patches/0003-Change-cxx-header-include-to-be-an-absolute-path.patch b/third_party/rust/cxx/v1/patches/0003-Change-cxx-header-include-to-be-an-absolute-path.patch index f1be1b6..3239956c 100644 --- a/third_party/rust/cxx/v1/patches/0003-Change-cxx-header-include-to-be-an-absolute-path.patch +++ b/third_party/rust/cxx/v1/patches/0003-Change-cxx-header-include-to-be-an-absolute-path.patch
@@ -1,23 +1,23 @@ -From b7aee81fc1fdab77833a5f3e4ee1110f6aa57692 Mon Sep 17 00:00:00 2001 -From: danakj <danakj@chromium.org> -Date: Tue, 2 Nov 2021 17:11:20 -0400 -Subject: [PATCH 3/4] Change cxx header include to be an absolute path +From 608e9f748a6327620f04735ff8eae279c42cd4c9 Mon Sep 17 00:00:00 2001 +From: Adrian Taylor <adetaylor@chromium.org> +Date: Wed, 8 Nov 2023 17:08:01 +0000 +Subject: [PATCH 3/4] Absolute path for cxx header -Signed-off-by: Collin Baker <collinbaker@chromium.org> +Change-Id: Iaaa5965443bd3446ac8cd645936614a24e8bb500 --- third_party/rust/cxx/v1/crate/src/cxx.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/rust/cxx/v1/crate/src/cxx.cc b/third_party/rust/cxx/v1/crate/src/cxx.cc -index 1601a05ab6e11..1860f1337cc2f 100644 +index 2522d61aa33dc..a1cdc44ea1ba9 100644 --- a/third_party/rust/cxx/v1/crate/src/cxx.cc +++ b/third_party/rust/cxx/v1/crate/src/cxx.cc @@ -1,4 +1,4 @@ -#include "../include/cxx.h" +#include "third_party/rust/cxx/v1/crate/include/cxx.h" + #include <cstdio> #include <cstring> #include <iostream> - #include <memory> -- -2.36.1.255.ge46751e96f-goog +2.42.0.869.gea05f2083d-goog
diff --git a/third_party/rust/cxx/v1/patches/0004-Define-exported-cxx-symbols.patch b/third_party/rust/cxx/v1/patches/0004-Define-exported-cxx-symbols.patch index 479d726..f1dab2e 100644 --- a/third_party/rust/cxx/v1/patches/0004-Define-exported-cxx-symbols.patch +++ b/third_party/rust/cxx/v1/patches/0004-Define-exported-cxx-symbols.patch
@@ -1,23 +1,18 @@ -From 137df54955c5bd3f58a41a9e98d382c17618eda7 Mon Sep 17 00:00:00 2001 +From 6e14500dafa3de4c23d7b8369c61995574a2e4ec Mon Sep 17 00:00:00 2001 From: Adrian Taylor <adetaylor@chromium.org> -Date: Wed, 16 Mar 2022 13:58:58 -0700 -Subject: [PATCH 4/4] Define exported cxx symbols. +Date: Wed, 8 Nov 2023 16:59:41 +0000 +Subject: [PATCH 4/4] Export symbols from cxx -This is a version of -https://github.com/dtolnay/cxx/pull/1025 -backported to the version of cxx which we currently use. - -Change-Id: I6a0f76fcf6afb36718d5e939c797e7988826bad1 -Signed-off-by: Collin Baker <collinbaker@chromium.org> +Change-Id: Ib53acaa4cbcd2c872c3e11580970e6cf562c9109 --- - third_party/rust/cxx/v1/crate/src/cxx.cc | 346 +++++++++++++---------- - 1 file changed, 203 insertions(+), 143 deletions(-) + third_party/rust/cxx/v1/crate/src/cxx.cc | 328 +++++++++++++---------- + 1 file changed, 179 insertions(+), 149 deletions(-) diff --git a/third_party/rust/cxx/v1/crate/src/cxx.cc b/third_party/rust/cxx/v1/crate/src/cxx.cc -index 1860f1337cc2f..3404c5ebabac6 100644 +index a1cdc44ea1ba9..bacf3f7d81323 100644 --- a/third_party/rust/cxx/v1/crate/src/cxx.cc +++ b/third_party/rust/cxx/v1/crate/src/cxx.cc -@@ -3,71 +3,93 @@ +@@ -4,71 +4,93 @@ #include <iostream> #include <memory> @@ -150,7 +145,7 @@ } // extern "C" namespace rust { -@@ -85,23 +107,24 @@ void panic [[noreturn]] (const char *msg) { +@@ -86,23 +108,24 @@ void panic [[noreturn]] (const char *msg) { template void panic<std::out_of_range> [[noreturn]] (const char *msg); @@ -179,7 +174,7 @@ static void initString(String *self, const char *s, std::size_t len) { if (!cxxbridge1$string$from_utf8(self, s, len)) { -@@ -115,27 +138,29 @@ static void initString(String *self, const char16_t *s, std::size_t len) { +@@ -116,27 +139,29 @@ static void initString(String *self, const char16_t *s, std::size_t len) { } } @@ -214,7 +209,7 @@ assert(s != nullptr || len == 0); assert(is_aligned<char16_t>(s)); initString(this, -@@ -146,46 +171,49 @@ String::String(const char16_t *s, std::size_t len) { +@@ -147,46 +172,49 @@ String::String(const char16_t *s, std::size_t len) { struct String::lossy_t {}; @@ -272,7 +267,7 @@ if (this != &other) { cxxbridge1$string$drop(this); cxxbridge1$string$clone(this, other); -@@ -193,32 +221,32 @@ String &String::operator=(const String &other) &noexcept { +@@ -194,32 +222,32 @@ String &String::operator=(const String &other) &noexcept { return *this; } @@ -312,7 +307,7 @@ auto len = this->length(); cxxbridge1$string$reserve_additional(this, 1); auto ptr = this->data(); -@@ -226,128 +254,151 @@ const char *String::c_str() noexcept { +@@ -227,72 +255,72 @@ const char *String::c_str() noexcept { return ptr; } @@ -337,19 +332,13 @@ } -String::const_iterator String::begin() const noexcept { return this->cbegin(); } -+CXX_CPP_EXPORT String::const_iterator String::begin() const noexcept { -+ return this->cbegin(); -+} ++CXX_CPP_EXPORT String::const_iterator String::begin() const noexcept { return this->cbegin(); } -String::const_iterator String::end() const noexcept { return this->cend(); } -+CXX_CPP_EXPORT String::const_iterator String::end() const noexcept { -+ return this->cend(); -+} ++CXX_CPP_EXPORT String::const_iterator String::end() const noexcept { return this->cend(); } -String::const_iterator String::cbegin() const noexcept { return this->data(); } -+CXX_CPP_EXPORT String::const_iterator String::cbegin() const noexcept { -+ return this->data(); -+} ++CXX_CPP_EXPORT String::const_iterator String::cbegin() const noexcept { return this->data(); } -String::const_iterator String::cend() const noexcept { +CXX_CPP_EXPORT String::const_iterator String::cend() const noexcept { @@ -398,7 +387,7 @@ -std::ostream &operator<<(std::ostream &os, const String &s) { +CXX_CPP_EXPORT std::ostream &operator<<(std::ostream &os, const String &s) { - os.write(s.data(), s.size()); + os.write(s.data(), static_cast<std::streamsize>(s.size())); return os; } @@ -406,22 +395,16 @@ +CXX_CPP_EXPORT Str::Str() noexcept { cxxbridge1$str$new(this); } -Str::Str(const String &s) noexcept { cxxbridge1$str$ref(this, &s); } -+CXX_CPP_EXPORT Str::Str(const String &s) noexcept { -+ cxxbridge1$str$ref(this, &s); -+} ++CXX_CPP_EXPORT Str::Str(const String &s) noexcept { cxxbridge1$str$ref(this, &s); } --static void initStr(Str *self, const char *ptr, std::size_t len) { -+CXX_CPP_EXPORT static void initStr(Str *self, const char *ptr, -+ std::size_t len) { + static void initStr(Str *self, const char *ptr, std::size_t len) { if (!cxxbridge1$str$from(self, ptr, len)) { - panic<std::invalid_argument>("data for rust::Str is not utf-8"); +@@ -300,55 +328,55 @@ static void initStr(Str *self, const char *ptr, std::size_t len) { } } -Str::Str(const std::string &s) { initStr(this, s.data(), s.length()); } -+CXX_CPP_EXPORT Str::Str(const std::string &s) { -+ initStr(this, s.data(), s.length()); -+} ++CXX_CPP_EXPORT Str::Str(const std::string &s) { initStr(this, s.data(), s.length()); } -Str::Str(const char *s) { +CXX_CPP_EXPORT Str::Str(const char *s) { @@ -443,14 +426,10 @@ } -const char *Str::data() const noexcept { return cxxbridge1$str$ptr(this); } -+CXX_CPP_EXPORT const char *Str::data() const noexcept { -+ return cxxbridge1$str$ptr(this); -+} ++CXX_CPP_EXPORT const char *Str::data() const noexcept { return cxxbridge1$str$ptr(this); } -std::size_t Str::size() const noexcept { return cxxbridge1$str$len(this); } -+CXX_CPP_EXPORT std::size_t Str::size() const noexcept { -+ return cxxbridge1$str$len(this); -+} ++CXX_CPP_EXPORT std::size_t Str::size() const noexcept { return cxxbridge1$str$len(this); } -std::size_t Str::length() const noexcept { return this->size(); } +CXX_CPP_EXPORT std::size_t Str::length() const noexcept { return this->size(); } @@ -459,19 +438,13 @@ +CXX_CPP_EXPORT bool Str::empty() const noexcept { return this->size() == 0; } -Str::const_iterator Str::begin() const noexcept { return this->cbegin(); } -+CXX_CPP_EXPORT Str::const_iterator Str::begin() const noexcept { -+ return this->cbegin(); -+} ++CXX_CPP_EXPORT Str::const_iterator Str::begin() const noexcept { return this->cbegin(); } -Str::const_iterator Str::end() const noexcept { return this->cend(); } -+CXX_CPP_EXPORT Str::const_iterator Str::end() const noexcept { -+ return this->cend(); -+} ++CXX_CPP_EXPORT Str::const_iterator Str::end() const noexcept { return this->cend(); } -Str::const_iterator Str::cbegin() const noexcept { return this->data(); } -+CXX_CPP_EXPORT Str::const_iterator Str::cbegin() const noexcept { -+ return this->data(); -+} ++CXX_CPP_EXPORT Str::const_iterator Str::cbegin() const noexcept { return this->data(); } -Str::const_iterator Str::cend() const noexcept { +CXX_CPP_EXPORT Str::const_iterator Str::cend() const noexcept { @@ -485,9 +458,7 @@ } -bool Str::operator!=(const Str &rhs) const noexcept { return !(*this == rhs); } -+CXX_CPP_EXPORT bool Str::operator!=(const Str &rhs) const noexcept { -+ return !(*this == rhs); -+} ++CXX_CPP_EXPORT bool Str::operator!=(const Str &rhs) const noexcept { return !(*this == rhs); } -bool Str::operator<(const Str &rhs) const noexcept { +CXX_CPP_EXPORT bool Str::operator<(const Str &rhs) const noexcept { @@ -500,19 +471,15 @@ // std::mismatch(this->begin(), this->end(), rhs.begin(), rhs.end()), except // without Undefined Behavior on C++11 if rhs is shorter than *this. const_iterator liter = this->begin(), lend = this->end(), riter = rhs.begin(), -@@ -364,27 +415,34 @@ bool Str::operator<=(const Str &rhs) const noexcept { +@@ -365,27 +393,27 @@ bool Str::operator<=(const Str &rhs) const noexcept { } } -bool Str::operator>(const Str &rhs) const noexcept { return rhs < *this; } -+CXX_CPP_EXPORT bool Str::operator>(const Str &rhs) const noexcept { -+ return rhs < *this; -+} ++CXX_CPP_EXPORT bool Str::operator>(const Str &rhs) const noexcept { return rhs < *this; } -bool Str::operator>=(const Str &rhs) const noexcept { return rhs <= *this; } -+CXX_CPP_EXPORT bool Str::operator>=(const Str &rhs) const noexcept { -+ return rhs <= *this; -+} ++CXX_CPP_EXPORT bool Str::operator>=(const Str &rhs) const noexcept { return rhs <= *this; } -void Str::swap(Str &rhs) noexcept { +CXX_CPP_EXPORT void Str::swap(Str &rhs) noexcept { @@ -522,27 +489,24 @@ -std::ostream &operator<<(std::ostream &os, const Str &s) { +CXX_CPP_EXPORT std::ostream &operator<<(std::ostream &os, const Str &s) { - os.write(s.data(), s.size()); + os.write(s.data(), static_cast<std::streamsize>(s.size())); return os; } -void sliceInit(void *self, const void *ptr, std::size_t len) noexcept { -+CXX_CPP_EXPORT void sliceInit(void *self, const void *ptr, -+ std::size_t len) noexcept { ++CXX_CPP_EXPORT void sliceInit(void *self, const void *ptr, std::size_t len) noexcept { cxxbridge1$slice$new(self, ptr, len); } -void *slicePtr(const void *self) noexcept { return cxxbridge1$slice$ptr(self); } -+CXX_CPP_EXPORT void *slicePtr(const void *self) noexcept { -+ return cxxbridge1$slice$ptr(self); -+} ++CXX_CPP_EXPORT void *slicePtr(const void *self) noexcept { return cxxbridge1$slice$ptr(self); } -std::size_t sliceLen(const void *self) noexcept { +CXX_CPP_EXPORT std::size_t sliceLen(const void *self) noexcept { return cxxbridge1$slice$len(self); } -@@ -455,7 +513,8 @@ static const char *errorCopy(const char *ptr, std::size_t len) { +@@ -456,25 +484,26 @@ static const char *errorCopy(const char *ptr, std::size_t len) { } extern "C" { @@ -552,7 +516,70 @@ return errorCopy(ptr, len); } } // extern "C" -@@ -532,23 +591,24 @@ void destroy(T *ptr) { + +-Error::Error(const Error &other) ++CXX_CPP_EXPORT Error::Error(const Error &other) + : std::exception(other), + msg(other.msg ? errorCopy(other.msg, other.len) : nullptr), + len(other.len) {} + +-Error::Error(Error &&other) noexcept ++CXX_CPP_EXPORT Error::Error(Error &&other) noexcept + : std::exception(std::move(other)), msg(other.msg), len(other.len) { + other.msg = nullptr; + other.len = 0; + } + +-Error::~Error() noexcept { delete[] this->msg; } ++CXX_CPP_EXPORT Error::~Error() noexcept { delete[] this->msg; } + +-Error &Error::operator=(const Error &other) & { ++CXX_CPP_EXPORT Error &Error::operator=(const Error &other) & { + if (this != &other) { + std::exception::operator=(other); + delete[] this->msg; +@@ -487,7 +516,7 @@ Error &Error::operator=(const Error &other) & { + return *this; + } + +-Error &Error::operator=(Error &&other) &noexcept { ++CXX_CPP_EXPORT Error &Error::operator=(Error &&other) &noexcept { + std::exception::operator=(std::move(other)); + delete[] this->msg; + this->msg = other.msg; +@@ -497,7 +526,7 @@ Error &Error::operator=(Error &&other) &noexcept { + return *this; + } + +-const char *Error::what() const noexcept { return this->msg; } ++CXX_CPP_EXPORT const char *Error::what() const noexcept { return this->msg; } + + namespace { + template <typename T> +@@ -516,7 +545,7 @@ struct PtrLen final { + } // namespace repr + + extern "C" { +-repr::PtrLen cxxbridge1$exception(const char *, std::size_t len) noexcept; ++CXX_RS_EXPORT repr::PtrLen cxxbridge1$exception(const char *, std::size_t len) noexcept; + } + + namespace detail { +@@ -542,11 +571,11 @@ public: + void operator()(const std::string &) noexcept; + }; + +-void Fail::operator()(const char *catch$) noexcept { ++CXX_CPP_EXPORT void Fail::operator()(const char *catch$) noexcept { + throw$ = cxxbridge1$exception(catch$, std::strlen(catch$)); + } + +-void Fail::operator()(const std::string &catch$) noexcept { ++CXX_CPP_EXPORT void Fail::operator()(const std::string &catch$) noexcept { + throw$ = cxxbridge1$exception(catch$.data(), catch$.length()); + } + } // namespace detail +@@ -562,23 +591,24 @@ void destroy(T *ptr) { } // namespace extern "C" { @@ -583,95 +610,95 @@ std::unique_ptr<std::string> *ptr) noexcept { ptr->~unique_ptr(); } -@@ -563,67 +623,67 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *), +@@ -593,69 +623,69 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *), } // namespace #define STD_VECTOR_OPS(RUST_TYPE, CXX_TYPE) \ +- std::vector<CXX_TYPE> *cxxbridge1$std$vector$##RUST_TYPE##$new() noexcept { \ ++ CXX_RS_EXPORT std::vector<CXX_TYPE> *cxxbridge1$std$vector$##RUST_TYPE##$new() noexcept { \ + return new std::vector<CXX_TYPE>(); \ + } \ - std::size_t cxxbridge1$std$vector$##RUST_TYPE##$size( \ -+ CXX_RS_EXPORT std::size_t cxxbridge1$std$vector$##RUST_TYPE##$size( \ ++ CXX_RS_EXPORT std::size_t cxxbridge1$std$vector$##RUST_TYPE##$size( \ const std::vector<CXX_TYPE> &s) noexcept { \ return s.size(); \ } \ - CXX_TYPE *cxxbridge1$std$vector$##RUST_TYPE##$get_unchecked( \ -+ CXX_RS_EXPORT CXX_TYPE *cxxbridge1$std$vector$##RUST_TYPE##$get_unchecked( \ ++ CXX_RS_EXPORT CXX_TYPE *cxxbridge1$std$vector$##RUST_TYPE##$get_unchecked( \ std::vector<CXX_TYPE> *s, std::size_t pos) noexcept { \ return &(*s)[pos]; \ } \ - void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$null( \ -+ CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$null( \ ++ CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$null( \ std::unique_ptr<std::vector<CXX_TYPE>> *ptr) noexcept { \ new (ptr) std::unique_ptr<std::vector<CXX_TYPE>>(); \ } \ - void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$raw( \ -+ CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$raw( \ ++ CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$raw( \ std::unique_ptr<std::vector<CXX_TYPE>> *ptr, \ std::vector<CXX_TYPE> *raw) noexcept { \ new (ptr) std::unique_ptr<std::vector<CXX_TYPE>>(raw); \ } \ - const std::vector<CXX_TYPE> \ -+ CXX_RS_EXPORT const std::vector<CXX_TYPE> \ ++ CXX_RS_EXPORT const std::vector<CXX_TYPE> \ *cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$get( \ const std::unique_ptr<std::vector<CXX_TYPE>> &ptr) noexcept { \ return ptr.get(); \ } \ - std::vector<CXX_TYPE> \ -+ CXX_RS_EXPORT std::vector<CXX_TYPE> \ ++ CXX_RS_EXPORT std::vector<CXX_TYPE> \ *cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$release( \ std::unique_ptr<std::vector<CXX_TYPE>> &ptr) noexcept { \ return ptr.release(); \ } \ - void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$drop( \ -+ CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$drop( \ ++ CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$drop( \ std::unique_ptr<std::vector<CXX_TYPE>> *ptr) noexcept { \ ptr->~unique_ptr(); \ } #define STD_VECTOR_TRIVIAL_OPS(RUST_TYPE, CXX_TYPE) \ - void cxxbridge1$std$vector$##RUST_TYPE##$push_back( \ -+ CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$push_back( \ ++ CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$push_back( \ std::vector<CXX_TYPE> *v, CXX_TYPE *value) noexcept { \ v->push_back(std::move(*value)); \ destroy(value); \ } \ - void cxxbridge1$std$vector$##RUST_TYPE##$pop_back(std::vector<CXX_TYPE> *v, \ -- CXX_TYPE *out) noexcept { \ -+ CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$pop_back( \ -+ std::vector<CXX_TYPE> *v, CXX_TYPE *out) noexcept { \ ++ CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$pop_back(std::vector<CXX_TYPE> *v, \ + CXX_TYPE *out) noexcept { \ new (out) CXX_TYPE(std::move(v->back())); \ v->pop_back(); \ } #define RUST_VEC_EXTERNS(RUST_TYPE, CXX_TYPE) \ - void cxxbridge1$rust_vec$##RUST_TYPE##$new( \ -+ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$new( \ ++ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$new( \ rust::Vec<CXX_TYPE> *ptr) noexcept; \ - void cxxbridge1$rust_vec$##RUST_TYPE##$drop( \ -+ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$drop( \ ++ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$drop( \ rust::Vec<CXX_TYPE> *ptr) noexcept; \ - std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$len( \ -+ CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$len( \ ++ CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$len( \ const rust::Vec<CXX_TYPE> *ptr) noexcept; \ - std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity( \ -+ CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity( \ ++ CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity( \ const rust::Vec<CXX_TYPE> *ptr) noexcept; \ - const CXX_TYPE *cxxbridge1$rust_vec$##RUST_TYPE##$data( \ -+ CXX_RS_EXPORT const CXX_TYPE *cxxbridge1$rust_vec$##RUST_TYPE##$data( \ ++ CXX_RS_EXPORT const CXX_TYPE *cxxbridge1$rust_vec$##RUST_TYPE##$data( \ const rust::Vec<CXX_TYPE> *ptr) noexcept; \ - void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total( \ -+ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total( \ ++ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total( \ rust::Vec<CXX_TYPE> *ptr, std::size_t new_cap) noexcept; \ - void cxxbridge1$rust_vec$##RUST_TYPE##$set_len(rust::Vec<CXX_TYPE> *ptr, \ -- std::size_t len) noexcept; \ ++ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$set_len(rust::Vec<CXX_TYPE> *ptr, \ + std::size_t len) noexcept; \ - void cxxbridge1$rust_vec$##RUST_TYPE##$truncate(rust::Vec<CXX_TYPE> *ptr, \ -- std::size_t len) noexcept; -+ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$set_len( \ -+ rust::Vec<CXX_TYPE> *ptr, std::size_t len) noexcept; \ -+ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$truncate( \ -+ rust::Vec<CXX_TYPE> *ptr, std::size_t len) noexcept; ++ CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$truncate(rust::Vec<CXX_TYPE> *ptr, \ + std::size_t len) noexcept; #define RUST_VEC_OPS(RUST_TYPE, CXX_TYPE) \ - template <> \ -@@ -662,52 +722,52 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *), +@@ -695,52 +725,52 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *), #define SHARED_PTR_OPS(RUST_TYPE, CXX_TYPE) \ static_assert(sizeof(std::shared_ptr<CXX_TYPE>) == 2 * sizeof(void *), ""); \ static_assert(alignof(std::shared_ptr<CXX_TYPE>) == alignof(void *), ""); \ @@ -735,5 +762,5 @@ self->~weak_ptr(); \ } -- -2.36.1.255.ge46751e96f-goog +2.42.0.869.gea05f2083d-goog
diff --git a/third_party/rust/cxxbridge_cmd/v1/BUILD.gn b/third_party/rust/cxxbridge_cmd/v1/BUILD.gn index 02b0343..3bc447b 100644 --- a/third_party/rust/cxxbridge_cmd/v1/BUILD.gn +++ b/third_party/rust/cxxbridge_cmd/v1/BUILD.gn
@@ -67,7 +67,7 @@ # Unit tests skipped. Generate with --with-tests to include them. build_native_rust_unit_tests = false edition = "2021" - cargo_pkg_version = "1.0.107" + cargo_pkg_version = "1.0.110" cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>" cargo_pkg_name = "cxxbridge-cmd" cargo_pkg_description =
diff --git a/third_party/rust/cxxbridge_cmd/v1/README.chromium b/third_party/rust/cxxbridge_cmd/v1/README.chromium index 6500476c..a32a703 100644 --- a/third_party/rust/cxxbridge_cmd/v1/README.chromium +++ b/third_party/rust/cxxbridge_cmd/v1/README.chromium
@@ -1,9 +1,9 @@ Name: cxxbridge-cmd URL: https://crates.io/crates/cxxbridge-cmd Description: C++ code generator for integrating `cxx` crate into a non-Cargo build. -Version: 1.0.107 +Version: 1.0.110 Security Critical: yes Shipped: yes License: Apache 2.0 License File: -Revision: 51ded1be5e27c2c1eac145064af3ccc41ea056bf +Revision: 306019c5a7434aa7424a83720a09c40e1ea12343
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/.cargo_vcs_info.json b/third_party/rust/cxxbridge_cmd/v1/crate/.cargo_vcs_info.json index e8a25618f..38bf9da2 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/.cargo_vcs_info.json +++ b/third_party/rust/cxxbridge_cmd/v1/crate/.cargo_vcs_info.json
@@ -1,6 +1,6 @@ { "git": { - "sha1": "51ded1be5e27c2c1eac145064af3ccc41ea056bf" + "sha1": "306019c5a7434aa7424a83720a09c40e1ea12343" }, "path_in_vcs": "gen/cmd" } \ No newline at end of file
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.lock b/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.lock index dc12b39c..0983c28 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.lock +++ b/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.lock
@@ -4,24 +4,24 @@ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "clap" -version = "4.4.1" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.1" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstyle", "clap_lex", @@ -30,9 +30,9 @@ [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "codespan-reporting" @@ -46,7 +46,7 @@ [[package]] name = "cxxbridge-cmd" -version = "1.0.107" +version = "1.0.110" dependencies = [ "clap", "codespan-reporting", @@ -57,9 +57,9 @@ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -81,9 +81,9 @@ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -92,24 +92,24 @@ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "winapi" @@ -129,9 +129,9 @@ [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ]
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.toml b/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.toml index 8387496..746ccab 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.toml +++ b/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.toml
@@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.56" name = "cxxbridge-cmd" -version = "1.0.107" +version = "1.0.110" authors = ["David Tolnay <dtolnay@gmail.com>"] exclude = ["build.rs"] description = "C++ code generator for integrating `cxx` crate into a non-Cargo build."
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.toml.orig b/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.toml.orig index 6d7604b..ad19332b 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.toml.orig +++ b/third_party/rust/cxxbridge_cmd/v1/crate/Cargo.toml.orig
@@ -1,6 +1,6 @@ [package] name = "cxxbridge-cmd" -version = "1.0.107" +version = "1.0.110" authors = ["David Tolnay <dtolnay@gmail.com>"] categories = ["development-tools::build-utils", "development-tools::ffi"] description = "C++ code generator for integrating `cxx` crate into a non-Cargo build."
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/cfg.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/cfg.rs index 29f0b9bc..92b954c 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/cfg.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/cfg.rs
@@ -5,7 +5,7 @@ use syn::{Ident, LitBool, LitStr, Token}; #[derive(Ord, PartialOrd, Eq, PartialEq)] -pub enum CfgValue { +pub(crate) enum CfgValue { Bool(bool), Str(String), } @@ -15,12 +15,12 @@ const TRUE: Self = CfgValue::Bool(true); } -pub struct FlagsCfgEvaluator { +pub(crate) struct FlagsCfgEvaluator { map: Map<String, Set<CfgValue>>, } impl FlagsCfgEvaluator { - pub fn new(map: Map<String, Set<CfgValue>>) -> Self { + pub(crate) fn new(map: Map<String, Set<CfgValue>>) -> Self { FlagsCfgEvaluator { map } } } @@ -73,7 +73,7 @@ } } -pub fn parse(input: ParseStream) -> syn::Result<(String, CfgValue)> { +pub(crate) fn parse(input: ParseStream) -> syn::Result<(String, CfgValue)> { let ident: Ident = input.parse()?; let name = ident.to_string(); if input.is_empty() {
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/block.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/block.rs index 96a9a6ee..4e6e6d2 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/block.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/block.rs
@@ -1,7 +1,7 @@ use proc_macro2::Ident; #[derive(Copy, Clone, PartialEq, Debug)] -pub enum Block<'a> { +pub(crate) enum Block<'a> { AnonymousNamespace, Namespace(&'static str), UserDefinedNamespace(&'a Ident), @@ -10,7 +10,7 @@ } impl<'a> Block<'a> { - pub fn write_begin(self, out: &mut String) { + pub(crate) fn write_begin(self, out: &mut String) { if let Block::InlineNamespace(_) = self { out.push_str("inline "); } @@ -18,7 +18,7 @@ out.push_str(" {\n"); } - pub fn write_end(self, out: &mut String) { + pub(crate) fn write_end(self, out: &mut String) { out.push_str("} // "); self.write_common(out); out.push('\n');
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/builtin.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/builtin.rs index 277c64f..d38473a 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/builtin.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/builtin.rs
@@ -3,7 +3,7 @@ use crate::gen::out::{Content, OutFile}; #[derive(Default, PartialEq)] -pub struct Builtins<'a> { +pub(crate) struct Builtins<'a> { pub panic: bool, pub rust_string: bool, pub rust_str: bool, @@ -36,7 +36,7 @@ } impl<'a> Builtins<'a> { - pub fn new() -> Self { + pub(crate) fn new() -> Self { Builtins::default() } }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/file.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/file.rs index 4e4259e..d55021a 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/file.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/file.rs
@@ -4,7 +4,7 @@ use syn::parse::{Error, Parse, ParseStream, Result}; use syn::{braced, Attribute, Ident, Item, Meta, Token, Visibility}; -pub struct File { +pub(crate) struct File { pub modules: Vec<Module>, }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/fs.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/fs.rs index 7bc3bbc..a96b551 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/fs.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/fs.rs
@@ -14,7 +14,7 @@ } impl Error { - pub fn kind(&self) -> io::ErrorKind { + pub(crate) fn kind(&self) -> io::ErrorKind { match &self.source { Some(io_error) => io_error.kind(), None => io::ErrorKind::Other,
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/include.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/include.rs index 62c92320..3b137c7 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/include.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/include.rs
@@ -19,7 +19,7 @@ } #[derive(Default, PartialEq)] -pub struct Includes<'a> { +pub(crate) struct Includes<'a> { pub custom: Vec<Include>, pub algorithm: bool, pub array: bool, @@ -44,15 +44,15 @@ } impl<'a> Includes<'a> { - pub fn new() -> Self { + pub(crate) fn new() -> Self { Includes::default() } - pub fn insert(&mut self, include: impl Into<Include>) { + pub(crate) fn insert(&mut self, include: impl Into<Include>) { self.custom.push(include.into()); } - pub fn has_cxx_header(&self) -> bool { + pub(crate) fn has_cxx_header(&self) -> bool { self.custom .iter() .any(|header| header.path == "rust/cxx.h" || header.path == "rust\\cxx.h")
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/names.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/names.rs index 834424b..620aaa8 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/names.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/names.rs
@@ -1,7 +1,7 @@ use crate::syntax::Pair; impl Pair { - pub fn to_fully_qualified(&self) -> String { + pub(crate) fn to_fully_qualified(&self) -> String { let mut fully_qualified = String::new(); for segment in &self.namespace { fully_qualified += "::";
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/namespace.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/namespace.rs index b79c38f..424e9d8e 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/namespace.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/namespace.rs
@@ -2,7 +2,7 @@ use crate::syntax::Api; impl Api { - pub fn namespace(&self) -> &Namespace { + pub(crate) fn namespace(&self) -> &Namespace { match self { Api::CxxFunction(efn) | Api::RustFunction(efn) => &efn.name.namespace, Api::CxxType(ety) | Api::RustType(ety) => &ety.name.namespace,
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/nested.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/nested.rs index 02816629..7b326664 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/nested.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/nested.rs
@@ -2,21 +2,23 @@ use crate::syntax::Api; use proc_macro2::Ident; -pub struct NamespaceEntries<'a> { +pub(crate) struct NamespaceEntries<'a> { direct: Vec<&'a Api>, nested: Vec<(&'a Ident, NamespaceEntries<'a>)>, } impl<'a> NamespaceEntries<'a> { - pub fn new(apis: Vec<&'a Api>) -> Self { + pub(crate) fn new(apis: Vec<&'a Api>) -> Self { sort_by_inner_namespace(apis, 0) } - pub fn direct_content(&self) -> &[&'a Api] { + pub(crate) fn direct_content(&self) -> &[&'a Api] { &self.direct } - pub fn nested_content(&self) -> impl Iterator<Item = (&'a Ident, &NamespaceEntries<'a>)> { + pub(crate) fn nested_content( + &self, + ) -> impl Iterator<Item = (&'a Ident, &NamespaceEntries<'a>)> { self.nested.iter().map(|(k, entries)| (*k, entries)) } }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/out.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/out.rs index 3b4d739..1cce363 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/out.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/gen/out.rs
@@ -17,7 +17,7 @@ } #[derive(Default)] -pub struct Content<'a> { +pub(crate) struct Content<'a> { bytes: String, namespace: &'a Namespace, blocks: Vec<BlockBoundary<'a>>, @@ -32,7 +32,7 @@ } impl<'a> OutFile<'a> { - pub fn new(header: bool, opt: &'a Opt, types: &'a Types) -> Self { + pub(crate) fn new(header: bool, opt: &'a Opt, types: &'a Types) -> Self { OutFile { header, opt, @@ -44,28 +44,28 @@ } // Write a blank line if the preceding section had any contents. - pub fn next_section(&mut self) { + pub(crate) fn next_section(&mut self) { self.content.get_mut().next_section(); } - pub fn begin_block(&mut self, block: Block<'a>) { + pub(crate) fn begin_block(&mut self, block: Block<'a>) { self.content.get_mut().begin_block(block); } - pub fn end_block(&mut self, block: Block<'a>) { + pub(crate) fn end_block(&mut self, block: Block<'a>) { self.content.get_mut().end_block(block); } - pub fn set_namespace(&mut self, namespace: &'a Namespace) { + pub(crate) fn set_namespace(&mut self, namespace: &'a Namespace) { self.content.get_mut().set_namespace(namespace); } - pub fn write_fmt(&self, args: Arguments) { + pub(crate) fn write_fmt(&self, args: Arguments) { let content = &mut *self.content.borrow_mut(); Write::write_fmt(content, args).unwrap(); } - pub fn content(&mut self) -> Vec<u8> { + pub(crate) fn content(&mut self) -> Vec<u8> { self.flush(); let include = &self.include.content.bytes; let builtin = &self.builtin.content.bytes; @@ -112,19 +112,19 @@ Content::default() } - pub fn next_section(&mut self) { + pub(crate) fn next_section(&mut self) { self.section_pending = true; } - pub fn begin_block(&mut self, block: Block<'a>) { + pub(crate) fn begin_block(&mut self, block: Block<'a>) { self.push_block_boundary(BlockBoundary::Begin(block)); } - pub fn end_block(&mut self, block: Block<'a>) { + pub(crate) fn end_block(&mut self, block: Block<'a>) { self.push_block_boundary(BlockBoundary::End(block)); } - pub fn set_namespace(&mut self, namespace: &'a Namespace) { + pub(crate) fn set_namespace(&mut self, namespace: &'a Namespace) { for name in self.namespace.iter().rev() { self.end_block(Block::UserDefinedNamespace(name)); } @@ -134,7 +134,7 @@ self.namespace = namespace; } - pub fn write_fmt(&mut self, args: Arguments) { + pub(crate) fn write_fmt(&mut self, args: Arguments) { Write::write_fmt(self, args).unwrap(); }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/main.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/main.rs index 4d5edfd1..b33bf68 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/main.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/main.rs
@@ -6,6 +6,7 @@ clippy::enum_glob_use, clippy::if_same_then_else, clippy::inherent_to_string, + clippy::into_iter_without_iter, clippy::items_after_statements, clippy::large_enum_variant, clippy::match_bool, @@ -22,6 +23,7 @@ clippy::similar_names, clippy::single_match_else, clippy::struct_excessive_bools, + clippy::struct_field_names, clippy::too_many_arguments, clippy::too_many_lines, clippy::toplevel_ref_arg,
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/atom.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/atom.rs index d4ad78f..08e04a3 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/atom.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/atom.rs
@@ -3,7 +3,7 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone, PartialEq)] -pub enum Atom { +pub(crate) enum Atom { Bool, Char, // C char, not Rust char U8, @@ -23,11 +23,11 @@ } impl Atom { - pub fn from(ident: &Ident) -> Option<Self> { + pub(crate) fn from(ident: &Ident) -> Option<Self> { Self::from_str(ident.to_string().as_str()) } - pub fn from_str(s: &str) -> Option<Self> { + pub(crate) fn from_str(s: &str) -> Option<Self> { use self::Atom::*; match s { "bool" => Some(Bool),
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/attrs.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/attrs.rs index 4ff700a..894b82b 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/attrs.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/attrs.rs
@@ -27,7 +27,7 @@ // ); // #[derive(Default)] -pub struct Parser<'a> { +pub(crate) struct Parser<'a> { pub cfg: Option<&'a mut CfgExpr>, pub doc: Option<&'a mut Doc>, pub derives: Option<&'a mut Vec<Derive>>, @@ -44,7 +44,7 @@ pub(crate) _more: (), } -pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> OtherAttrs { +pub(crate) fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> OtherAttrs { let mut passthrough_attrs = Vec::new(); for attr in attrs { let attr_path = attr.path(); @@ -283,14 +283,14 @@ } #[derive(Clone)] -pub struct OtherAttrs(Vec<Attribute>); +pub(crate) struct OtherAttrs(Vec<Attribute>); impl OtherAttrs { - pub fn none() -> Self { + pub(crate) fn none() -> Self { OtherAttrs(Vec::new()) } - pub fn extend(&mut self, other: Self) { + pub(crate) fn extend(&mut self, other: Self) { self.0.extend(other.0); } }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/cfg.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/cfg.rs index ce6f338..83511d7 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/cfg.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/cfg.rs
@@ -4,7 +4,7 @@ use syn::{parenthesized, token, Attribute, LitStr, Token}; #[derive(Clone)] -pub enum CfgExpr { +pub(crate) enum CfgExpr { Unconditional, Eq(Ident, Option<LitStr>), All(Vec<CfgExpr>), @@ -13,7 +13,7 @@ } impl CfgExpr { - pub fn merge(&mut self, expr: CfgExpr) { + pub(crate) fn merge(&mut self, expr: CfgExpr) { if let CfgExpr::Unconditional = self { *self = expr; } else if let CfgExpr::All(list) = self { @@ -25,7 +25,7 @@ } } -pub fn parse_attribute(attr: &Attribute) -> Result<CfgExpr> { +pub(crate) fn parse_attribute(attr: &Attribute) -> Result<CfgExpr> { attr.parse_args_with(|input: ParseStream| { let cfg_expr = input.call(parse_single)?; input.parse::<Option<Token![,]>>()?;
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/derive.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/derive.rs index 7727fbc9..9e09461 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/derive.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/derive.rs
@@ -2,13 +2,13 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone)] -pub struct Derive { +pub(crate) struct Derive { pub what: Trait, pub span: Span, } #[derive(Copy, Clone, PartialEq)] -pub enum Trait { +pub(crate) enum Trait { Clone, Copy, Debug, @@ -24,7 +24,7 @@ } impl Derive { - pub fn from(ident: &Ident) -> Option<Self> { + pub(crate) fn from(ident: &Ident) -> Option<Self> { let what = match ident.to_string().as_str() { "Clone" => Trait::Clone, "Copy" => Trait::Copy, @@ -76,6 +76,6 @@ } } -pub fn contains(derives: &[Derive], query: Trait) -> bool { +pub(crate) fn contains(derives: &[Derive], query: Trait) -> bool { derives.iter().any(|derive| derive.what == query) }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/discriminant.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/discriminant.rs index 01a7d87d..775e57bb 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/discriminant.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/discriminant.rs
@@ -7,14 +7,14 @@ use std::str::FromStr; use syn::{Error, Expr, Lit, Result, Token, UnOp}; -pub struct DiscriminantSet { +pub(crate) struct DiscriminantSet { repr: Option<Atom>, values: BTreeSet<Discriminant>, previous: Option<Discriminant>, } #[derive(Copy, Clone, Eq, PartialEq)] -pub struct Discriminant { +pub(crate) struct Discriminant { sign: Sign, magnitude: u64, } @@ -26,7 +26,7 @@ } impl DiscriminantSet { - pub fn new(repr: Option<Atom>) -> Self { + pub(crate) fn new(repr: Option<Atom>) -> Self { DiscriminantSet { repr, values: BTreeSet::new(), @@ -34,7 +34,7 @@ } } - pub fn insert(&mut self, expr: &Expr) -> Result<Discriminant> { + pub(crate) fn insert(&mut self, expr: &Expr) -> Result<Discriminant> { let (discriminant, repr) = expr_to_discriminant(expr)?; match (self.repr, repr) { (None, Some(new_repr)) => { @@ -61,7 +61,7 @@ insert(self, discriminant) } - pub fn insert_next(&mut self) -> Result<Discriminant> { + pub(crate) fn insert_next(&mut self) -> Result<Discriminant> { let discriminant = match self.previous { None => Discriminant::zero(), Some(mut discriminant) => match discriminant.sign { @@ -85,7 +85,7 @@ insert(self, discriminant) } - pub fn inferred_repr(&self) -> Result<Atom> { + pub(crate) fn inferred_repr(&self) -> Result<Atom> { if let Some(repr) = self.repr { return Ok(repr); } @@ -149,7 +149,7 @@ } impl Discriminant { - pub const fn zero() -> Self { + pub(crate) const fn zero() -> Self { Discriminant { sign: Sign::Positive, magnitude: 0, @@ -180,7 +180,7 @@ } #[cfg(feature = "experimental-enum-variants-from-header")] - pub const fn checked_succ(self) -> Option<Self> { + pub(crate) const fn checked_succ(self) -> Option<Self> { match self.sign { Sign::Negative => { if self.magnitude == 1 {
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/doc.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/doc.rs index 5de824f..bd8111e 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/doc.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/doc.rs
@@ -2,30 +2,30 @@ use quote::{quote, ToTokens}; use syn::LitStr; -pub struct Doc { - pub(crate) hidden: bool, +pub(crate) struct Doc { + pub hidden: bool, fragments: Vec<LitStr>, } impl Doc { - pub fn new() -> Self { + pub(crate) fn new() -> Self { Doc { hidden: false, fragments: Vec::new(), } } - pub fn push(&mut self, lit: LitStr) { + pub(crate) fn push(&mut self, lit: LitStr) { self.fragments.push(lit); } #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro - pub fn is_empty(&self) -> bool { + pub(crate) fn is_empty(&self) -> bool { self.fragments.is_empty() } #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro - pub fn to_string(&self) -> String { + pub(crate) fn to_string(&self) -> String { let mut doc = String::new(); for lit in &self.fragments { doc += &lit.value();
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/error.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/error.rs index f40c4a8..4487693 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/error.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/error.rs
@@ -1,9 +1,11 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone)] -pub struct Error { +pub(crate) struct Error { pub msg: &'static str, + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub label: Option<&'static str>, + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub note: Option<&'static str>, } @@ -13,7 +15,7 @@ } } -pub static ERRORS: &[Error] = &[ +pub(crate) static ERRORS: &[Error] = &[ BOX_CXX_TYPE, CXXBRIDGE_RESERVED, CXX_STRING_BY_VALUE, @@ -27,67 +29,67 @@ USE_NOT_ALLOWED, ]; -pub static BOX_CXX_TYPE: Error = Error { +pub(crate) static BOX_CXX_TYPE: Error = Error { msg: "Box of a C++ type is not supported yet", label: None, note: Some("hint: use UniquePtr<> or SharedPtr<>"), }; -pub static CXXBRIDGE_RESERVED: Error = Error { +pub(crate) static CXXBRIDGE_RESERVED: Error = Error { msg: "identifiers starting with cxxbridge are reserved", label: Some("reserved identifier"), note: Some("identifiers starting with cxxbridge are reserved"), }; -pub static CXX_STRING_BY_VALUE: Error = Error { +pub(crate) static CXX_STRING_BY_VALUE: Error = Error { msg: "C++ string by value is not supported", label: None, note: Some("hint: wrap it in a UniquePtr<>"), }; -pub static CXX_TYPE_BY_VALUE: Error = Error { +pub(crate) static CXX_TYPE_BY_VALUE: Error = Error { msg: "C++ type by value is not supported", label: None, note: Some("hint: wrap it in a UniquePtr<> or SharedPtr<>"), }; -pub static DISCRIMINANT_OVERFLOW: Error = Error { +pub(crate) static DISCRIMINANT_OVERFLOW: Error = Error { msg: "discriminant overflow on value after ", label: Some("discriminant overflow"), note: Some("note: explicitly set `= 0` if that is desired outcome"), }; -pub static DOT_INCLUDE: Error = Error { +pub(crate) static DOT_INCLUDE: Error = Error { msg: "#include relative to `.` or `..` is not supported in Cargo builds", label: Some("#include relative to `.` or `..` is not supported in Cargo builds"), note: Some("note: use a path starting with the crate name"), }; -pub static DOUBLE_UNDERSCORE: Error = Error { +pub(crate) static DOUBLE_UNDERSCORE: Error = Error { msg: "identifiers containing double underscore are reserved in C++", label: Some("reserved identifier"), note: Some("identifiers containing double underscore are reserved in C++"), }; -pub static RESERVED_LIFETIME: Error = Error { +pub(crate) static RESERVED_LIFETIME: Error = Error { msg: "invalid lifetime parameter name: `'static`", label: Some("'static is a reserved lifetime name"), note: None, }; -pub static RUST_TYPE_BY_VALUE: Error = Error { +pub(crate) static RUST_TYPE_BY_VALUE: Error = Error { msg: "opaque Rust type by value is not supported", label: None, note: Some("hint: wrap it in a Box<>"), }; -pub static UNSUPPORTED_TYPE: Error = Error { +pub(crate) static UNSUPPORTED_TYPE: Error = Error { msg: "unsupported type: ", label: Some("unsupported type"), note: None, }; -pub static USE_NOT_ALLOWED: Error = Error { +pub(crate) static USE_NOT_ALLOWED: Error = Error { msg: "`use` items are not allowed within cxx bridge", label: Some("not allowed"), note: Some(
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/file.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/file.rs index 71f11ee..cf6d3e8 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/file.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/file.rs
@@ -7,19 +7,24 @@ ItemStruct, ItemUse, LitStr, Token, Visibility, }; -pub struct Module { +pub(crate) struct Module { + #[allow(dead_code)] pub cfg: CfgExpr, pub namespace: Namespace, pub attrs: Vec<Attribute>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub vis: Visibility, pub unsafety: Option<Token![unsafe]>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub mod_token: Token![mod], + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub ident: Ident, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub brace_token: token::Brace, pub content: Vec<Item>, } -pub enum Item { +pub(crate) enum Item { Struct(ItemStruct), Enum(ItemEnum), ForeignMod(ItemForeignMod), @@ -28,10 +33,11 @@ Other(RustItem), } -pub struct ItemForeignMod { +pub(crate) struct ItemForeignMod { pub attrs: Vec<Attribute>, pub unsafety: Option<Token![unsafe]>, pub abi: Abi, + #[allow(dead_code)] pub brace_token: token::Brace, pub items: Vec<ForeignItem>, }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/improper.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/improper.rs index f19eb86a..a19f5b7d 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/improper.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/improper.rs
@@ -3,14 +3,14 @@ use crate::syntax::{Type, Types}; use proc_macro2::Ident; -pub enum ImproperCtype<'a> { +pub(crate) enum ImproperCtype<'a> { Definite(bool), Depends(&'a Ident), } impl<'a> Types<'a> { // yes, no, maybe - pub fn determine_improper_ctype(&self, ty: &Type) -> ImproperCtype<'a> { + pub(crate) fn determine_improper_ctype(&self, ty: &Type) -> ImproperCtype<'a> { match ty { Type::Ident(ident) => { let ident = &ident.rust;
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/instantiate.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/instantiate.rs index b6cbf24b..dda3069 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/instantiate.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/instantiate.rs
@@ -4,7 +4,7 @@ use syn::Token; #[derive(Copy, Clone, PartialEq, Eq, Hash)] -pub enum ImplKey<'a> { +pub(crate) enum ImplKey<'a> { RustBox(NamedImplKey<'a>), RustVec(NamedImplKey<'a>), UniquePtr(NamedImplKey<'a>), @@ -14,11 +14,15 @@ } #[derive(Copy, Clone)] -pub struct NamedImplKey<'a> { +pub(crate) struct NamedImplKey<'a> { + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub begin_span: Span, pub rust: &'a Ident, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub lt_token: Option<Token![<]>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub gt_token: Option<Token![>]>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub end_span: Span, }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/mangle.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/mangle.rs index 287b443..6f019657 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/mangle.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/mangle.rs
@@ -84,7 +84,7 @@ }; } -pub fn extern_fn(efn: &ExternFn, types: &Types) -> Symbol { +pub(crate) fn extern_fn(efn: &ExternFn, types: &Types) -> Symbol { match &efn.receiver { Some(receiver) => { let receiver_ident = types.resolve(&receiver.ty); @@ -99,7 +99,7 @@ } } -pub fn operator(receiver: &Pair, operator: &'static str) -> Symbol { +pub(crate) fn operator(receiver: &Pair, operator: &'static str) -> Symbol { join!( receiver.namespace, CXXBRIDGE, @@ -110,11 +110,11 @@ } // The C half of a function pointer trampoline. -pub fn c_trampoline(efn: &ExternFn, var: &Pair, types: &Types) -> Symbol { +pub(crate) fn c_trampoline(efn: &ExternFn, var: &Pair, types: &Types) -> Symbol { join!(extern_fn(efn, types), var.rust, 0) } // The Rust half of a function pointer trampoline. -pub fn r_trampoline(efn: &ExternFn, var: &Pair, types: &Types) -> Symbol { +pub(crate) fn r_trampoline(efn: &ExternFn, var: &Pair, types: &Types) -> Symbol { join!(extern_fn(efn, types), var.rust, 1) }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/map.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/map.rs index 526b793..4a2db0b 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/map.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/map.rs
@@ -3,9 +3,9 @@ use std::ops::Index; use std::slice; -pub use self::ordered::OrderedMap; -pub use self::unordered::UnorderedMap; -pub use std::collections::hash_map::Entry; +pub(crate) use self::ordered::OrderedMap; +pub(crate) use self::unordered::UnorderedMap; +pub(crate) use std::collections::hash_map::Entry; mod ordered { use super::{Entry, Iter, UnorderedMap}; @@ -13,24 +13,25 @@ use std::hash::Hash; use std::mem; - pub struct OrderedMap<K, V> { + pub(crate) struct OrderedMap<K, V> { map: UnorderedMap<K, usize>, vec: Vec<(K, V)>, } impl<K, V> OrderedMap<K, V> { - pub fn new() -> Self { + pub(crate) fn new() -> Self { OrderedMap { map: UnorderedMap::new(), vec: Vec::new(), } } - pub fn iter(&self) -> Iter<K, V> { + pub(crate) fn iter(&self) -> Iter<K, V> { Iter(self.vec.iter()) } - pub fn keys(&self) -> impl Iterator<Item = &K> { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro + pub(crate) fn keys(&self) -> impl Iterator<Item = &K> { self.vec.iter().map(|(k, _v)| k) } } @@ -39,7 +40,7 @@ where K: Copy + Hash + Eq, { - pub fn insert(&mut self, key: K, value: V) -> Option<V> { + pub(crate) fn insert(&mut self, key: K, value: V) -> Option<V> { match self.map.entry(key) { Entry::Occupied(entry) => { let i = &mut self.vec[*entry.get()]; @@ -53,22 +54,13 @@ } } - pub fn contains_key<Q>(&self, key: &Q) -> bool + pub(crate) fn contains_key<Q>(&self, key: &Q) -> bool where K: Borrow<Q>, Q: ?Sized + Hash + Eq, { self.map.contains_key(key) } - - pub fn get<Q>(&self, key: &Q) -> Option<&V> - where - K: Borrow<Q>, - Q: ?Sized + Hash + Eq, - { - let i = *self.map.get(key)?; - Some(&self.vec[i].1) - } } impl<'a, K, V> IntoIterator for &'a OrderedMap<K, V> { @@ -88,10 +80,10 @@ // Wrapper prohibits accidentally introducing iteration over the map, which // could lead to nondeterministic generated code. - pub struct UnorderedMap<K, V>(HashMap<K, V>); + pub(crate) struct UnorderedMap<K, V>(HashMap<K, V>); impl<K, V> UnorderedMap<K, V> { - pub fn new() -> Self { + pub(crate) fn new() -> Self { UnorderedMap(HashMap::new()) } } @@ -100,11 +92,11 @@ where K: Hash + Eq, { - pub fn insert(&mut self, key: K, value: V) -> Option<V> { + pub(crate) fn insert(&mut self, key: K, value: V) -> Option<V> { self.0.insert(key, value) } - pub fn contains_key<Q>(&self, key: &Q) -> bool + pub(crate) fn contains_key<Q>(&self, key: &Q) -> bool where K: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -112,7 +104,7 @@ self.0.contains_key(key) } - pub fn get<Q>(&self, key: &Q) -> Option<&V> + pub(crate) fn get<Q>(&self, key: &Q) -> Option<&V> where K: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -120,12 +112,12 @@ self.0.get(key) } - pub fn entry(&mut self, key: K) -> Entry<K, V> { + pub(crate) fn entry(&mut self, key: K) -> Entry<K, V> { self.0.entry(key) } #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro - pub fn remove<Q>(&mut self, key: &Q) -> Option<V> + pub(crate) fn remove<Q>(&mut self, key: &Q) -> Option<V> where K: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -133,7 +125,7 @@ self.0.remove(key) } - pub fn keys(&self) -> UnorderedSet<K> + pub(crate) fn keys(&self) -> UnorderedSet<K> where K: Copy, { @@ -146,7 +138,7 @@ } } -pub struct Iter<'a, K, V>(slice::Iter<'a, (K, V)>); +pub(crate) struct Iter<'a, K, V>(slice::Iter<'a, (K, V)>); impl<'a, K, V> Iterator for Iter<'a, K, V> { type Item = (&'a K, &'a V);
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/mod.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/mod.rs index 4f19d96..5ff343b 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/mod.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/mod.rs
@@ -1,33 +1,33 @@ // Functionality that is shared between the cxxbridge macro and the cmd. -pub mod atom; -pub mod attrs; -pub mod cfg; -pub mod check; -pub mod derive; +pub(crate) mod atom; +pub(crate) mod attrs; +pub(crate) mod cfg; +pub(crate) mod check; +pub(crate) mod derive; mod discriminant; mod doc; -pub mod error; -pub mod file; -pub mod ident; +pub(crate) mod error; +pub(crate) mod file; +pub(crate) mod ident; mod impls; mod improper; -pub mod instantiate; -pub mod mangle; -pub mod map; +pub(crate) mod instantiate; +pub(crate) mod mangle; +pub(crate) mod map; mod names; -pub mod namespace; +pub(crate) mod namespace; mod parse; mod pod; -pub mod qualified; -pub mod report; -pub mod resolve; -pub mod set; -pub mod symbol; +pub(crate) mod qualified; +pub(crate) mod report; +pub(crate) mod resolve; +pub(crate) mod set; +pub(crate) mod symbol; mod tokens; mod toposort; -pub mod trivial; -pub mod types; +pub(crate) mod trivial; +pub(crate) mod types; mod visit; use self::attrs::OtherAttrs; @@ -40,15 +40,15 @@ use syn::token::{Brace, Bracket, Paren}; use syn::{Attribute, Expr, Generics, Lifetime, LitInt, Token, Type as RustType}; -pub use self::atom::Atom; -pub use self::derive::{Derive, Trait}; -pub use self::discriminant::Discriminant; -pub use self::doc::Doc; -pub use self::names::ForeignName; -pub use self::parse::parse_items; -pub use self::types::Types; +pub(crate) use self::atom::Atom; +pub(crate) use self::derive::{Derive, Trait}; +pub(crate) use self::discriminant::Discriminant; +pub(crate) use self::doc::Doc; +pub(crate) use self::names::ForeignName; +pub(crate) use self::parse::parse_items; +pub(crate) use self::types::Types; -pub enum Api { +pub(crate) enum Api { Include(Include), Struct(Struct), Enum(Enum), @@ -60,11 +60,13 @@ Impl(Impl), } -pub struct Include { +pub(crate) struct Include { pub cfg: CfgExpr, pub path: String, pub kind: IncludeKind, + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub begin_span: Span, + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub end_span: Span, } @@ -77,27 +79,35 @@ Bracketed, } -pub struct ExternType { +pub(crate) struct ExternType { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub lang: Lang, pub doc: Doc, pub derives: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub type_token: Token![type], pub name: Pair, pub generics: Lifetimes, + #[allow(dead_code)] pub colon_token: Option<Token![:]>, pub bounds: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub semi_token: Token![;], pub trusted: bool, } -pub struct Struct { +pub(crate) struct Struct { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub doc: Doc, pub derives: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub struct_token: Token![struct], pub name: Pair, @@ -106,11 +116,14 @@ pub fields: Vec<Var>, } -pub struct Enum { +pub(crate) struct Enum { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub doc: Doc, pub derives: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub enum_token: Token![enum], pub name: Pair, @@ -118,12 +131,13 @@ pub brace_token: Brace, pub variants: Vec<Variant>, pub variants_from_header: bool, + #[allow(dead_code)] pub variants_from_header_attr: Option<Attribute>, pub repr: EnumRepr, pub explicit_repr: bool, } -pub enum EnumRepr { +pub(crate) enum EnumRepr { Native { atom: Atom, repr_type: Type, @@ -134,11 +148,14 @@ }, } -pub struct ExternFn { +pub(crate) struct ExternFn { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub lang: Lang, pub doc: Doc, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub name: Pair, pub sig: Signature, @@ -146,39 +163,49 @@ pub trusted: bool, } -pub struct TypeAlias { +pub(crate) struct TypeAlias { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub doc: Doc, pub derives: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub type_token: Token![type], pub name: Pair, pub generics: Lifetimes, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub eq_token: Token![=], + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub ty: RustType, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub semi_token: Token![;], } -pub struct Impl { +pub(crate) struct Impl { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub impl_token: Token![impl], pub impl_generics: Lifetimes, + #[allow(dead_code)] pub negative: bool, pub ty: Type, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub ty_generics: Lifetimes, pub brace_token: Brace, pub negative_token: Option<Token![!]>, } #[derive(Clone, Default)] -pub struct Lifetimes { +pub(crate) struct Lifetimes { pub lt_token: Option<Token![<]>, pub lifetimes: Punctuated<Lifetime, Token![,]>, pub gt_token: Option<Token![>]>, } -pub struct Signature { +pub(crate) struct Signature { pub asyncness: Option<Token![async]>, pub unsafety: Option<Token![unsafe]>, pub fn_token: Token![fn], @@ -191,39 +218,48 @@ pub throws_tokens: Option<(kw::Result, Token![<], Token![>])>, } -pub struct Var { +pub(crate) struct Var { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub doc: Doc, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub name: Pair, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub colon_token: Token![:], pub ty: Type, } -pub struct Receiver { +pub(crate) struct Receiver { pub pinned: bool, pub ampersand: Token![&], pub lifetime: Option<Lifetime>, pub mutable: bool, pub var: Token![self], pub ty: NamedType, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub colon_token: Token![:], pub shorthand: bool, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub pin_tokens: Option<(kw::Pin, Token![<], Token![>])>, pub mutability: Option<Token![mut]>, } -pub struct Variant { +pub(crate) struct Variant { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub doc: Doc, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, pub name: Pair, pub discriminant: Discriminant, + #[allow(dead_code)] pub expr: Option<Expr>, } -pub enum Type { +pub(crate) enum Type { Ident(NamedType), RustBox(Box<Ty1>), RustVec(Box<Ty1>), @@ -240,14 +276,14 @@ Array(Box<Array>), } -pub struct Ty1 { +pub(crate) struct Ty1 { pub name: Ident, pub langle: Token![<], pub inner: Type, pub rangle: Token![>], } -pub struct Ref { +pub(crate) struct Ref { pub pinned: bool, pub ampersand: Token![&], pub lifetime: Option<Lifetime>, @@ -257,7 +293,7 @@ pub mutability: Option<Token![mut]>, } -pub struct Ptr { +pub(crate) struct Ptr { pub star: Token![*], pub mutable: bool, pub inner: Type, @@ -265,7 +301,7 @@ pub constness: Option<Token![const]>, } -pub struct SliceRef { +pub(crate) struct SliceRef { pub ampersand: Token![&], pub lifetime: Option<Lifetime>, pub mutable: bool, @@ -274,7 +310,7 @@ pub mutability: Option<Token![mut]>, } -pub struct Array { +pub(crate) struct Array { pub bracket: Bracket, pub inner: Type, pub semi_token: Token![;], @@ -283,7 +319,7 @@ } #[derive(Copy, Clone, PartialEq)] -pub enum Lang { +pub(crate) enum Lang { Cxx, Rust, } @@ -291,7 +327,7 @@ // An association of a defined Rust name with a fully resolved, namespace // qualified C++ name. #[derive(Clone)] -pub struct Pair { +pub(crate) struct Pair { pub namespace: Namespace, pub cxx: ForeignName, pub rust: Ident, @@ -300,7 +336,7 @@ // Wrapper for a type which needs to be resolved before it can be printed in // C++. #[derive(PartialEq, Eq, Hash)] -pub struct NamedType { +pub(crate) struct NamedType { pub rust: Ident, pub generics: Lifetimes, }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/names.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/names.rs index 329a102..7afa5a9e 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/names.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/names.rs
@@ -8,12 +8,12 @@ use syn::punctuated::Punctuated; #[derive(Clone)] -pub struct ForeignName { +pub(crate) struct ForeignName { text: String, } impl Pair { - pub fn to_symbol(&self) -> Symbol { + pub(crate) fn to_symbol(&self) -> Symbol { let segments = self .namespace .iter() @@ -24,7 +24,7 @@ } impl NamedType { - pub fn new(rust: Ident) -> Self { + pub(crate) fn new(rust: Ident) -> Self { let generics = Lifetimes { lt_token: None, lifetimes: Punctuated::new(), @@ -32,14 +32,10 @@ }; NamedType { rust, generics } } - - pub fn span(&self) -> Span { - self.rust.span() - } } impl ForeignName { - pub fn parse(text: &str, span: Span) -> Result<Self> { + pub(crate) fn parse(text: &str, span: Span) -> Result<Self> { // TODO: support C++ names containing whitespace (`unsigned int`) or // non-alphanumeric characters (`operator++`). match Ident::parse_any.parse_str(text) {
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/namespace.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/namespace.rs index b4adb3f..417fb34 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/namespace.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/namespace.rs
@@ -10,20 +10,20 @@ } #[derive(Clone, Default)] -pub struct Namespace { +pub(crate) struct Namespace { segments: Vec<Ident>, } impl Namespace { - pub const ROOT: Self = Namespace { + pub(crate) const ROOT: Self = Namespace { segments: Vec::new(), }; - pub fn iter(&self) -> Iter<Ident> { + pub(crate) fn iter(&self) -> Iter<Ident> { self.segments.iter() } - pub fn parse_bridge_attr_namespace(input: ParseStream) -> Result<Self> { + pub(crate) fn parse_bridge_attr_namespace(input: ParseStream) -> Result<Self> { if input.is_empty() { return Ok(Namespace::ROOT); } @@ -35,7 +35,7 @@ Ok(namespace) } - pub fn parse_meta(meta: &Meta) -> Result<Self> { + pub(crate) fn parse_meta(meta: &Meta) -> Result<Self> { if let Meta::NameValue(meta) = meta { match &meta.value { Expr::Lit(expr) => {
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/parse.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/parse.rs index 8ba8c17..850dcc8d 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/parse.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/parse.rs
@@ -22,12 +22,12 @@ TypeReference, Variant as RustVariant, Visibility, }; -pub mod kw { +pub(crate) mod kw { syn::custom_keyword!(Pin); syn::custom_keyword!(Result); } -pub fn parse_items( +pub(crate) fn parse_items( cx: &mut Errors, items: Vec<Item>, trusted: bool,
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/pod.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/pod.rs index 0bf152e..506e53c 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/pod.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/pod.rs
@@ -2,7 +2,7 @@ use crate::syntax::{derive, Trait, Type, Types}; impl<'a> Types<'a> { - pub fn is_guaranteed_pod(&self, ty: &Type) -> bool { + pub(crate) fn is_guaranteed_pod(&self, ty: &Type) -> bool { match ty { Type::Ident(ident) => { let ident = &ident.rust;
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/qualified.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/qualified.rs index e11ffbc..07c9908c 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/qualified.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/qualified.rs
@@ -2,12 +2,12 @@ use syn::parse::{Error, ParseStream, Result}; use syn::{Ident, LitStr, Token}; -pub struct QualifiedName { +pub(crate) struct QualifiedName { pub segments: Vec<Ident>, } impl QualifiedName { - pub fn parse_quoted(lit: &LitStr) -> Result<Self> { + pub(crate) fn parse_quoted(lit: &LitStr) -> Result<Self> { if lit.value().is_empty() { let segments = Vec::new(); Ok(QualifiedName { segments }) @@ -19,12 +19,12 @@ } } - pub fn parse_unquoted(input: ParseStream) -> Result<Self> { + pub(crate) fn parse_unquoted(input: ParseStream) -> Result<Self> { let allow_raw = true; parse_unquoted(input, allow_raw) } - pub fn parse_quoted_or_unquoted(input: ParseStream) -> Result<Self> { + pub(crate) fn parse_quoted_or_unquoted(input: ParseStream) -> Result<Self> { if input.peek(LitStr) { let lit: LitStr = input.parse()?; Self::parse_quoted(&lit)
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/report.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/report.rs index d1d8bc9..1997182 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/report.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/report.rs
@@ -2,24 +2,24 @@ use std::fmt::Display; use syn::{Error, Result}; -pub struct Errors { +pub(crate) struct Errors { errors: Vec<Error>, } impl Errors { - pub fn new() -> Self { + pub(crate) fn new() -> Self { Errors { errors: Vec::new() } } - pub fn error(&mut self, sp: impl ToTokens, msg: impl Display) { + pub(crate) fn error(&mut self, sp: impl ToTokens, msg: impl Display) { self.errors.push(Error::new_spanned(sp, msg)); } - pub fn push(&mut self, error: Error) { + pub(crate) fn push(&mut self, error: Error) { self.errors.push(error); } - pub fn propagate(&mut self) -> Result<()> { + pub(crate) fn propagate(&mut self) -> Result<()> { let mut iter = self.errors.drain(..); let mut all_errors = match iter.next() { Some(err) => err,
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/resolve.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/resolve.rs index 3a2635bd3..b0a4782 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/resolve.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/resolve.rs
@@ -3,13 +3,13 @@ use proc_macro2::Ident; #[derive(Copy, Clone)] -pub struct Resolution<'a> { +pub(crate) struct Resolution<'a> { pub name: &'a Pair, pub generics: &'a Lifetimes, } impl<'a> Types<'a> { - pub fn resolve(&self, ident: &impl UnresolvedName) -> Resolution<'a> { + pub(crate) fn resolve(&self, ident: &impl UnresolvedName) -> Resolution<'a> { let ident = ident.ident(); match self.try_resolve(ident) { Some(resolution) => resolution, @@ -17,13 +17,13 @@ } } - pub fn try_resolve(&self, ident: &impl UnresolvedName) -> Option<Resolution<'a>> { + pub(crate) fn try_resolve(&self, ident: &impl UnresolvedName) -> Option<Resolution<'a>> { let ident = ident.ident(); self.resolutions.get(ident).copied() } } -pub trait UnresolvedName { +pub(crate) trait UnresolvedName { fn ident(&self) -> &Ident; }
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/set.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/set.rs index ca0c43e0..0907834 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/set.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/set.rs
@@ -1,15 +1,14 @@ use std::fmt::{self, Debug}; use std::slice; -pub use self::ordered::OrderedSet; -pub use self::unordered::UnorderedSet; +pub(crate) use self::ordered::OrderedSet; +pub(crate) use self::unordered::UnorderedSet; mod ordered { use super::{Iter, UnorderedSet}; - use std::borrow::Borrow; use std::hash::Hash; - pub struct OrderedSet<T> { + pub(crate) struct OrderedSet<T> { set: UnorderedSet<T>, vec: Vec<T>, } @@ -18,44 +17,28 @@ where T: Hash + Eq, { - pub fn new() -> Self { + pub(crate) fn new() -> Self { OrderedSet { set: UnorderedSet::new(), vec: Vec::new(), } } - pub fn insert(&mut self, value: &'a T) -> bool { + pub(crate) fn insert(&mut self, value: &'a T) -> bool { let new = self.set.insert(value); if new { self.vec.push(value); } new } - - pub fn contains<Q>(&self, value: &Q) -> bool - where - &'a T: Borrow<Q>, - Q: ?Sized + Hash + Eq, - { - self.set.contains(value) - } - - pub fn get<Q>(&self, value: &Q) -> Option<&'a T> - where - &'a T: Borrow<Q>, - Q: ?Sized + Hash + Eq, - { - self.set.get(value).copied() - } } impl<'a, T> OrderedSet<&'a T> { - pub fn is_empty(&self) -> bool { + pub(crate) fn is_empty(&self) -> bool { self.vec.is_empty() } - pub fn iter(&self) -> Iter<'_, 'a, T> { + pub(crate) fn iter(&self) -> Iter<'_, 'a, T> { Iter(self.vec.iter()) } } @@ -76,21 +59,21 @@ // Wrapper prohibits accidentally introducing iteration over the set, which // could lead to nondeterministic generated code. - pub struct UnorderedSet<T>(HashSet<T>); + pub(crate) struct UnorderedSet<T>(HashSet<T>); impl<T> UnorderedSet<T> where T: Hash + Eq, { - pub fn new() -> Self { + pub(crate) fn new() -> Self { UnorderedSet(HashSet::new()) } - pub fn insert(&mut self, value: T) -> bool { + pub(crate) fn insert(&mut self, value: T) -> bool { self.0.insert(value) } - pub fn contains<Q>(&self, value: &Q) -> bool + pub(crate) fn contains<Q>(&self, value: &Q) -> bool where T: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -98,7 +81,8 @@ self.0.contains(value) } - pub fn get<Q>(&self, value: &Q) -> Option<&T> + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-cmd + pub(crate) fn get<Q>(&self, value: &Q) -> Option<&T> where T: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -106,13 +90,13 @@ self.0.get(value) } - pub fn retain(&mut self, f: impl FnMut(&T) -> bool) { + pub(crate) fn retain(&mut self, f: impl FnMut(&T) -> bool) { self.0.retain(f); } } } -pub struct Iter<'s, 'a, T>(slice::Iter<'s, &'a T>); +pub(crate) struct Iter<'s, 'a, T>(slice::Iter<'s, &'a T>); impl<'s, 'a, T> Iterator for Iter<'s, 'a, T> { type Item = &'a T;
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/symbol.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/symbol.rs index 4c1607e..f9fd32c5 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/symbol.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/symbol.rs
@@ -6,7 +6,7 @@ // A mangled symbol consisting of segments separated by '$'. // For example: cxxbridge1$string$new -pub struct Symbol(String); +pub(crate) struct Symbol(String); impl Display for Symbol { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -30,7 +30,7 @@ assert!(self.0.len() > len_before); } - pub fn from_idents<'a>(it: impl Iterator<Item = &'a dyn Segment>) -> Self { + pub(crate) fn from_idents<'a>(it: impl Iterator<Item = &'a dyn Segment>) -> Self { let mut symbol = Symbol(String::new()); for segment in it { segment.write(&mut symbol); @@ -40,7 +40,7 @@ } } -pub trait Segment { +pub(crate) trait Segment { fn write(&self, symbol: &mut Symbol); } @@ -100,7 +100,7 @@ } } -pub fn join(segments: &[&dyn Segment]) -> Symbol { +pub(crate) fn join(segments: &[&dyn Segment]) -> Symbol { let mut symbol = Symbol(String::new()); for segment in segments { segment.write(&mut symbol);
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/toposort.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/toposort.rs index 8fe55b8..9c97eb1 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/toposort.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/toposort.rs
@@ -7,7 +7,7 @@ Visited, } -pub fn sort<'a>(cx: &mut Errors, apis: &'a [Api], types: &Types<'a>) -> Vec<&'a Struct> { +pub(crate) fn sort<'a>(cx: &mut Errors, apis: &'a [Api], types: &Types<'a>) -> Vec<&'a Struct> { let mut sorted = Vec::new(); let ref mut marks = Map::new(); for api in apis {
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/trivial.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/trivial.rs index 067e2d7..9533400 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/trivial.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/trivial.rs
@@ -5,7 +5,7 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone)] -pub enum TrivialReason<'a> { +pub(crate) enum TrivialReason<'a> { StructField(&'a Struct), FunctionArgument(&'a ExternFn), FunctionReturn(&'a ExternFn), @@ -15,7 +15,7 @@ UnpinnedMut(&'a ExternFn), } -pub fn required_trivial_reasons<'a>( +pub(crate) fn required_trivial_reasons<'a>( apis: &'a [Api], all: &Set<&'a Type>, structs: &UnorderedMap<&'a Ident, &'a Struct>, @@ -124,7 +124,7 @@ // Context: // "type {type} should be trivially move constructible and trivially destructible in C++ to be used as {what} in Rust" // "needs a cxx::ExternType impl in order to be used as {what}" -pub fn as_what<'a>(name: &'a Pair, reasons: &'a [TrivialReason]) -> impl Display + 'a { +pub(crate) fn as_what<'a>(name: &'a Pair, reasons: &'a [TrivialReason]) -> impl Display + 'a { struct Description<'a> { name: &'a Pair, reasons: &'a [TrivialReason<'a>],
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/types.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/types.rs index 82b45300..623a8b8 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/types.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/types.rs
@@ -12,7 +12,7 @@ use proc_macro2::Ident; use quote::ToTokens; -pub struct Types<'a> { +pub(crate) struct Types<'a> { pub all: OrderedSet<&'a Type>, pub structs: UnorderedMap<&'a Ident, &'a Struct>, pub enums: UnorderedMap<&'a Ident, &'a Enum>, @@ -28,7 +28,7 @@ } impl<'a> Types<'a> { - pub fn collect(cx: &mut Errors, apis: &'a [Api]) -> Self { + pub(crate) fn collect(cx: &mut Errors, apis: &'a [Api]) -> Self { let mut all = OrderedSet::new(); let mut structs = UnorderedMap::new(); let mut enums = UnorderedMap::new(); @@ -241,7 +241,7 @@ types } - pub fn needs_indirect_abi(&self, ty: &Type) -> bool { + pub(crate) fn needs_indirect_abi(&self, ty: &Type) -> bool { match ty { Type::RustBox(_) | Type::UniquePtr(_) => false, Type::Array(_) => true, @@ -255,7 +255,8 @@ // refuses to believe that C could know how to supply us with a pointer to a // Rust String, even though C could easily have obtained that pointer // legitimately from a Rust call. - pub fn is_considered_improper_ctype(&self, ty: &Type) -> bool { + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build + pub(crate) fn is_considered_improper_ctype(&self, ty: &Type) -> bool { match self.determine_improper_ctype(ty) { ImproperCtype::Definite(improper) => improper, ImproperCtype::Depends(ident) => self.struct_improper_ctypes.contains(ident), @@ -264,7 +265,7 @@ // Types which we need to assume could possibly exist by value on the Rust // side. - pub fn is_maybe_trivial(&self, ty: &Ident) -> bool { + pub(crate) fn is_maybe_trivial(&self, ty: &Ident) -> bool { self.structs.contains_key(ty) || self.enums.contains_key(ty) || self.aliases.contains_key(ty)
diff --git a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/visit.rs b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/visit.rs index 2f31378..e31b8c4 100644 --- a/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/visit.rs +++ b/third_party/rust/cxxbridge_cmd/v1/crate/src/syntax/visit.rs
@@ -1,12 +1,12 @@ use crate::syntax::Type; -pub trait Visit<'a> { +pub(crate) trait Visit<'a> { fn visit_type(&mut self, ty: &'a Type) { visit_type(self, ty); } } -pub fn visit_type<'a, V>(visitor: &mut V, ty: &'a Type) +pub(crate) fn visit_type<'a, V>(visitor: &mut V, ty: &'a Type) where V: Visit<'a> + ?Sized, {
diff --git a/third_party/rust/cxxbridge_macro/v1/BUILD.gn b/third_party/rust/cxxbridge_macro/v1/BUILD.gn index 71ead3f..333a5904 100644 --- a/third_party/rust/cxxbridge_macro/v1/BUILD.gn +++ b/third_party/rust/cxxbridge_macro/v1/BUILD.gn
@@ -57,7 +57,7 @@ # Unit tests skipped. Generate with --with-tests to include them. build_native_rust_unit_tests = false edition = "2021" - cargo_pkg_version = "1.0.107" + cargo_pkg_version = "1.0.110" cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>" cargo_pkg_name = "cxxbridge-macro" cargo_pkg_description = "Implementation detail of the `cxx` crate."
diff --git a/third_party/rust/cxxbridge_macro/v1/README.chromium b/third_party/rust/cxxbridge_macro/v1/README.chromium index a2b23fe3..e02f834 100644 --- a/third_party/rust/cxxbridge_macro/v1/README.chromium +++ b/third_party/rust/cxxbridge_macro/v1/README.chromium
@@ -1,9 +1,9 @@ Name: cxxbridge-macro URL: https://crates.io/crates/cxxbridge-macro Description: Implementation detail of the `cxx` crate. -Version: 1.0.107 +Version: 1.0.110 Security Critical: yes Shipped: yes License: Apache 2.0 License File: -Revision: 51ded1be5e27c2c1eac145064af3ccc41ea056bf +Revision: 306019c5a7434aa7424a83720a09c40e1ea12343
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/.cargo_vcs_info.json b/third_party/rust/cxxbridge_macro/v1/crate/.cargo_vcs_info.json index 0254c48..1e083db 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/.cargo_vcs_info.json +++ b/third_party/rust/cxxbridge_macro/v1/crate/.cargo_vcs_info.json
@@ -1,6 +1,6 @@ { "git": { - "sha1": "51ded1be5e27c2c1eac145064af3ccc41ea056bf" + "sha1": "306019c5a7434aa7424a83720a09c40e1ea12343" }, "path_in_vcs": "macro" } \ No newline at end of file
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/Cargo.toml b/third_party/rust/cxxbridge_macro/v1/crate/Cargo.toml index 40eebee..911614e 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/Cargo.toml +++ b/third_party/rust/cxxbridge_macro/v1/crate/Cargo.toml
@@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.60" name = "cxxbridge-macro" -version = "1.0.107" +version = "1.0.110" authors = ["David Tolnay <dtolnay@gmail.com>"] exclude = [ "build.rs",
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/Cargo.toml.orig b/third_party/rust/cxxbridge_macro/v1/crate/Cargo.toml.orig index 4a8b9012..d6ed78e 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/Cargo.toml.orig +++ b/third_party/rust/cxxbridge_macro/v1/crate/Cargo.toml.orig
@@ -1,6 +1,6 @@ [package] name = "cxxbridge-macro" -version = "1.0.107" +version = "1.0.110" authors = ["David Tolnay <dtolnay@gmail.com>"] categories = ["development-tools::ffi"] description = "Implementation detail of the `cxx` crate."
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/clang.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/clang.rs index dfbd8346..09efc1e 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/clang.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/clang.rs
@@ -1,9 +1,9 @@ use serde_derive::{Deserialize, Serialize}; -pub type Node = clang_ast::Node<Clang>; +pub(crate) type Node = clang_ast::Node<Clang>; #[derive(Deserialize, Serialize)] -pub enum Clang { +pub(crate) enum Clang { NamespaceDecl(NamespaceDecl), EnumDecl(EnumDecl), EnumConstantDecl(EnumConstantDecl), @@ -13,13 +13,13 @@ } #[derive(Deserialize, Serialize)] -pub struct NamespaceDecl { +pub(crate) struct NamespaceDecl { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<Box<str>>, } #[derive(Deserialize, Serialize)] -pub struct EnumDecl { +pub(crate) struct EnumDecl { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<Box<str>>, #[serde( @@ -30,17 +30,17 @@ } #[derive(Deserialize, Serialize)] -pub struct EnumConstantDecl { +pub(crate) struct EnumConstantDecl { pub name: Box<str>, } #[derive(Deserialize, Serialize)] -pub struct ConstantExpr { +pub(crate) struct ConstantExpr { pub value: Box<str>, } #[derive(Deserialize, Serialize)] -pub struct Type { +pub(crate) struct Type { #[serde(rename = "qualType")] pub qual_type: Box<str>, #[serde(rename = "desugaredQualType", skip_serializing_if = "Option::is_none")]
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/derive.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/derive.rs index 90c888c7..1c06ad8 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/derive.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/derive.rs
@@ -2,9 +2,12 @@ use proc_macro2::{Ident, Span, TokenStream}; use quote::{quote, quote_spanned, ToTokens}; -pub use crate::syntax::derive::*; +pub(crate) use crate::syntax::derive::*; -pub fn expand_struct(strct: &Struct, actual_derives: &mut Option<TokenStream>) -> TokenStream { +pub(crate) fn expand_struct( + strct: &Struct, + actual_derives: &mut Option<TokenStream>, +) -> TokenStream { let mut expanded = TokenStream::new(); let mut traits = Vec::new(); @@ -35,7 +38,7 @@ expanded } -pub fn expand_enum(enm: &Enum, actual_derives: &mut Option<TokenStream>) -> TokenStream { +pub(crate) fn expand_enum(enm: &Enum, actual_derives: &mut Option<TokenStream>) -> TokenStream { let mut expanded = TokenStream::new(); let mut traits = Vec::new(); let mut has_copy = false; @@ -212,7 +215,8 @@ quote_spanned! {span=> impl #generics ::cxx::core::cmp::PartialOrd for #ident #generics { - #[allow(clippy::incorrect_partial_ord_impl_on_ord_type)] + #[allow(clippy::non_canonical_partial_ord_impl)] + #[allow(renamed_and_removed_lints, clippy::incorrect_partial_ord_impl_on_ord_type)] // Rust 1.73 and older fn partial_cmp(&self, other: &Self) -> ::cxx::core::option::Option<::cxx::core::cmp::Ordering> { #body } @@ -281,7 +285,8 @@ quote_spanned! {span=> impl ::cxx::core::cmp::PartialOrd for #ident { - #[allow(clippy::incorrect_partial_ord_impl_on_ord_type)] + #[allow(clippy::non_canonical_partial_ord_impl)] + #[allow(renamed_and_removed_lints, clippy::incorrect_partial_ord_impl_on_ord_type)] // Rust 1.73 and older fn partial_cmp(&self, other: &Self) -> ::cxx::core::option::Option<::cxx::core::cmp::Ordering> { ::cxx::core::cmp::PartialOrd::partial_cmp(&self.repr, &other.repr) }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/expand.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/expand.rs index dcc0081..7715ba8 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/expand.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/expand.rs
@@ -17,7 +17,7 @@ use std::mem; use syn::{parse_quote, punctuated, Generics, Lifetime, Result, Token}; -pub fn bridge(mut ffi: Module) -> Result<TokenStream> { +pub(crate) fn bridge(mut ffi: Module) -> Result<TokenStream> { let ref mut errors = Errors::new(); let mut cfg = CfgExpr::Unconditional; @@ -142,6 +142,7 @@ #[allow( non_camel_case_types, non_snake_case, + unused_unsafe, // FIXME: only needed by rustc 1.64 and older clippy::extra_unused_type_parameters, clippy::items_after_statements, clippy::ptr_as_ptr, @@ -718,12 +719,9 @@ expr = quote_spanned!(span=> ::cxx::core::result::Result::Ok(#expr)); } }; - let mut dispatch = quote!(#setup #expr); + let dispatch = quote_spanned!(span=> unsafe { #setup #expr }); let visibility = efn.visibility; let unsafety = &efn.sig.unsafety; - if unsafety.is_none() { - dispatch = quote_spanned!(span=> unsafe { #dispatch }); - } let fn_token = efn.sig.fn_token; let ident = &efn.name.rust; let generics = &efn.generics; @@ -985,22 +983,31 @@ }); let all_args = receiver.into_iter().chain(args); + let mut requires_unsafe = false; let arg_vars = sig.args.iter().map(|arg| { let var = &arg.name.rust; let span = var.span(); match &arg.ty { Type::Ident(i) if i.rust == RustString => { + requires_unsafe = true; quote_spanned!(span=> ::cxx::core::mem::take((*#var).as_mut_string())) } - Type::RustBox(_) => quote_spanned!(span=> ::cxx::alloc::boxed::Box::from_raw(#var)), + Type::RustBox(_) => { + requires_unsafe = true; + quote_spanned!(span=> ::cxx::alloc::boxed::Box::from_raw(#var)) + } Type::RustVec(vec) => { + requires_unsafe = true; if vec.inner == RustString { quote_spanned!(span=> ::cxx::core::mem::take((*#var).as_mut_vec_string())) } else { quote_spanned!(span=> ::cxx::core::mem::take((*#var).as_mut_vec())) } } - Type::UniquePtr(_) => quote_spanned!(span=> ::cxx::UniquePtr::from_raw(#var)), + Type::UniquePtr(_) => { + requires_unsafe = true; + quote_spanned!(span=> ::cxx::UniquePtr::from_raw(#var)) + } Type::Ref(ty) => match &ty.inner { Type::Ident(i) if i.rust == RustString => match ty.mutable { false => quote_spanned!(span=> #var.as_string()), @@ -1016,8 +1023,12 @@ }, _ => quote!(#var), }, - Type::Str(_) => quote_spanned!(span=> #var.as_str()), + Type::Str(_) => { + requires_unsafe = true; + quote_spanned!(span=> #var.as_str()) + } Type::SliceRef(slice) => { + requires_unsafe = true; let inner = &slice.inner; match slice.mutable { false => quote_spanned!(span=> #var.as_slice::<#inner>()), @@ -1025,6 +1036,7 @@ } } ty if types.needs_indirect_abi(ty) => { + requires_unsafe = true; quote_spanned!(span=> ::cxx::core::ptr::read(#var)) } _ => quote!(#var), @@ -1042,6 +1054,7 @@ } None => { requires_closure = true; + requires_unsafe = true; quote!(::cxx::core::mem::transmute::<*const (), #sig>(__extern)) } }; @@ -1109,12 +1122,18 @@ None => quote_spanned!(span=> &mut ()), }; requires_closure = true; + requires_unsafe = true; expr = quote_spanned!(span=> ::cxx::private::r#try(#out, #expr)); } else if indirect_return { requires_closure = true; + requires_unsafe = true; expr = quote_spanned!(span=> ::cxx::core::ptr::write(__return, #expr)); } + if requires_unsafe { + expr = quote_spanned!(span=> unsafe { #expr }); + } + let closure = if requires_closure { quote_spanned!(span=> move || #expr) } else { @@ -1193,9 +1212,14 @@ } }; + let mut body = quote_spanned!(span=> #call(#(#vars,)*)); + if unsafety.is_some() { + body = quote_spanned!(span=> unsafe { #body }); + } + quote_spanned! {span=> #unsafety fn #local_name #generics(#(#all_args,)*) #ret { - #call(#(#vars,)*) + #body } } } @@ -1286,13 +1310,13 @@ #[export_name = #link_dealloc] unsafe extern "C" fn #local_dealloc #impl_generics(ptr: *mut ::cxx::core::mem::MaybeUninit<#ident #ty_generics>) { // No prevent_unwind: the global allocator is not allowed to panic. - let _ = ::cxx::alloc::boxed::Box::from_raw(ptr); + let _ = unsafe { ::cxx::alloc::boxed::Box::from_raw(ptr) }; } #[doc(hidden)] #[export_name = #link_drop] unsafe extern "C" fn #local_drop #impl_generics(this: *mut ::cxx::alloc::boxed::Box<#ident #ty_generics>) { let __fn = concat!("<", module_path!(), #prevent_unwind_drop_label); - ::cxx::private::prevent_unwind(__fn, || ::cxx::core::ptr::drop_in_place(this)); + ::cxx::private::prevent_unwind(__fn, || unsafe { ::cxx::core::ptr::drop_in_place(this) }); } } } @@ -1334,49 +1358,61 @@ #[export_name = #link_new] unsafe extern "C" fn #local_new #impl_generics(this: *mut ::cxx::private::RustVec<#elem #ty_generics>) { // No prevent_unwind: cannot panic. - ::cxx::core::ptr::write(this, ::cxx::private::RustVec::new()); + unsafe { + ::cxx::core::ptr::write(this, ::cxx::private::RustVec::new()); + } } #[doc(hidden)] #[export_name = #link_drop] unsafe extern "C" fn #local_drop #impl_generics(this: *mut ::cxx::private::RustVec<#elem #ty_generics>) { let __fn = concat!("<", module_path!(), #prevent_unwind_drop_label); - ::cxx::private::prevent_unwind(__fn, || ::cxx::core::ptr::drop_in_place(this)); + ::cxx::private::prevent_unwind( + __fn, + || unsafe { ::cxx::core::ptr::drop_in_place(this) }, + ); } #[doc(hidden)] #[export_name = #link_len] unsafe extern "C" fn #local_len #impl_generics(this: *const ::cxx::private::RustVec<#elem #ty_generics>) -> usize { // No prevent_unwind: cannot panic. - (*this).len() + unsafe { (*this).len() } } #[doc(hidden)] #[export_name = #link_capacity] unsafe extern "C" fn #local_capacity #impl_generics(this: *const ::cxx::private::RustVec<#elem #ty_generics>) -> usize { // No prevent_unwind: cannot panic. - (*this).capacity() + unsafe { (*this).capacity() } } #[doc(hidden)] #[export_name = #link_data] unsafe extern "C" fn #local_data #impl_generics(this: *const ::cxx::private::RustVec<#elem #ty_generics>) -> *const #elem #ty_generics { // No prevent_unwind: cannot panic. - (*this).as_ptr() + unsafe { (*this).as_ptr() } } #[doc(hidden)] #[export_name = #link_reserve_total] unsafe extern "C" fn #local_reserve_total #impl_generics(this: *mut ::cxx::private::RustVec<#elem #ty_generics>, new_cap: usize) { // No prevent_unwind: the global allocator is not allowed to panic. - (*this).reserve_total(new_cap); + unsafe { + (*this).reserve_total(new_cap); + } } #[doc(hidden)] #[export_name = #link_set_len] unsafe extern "C" fn #local_set_len #impl_generics(this: *mut ::cxx::private::RustVec<#elem #ty_generics>, len: usize) { // No prevent_unwind: cannot panic. - (*this).set_len(len); + unsafe { + (*this).set_len(len); + } } #[doc(hidden)] #[export_name = #link_truncate] unsafe extern "C" fn #local_truncate #impl_generics(this: *mut ::cxx::private::RustVec<#elem #ty_generics>, len: usize) { let __fn = concat!("<", module_path!(), #prevent_unwind_drop_label); - ::cxx::private::prevent_unwind(__fn, || (*this).truncate(len)); + ::cxx::private::prevent_unwind( + __fn, + || unsafe { (*this).truncate(len) }, + ); } } } @@ -1408,7 +1444,9 @@ fn __uninit(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *mut ::cxx::core::ffi::c_void; } let mut repr = ::cxx::core::mem::MaybeUninit::uninit(); - unsafe { __uninit(&mut repr).cast::<#ident #ty_generics>().write(value) } + unsafe { + __uninit(&mut repr).cast::<#ident #ty_generics>().write(value); + } repr } }) @@ -1431,7 +1469,9 @@ fn __null(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>); } let mut repr = ::cxx::core::mem::MaybeUninit::uninit(); - unsafe { __null(&mut repr) } + unsafe { + __null(&mut repr); + } repr } #new_method @@ -1441,7 +1481,9 @@ fn __raw(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>, raw: *mut ::cxx::core::ffi::c_void); } let mut repr = ::cxx::core::mem::MaybeUninit::uninit(); - __raw(&mut repr, raw.cast()); + unsafe { + __raw(&mut repr, raw.cast()); + } repr } unsafe fn __get(repr: ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *const Self { @@ -1449,21 +1491,23 @@ #[link_name = #link_get] fn __get(this: *const ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *const ::cxx::core::ffi::c_void; } - __get(&repr).cast() + unsafe { __get(&repr).cast() } } unsafe fn __release(mut repr: ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *mut Self { extern "C" { #[link_name = #link_release] fn __release(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *mut ::cxx::core::ffi::c_void; } - __release(&mut repr).cast() + unsafe { __release(&mut repr).cast() } } unsafe fn __drop(mut repr: ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) { extern "C" { #[link_name = #link_drop] fn __drop(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>); } - __drop(&mut repr); + unsafe { + __drop(&mut repr); + } } } } @@ -1494,7 +1538,9 @@ #[link_name = #link_uninit] fn __uninit(new: *mut ::cxx::core::ffi::c_void) -> *mut ::cxx::core::ffi::c_void; } - __uninit(new).cast::<#ident #ty_generics>().write(value); + unsafe { + __uninit(new).cast::<#ident #ty_generics>().write(value); + } } }) } else { @@ -1515,7 +1561,9 @@ #[link_name = #link_null] fn __null(new: *mut ::cxx::core::ffi::c_void); } - __null(new); + unsafe { + __null(new); + } } #new_method unsafe fn __clone(this: *const ::cxx::core::ffi::c_void, new: *mut ::cxx::core::ffi::c_void) { @@ -1523,21 +1571,25 @@ #[link_name = #link_clone] fn __clone(this: *const ::cxx::core::ffi::c_void, new: *mut ::cxx::core::ffi::c_void); } - __clone(this, new); + unsafe { + __clone(this, new); + } } unsafe fn __get(this: *const ::cxx::core::ffi::c_void) -> *const Self { extern "C" { #[link_name = #link_get] fn __get(this: *const ::cxx::core::ffi::c_void) -> *const ::cxx::core::ffi::c_void; } - __get(this).cast() + unsafe { __get(this).cast() } } unsafe fn __drop(this: *mut ::cxx::core::ffi::c_void) { extern "C" { #[link_name = #link_drop] fn __drop(this: *mut ::cxx::core::ffi::c_void); } - __drop(this); + unsafe { + __drop(this); + } } } } @@ -1570,35 +1622,45 @@ #[link_name = #link_null] fn __null(new: *mut ::cxx::core::ffi::c_void); } - __null(new); + unsafe { + __null(new); + } } unsafe fn __clone(this: *const ::cxx::core::ffi::c_void, new: *mut ::cxx::core::ffi::c_void) { extern "C" { #[link_name = #link_clone] fn __clone(this: *const ::cxx::core::ffi::c_void, new: *mut ::cxx::core::ffi::c_void); } - __clone(this, new); + unsafe { + __clone(this, new); + } } unsafe fn __downgrade(shared: *const ::cxx::core::ffi::c_void, weak: *mut ::cxx::core::ffi::c_void) { extern "C" { #[link_name = #link_downgrade] fn __downgrade(shared: *const ::cxx::core::ffi::c_void, weak: *mut ::cxx::core::ffi::c_void); } - __downgrade(shared, weak); + unsafe { + __downgrade(shared, weak); + } } unsafe fn __upgrade(weak: *const ::cxx::core::ffi::c_void, shared: *mut ::cxx::core::ffi::c_void) { extern "C" { #[link_name = #link_upgrade] fn __upgrade(weak: *const ::cxx::core::ffi::c_void, shared: *mut ::cxx::core::ffi::c_void); } - __upgrade(weak, shared); + unsafe { + __upgrade(weak, shared); + } } unsafe fn __drop(this: *mut ::cxx::core::ffi::c_void) { extern "C" { #[link_name = #link_drop] fn __drop(this: *mut ::cxx::core::ffi::c_void); } - __drop(this); + unsafe { + __drop(this); + } } } } @@ -1648,7 +1710,12 @@ value: *mut ::cxx::core::ffi::c_void, ); } - __push_back(this, value as *mut ::cxx::core::mem::ManuallyDrop<Self> as *mut ::cxx::core::ffi::c_void); + unsafe { + __push_back( + this, + value as *mut ::cxx::core::mem::ManuallyDrop<Self> as *mut ::cxx::core::ffi::c_void, + ); + } } unsafe fn __pop_back( this: ::cxx::core::pin::Pin<&mut ::cxx::CxxVector<Self>>, @@ -1661,7 +1728,12 @@ out: *mut ::cxx::core::ffi::c_void, ); } - __pop_back(this, out as *mut ::cxx::core::mem::MaybeUninit<Self> as *mut ::cxx::core::ffi::c_void); + unsafe { + __pop_back( + this, + out as *mut ::cxx::core::mem::MaybeUninit<Self> as *mut ::cxx::core::ffi::c_void, + ); + } } }) } else { @@ -1695,7 +1767,7 @@ pos: usize, ) -> *mut ::cxx::core::ffi::c_void; } - __get_unchecked(v, pos) as *mut Self + unsafe { __get_unchecked(v, pos) as *mut Self } } #by_value_methods fn __unique_ptr_null() -> ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void> { @@ -1704,7 +1776,9 @@ fn __unique_ptr_null(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>); } let mut repr = ::cxx::core::mem::MaybeUninit::uninit(); - unsafe { __unique_ptr_null(&mut repr) } + unsafe { + __unique_ptr_null(&mut repr); + } repr } unsafe fn __unique_ptr_raw(raw: *mut ::cxx::CxxVector<Self>) -> ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void> { @@ -1713,7 +1787,9 @@ fn __unique_ptr_raw #impl_generics(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>, raw: *mut ::cxx::CxxVector<#elem #ty_generics>); } let mut repr = ::cxx::core::mem::MaybeUninit::uninit(); - __unique_ptr_raw(&mut repr, raw); + unsafe { + __unique_ptr_raw(&mut repr, raw); + } repr } unsafe fn __unique_ptr_get(repr: ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *const ::cxx::CxxVector<Self> { @@ -1721,21 +1797,23 @@ #[link_name = #link_unique_ptr_get] fn __unique_ptr_get #impl_generics(this: *const ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *const ::cxx::CxxVector<#elem #ty_generics>; } - __unique_ptr_get(&repr) + unsafe { __unique_ptr_get(&repr) } } unsafe fn __unique_ptr_release(mut repr: ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *mut ::cxx::CxxVector<Self> { extern "C" { #[link_name = #link_unique_ptr_release] fn __unique_ptr_release #impl_generics(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) -> *mut ::cxx::CxxVector<#elem #ty_generics>; } - __unique_ptr_release(&mut repr) + unsafe { __unique_ptr_release(&mut repr) } } unsafe fn __unique_ptr_drop(mut repr: ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>) { extern "C" { #[link_name = #link_unique_ptr_drop] fn __unique_ptr_drop(this: *mut ::cxx::core::mem::MaybeUninit<*mut ::cxx::core::ffi::c_void>); } - __unique_ptr_drop(&mut repr); + unsafe { + __unique_ptr_drop(&mut repr); + } } } }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/generics.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/generics.rs index 7862536..f501def2 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/generics.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/generics.rs
@@ -5,18 +5,18 @@ use quote::ToTokens; use syn::{Lifetime, Token}; -pub struct ImplGenerics<'a> { +pub(crate) struct ImplGenerics<'a> { explicit_impl: Option<&'a Impl>, resolve: Resolution<'a>, } -pub struct TyGenerics<'a> { +pub(crate) struct TyGenerics<'a> { key: NamedImplKey<'a>, explicit_impl: Option<&'a Impl>, resolve: Resolution<'a>, } -pub fn split_for_impl<'a>( +pub(crate) fn split_for_impl<'a>( key: NamedImplKey<'a>, explicit_impl: Option<&'a Impl>, resolve: Resolution<'a>, @@ -62,12 +62,12 @@ } } -pub struct UnderscoreLifetimes<'a> { +pub(crate) struct UnderscoreLifetimes<'a> { generics: &'a Lifetimes, } impl Lifetimes { - pub fn to_underscore_lifetimes(&self) -> UnderscoreLifetimes { + pub(crate) fn to_underscore_lifetimes(&self) -> UnderscoreLifetimes { UnderscoreLifetimes { generics: self } } }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/lib.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/lib.rs index 2dd0ffa..99132bb78 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/lib.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/lib.rs
@@ -6,6 +6,7 @@ clippy::enum_glob_use, clippy::if_same_then_else, clippy::inherent_to_string, + clippy::into_iter_without_iter, clippy::items_after_statements, clippy::large_enum_variant, clippy::match_bool, @@ -21,6 +22,7 @@ clippy::similar_names, clippy::single_match, clippy::single_match_else, + clippy::struct_field_names, clippy::too_many_arguments, clippy::too_many_lines, clippy::toplevel_ref_arg,
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/load.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/load.rs index 7bcf3ee..d3148c9 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/load.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/load.rs
@@ -18,7 +18,7 @@ const CXX_CLANG_AST: &str = "CXX_CLANG_AST"; -pub fn load(cx: &mut Errors, apis: &mut [Api]) { +pub(crate) fn load(cx: &mut Errors, apis: &mut [Api]) { let ref mut variants_from_header = Vec::new(); for api in apis { if let Api::Enum(enm) = api { @@ -36,7 +36,7 @@ } } - let span = match variants_from_header.get(0) { + let span = match variants_from_header.first() { None => return, Some(enm) => enm.variants_from_header_attr.clone().unwrap(), }; @@ -60,7 +60,7 @@ if is_gzipped { gunzipped = Vec::new(); let decode_result = GzDecoder::new(&mut gunzipped).write_all(memmap); - decode_result.map(|_| gunzipped.as_slice()) + decode_result.map(|()| gunzipped.as_slice()) } else { Ok(memmap as &[u8]) }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/atom.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/atom.rs index d4ad78f..08e04a3 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/atom.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/atom.rs
@@ -3,7 +3,7 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone, PartialEq)] -pub enum Atom { +pub(crate) enum Atom { Bool, Char, // C char, not Rust char U8, @@ -23,11 +23,11 @@ } impl Atom { - pub fn from(ident: &Ident) -> Option<Self> { + pub(crate) fn from(ident: &Ident) -> Option<Self> { Self::from_str(ident.to_string().as_str()) } - pub fn from_str(s: &str) -> Option<Self> { + pub(crate) fn from_str(s: &str) -> Option<Self> { use self::Atom::*; match s { "bool" => Some(Bool),
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/attrs.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/attrs.rs index 4ff700a..894b82b 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/attrs.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/attrs.rs
@@ -27,7 +27,7 @@ // ); // #[derive(Default)] -pub struct Parser<'a> { +pub(crate) struct Parser<'a> { pub cfg: Option<&'a mut CfgExpr>, pub doc: Option<&'a mut Doc>, pub derives: Option<&'a mut Vec<Derive>>, @@ -44,7 +44,7 @@ pub(crate) _more: (), } -pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> OtherAttrs { +pub(crate) fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> OtherAttrs { let mut passthrough_attrs = Vec::new(); for attr in attrs { let attr_path = attr.path(); @@ -283,14 +283,14 @@ } #[derive(Clone)] -pub struct OtherAttrs(Vec<Attribute>); +pub(crate) struct OtherAttrs(Vec<Attribute>); impl OtherAttrs { - pub fn none() -> Self { + pub(crate) fn none() -> Self { OtherAttrs(Vec::new()) } - pub fn extend(&mut self, other: Self) { + pub(crate) fn extend(&mut self, other: Self) { self.0.extend(other.0); } }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/cfg.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/cfg.rs index ce6f338..83511d7 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/cfg.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/cfg.rs
@@ -4,7 +4,7 @@ use syn::{parenthesized, token, Attribute, LitStr, Token}; #[derive(Clone)] -pub enum CfgExpr { +pub(crate) enum CfgExpr { Unconditional, Eq(Ident, Option<LitStr>), All(Vec<CfgExpr>), @@ -13,7 +13,7 @@ } impl CfgExpr { - pub fn merge(&mut self, expr: CfgExpr) { + pub(crate) fn merge(&mut self, expr: CfgExpr) { if let CfgExpr::Unconditional = self { *self = expr; } else if let CfgExpr::All(list) = self { @@ -25,7 +25,7 @@ } } -pub fn parse_attribute(attr: &Attribute) -> Result<CfgExpr> { +pub(crate) fn parse_attribute(attr: &Attribute) -> Result<CfgExpr> { attr.parse_args_with(|input: ParseStream| { let cfg_expr = input.call(parse_single)?; input.parse::<Option<Token![,]>>()?;
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/derive.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/derive.rs index 7727fbc9..9e09461 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/derive.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/derive.rs
@@ -2,13 +2,13 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone)] -pub struct Derive { +pub(crate) struct Derive { pub what: Trait, pub span: Span, } #[derive(Copy, Clone, PartialEq)] -pub enum Trait { +pub(crate) enum Trait { Clone, Copy, Debug, @@ -24,7 +24,7 @@ } impl Derive { - pub fn from(ident: &Ident) -> Option<Self> { + pub(crate) fn from(ident: &Ident) -> Option<Self> { let what = match ident.to_string().as_str() { "Clone" => Trait::Clone, "Copy" => Trait::Copy, @@ -76,6 +76,6 @@ } } -pub fn contains(derives: &[Derive], query: Trait) -> bool { +pub(crate) fn contains(derives: &[Derive], query: Trait) -> bool { derives.iter().any(|derive| derive.what == query) }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/discriminant.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/discriminant.rs index 01a7d87d..775e57bb 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/discriminant.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/discriminant.rs
@@ -7,14 +7,14 @@ use std::str::FromStr; use syn::{Error, Expr, Lit, Result, Token, UnOp}; -pub struct DiscriminantSet { +pub(crate) struct DiscriminantSet { repr: Option<Atom>, values: BTreeSet<Discriminant>, previous: Option<Discriminant>, } #[derive(Copy, Clone, Eq, PartialEq)] -pub struct Discriminant { +pub(crate) struct Discriminant { sign: Sign, magnitude: u64, } @@ -26,7 +26,7 @@ } impl DiscriminantSet { - pub fn new(repr: Option<Atom>) -> Self { + pub(crate) fn new(repr: Option<Atom>) -> Self { DiscriminantSet { repr, values: BTreeSet::new(), @@ -34,7 +34,7 @@ } } - pub fn insert(&mut self, expr: &Expr) -> Result<Discriminant> { + pub(crate) fn insert(&mut self, expr: &Expr) -> Result<Discriminant> { let (discriminant, repr) = expr_to_discriminant(expr)?; match (self.repr, repr) { (None, Some(new_repr)) => { @@ -61,7 +61,7 @@ insert(self, discriminant) } - pub fn insert_next(&mut self) -> Result<Discriminant> { + pub(crate) fn insert_next(&mut self) -> Result<Discriminant> { let discriminant = match self.previous { None => Discriminant::zero(), Some(mut discriminant) => match discriminant.sign { @@ -85,7 +85,7 @@ insert(self, discriminant) } - pub fn inferred_repr(&self) -> Result<Atom> { + pub(crate) fn inferred_repr(&self) -> Result<Atom> { if let Some(repr) = self.repr { return Ok(repr); } @@ -149,7 +149,7 @@ } impl Discriminant { - pub const fn zero() -> Self { + pub(crate) const fn zero() -> Self { Discriminant { sign: Sign::Positive, magnitude: 0, @@ -180,7 +180,7 @@ } #[cfg(feature = "experimental-enum-variants-from-header")] - pub const fn checked_succ(self) -> Option<Self> { + pub(crate) const fn checked_succ(self) -> Option<Self> { match self.sign { Sign::Negative => { if self.magnitude == 1 {
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/doc.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/doc.rs index 5de824f..bd8111e 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/doc.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/doc.rs
@@ -2,30 +2,30 @@ use quote::{quote, ToTokens}; use syn::LitStr; -pub struct Doc { - pub(crate) hidden: bool, +pub(crate) struct Doc { + pub hidden: bool, fragments: Vec<LitStr>, } impl Doc { - pub fn new() -> Self { + pub(crate) fn new() -> Self { Doc { hidden: false, fragments: Vec::new(), } } - pub fn push(&mut self, lit: LitStr) { + pub(crate) fn push(&mut self, lit: LitStr) { self.fragments.push(lit); } #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro - pub fn is_empty(&self) -> bool { + pub(crate) fn is_empty(&self) -> bool { self.fragments.is_empty() } #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro - pub fn to_string(&self) -> String { + pub(crate) fn to_string(&self) -> String { let mut doc = String::new(); for lit in &self.fragments { doc += &lit.value();
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/error.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/error.rs index f40c4a8..4487693 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/error.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/error.rs
@@ -1,9 +1,11 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone)] -pub struct Error { +pub(crate) struct Error { pub msg: &'static str, + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub label: Option<&'static str>, + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub note: Option<&'static str>, } @@ -13,7 +15,7 @@ } } -pub static ERRORS: &[Error] = &[ +pub(crate) static ERRORS: &[Error] = &[ BOX_CXX_TYPE, CXXBRIDGE_RESERVED, CXX_STRING_BY_VALUE, @@ -27,67 +29,67 @@ USE_NOT_ALLOWED, ]; -pub static BOX_CXX_TYPE: Error = Error { +pub(crate) static BOX_CXX_TYPE: Error = Error { msg: "Box of a C++ type is not supported yet", label: None, note: Some("hint: use UniquePtr<> or SharedPtr<>"), }; -pub static CXXBRIDGE_RESERVED: Error = Error { +pub(crate) static CXXBRIDGE_RESERVED: Error = Error { msg: "identifiers starting with cxxbridge are reserved", label: Some("reserved identifier"), note: Some("identifiers starting with cxxbridge are reserved"), }; -pub static CXX_STRING_BY_VALUE: Error = Error { +pub(crate) static CXX_STRING_BY_VALUE: Error = Error { msg: "C++ string by value is not supported", label: None, note: Some("hint: wrap it in a UniquePtr<>"), }; -pub static CXX_TYPE_BY_VALUE: Error = Error { +pub(crate) static CXX_TYPE_BY_VALUE: Error = Error { msg: "C++ type by value is not supported", label: None, note: Some("hint: wrap it in a UniquePtr<> or SharedPtr<>"), }; -pub static DISCRIMINANT_OVERFLOW: Error = Error { +pub(crate) static DISCRIMINANT_OVERFLOW: Error = Error { msg: "discriminant overflow on value after ", label: Some("discriminant overflow"), note: Some("note: explicitly set `= 0` if that is desired outcome"), }; -pub static DOT_INCLUDE: Error = Error { +pub(crate) static DOT_INCLUDE: Error = Error { msg: "#include relative to `.` or `..` is not supported in Cargo builds", label: Some("#include relative to `.` or `..` is not supported in Cargo builds"), note: Some("note: use a path starting with the crate name"), }; -pub static DOUBLE_UNDERSCORE: Error = Error { +pub(crate) static DOUBLE_UNDERSCORE: Error = Error { msg: "identifiers containing double underscore are reserved in C++", label: Some("reserved identifier"), note: Some("identifiers containing double underscore are reserved in C++"), }; -pub static RESERVED_LIFETIME: Error = Error { +pub(crate) static RESERVED_LIFETIME: Error = Error { msg: "invalid lifetime parameter name: `'static`", label: Some("'static is a reserved lifetime name"), note: None, }; -pub static RUST_TYPE_BY_VALUE: Error = Error { +pub(crate) static RUST_TYPE_BY_VALUE: Error = Error { msg: "opaque Rust type by value is not supported", label: None, note: Some("hint: wrap it in a Box<>"), }; -pub static UNSUPPORTED_TYPE: Error = Error { +pub(crate) static UNSUPPORTED_TYPE: Error = Error { msg: "unsupported type: ", label: Some("unsupported type"), note: None, }; -pub static USE_NOT_ALLOWED: Error = Error { +pub(crate) static USE_NOT_ALLOWED: Error = Error { msg: "`use` items are not allowed within cxx bridge", label: Some("not allowed"), note: Some(
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/file.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/file.rs index 71f11ee..cf6d3e8 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/file.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/file.rs
@@ -7,19 +7,24 @@ ItemStruct, ItemUse, LitStr, Token, Visibility, }; -pub struct Module { +pub(crate) struct Module { + #[allow(dead_code)] pub cfg: CfgExpr, pub namespace: Namespace, pub attrs: Vec<Attribute>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub vis: Visibility, pub unsafety: Option<Token![unsafe]>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub mod_token: Token![mod], + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub ident: Ident, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub brace_token: token::Brace, pub content: Vec<Item>, } -pub enum Item { +pub(crate) enum Item { Struct(ItemStruct), Enum(ItemEnum), ForeignMod(ItemForeignMod), @@ -28,10 +33,11 @@ Other(RustItem), } -pub struct ItemForeignMod { +pub(crate) struct ItemForeignMod { pub attrs: Vec<Attribute>, pub unsafety: Option<Token![unsafe]>, pub abi: Abi, + #[allow(dead_code)] pub brace_token: token::Brace, pub items: Vec<ForeignItem>, }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/improper.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/improper.rs index f19eb86a..a19f5b7d 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/improper.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/improper.rs
@@ -3,14 +3,14 @@ use crate::syntax::{Type, Types}; use proc_macro2::Ident; -pub enum ImproperCtype<'a> { +pub(crate) enum ImproperCtype<'a> { Definite(bool), Depends(&'a Ident), } impl<'a> Types<'a> { // yes, no, maybe - pub fn determine_improper_ctype(&self, ty: &Type) -> ImproperCtype<'a> { + pub(crate) fn determine_improper_ctype(&self, ty: &Type) -> ImproperCtype<'a> { match ty { Type::Ident(ident) => { let ident = &ident.rust;
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/instantiate.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/instantiate.rs index b6cbf24b..dda3069 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/instantiate.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/instantiate.rs
@@ -4,7 +4,7 @@ use syn::Token; #[derive(Copy, Clone, PartialEq, Eq, Hash)] -pub enum ImplKey<'a> { +pub(crate) enum ImplKey<'a> { RustBox(NamedImplKey<'a>), RustVec(NamedImplKey<'a>), UniquePtr(NamedImplKey<'a>), @@ -14,11 +14,15 @@ } #[derive(Copy, Clone)] -pub struct NamedImplKey<'a> { +pub(crate) struct NamedImplKey<'a> { + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub begin_span: Span, pub rust: &'a Ident, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub lt_token: Option<Token![<]>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub gt_token: Option<Token![>]>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub end_span: Span, }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/mangle.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/mangle.rs index 287b443..6f019657 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/mangle.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/mangle.rs
@@ -84,7 +84,7 @@ }; } -pub fn extern_fn(efn: &ExternFn, types: &Types) -> Symbol { +pub(crate) fn extern_fn(efn: &ExternFn, types: &Types) -> Symbol { match &efn.receiver { Some(receiver) => { let receiver_ident = types.resolve(&receiver.ty); @@ -99,7 +99,7 @@ } } -pub fn operator(receiver: &Pair, operator: &'static str) -> Symbol { +pub(crate) fn operator(receiver: &Pair, operator: &'static str) -> Symbol { join!( receiver.namespace, CXXBRIDGE, @@ -110,11 +110,11 @@ } // The C half of a function pointer trampoline. -pub fn c_trampoline(efn: &ExternFn, var: &Pair, types: &Types) -> Symbol { +pub(crate) fn c_trampoline(efn: &ExternFn, var: &Pair, types: &Types) -> Symbol { join!(extern_fn(efn, types), var.rust, 0) } // The Rust half of a function pointer trampoline. -pub fn r_trampoline(efn: &ExternFn, var: &Pair, types: &Types) -> Symbol { +pub(crate) fn r_trampoline(efn: &ExternFn, var: &Pair, types: &Types) -> Symbol { join!(extern_fn(efn, types), var.rust, 1) }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/map.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/map.rs index 526b793..4a2db0b 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/map.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/map.rs
@@ -3,9 +3,9 @@ use std::ops::Index; use std::slice; -pub use self::ordered::OrderedMap; -pub use self::unordered::UnorderedMap; -pub use std::collections::hash_map::Entry; +pub(crate) use self::ordered::OrderedMap; +pub(crate) use self::unordered::UnorderedMap; +pub(crate) use std::collections::hash_map::Entry; mod ordered { use super::{Entry, Iter, UnorderedMap}; @@ -13,24 +13,25 @@ use std::hash::Hash; use std::mem; - pub struct OrderedMap<K, V> { + pub(crate) struct OrderedMap<K, V> { map: UnorderedMap<K, usize>, vec: Vec<(K, V)>, } impl<K, V> OrderedMap<K, V> { - pub fn new() -> Self { + pub(crate) fn new() -> Self { OrderedMap { map: UnorderedMap::new(), vec: Vec::new(), } } - pub fn iter(&self) -> Iter<K, V> { + pub(crate) fn iter(&self) -> Iter<K, V> { Iter(self.vec.iter()) } - pub fn keys(&self) -> impl Iterator<Item = &K> { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro + pub(crate) fn keys(&self) -> impl Iterator<Item = &K> { self.vec.iter().map(|(k, _v)| k) } } @@ -39,7 +40,7 @@ where K: Copy + Hash + Eq, { - pub fn insert(&mut self, key: K, value: V) -> Option<V> { + pub(crate) fn insert(&mut self, key: K, value: V) -> Option<V> { match self.map.entry(key) { Entry::Occupied(entry) => { let i = &mut self.vec[*entry.get()]; @@ -53,22 +54,13 @@ } } - pub fn contains_key<Q>(&self, key: &Q) -> bool + pub(crate) fn contains_key<Q>(&self, key: &Q) -> bool where K: Borrow<Q>, Q: ?Sized + Hash + Eq, { self.map.contains_key(key) } - - pub fn get<Q>(&self, key: &Q) -> Option<&V> - where - K: Borrow<Q>, - Q: ?Sized + Hash + Eq, - { - let i = *self.map.get(key)?; - Some(&self.vec[i].1) - } } impl<'a, K, V> IntoIterator for &'a OrderedMap<K, V> { @@ -88,10 +80,10 @@ // Wrapper prohibits accidentally introducing iteration over the map, which // could lead to nondeterministic generated code. - pub struct UnorderedMap<K, V>(HashMap<K, V>); + pub(crate) struct UnorderedMap<K, V>(HashMap<K, V>); impl<K, V> UnorderedMap<K, V> { - pub fn new() -> Self { + pub(crate) fn new() -> Self { UnorderedMap(HashMap::new()) } } @@ -100,11 +92,11 @@ where K: Hash + Eq, { - pub fn insert(&mut self, key: K, value: V) -> Option<V> { + pub(crate) fn insert(&mut self, key: K, value: V) -> Option<V> { self.0.insert(key, value) } - pub fn contains_key<Q>(&self, key: &Q) -> bool + pub(crate) fn contains_key<Q>(&self, key: &Q) -> bool where K: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -112,7 +104,7 @@ self.0.contains_key(key) } - pub fn get<Q>(&self, key: &Q) -> Option<&V> + pub(crate) fn get<Q>(&self, key: &Q) -> Option<&V> where K: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -120,12 +112,12 @@ self.0.get(key) } - pub fn entry(&mut self, key: K) -> Entry<K, V> { + pub(crate) fn entry(&mut self, key: K) -> Entry<K, V> { self.0.entry(key) } #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro - pub fn remove<Q>(&mut self, key: &Q) -> Option<V> + pub(crate) fn remove<Q>(&mut self, key: &Q) -> Option<V> where K: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -133,7 +125,7 @@ self.0.remove(key) } - pub fn keys(&self) -> UnorderedSet<K> + pub(crate) fn keys(&self) -> UnorderedSet<K> where K: Copy, { @@ -146,7 +138,7 @@ } } -pub struct Iter<'a, K, V>(slice::Iter<'a, (K, V)>); +pub(crate) struct Iter<'a, K, V>(slice::Iter<'a, (K, V)>); impl<'a, K, V> Iterator for Iter<'a, K, V> { type Item = (&'a K, &'a V);
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/mod.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/mod.rs index 4f19d96..5ff343b 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/mod.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/mod.rs
@@ -1,33 +1,33 @@ // Functionality that is shared between the cxxbridge macro and the cmd. -pub mod atom; -pub mod attrs; -pub mod cfg; -pub mod check; -pub mod derive; +pub(crate) mod atom; +pub(crate) mod attrs; +pub(crate) mod cfg; +pub(crate) mod check; +pub(crate) mod derive; mod discriminant; mod doc; -pub mod error; -pub mod file; -pub mod ident; +pub(crate) mod error; +pub(crate) mod file; +pub(crate) mod ident; mod impls; mod improper; -pub mod instantiate; -pub mod mangle; -pub mod map; +pub(crate) mod instantiate; +pub(crate) mod mangle; +pub(crate) mod map; mod names; -pub mod namespace; +pub(crate) mod namespace; mod parse; mod pod; -pub mod qualified; -pub mod report; -pub mod resolve; -pub mod set; -pub mod symbol; +pub(crate) mod qualified; +pub(crate) mod report; +pub(crate) mod resolve; +pub(crate) mod set; +pub(crate) mod symbol; mod tokens; mod toposort; -pub mod trivial; -pub mod types; +pub(crate) mod trivial; +pub(crate) mod types; mod visit; use self::attrs::OtherAttrs; @@ -40,15 +40,15 @@ use syn::token::{Brace, Bracket, Paren}; use syn::{Attribute, Expr, Generics, Lifetime, LitInt, Token, Type as RustType}; -pub use self::atom::Atom; -pub use self::derive::{Derive, Trait}; -pub use self::discriminant::Discriminant; -pub use self::doc::Doc; -pub use self::names::ForeignName; -pub use self::parse::parse_items; -pub use self::types::Types; +pub(crate) use self::atom::Atom; +pub(crate) use self::derive::{Derive, Trait}; +pub(crate) use self::discriminant::Discriminant; +pub(crate) use self::doc::Doc; +pub(crate) use self::names::ForeignName; +pub(crate) use self::parse::parse_items; +pub(crate) use self::types::Types; -pub enum Api { +pub(crate) enum Api { Include(Include), Struct(Struct), Enum(Enum), @@ -60,11 +60,13 @@ Impl(Impl), } -pub struct Include { +pub(crate) struct Include { pub cfg: CfgExpr, pub path: String, pub kind: IncludeKind, + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub begin_span: Span, + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub end_span: Span, } @@ -77,27 +79,35 @@ Bracketed, } -pub struct ExternType { +pub(crate) struct ExternType { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub lang: Lang, pub doc: Doc, pub derives: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub type_token: Token![type], pub name: Pair, pub generics: Lifetimes, + #[allow(dead_code)] pub colon_token: Option<Token![:]>, pub bounds: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub semi_token: Token![;], pub trusted: bool, } -pub struct Struct { +pub(crate) struct Struct { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub doc: Doc, pub derives: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub struct_token: Token![struct], pub name: Pair, @@ -106,11 +116,14 @@ pub fields: Vec<Var>, } -pub struct Enum { +pub(crate) struct Enum { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub doc: Doc, pub derives: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub enum_token: Token![enum], pub name: Pair, @@ -118,12 +131,13 @@ pub brace_token: Brace, pub variants: Vec<Variant>, pub variants_from_header: bool, + #[allow(dead_code)] pub variants_from_header_attr: Option<Attribute>, pub repr: EnumRepr, pub explicit_repr: bool, } -pub enum EnumRepr { +pub(crate) enum EnumRepr { Native { atom: Atom, repr_type: Type, @@ -134,11 +148,14 @@ }, } -pub struct ExternFn { +pub(crate) struct ExternFn { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub lang: Lang, pub doc: Doc, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub name: Pair, pub sig: Signature, @@ -146,39 +163,49 @@ pub trusted: bool, } -pub struct TypeAlias { +pub(crate) struct TypeAlias { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub doc: Doc, pub derives: Vec<Derive>, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub type_token: Token![type], pub name: Pair, pub generics: Lifetimes, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub eq_token: Token![=], + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub ty: RustType, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub semi_token: Token![;], } -pub struct Impl { +pub(crate) struct Impl { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub impl_token: Token![impl], pub impl_generics: Lifetimes, + #[allow(dead_code)] pub negative: bool, pub ty: Type, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub ty_generics: Lifetimes, pub brace_token: Brace, pub negative_token: Option<Token![!]>, } #[derive(Clone, Default)] -pub struct Lifetimes { +pub(crate) struct Lifetimes { pub lt_token: Option<Token![<]>, pub lifetimes: Punctuated<Lifetime, Token![,]>, pub gt_token: Option<Token![>]>, } -pub struct Signature { +pub(crate) struct Signature { pub asyncness: Option<Token![async]>, pub unsafety: Option<Token![unsafe]>, pub fn_token: Token![fn], @@ -191,39 +218,48 @@ pub throws_tokens: Option<(kw::Result, Token![<], Token![>])>, } -pub struct Var { +pub(crate) struct Var { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub doc: Doc, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub visibility: Token![pub], pub name: Pair, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub colon_token: Token![:], pub ty: Type, } -pub struct Receiver { +pub(crate) struct Receiver { pub pinned: bool, pub ampersand: Token![&], pub lifetime: Option<Lifetime>, pub mutable: bool, pub var: Token![self], pub ty: NamedType, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub colon_token: Token![:], pub shorthand: bool, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub pin_tokens: Option<(kw::Pin, Token![<], Token![>])>, pub mutability: Option<Token![mut]>, } -pub struct Variant { +pub(crate) struct Variant { + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro pub cfg: CfgExpr, pub doc: Doc, + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build pub attrs: OtherAttrs, pub name: Pair, pub discriminant: Discriminant, + #[allow(dead_code)] pub expr: Option<Expr>, } -pub enum Type { +pub(crate) enum Type { Ident(NamedType), RustBox(Box<Ty1>), RustVec(Box<Ty1>), @@ -240,14 +276,14 @@ Array(Box<Array>), } -pub struct Ty1 { +pub(crate) struct Ty1 { pub name: Ident, pub langle: Token![<], pub inner: Type, pub rangle: Token![>], } -pub struct Ref { +pub(crate) struct Ref { pub pinned: bool, pub ampersand: Token![&], pub lifetime: Option<Lifetime>, @@ -257,7 +293,7 @@ pub mutability: Option<Token![mut]>, } -pub struct Ptr { +pub(crate) struct Ptr { pub star: Token![*], pub mutable: bool, pub inner: Type, @@ -265,7 +301,7 @@ pub constness: Option<Token![const]>, } -pub struct SliceRef { +pub(crate) struct SliceRef { pub ampersand: Token![&], pub lifetime: Option<Lifetime>, pub mutable: bool, @@ -274,7 +310,7 @@ pub mutability: Option<Token![mut]>, } -pub struct Array { +pub(crate) struct Array { pub bracket: Bracket, pub inner: Type, pub semi_token: Token![;], @@ -283,7 +319,7 @@ } #[derive(Copy, Clone, PartialEq)] -pub enum Lang { +pub(crate) enum Lang { Cxx, Rust, } @@ -291,7 +327,7 @@ // An association of a defined Rust name with a fully resolved, namespace // qualified C++ name. #[derive(Clone)] -pub struct Pair { +pub(crate) struct Pair { pub namespace: Namespace, pub cxx: ForeignName, pub rust: Ident, @@ -300,7 +336,7 @@ // Wrapper for a type which needs to be resolved before it can be printed in // C++. #[derive(PartialEq, Eq, Hash)] -pub struct NamedType { +pub(crate) struct NamedType { pub rust: Ident, pub generics: Lifetimes, }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/names.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/names.rs index 329a102..7afa5a9e 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/names.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/names.rs
@@ -8,12 +8,12 @@ use syn::punctuated::Punctuated; #[derive(Clone)] -pub struct ForeignName { +pub(crate) struct ForeignName { text: String, } impl Pair { - pub fn to_symbol(&self) -> Symbol { + pub(crate) fn to_symbol(&self) -> Symbol { let segments = self .namespace .iter() @@ -24,7 +24,7 @@ } impl NamedType { - pub fn new(rust: Ident) -> Self { + pub(crate) fn new(rust: Ident) -> Self { let generics = Lifetimes { lt_token: None, lifetimes: Punctuated::new(), @@ -32,14 +32,10 @@ }; NamedType { rust, generics } } - - pub fn span(&self) -> Span { - self.rust.span() - } } impl ForeignName { - pub fn parse(text: &str, span: Span) -> Result<Self> { + pub(crate) fn parse(text: &str, span: Span) -> Result<Self> { // TODO: support C++ names containing whitespace (`unsigned int`) or // non-alphanumeric characters (`operator++`). match Ident::parse_any.parse_str(text) {
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/namespace.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/namespace.rs index b4adb3f..417fb34 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/namespace.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/namespace.rs
@@ -10,20 +10,20 @@ } #[derive(Clone, Default)] -pub struct Namespace { +pub(crate) struct Namespace { segments: Vec<Ident>, } impl Namespace { - pub const ROOT: Self = Namespace { + pub(crate) const ROOT: Self = Namespace { segments: Vec::new(), }; - pub fn iter(&self) -> Iter<Ident> { + pub(crate) fn iter(&self) -> Iter<Ident> { self.segments.iter() } - pub fn parse_bridge_attr_namespace(input: ParseStream) -> Result<Self> { + pub(crate) fn parse_bridge_attr_namespace(input: ParseStream) -> Result<Self> { if input.is_empty() { return Ok(Namespace::ROOT); } @@ -35,7 +35,7 @@ Ok(namespace) } - pub fn parse_meta(meta: &Meta) -> Result<Self> { + pub(crate) fn parse_meta(meta: &Meta) -> Result<Self> { if let Meta::NameValue(meta) = meta { match &meta.value { Expr::Lit(expr) => {
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/parse.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/parse.rs index 8ba8c17..850dcc8d 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/parse.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/parse.rs
@@ -22,12 +22,12 @@ TypeReference, Variant as RustVariant, Visibility, }; -pub mod kw { +pub(crate) mod kw { syn::custom_keyword!(Pin); syn::custom_keyword!(Result); } -pub fn parse_items( +pub(crate) fn parse_items( cx: &mut Errors, items: Vec<Item>, trusted: bool,
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/pod.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/pod.rs index 0bf152e..506e53c 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/pod.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/pod.rs
@@ -2,7 +2,7 @@ use crate::syntax::{derive, Trait, Type, Types}; impl<'a> Types<'a> { - pub fn is_guaranteed_pod(&self, ty: &Type) -> bool { + pub(crate) fn is_guaranteed_pod(&self, ty: &Type) -> bool { match ty { Type::Ident(ident) => { let ident = &ident.rust;
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/qualified.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/qualified.rs index e11ffbc..07c9908c 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/qualified.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/qualified.rs
@@ -2,12 +2,12 @@ use syn::parse::{Error, ParseStream, Result}; use syn::{Ident, LitStr, Token}; -pub struct QualifiedName { +pub(crate) struct QualifiedName { pub segments: Vec<Ident>, } impl QualifiedName { - pub fn parse_quoted(lit: &LitStr) -> Result<Self> { + pub(crate) fn parse_quoted(lit: &LitStr) -> Result<Self> { if lit.value().is_empty() { let segments = Vec::new(); Ok(QualifiedName { segments }) @@ -19,12 +19,12 @@ } } - pub fn parse_unquoted(input: ParseStream) -> Result<Self> { + pub(crate) fn parse_unquoted(input: ParseStream) -> Result<Self> { let allow_raw = true; parse_unquoted(input, allow_raw) } - pub fn parse_quoted_or_unquoted(input: ParseStream) -> Result<Self> { + pub(crate) fn parse_quoted_or_unquoted(input: ParseStream) -> Result<Self> { if input.peek(LitStr) { let lit: LitStr = input.parse()?; Self::parse_quoted(&lit)
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/report.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/report.rs index d1d8bc9..1997182 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/report.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/report.rs
@@ -2,24 +2,24 @@ use std::fmt::Display; use syn::{Error, Result}; -pub struct Errors { +pub(crate) struct Errors { errors: Vec<Error>, } impl Errors { - pub fn new() -> Self { + pub(crate) fn new() -> Self { Errors { errors: Vec::new() } } - pub fn error(&mut self, sp: impl ToTokens, msg: impl Display) { + pub(crate) fn error(&mut self, sp: impl ToTokens, msg: impl Display) { self.errors.push(Error::new_spanned(sp, msg)); } - pub fn push(&mut self, error: Error) { + pub(crate) fn push(&mut self, error: Error) { self.errors.push(error); } - pub fn propagate(&mut self) -> Result<()> { + pub(crate) fn propagate(&mut self) -> Result<()> { let mut iter = self.errors.drain(..); let mut all_errors = match iter.next() { Some(err) => err,
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/resolve.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/resolve.rs index 3a2635bd3..b0a4782 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/resolve.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/resolve.rs
@@ -3,13 +3,13 @@ use proc_macro2::Ident; #[derive(Copy, Clone)] -pub struct Resolution<'a> { +pub(crate) struct Resolution<'a> { pub name: &'a Pair, pub generics: &'a Lifetimes, } impl<'a> Types<'a> { - pub fn resolve(&self, ident: &impl UnresolvedName) -> Resolution<'a> { + pub(crate) fn resolve(&self, ident: &impl UnresolvedName) -> Resolution<'a> { let ident = ident.ident(); match self.try_resolve(ident) { Some(resolution) => resolution, @@ -17,13 +17,13 @@ } } - pub fn try_resolve(&self, ident: &impl UnresolvedName) -> Option<Resolution<'a>> { + pub(crate) fn try_resolve(&self, ident: &impl UnresolvedName) -> Option<Resolution<'a>> { let ident = ident.ident(); self.resolutions.get(ident).copied() } } -pub trait UnresolvedName { +pub(crate) trait UnresolvedName { fn ident(&self) -> &Ident; }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/set.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/set.rs index ca0c43e0..0907834 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/set.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/set.rs
@@ -1,15 +1,14 @@ use std::fmt::{self, Debug}; use std::slice; -pub use self::ordered::OrderedSet; -pub use self::unordered::UnorderedSet; +pub(crate) use self::ordered::OrderedSet; +pub(crate) use self::unordered::UnorderedSet; mod ordered { use super::{Iter, UnorderedSet}; - use std::borrow::Borrow; use std::hash::Hash; - pub struct OrderedSet<T> { + pub(crate) struct OrderedSet<T> { set: UnorderedSet<T>, vec: Vec<T>, } @@ -18,44 +17,28 @@ where T: Hash + Eq, { - pub fn new() -> Self { + pub(crate) fn new() -> Self { OrderedSet { set: UnorderedSet::new(), vec: Vec::new(), } } - pub fn insert(&mut self, value: &'a T) -> bool { + pub(crate) fn insert(&mut self, value: &'a T) -> bool { let new = self.set.insert(value); if new { self.vec.push(value); } new } - - pub fn contains<Q>(&self, value: &Q) -> bool - where - &'a T: Borrow<Q>, - Q: ?Sized + Hash + Eq, - { - self.set.contains(value) - } - - pub fn get<Q>(&self, value: &Q) -> Option<&'a T> - where - &'a T: Borrow<Q>, - Q: ?Sized + Hash + Eq, - { - self.set.get(value).copied() - } } impl<'a, T> OrderedSet<&'a T> { - pub fn is_empty(&self) -> bool { + pub(crate) fn is_empty(&self) -> bool { self.vec.is_empty() } - pub fn iter(&self) -> Iter<'_, 'a, T> { + pub(crate) fn iter(&self) -> Iter<'_, 'a, T> { Iter(self.vec.iter()) } } @@ -76,21 +59,21 @@ // Wrapper prohibits accidentally introducing iteration over the set, which // could lead to nondeterministic generated code. - pub struct UnorderedSet<T>(HashSet<T>); + pub(crate) struct UnorderedSet<T>(HashSet<T>); impl<T> UnorderedSet<T> where T: Hash + Eq, { - pub fn new() -> Self { + pub(crate) fn new() -> Self { UnorderedSet(HashSet::new()) } - pub fn insert(&mut self, value: T) -> bool { + pub(crate) fn insert(&mut self, value: T) -> bool { self.0.insert(value) } - pub fn contains<Q>(&self, value: &Q) -> bool + pub(crate) fn contains<Q>(&self, value: &Q) -> bool where T: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -98,7 +81,8 @@ self.0.contains(value) } - pub fn get<Q>(&self, value: &Q) -> Option<&T> + #[allow(dead_code)] // only used by cxx-build, not cxxbridge-cmd + pub(crate) fn get<Q>(&self, value: &Q) -> Option<&T> where T: Borrow<Q>, Q: ?Sized + Hash + Eq, @@ -106,13 +90,13 @@ self.0.get(value) } - pub fn retain(&mut self, f: impl FnMut(&T) -> bool) { + pub(crate) fn retain(&mut self, f: impl FnMut(&T) -> bool) { self.0.retain(f); } } } -pub struct Iter<'s, 'a, T>(slice::Iter<'s, &'a T>); +pub(crate) struct Iter<'s, 'a, T>(slice::Iter<'s, &'a T>); impl<'s, 'a, T> Iterator for Iter<'s, 'a, T> { type Item = &'a T;
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/symbol.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/symbol.rs index 4c1607e..f9fd32c5 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/symbol.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/symbol.rs
@@ -6,7 +6,7 @@ // A mangled symbol consisting of segments separated by '$'. // For example: cxxbridge1$string$new -pub struct Symbol(String); +pub(crate) struct Symbol(String); impl Display for Symbol { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -30,7 +30,7 @@ assert!(self.0.len() > len_before); } - pub fn from_idents<'a>(it: impl Iterator<Item = &'a dyn Segment>) -> Self { + pub(crate) fn from_idents<'a>(it: impl Iterator<Item = &'a dyn Segment>) -> Self { let mut symbol = Symbol(String::new()); for segment in it { segment.write(&mut symbol); @@ -40,7 +40,7 @@ } } -pub trait Segment { +pub(crate) trait Segment { fn write(&self, symbol: &mut Symbol); } @@ -100,7 +100,7 @@ } } -pub fn join(segments: &[&dyn Segment]) -> Symbol { +pub(crate) fn join(segments: &[&dyn Segment]) -> Symbol { let mut symbol = Symbol(String::new()); for segment in segments { segment.write(&mut symbol);
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/toposort.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/toposort.rs index 8fe55b8..9c97eb1 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/toposort.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/toposort.rs
@@ -7,7 +7,7 @@ Visited, } -pub fn sort<'a>(cx: &mut Errors, apis: &'a [Api], types: &Types<'a>) -> Vec<&'a Struct> { +pub(crate) fn sort<'a>(cx: &mut Errors, apis: &'a [Api], types: &Types<'a>) -> Vec<&'a Struct> { let mut sorted = Vec::new(); let ref mut marks = Map::new(); for api in apis {
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/trivial.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/trivial.rs index 067e2d7..9533400 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/trivial.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/trivial.rs
@@ -5,7 +5,7 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone)] -pub enum TrivialReason<'a> { +pub(crate) enum TrivialReason<'a> { StructField(&'a Struct), FunctionArgument(&'a ExternFn), FunctionReturn(&'a ExternFn), @@ -15,7 +15,7 @@ UnpinnedMut(&'a ExternFn), } -pub fn required_trivial_reasons<'a>( +pub(crate) fn required_trivial_reasons<'a>( apis: &'a [Api], all: &Set<&'a Type>, structs: &UnorderedMap<&'a Ident, &'a Struct>, @@ -124,7 +124,7 @@ // Context: // "type {type} should be trivially move constructible and trivially destructible in C++ to be used as {what} in Rust" // "needs a cxx::ExternType impl in order to be used as {what}" -pub fn as_what<'a>(name: &'a Pair, reasons: &'a [TrivialReason]) -> impl Display + 'a { +pub(crate) fn as_what<'a>(name: &'a Pair, reasons: &'a [TrivialReason]) -> impl Display + 'a { struct Description<'a> { name: &'a Pair, reasons: &'a [TrivialReason<'a>],
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/types.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/types.rs index 82b45300..623a8b8 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/types.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/types.rs
@@ -12,7 +12,7 @@ use proc_macro2::Ident; use quote::ToTokens; -pub struct Types<'a> { +pub(crate) struct Types<'a> { pub all: OrderedSet<&'a Type>, pub structs: UnorderedMap<&'a Ident, &'a Struct>, pub enums: UnorderedMap<&'a Ident, &'a Enum>, @@ -28,7 +28,7 @@ } impl<'a> Types<'a> { - pub fn collect(cx: &mut Errors, apis: &'a [Api]) -> Self { + pub(crate) fn collect(cx: &mut Errors, apis: &'a [Api]) -> Self { let mut all = OrderedSet::new(); let mut structs = UnorderedMap::new(); let mut enums = UnorderedMap::new(); @@ -241,7 +241,7 @@ types } - pub fn needs_indirect_abi(&self, ty: &Type) -> bool { + pub(crate) fn needs_indirect_abi(&self, ty: &Type) -> bool { match ty { Type::RustBox(_) | Type::UniquePtr(_) => false, Type::Array(_) => true, @@ -255,7 +255,8 @@ // refuses to believe that C could know how to supply us with a pointer to a // Rust String, even though C could easily have obtained that pointer // legitimately from a Rust call. - pub fn is_considered_improper_ctype(&self, ty: &Type) -> bool { + #[allow(dead_code)] // only used by cxxbridge-macro, not cxx-build + pub(crate) fn is_considered_improper_ctype(&self, ty: &Type) -> bool { match self.determine_improper_ctype(ty) { ImproperCtype::Definite(improper) => improper, ImproperCtype::Depends(ident) => self.struct_improper_ctypes.contains(ident), @@ -264,7 +265,7 @@ // Types which we need to assume could possibly exist by value on the Rust // side. - pub fn is_maybe_trivial(&self, ty: &Ident) -> bool { + pub(crate) fn is_maybe_trivial(&self, ty: &Ident) -> bool { self.structs.contains_key(ty) || self.enums.contains_key(ty) || self.aliases.contains_key(ty)
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/visit.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/visit.rs index 2f31378..e31b8c4 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/visit.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/syntax/visit.rs
@@ -1,12 +1,12 @@ use crate::syntax::Type; -pub trait Visit<'a> { +pub(crate) trait Visit<'a> { fn visit_type(&mut self, ty: &'a Type) { visit_type(self, ty); } } -pub fn visit_type<'a, V>(visitor: &mut V, ty: &'a Type) +pub(crate) fn visit_type<'a, V>(visitor: &mut V, ty: &'a Type) where V: Visit<'a> + ?Sized, {
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/tokens.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/tokens.rs index 805af22..f3512a7 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/tokens.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/tokens.rs
@@ -3,17 +3,17 @@ use quote::{quote_spanned, ToTokens}; use syn::Token; -pub struct ReceiverType<'a>(&'a Receiver); -pub struct ReceiverTypeSelf<'a>(&'a Receiver); +pub(crate) struct ReceiverType<'a>(&'a Receiver); +pub(crate) struct ReceiverTypeSelf<'a>(&'a Receiver); impl Receiver { // &TheType - pub fn ty(&self) -> ReceiverType { + pub(crate) fn ty(&self) -> ReceiverType { ReceiverType(self) } // &Self - pub fn ty_self(&self) -> ReceiverTypeSelf { + pub(crate) fn ty_self(&self) -> ReceiverTypeSelf { ReceiverTypeSelf(self) } }
diff --git a/third_party/rust/cxxbridge_macro/v1/crate/src/type_id.rs b/third_party/rust/cxxbridge_macro/v1/crate/src/type_id.rs index 7bca67b..3184298 100644 --- a/third_party/rust/cxxbridge_macro/v1/crate/src/type_id.rs +++ b/third_party/rust/cxxbridge_macro/v1/crate/src/type_id.rs
@@ -3,7 +3,7 @@ use quote::{format_ident, quote, ToTokens}; use syn::ext::IdentExt; -pub enum Crate { +pub(crate) enum Crate { Cxx, DollarCrate(TokenTree), } @@ -18,7 +18,7 @@ } // "folly::File" => `(f, o, l, l, y, (), F, i, l, e)` -pub fn expand(krate: Crate, arg: QualifiedName) -> TokenStream { +pub(crate) fn expand(krate: Crate, arg: QualifiedName) -> TokenStream { let mut ids = Vec::new(); for word in arg.segments {
diff --git a/third_party/skia b/third_party/skia index a4cce52..b6ce84d 160000 --- a/third_party/skia +++ b/third_party/skia
@@ -1 +1 @@ -Subproject commit a4cce5236dcf5af8b3b8725559df76877802f209 +Subproject commit b6ce84dc3e53eb5850206d5b567c8a2b6e4b211d
diff --git a/third_party/wayland-protocols/unstable/ui-controls/ui-controls-unstable-v1.xml b/third_party/wayland-protocols/unstable/ui-controls/ui-controls-unstable-v1.xml index 547f661..6c72622 100644 --- a/third_party/wayland-protocols/unstable/ui-controls/ui-controls-unstable-v1.xml +++ b/third_party/wayland-protocols/unstable/ui-controls/ui-controls-unstable-v1.xml
@@ -170,7 +170,6 @@ </description> <arg name="id" type="uint" summary="ID of the processed request"/> </event> - </interface> <!-- Version 3 additions --> <request name="set_display_info_id" since="3"> @@ -224,4 +223,5 @@ <arg name="id" type="uint" summary="will be echoed back in the matching sent event"/> </request> + </interface> </protocol>
diff --git a/third_party/wayland/src b/third_party/wayland/src index 3fda2fb..af7f441 160000 --- a/third_party/wayland/src +++ b/third_party/wayland/src
@@ -1 +1 @@ -Subproject commit 3fda2fbf51db54398c0155facee82cc9533958a2 +Subproject commit af7f44122127b86a8c74cb7432909180f4899eaa
diff --git a/third_party/webgpu-cts/src b/third_party/webgpu-cts/src index f413d34..5a69832 160000 --- a/third_party/webgpu-cts/src +++ b/third_party/webgpu-cts/src
@@ -1 +1 @@ -Subproject commit f413d3474963ae2e63a7ba9580709b3c7180f9e8 +Subproject commit 5a6983265a19816f74953c3d51efbbaa246ff190
diff --git a/third_party/webrtc b/third_party/webrtc index bd396fd..d3414d9 160000 --- a/third_party/webrtc +++ b/third_party/webrtc
@@ -1 +1 @@ -Subproject commit bd396fdffae452216e1984dec3cea73937192479 +Subproject commit d3414d96888391774677736f25e9ed3865d5db23
diff --git a/third_party/wpt_tools/README.chromium b/third_party/wpt_tools/README.chromium index 602f7fa..3828fac6 100644 --- a/third_party/wpt_tools/README.chromium +++ b/third_party/wpt_tools/README.chromium
@@ -1,7 +1,7 @@ Name: web-platform-tests - Test Suites for Web Platform specifications Short Name: wpt URL: https://github.com/web-platform-tests/wpt/ -Version: 892583e4adb98da9b63c6ceaf1e0896f2cfb71e7 +Version: c359284745e2a2f6c44af320d1d6c43ce51f25bc License: LICENSES FOR W3C TEST SUITES (https://www.w3.org/Consortium/Legal/2008/03-bsd-license.html) Security Critical: no Shipped: no
diff --git a/third_party/wpt_tools/WPTIncludeList b/third_party/wpt_tools/WPTIncludeList index 7d634ba..33415ff 100644 --- a/third_party/wpt_tools/WPTIncludeList +++ b/third_party/wpt_tools/WPTIncludeList
@@ -74,28 +74,31 @@ ./tools/third_party/enum/enum/LICENSE ./tools/third_party/enum/enum/README ./tools/third_party/enum/enum/__init__.py -./tools/third_party/h2/LICENSE -./tools/third_party/h2/h2/__init__.py -./tools/third_party/h2/h2/config.py -./tools/third_party/h2/h2/connection.py -./tools/third_party/h2/h2/errors.py -./tools/third_party/h2/h2/events.py -./tools/third_party/h2/h2/exceptions.py -./tools/third_party/h2/h2/frame_buffer.py -./tools/third_party/h2/h2/settings.py -./tools/third_party/h2/h2/stream.py -./tools/third_party/h2/h2/utilities.py -./tools/third_party/h2/h2/windows.py +./tools/third_party/h2/src/h2/__init__.py +./tools/third_party/h2/src/h2/errors.py +./tools/third_party/h2/src/h2/frame_buffer.py +./tools/third_party/h2/src/h2/utilities.py +./tools/third_party/h2/src/h2/config.py +./tools/third_party/h2/src/h2/events.py +./tools/third_party/h2/src/h2/settings.py +./tools/third_party/h2/src/h2/windows.py +./tools/third_party/h2/src/h2/connection.py +./tools/third_party/h2/src/h2/exceptions.py +./tools/third_party/h2/src/h2/stream.py ./tools/third_party/hpack/LICENSE -./tools/third_party/hpack/hpack/__init__.py -./tools/third_party/hpack/hpack/compat.py -./tools/third_party/hpack/hpack/exceptions.py -./tools/third_party/hpack/hpack/hpack.py -./tools/third_party/hpack/hpack/huffman.py -./tools/third_party/hpack/hpack/huffman_constants.py -./tools/third_party/hpack/hpack/huffman_table.py -./tools/third_party/hpack/hpack/struct.py -./tools/third_party/hpack/hpack/table.py +./tools/third_party/hpack/src/hpack/__init__.py +./tools/third_party/hpack/src/hpack/exceptions.py +./tools/third_party/hpack/src/hpack/hpack.py +./tools/third_party/hpack/src/hpack/huffman.py +./tools/third_party/hpack/src/hpack/huffman_constants.py +./tools/third_party/hpack/src/hpack/huffman_table.py +./tools/third_party/hpack/src/hpack/struct.py +./tools/third_party/hpack/src/hpack/table.py +./tools/third_party/hyperframe/src/hyperframe/exceptions.py +./tools/third_party/hyperframe/src/hyperframe/frame.py +./tools/third_party/hyperframe/src/hyperframe/py.typed +./tools/third_party/hyperframe/src/hyperframe/__init__.py +./tools/third_party/hyperframe/src/hyperframe/flags.py ./tools/third_party/html5lib/LICENSE ./tools/third_party/html5lib/README.rst ./tools/third_party/html5lib/html5lib/__init__.py
diff --git a/third_party/wpt_tools/wpt/tools/localpaths.py b/third_party/wpt_tools/wpt/tools/localpaths.py index 280f4bf..a027af8 100644 --- a/third_party/wpt_tools/wpt/tools/localpaths.py +++ b/third_party/wpt_tools/wpt/tools/localpaths.py
@@ -22,9 +22,9 @@ sys.path.insert(0, os.path.join(here, "third_party", "six")) sys.path.insert(0, os.path.join(here, "third_party", "typing_extensions", "src")) sys.path.insert(0, os.path.join(here, "third_party", "webencodings")) -sys.path.insert(0, os.path.join(here, "third_party", "h2")) -sys.path.insert(0, os.path.join(here, "third_party", "hpack")) -sys.path.insert(0, os.path.join(here, "third_party", "hyperframe")) +sys.path.insert(0, os.path.join(here, "third_party", "h2", "src")) +sys.path.insert(0, os.path.join(here, "third_party", "hpack", "src")) +sys.path.insert(0, os.path.join(here, "third_party", "hyperframe", "src")) sys.path.insert(0, os.path.join(here, "third_party", "certifi")) sys.path.insert(0, os.path.join(here, "third_party", "hyper")) sys.path.insert(0, os.path.join(here, "third_party", "websockets", "src"))
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/LICENSE b/third_party/wpt_tools/wpt/tools/third_party/h2/LICENSE deleted file mode 100644 index 7bb76c5..0000000 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/LICENSE +++ /dev/null
@@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2016 Cory Benfield and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/__init__.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/__init__.py similarity index 74% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/__init__.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/__init__.py index 6290710..d3fd0cb6 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/__init__.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/__init__.py
@@ -5,4 +5,4 @@ A HTTP/2 implementation. """ -__version__ = '3.2.0' +__version__ = '4.1.0'
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/config.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/config.py similarity index 85% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/config.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/config.py index 1c437ee..915df55 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/config.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/config.py
@@ -6,8 +6,10 @@ Objects for controlling the configuration of the HTTP/2 stack. """ +import sys -class _BooleanConfigOption(object): + +class _BooleanConfigOption: """ Descriptor for handling a boolean config option. This will block attempts to set boolean config options to non-bools. @@ -25,12 +27,12 @@ setattr(instance, self.attr_name, value) -class DummyLogger(object): +class DummyLogger: """ - An Logger object that does not actual logging, hence a DummyLogger. + A Logger object that does not actual logging, hence a DummyLogger. For the class the log operation is merely a no-op. The intent is to avoid - conditionals being sprinkled throughout the hyper-h2 code for calls to + conditionals being sprinkled throughout the h2 code for calls to logging functions when no logger is passed into the corresponding object. """ def __init__(self, *vargs): @@ -49,7 +51,30 @@ pass -class H2Configuration(object): +class OutputLogger: + """ + A Logger object that prints to stderr or any other file-like object. + + This class is provided for convenience and not part of the stable API. + + :param file: A file-like object passed to the print function. + Defaults to ``sys.stderr``. + :param trace: Enables trace-level output. Defaults to ``False``. + """ + def __init__(self, file=None, trace_level=False): + super().__init__() + self.file = file or sys.stderr + self.trace_level = trace_level + + def debug(self, fmtstr, *args): + print(f"h2 (debug): {fmtstr % args}", file=self.file) + + def trace(self, fmtstr, *args): + if self.trace_level: + print(f"h2 (trace): {fmtstr % args}", file=self.file) + + +class H2Configuration: """ An object that controls the way a single HTTP/2 connection behaves. @@ -101,7 +126,7 @@ :param normalize_inbound_headers: Controls whether the headers received by this object are normalized according to the rules of RFC 7540. - Disabling this setting may lead to hyper-h2 emitting header blocks that + Disabling this setting may lead to h2 emitting header blocks that some RFCs forbid, e.g. with multiple cookie fields. .. versionadded:: 3.0.0
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/connection.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/connection.py similarity index 98% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/connection.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/connection.py index 35e6fd6..25251e20 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/connection.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/connection.py
@@ -72,7 +72,7 @@ ODD = 1 -class H2ConnectionStateMachine(object): +class H2ConnectionStateMachine: """ A single HTTP/2 connection state machine. @@ -236,7 +236,7 @@ return [] -class H2Connection(object): +class H2Connection: """ A low-level HTTP/2 connection object. This handles building and receiving frames and maintains both connection and per-stream state for all streams @@ -806,8 +806,8 @@ :class:`FrameTooLargeError <h2.exceptions.FrameTooLargeError>` will be raised. - Hyper-h2 does this to avoid buffering the data internally. If the user - has more data to send than hyper-h2 will allow, consider breaking it up + h2 does this to avoid buffering the data internally. If the user + has more data to send than h2 will allow, consider breaking it up and buffering it externally. :param stream_id: The ID of the stream on which to send the data. @@ -1097,10 +1097,10 @@ The explicit method of advertising can be done as long as the connection is active. The implicit method can only be done after the client has sent the request headers and before the server has sent the - response headers: outside of those points, Hyper-h2 will forbid sending + response headers: outside of those points, h2 will forbid sending the Alternative Service advertisement by raising a ProtocolError. - The ``field_value`` parameter is specified in RFC 7838. Hyper-h2 does + The ``field_value`` parameter is specified in RFC 7838. h2 does not validate or introspect this argument: the user is required to ensure that it's well-formed. ``field_value`` corresponds to RFC 7838's "Alternative Service Field Value". @@ -1109,13 +1109,13 @@ advertising Alternative Services. The implicit method of advertising Alternative Services has a number of subtleties and can lead to inconsistencies between the server and - client. Hyper-h2 allows both mechanisms, but caution is + client. h2 allows both mechanisms, but caution is strongly advised. .. versionadded:: 2.3.0 :param field_value: The RFC 7838 Alternative Service Field Value. This - argument is not introspected by Hyper-h2: the user is responsible + argument is not introspected by h2: the user is responsible for ensuring that it is well-formed. :type field_value: ``bytes`` @@ -1173,17 +1173,17 @@ stream is closed. .. warning:: RFC 7540 allows for servers to change the priority of - streams. However, hyper-h2 **does not** allow server + streams. However, h2 **does not** allow server stacks to do this. This is because most clients do not adequately know how to respond when provided conflicting priority information, and relatively little utility is provided by making that functionality available. - .. note:: hyper-h2 **does not** maintain any information about the - RFC 7540 priority tree. That means that hyper-h2 does not + .. note:: h2 **does not** maintain any information about the + RFC 7540 priority tree. That means that h2 does not prevent incautious users from creating invalid priority trees, particularly by creating priority loops. While some - basic error checking is provided by hyper-h2, users are + basic error checking is provided by h2, users are strongly recommended to understand their prioritisation strategies before using the priority tools here. @@ -1481,6 +1481,7 @@ .. versionchanged:: 2.0.0 Removed from the public API. """ + self.config.logger.trace("Received frame: %s", repr(frame)) try: # I don't love using __class__ here, maybe reconsider it. frames, events = self._frame_dispatch_table[frame.__class__](frame) @@ -1721,22 +1722,21 @@ """ Receive a WINDOW_UPDATE frame on the connection. """ - # Validate the frame. - if not (1 <= frame.window_increment <= self.MAX_WINDOW_INCREMENT): - raise ProtocolError( - "Flow control increment must be between 1 and %d, received %d" - % (self.MAX_WINDOW_INCREMENT, frame.window_increment) - ) + # hyperframe will take care of validating the window_increment. + # If we reach in here, we can assume a valid value. events = self.state_machine.process_input( ConnectionInputs.RECV_WINDOW_UPDATE ) if frame.stream_id: - stream = self._get_stream_by_id(frame.stream_id) - frames, stream_events = stream.receive_window_update( - frame.window_increment - ) + try: + stream = self._get_stream_by_id(frame.stream_id) + frames, stream_events = stream.receive_window_update( + frame.window_increment + ) + except StreamClosedError: + return [], events else: # Increment our local flow control window. self.outbound_flow_control_window = guard_increment_window( @@ -2029,9 +2029,9 @@ def _decode_headers(decoder, encoded_header_block): """ Decode a HPACK-encoded header block, translating HPACK exceptions into - sensible hyper-h2 errors. + sensible h2 errors. - This only ever returns bytestring headers: hyper-h2 may emit them as + This only ever returns bytestring headers: h2 may emit them as unicode later, but internally it processes them as bytestrings only. """ try:
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/errors.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/errors.py similarity index 98% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/errors.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/errors.py index baef2001..303df597 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/errors.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/errors.py
@@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ h2/errors -~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~ Global error code registry containing the established HTTP/2 error codes.
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/events.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/events.py similarity index 93% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/events.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/events.py index a06c990..66c3cff 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/events.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/events.py
@@ -14,7 +14,7 @@ from .settings import ChangedSetting, _setting_code_from_int -class Event(object): +class Event: """ Base class for h2 events. """ @@ -311,7 +311,7 @@ its settings. It contains a complete inventory of changed settings, including their previous values. - In HTTP/2, settings changes need to be acknowledged. hyper-h2 automatically + In HTTP/2, settings changes need to be acknowledged. h2 automatically acknowledges settings changes for efficiency. However, it is possible that the caller may not be happy with the changed setting. @@ -322,7 +322,7 @@ .. versionchanged:: 2.0.0 Prior to this version the user needed to acknowledge settings changes. - This is no longer the case: hyper-h2 now automatically acknowledges + This is no longer the case: h2 now automatically acknowledges them. """ def __init__(self): @@ -374,11 +374,16 @@ ) -class PingAcknowledged(Event): +class PingAckReceived(Event): """ - Same as PingAckReceived. + The PingAckReceived event is fired whenever a PING acknowledgment is + received. It contains the 'opaque data' of the PING+ACK frame, allowing the + user to correlate PINGs and calculate RTT. - .. deprecated:: 3.1.0 + .. versionadded:: 3.1.0 + + .. versionchanged:: 4.0.0 + Removed deprecated but equivalent ``PingAcknowledged``. """ def __init__(self): #: The data included on the ping. @@ -390,17 +395,6 @@ ) -class PingAckReceived(PingAcknowledged): - """ - The PingAckReceived event is fired whenever a PING acknowledgment is - received. It contains the 'opaque data' of the PING+ACK frame, allowing the - user to correlate PINGs and calculate RTT. - - .. versionadded:: 3.1.0 - """ - pass - - class StreamEnded(Event): """ The StreamEnded event is fired whenever a stream is ended by a remote @@ -420,10 +414,10 @@ The StreamReset event is fired in two situations. The first is when the remote party forcefully resets the stream. The second is when the remote party has made a protocol error which only affects a single stream. In this - case, Hyper-h2 will terminate the stream early and return this event. + case, h2 will terminate the stream early and return this event. .. versionchanged:: 2.0.0 - This event is now fired when Hyper-h2 automatically resets a stream. + This event is now fired when h2 automatically resets a stream. """ def __init__(self): #: The Stream ID of the stream that was reset. @@ -567,12 +561,12 @@ This event always carries the origin to which the ALTSVC information applies. That origin is either supplied by the server directly, or inferred - by hyper-h2 from the ``:authority`` pseudo-header field that was sent by + by h2 from the ``:authority`` pseudo-header field that was sent by the user when initiating a given stream. This event also carries what RFC 7838 calls the "Alternative Service Field Value", which is formatted like a HTTP header field and contains the - relevant alternative service information. Hyper-h2 does not parse or in any + relevant alternative service information. h2 does not parse or in any way modify that information: the user is required to do that. This event can only be fired on the client end of a connection. @@ -582,13 +576,13 @@ def __init__(self): #: The origin to which the alternative service field value applies. #: This field is either supplied by the server directly, or inferred by - #: hyper-h2 from the ``:authority`` pseudo-header field that was sent + #: h2 from the ``:authority`` pseudo-header field that was sent #: by the user when initiating the stream on which the frame was #: received. self.origin = None #: The ALTSVC field value. This contains information about the HTTP - #: alternative service being advertised by the server. Hyper-h2 does + #: alternative service being advertised by the server. h2 does #: not parse this field: it is left exactly as sent by the server. The #: structure of the data in this field is given by `RFC 7838 Section 3 #: <https://tools.ietf.org/html/rfc7838#section-3>`_. @@ -606,11 +600,11 @@ class UnknownFrameReceived(Event): """ The UnknownFrameReceived event is fired when the remote peer sends a frame - that hyper-h2 does not understand. This occurs primarily when the remote - peer is employing HTTP/2 extensions that hyper-h2 doesn't know anything + that h2 does not understand. This occurs primarily when the remote + peer is employing HTTP/2 extensions that h2 doesn't know anything about. - RFC 7540 requires that HTTP/2 implementations ignore these frames. hyper-h2 + RFC 7540 requires that HTTP/2 implementations ignore these frames. h2 does so. However, this event is fired to allow implementations to perform special processing on those frames if needed (e.g. if the implementation is capable of handling the frame itself). @@ -637,12 +631,4 @@ if data is None: return None - hex = binascii.hexlify(data) - - # This is moderately clever: on all Python versions hexlify returns a byte - # string. On Python 3 we want an actual string, so we just check whether - # that's what we have. - if not isinstance(hex, str): # pragma: no cover - hex = hex.decode('ascii') - - return hex + return binascii.hexlify(data).decode('ascii')
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/exceptions.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/exceptions.py similarity index 89% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/exceptions.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/exceptions.py index 388f9e9a..e22bebc 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/exceptions.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/exceptions.py
@@ -26,7 +26,7 @@ """ The frame that we tried to send or that we received was too large. """ - #: This error code that corresponds to this kind of Protocol Error. + #: The error code corresponds to this kind of Protocol Error. error_code = h2.errors.ErrorCodes.FRAME_SIZE_ERROR @@ -36,7 +36,7 @@ .. versionadded:: 2.0.0 """ - #: The error code that corresponds to this kind of Protocol Error + #: The error code corresponds to this kind of Protocol Error. error_code = h2.errors.ErrorCodes.FRAME_SIZE_ERROR @@ -52,8 +52,7 @@ """ An attempted action violates flow control constraints. """ - #: The error code that corresponds to this kind of - #: :class:`ProtocolError <h2.exceptions.ProtocolError>` + #: The error code corresponds to this kind of Protocol Error. error_code = h2.errors.ErrorCodes.FLOW_CONTROL_ERROR @@ -94,7 +93,7 @@ <h2.exceptions.ProtocolError>` """ def __init__(self, stream_id): - #: The stream ID that corresponds to the non-existent stream. + #: The stream ID corresponds to the non-existent stream. self.stream_id = stream_id @@ -106,7 +105,7 @@ stream has been removed. """ def __init__(self, stream_id): - #: The stream ID that corresponds to the nonexistent stream. + #: The stream ID corresponds to the nonexistent stream. self.stream_id = stream_id #: The relevant HTTP/2 error code. @@ -145,13 +144,15 @@ ) -class UnsupportedFrameError(ProtocolError, KeyError): +class UnsupportedFrameError(ProtocolError): """ The remote peer sent a frame that is unsupported in this context. .. versionadded:: 2.1.0 + + .. versionchanged:: 4.0.0 + Removed deprecated KeyError parent class. """ - # TODO: Remove the KeyError in 3.0.0 pass @@ -181,6 +182,6 @@ .. versionadded:: 2.5.0 """ - #: The error code that corresponds to this kind of + #: The error code corresponds to this kind of #: :class:`ProtocolError <h2.exceptions.ProtocolError>` error_code = h2.errors.ErrorCodes.ENHANCE_YOUR_CALM
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/frame_buffer.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/frame_buffer.py similarity index 80% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/frame_buffer.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/frame_buffer.py index e79f6ec..785775eb 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/frame_buffer.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/frame_buffer.py
@@ -6,7 +6,7 @@ A data structure that provides a way to iterate over a byte buffer in terms of frames. """ -from hyperframe.exceptions import InvalidFrameError +from hyperframe.exceptions import InvalidFrameError, InvalidDataError from hyperframe.frame import ( Frame, HeadersFrame, ContinuationFrame, PushPromiseFrame ) @@ -26,7 +26,7 @@ CONTINUATION_BACKLOG = 64 -class FrameBuffer(object): +class FrameBuffer: """ This is a data structure that expects to act as a buffer for HTTP/2 data that allows iteraton in terms of H2 frames. @@ -57,20 +57,6 @@ self.data += data - def _parse_frame_header(self, data): - """ - Parses the frame header from the data. Either returns a tuple of - (frame, length), or throws an exception. The returned frame may be None - if the frame is of unknown type. - """ - try: - frame, length = Frame.parse_frame_header(data[:9]) - except ValueError as e: - # The frame header is invalid. This is a ProtocolError - raise ProtocolError("Invalid frame header received: %s" % str(e)) - - return frame, length - def _validate_frame_length(self, length): """ Confirm that the frame is an appropriate length. @@ -130,16 +116,18 @@ def __iter__(self): return self - def next(self): # Python 2 + def __next__(self): # First, check that we have enough data to successfully parse the # next frame header. If not, bail. Otherwise, parse it. if len(self.data) < 9: raise StopIteration() try: - f, length = self._parse_frame_header(self.data) - except InvalidFrameError: # pragma: no cover - raise ProtocolError("Received frame with invalid frame header.") + f, length = Frame.parse_frame_header(self.data[:9]) + except (InvalidDataError, InvalidFrameError) as e: # pragma: no cover + raise ProtocolError( + "Received frame with invalid header: %s" % str(e) + ) # Next, check that we have enough length to parse the frame body. If # not, bail, leaving the frame header data in the buffer for next time. @@ -149,13 +137,13 @@ # Confirm the frame has an appropriate length. self._validate_frame_length(length) - # Don't try to parse the body if we didn't get a frame we know about: - # there's nothing we can do with it anyway. - if f is not None: - try: - f.parse_body(memoryview(self.data[9:9+length])) - except InvalidFrameError: - raise FrameDataMissingError("Frame data missing or invalid") + # Try to parse the frame body + try: + f.parse_body(memoryview(self.data[9:9+length])) + except InvalidDataError: + raise ProtocolError("Received frame with non-compliant data") + except InvalidFrameError: + raise FrameDataMissingError("Frame data missing or invalid") # At this point, as we know we'll use or discard the entire frame, we # can update the data. @@ -169,7 +157,4 @@ # frame in the sequence instead. Recurse back into ourselves to do # that. This is safe because the amount of work we have to do here is # strictly bounded by the length of the buffer. - return f if f is not None else self.next() - - def __next__(self): # Python 3 - return self.next() + return f if f is not None else self.__next__()
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/settings.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/settings.py similarity index 98% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/settings.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/settings.py index bf87c94f..969a162 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/settings.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/settings.py
@@ -8,6 +8,7 @@ state of the settings and the unacknowledged future values of the settings. """ import collections +from collections.abc import MutableMapping import enum from hyperframe.frame import SettingsFrame @@ -15,12 +16,6 @@ from h2.errors import ErrorCodes from h2.exceptions import InvalidSettingsValueError -try: - from collections.abc import MutableMapping -except ImportError: # pragma: no cover - # Python 2.7 compatibility - from collections import MutableMapping - class SettingCodes(enum.IntEnum): """
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/stream.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/stream.py similarity index 99% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/stream.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/stream.py index 1cb9178..817636f8 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/stream.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/stream.py
@@ -80,7 +80,7 @@ STREAM_OPEN[StreamState.HALF_CLOSED_REMOTE] = True -class H2StreamStateMachine(object): +class H2StreamStateMachine: """ A single HTTP/2 stream state machine. @@ -198,6 +198,8 @@ """ Fires when data is received. """ + if not self.headers_received: + raise ProtocolError("cannot receive data before headers") event = DataReceived() event.stream_id = self.stream_id return [event] @@ -526,7 +528,7 @@ # For this reason, our state machine implementation below allows for # PUSH_PROMISE frames both in the IDLE state (as in the diagram), but also # in the OPEN, HALF_CLOSED_LOCAL, and HALF_CLOSED_REMOTE states. -# Essentially, for hyper-h2, PUSH_PROMISE frames are effectively sent on +# Essentially, for h2, PUSH_PROMISE frames are effectively sent on # two streams. # # The _transitions dictionary contains a mapping of tuples of @@ -734,7 +736,7 @@ } -class H2Stream(object): +class H2Stream: """ A low-level HTTP/2 stream object. This handles building and receiving frames and maintains per-stream state.
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/utilities.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/utilities.py similarity index 96% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/utilities.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/utilities.py index 06c916ee..c7a620d8 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/utilities.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/utilities.py
@@ -8,7 +8,6 @@ import collections import re from string import whitespace -import sys from hpack import HeaderTuple, NeverIndexedHeaderTuple @@ -61,10 +60,7 @@ _CONNECT_REQUEST_ONLY_HEADERS = frozenset([b':protocol', u':protocol']) -if sys.version_info[0] == 2: # Python 2.X - _WHITESPACE = frozenset(whitespace) -else: # Python 3.3+ - _WHITESPACE = frozenset(map(ord, whitespace)) +_WHITESPACE = frozenset(map(ord, whitespace)) def _secure_headers(headers, hdr_validation_flags): @@ -207,9 +203,12 @@ # checking remains somewhat expensive, and attempts should be made wherever # possible to reduce the time spent doing them. # - # For example, we avoid tuple upacking in loops because it represents a + # For example, we avoid tuple unpacking in loops because it represents a # fixed cost that we don't want to spend, instead indexing into the header # tuples. + headers = _reject_empty_header_names( + headers, hdr_validation_flags + ) headers = _reject_uppercase_header_fields( headers, hdr_validation_flags ) @@ -233,6 +232,19 @@ return headers +def _reject_empty_header_names(headers, hdr_validation_flags): + """ + Raises a ProtocolError if any header names are empty (length 0). + While hpack decodes such headers without errors, they are semantically + forbidden in HTTP, see RFC 7230, stating that they must be at least one + character long. + """ + for header in headers: + if len(header[0]) == 0: + raise ProtocolError("Received header name with zero length.") + yield header + + def _reject_uppercase_header_fields(headers, hdr_validation_flags): """ Raises a ProtocolError if any uppercase character is found in a header @@ -276,7 +288,7 @@ if header[0] in (b'te', u'te'): if header[1].lower() not in (b'trailers', u'trailers'): raise ProtocolError( - "Invalid value for Transfer-Encoding header: %s" % + "Invalid value for TE header: %s" % header[1] )
diff --git a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/windows.py b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/windows.py similarity index 99% rename from third_party/wpt_tools/wpt/tools/third_party/h2/h2/windows.py rename to third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/windows.py index 6656975..be4eb43 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/h2/h2/windows.py +++ b/third_party/wpt_tools/wpt/tools/third_party/h2/src/h2/windows.py
@@ -21,7 +21,7 @@ LARGEST_FLOW_CONTROL_WINDOW = 2**31 - 1 -class WindowManager(object): +class WindowManager: """ A basic HTTP/2 window manager.
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/__init__.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/__init__.py deleted file mode 100644 index 22edde2..0000000 --- a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/__init__.py +++ /dev/null
@@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -""" -hpack -~~~~~ - -HTTP/2 header encoding for Python. -""" -from .hpack import Encoder, Decoder -from .struct import HeaderTuple, NeverIndexedHeaderTuple -from .exceptions import ( - HPACKError, HPACKDecodingError, InvalidTableIndex, OversizedHeaderListError -) - -__all__ = [ - 'Encoder', 'Decoder', 'HPACKError', 'HPACKDecodingError', - 'InvalidTableIndex', 'HeaderTuple', 'NeverIndexedHeaderTuple', - 'OversizedHeaderListError' -] - -__version__ = '3.0.0'
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/compat.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/compat.py deleted file mode 100644 index 4fcaad4..0000000 --- a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/compat.py +++ /dev/null
@@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -""" -hpack/compat -~~~~~~~~~~~~ - -Normalizes the Python 2/3 API for internal use. -""" -import sys - - -_ver = sys.version_info -is_py2 = _ver[0] == 2 -is_py3 = _ver[0] == 3 - -if is_py2: - def to_byte(char): - return ord(char) - - def decode_hex(b): - return b.decode('hex') - - def to_bytes(b): - if isinstance(b, memoryview): - return b.tobytes() - else: - return bytes(b) - - unicode = unicode # noqa - bytes = str - -elif is_py3: - def to_byte(char): - return char - - def decode_hex(b): - return bytes.fromhex(b) - - def to_bytes(b): - return bytes(b) - - unicode = str - bytes = bytes
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/__init__.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/__init__.py new file mode 100644 index 0000000..fc26ac5 --- /dev/null +++ b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/__init__.py
@@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +""" +hpack +~~~~~ + +HTTP/2 header encoding for Python. +""" +from .hpack import Encoder, Decoder +from .struct import HeaderTuple, NeverIndexedHeaderTuple +from .exceptions import ( + HPACKError, + HPACKDecodingError, + InvalidTableIndex, + OversizedHeaderListError, + InvalidTableSizeError +) + +__all__ = [ + 'Encoder', + 'Decoder', + 'HeaderTuple', + 'NeverIndexedHeaderTuple', + 'HPACKError', + 'HPACKDecodingError', + 'InvalidTableIndex', + 'OversizedHeaderListError', + 'InvalidTableSizeError', +] + +__version__ = '4.0.0'
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/exceptions.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/exceptions.py similarity index 100% rename from third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/exceptions.py rename to third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/exceptions.py
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/hpack.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/hpack.py similarity index 96% rename from third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/hpack.py rename to third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/hpack.py index f8e808b..cc39bfd6 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/hpack.py +++ b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/hpack.py
@@ -8,7 +8,6 @@ import logging from .table import HeaderTable, table_entry_size -from .compat import to_byte, to_bytes from .exceptions import ( HPACKDecodingError, OversizedHeaderListError, InvalidTableSizeError ) @@ -46,8 +45,8 @@ Provides a header as a unicode string if raw is False, otherwise returns it as a bytestring. """ - name = to_bytes(header[0]) - value = to_bytes(header[1]) + name = bytes(header[0]) + value = bytes(header[1]) if not raw: name = name.decode('utf-8') value = value.decode('utf-8') @@ -106,10 +105,10 @@ mask = (0xFF >> (8 - prefix_bits)) try: - number = to_byte(data[0]) & mask + number = data[0] & mask if number == max_number: while True: - next_byte = to_byte(data[index]) + next_byte = data[index] index += 1 if next_byte >= 128: @@ -132,7 +131,7 @@ def _dict_to_iterable(header_dict): """ This converts a dictionary to an iterable of two-tuples. This is a - HPACK-specific function becuase it pulls "special-headers" out first and + HPACK-specific function because it pulls "special-headers" out first and then emits them. """ assert isinstance(header_dict, dict) @@ -154,7 +153,7 @@ return string if isinstance(string, bytes) else string.encode('utf-8') -class Encoder(object): +class Encoder: """ An HPACK encoder object. This object takes HTTP headers and emits encoded HTTP/2 header blocks. @@ -187,7 +186,7 @@ :param headers: The headers to encode. Must be either an iterable of tuples, an iterable of :class:`HeaderTuple - <hpack.struct.HeaderTuple>`, or a ``dict``. + <hpack.HeaderTuple>`, or a ``dict``. If an iterable of tuples, the tuples may be either two-tuples or three-tuples. If they are two-tuples, the @@ -199,10 +198,10 @@ ``sensitive`` defaults to ``False``. If an iterable of :class:`HeaderTuple - <hpack.struct.HeaderTuple>`, the tuples must always be + <hpack.HeaderTuple>`, the tuples must always be two-tuples. Instead of using ``sensitive`` as a third tuple entry, use :class:`NeverIndexedHeaderTuple - <hpack.struct.NeverIndexedHeaderTuple>` to request that + <hpack.NeverIndexedHeaderTuple>` to request that the field never be indexed. .. warning:: HTTP/2 requires that all special headers @@ -265,7 +264,12 @@ """ This function takes a header key-value tuple and serializes it. """ - log.debug("Adding %s to the header table", to_add) + log.debug( + "Adding %s to the header table, sensitive:%s, huffman:%s", + to_add, + sensitive, + huffman + ) name, value = to_add @@ -370,7 +374,7 @@ return block -class Decoder(object): +class Decoder: """ An HPACK decoder object. @@ -386,7 +390,7 @@ If this amount of data is exceeded, a `OversizedHeaderListError <hpack.OversizedHeaderListError>` exception will be raised. At this point the connection should be shut down, as the HPACK state will no - longer be useable. + longer be usable. Defaults to 64kB. :type max_header_list_size: ``int`` @@ -456,7 +460,7 @@ while current_index < data_len: # Work out what kind of header we're decoding. # If the high bit is 1, it's an indexed field. - current = to_byte(data[current_index]) + current = data[current_index] indexed = True if current & 0x80 else False # Otherwise, if the second-highest bit is 1 it's a field that does @@ -564,11 +568,11 @@ # When should_index is false, if the low four bits of the first byte # are nonzero the header name is indexed. if should_index: - indexed_name = to_byte(data[0]) & 0x3F + indexed_name = data[0] & 0x3F name_len = 6 not_indexable = False else: - high_byte = to_byte(data[0]) + high_byte = data[0] indexed_name = high_byte & 0x0F name_len = 4 not_indexable = high_byte & 0x10 @@ -590,7 +594,7 @@ if len(name) != length: raise HPACKDecodingError("Truncated header block") - if to_byte(data[0]) & 0x80: + if data[0] & 0x80: name = decode_huffman(name) total_consumed = consumed + length + 1 # Since we moved forward 1. @@ -602,7 +606,7 @@ if len(value) != length: raise HPACKDecodingError("Truncated header block") - if to_byte(data[0]) & 0x80: + if data[0] & 0x80: value = decode_huffman(value) # Updated the total consumed length.
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/huffman.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/huffman.py similarity index 92% rename from third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/huffman.py rename to third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/huffman.py index 159569c..595d69b6 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/huffman.py +++ b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/huffman.py
@@ -6,10 +6,9 @@ An implementation of a bitwise prefix tree specially built for decoding Huffman-coded content where we already know the Huffman table. """ -from .compat import to_byte, decode_hex -class HuffmanEncoder(object): +class HuffmanEncoder: """ Encodes a string according to the Huffman encoding table defined in the HPACK specification. @@ -33,8 +32,7 @@ # Turn each byte into its huffman code. These codes aren't necessarily # octet aligned, so keep track of how far through an octet we are. To # handle this cleanly, just use a single giant integer. - for char in bytes_to_encode: - byte = to_byte(char) + for byte in bytes_to_encode: bin_int_len = self.huffman_code_list_lengths[byte] bin_int = self.huffman_code_list[byte] & ( 2 ** (bin_int_len + 1) - 1 @@ -65,4 +63,4 @@ missing_digits = expected_digits - len(final_num) final_num = ('0' * missing_digits) + final_num - return decode_hex(final_num) + return bytes.fromhex(final_num)
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/huffman_constants.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/huffman_constants.py similarity index 99% rename from third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/huffman_constants.py rename to third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/huffman_constants.py index c2b3bb2..4caf012 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/huffman_constants.py +++ b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/huffman_constants.py
@@ -6,6 +6,7 @@ Defines the constant Huffman table. This takes up an upsetting amount of space, but c'est la vie. """ +# flake8: noqa REQUEST_CODES = [ 0x1ff8,
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/huffman_table.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/huffman_table.py similarity index 100% rename from third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/huffman_table.py rename to third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/huffman_table.py
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/struct.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/struct.py similarity index 93% rename from third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/struct.py rename to third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/struct.py index e860cd75..fcab929 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/struct.py +++ b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/struct.py
@@ -25,8 +25,8 @@ indexable = True - def __new__(_cls, *args): - return tuple.__new__(_cls, args) + def __new__(cls, *args): + return tuple.__new__(cls, args) class NeverIndexedHeaderTuple(HeaderTuple):
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/table.py b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/table.py similarity index 89% rename from third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/table.py rename to third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/table.py index 9a89c72..2b656f3 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/hpack/hpack/table.py +++ b/third_party/wpt_tools/wpt/tools/third_party/hpack/src/hpack/table.py
@@ -23,7 +23,7 @@ return 32 + len(name) + len(value) -class HeaderTable(object): +class HeaderTable: """ Implements the combined static and dynamic header table @@ -170,14 +170,17 @@ - ``(index, name, None)`` for partial matches on name only. - ``(index, name, value)`` for perfect matches. """ - offset = HeaderTable.STATIC_TABLE_LENGTH + 1 partial = None - for (i, (n, v)) in enumerate(HeaderTable.STATIC_TABLE): - if n == name: - if v == value: - return i + 1, n, v - elif partial is None: - partial = (i + 1, n, None) + + header_name_search_result = HeaderTable.STATIC_TABLE_MAPPING.get(name) + if header_name_search_result: + index = header_name_search_result[1].get(value) + if index is not None: + return index, name, value + else: + partial = (header_name_search_result[0], name, None) + + offset = HeaderTable.STATIC_TABLE_LENGTH + 1 for (i, (n, v)) in enumerate(self.dynamic_entries): if n == name: if v == value: @@ -213,3 +216,20 @@ cursize -= table_entry_size(name, value) log.debug("Evicting %s: %s from the header table", name, value) self._current_size = cursize + + +def _build_static_table_mapping(): + """ + Build static table mapping from header name to tuple with next structure: + (<minimal index of header>, <mapping from header value to it index>). + + static_table_mapping used for hash searching. + """ + static_table_mapping = {} + for index, (name, value) in enumerate(HeaderTable.STATIC_TABLE, 1): + header_name_search_result = static_table_mapping.setdefault(name, (index, {})) + header_name_search_result[1][value] = index + return static_table_mapping + + +HeaderTable.STATIC_TABLE_MAPPING = _build_static_table_mapping()
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/exceptions.py b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/exceptions.py deleted file mode 100644 index dd30369..0000000 --- a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/exceptions.py +++ /dev/null
@@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -""" -hyperframe/exceptions -~~~~~~~~~~~~~~~~~~~~~ - -Defines the exceptions that can be thrown by hyperframe. -""" - - -class UnknownFrameError(ValueError): - """ - An frame of unknown type was received. - """ - def __init__(self, frame_type, length): - #: The type byte of the unknown frame that was received. - self.frame_type = frame_type - - #: The length of the data portion of the unknown frame. - self.length = length - - def __str__(self): - return ( - "UnknownFrameError: Unknown frame type 0x%X received, " - "length %d bytes" % (self.frame_type, self.length) - ) - - -class InvalidPaddingError(ValueError): - """ - A frame with invalid padding was received. - """ - pass - - -class InvalidFrameError(ValueError): - """ - Parsing a frame failed because the data was not laid out appropriately. - - .. versionadded:: 3.0.2 - """ - pass
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/flags.py b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/flags.py deleted file mode 100644 index 1660bd1..0000000 --- a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/flags.py +++ /dev/null
@@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -""" -hyperframe/flags -~~~~~~~~~~~~~~~~ - -Defines basic Flag and Flags data structures. -""" -import collections - -try: - from collections.abc import MutableSet -except ImportError: # pragma: no cover - # Python 2.7 compatibility - from collections import MutableSet - -Flag = collections.namedtuple("Flag", ["name", "bit"]) - - -class Flags(MutableSet): - """ - A simple MutableSet implementation that will only accept known flags as - elements. - - Will behave like a regular set(), except that a ValueError will be thrown - when .add()ing unexpected flags. - """ - def __init__(self, defined_flags): - self._valid_flags = set(flag.name for flag in defined_flags) - self._flags = set() - - def __contains__(self, x): - return self._flags.__contains__(x) - - def __iter__(self): - return self._flags.__iter__() - - def __len__(self): - return self._flags.__len__() - - def discard(self, value): - return self._flags.discard(value) - - def add(self, value): - if value not in self._valid_flags: - raise ValueError( - "Unexpected flag: {}. Valid flags are: {}".format( - value, self._valid_flags - ) - ) - return self._flags.add(value)
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/__init__.py b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/__init__.py similarity index 83% rename from third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/__init__.py rename to third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/__init__.py index 7620b4b..bf5ba1c 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/__init__.py +++ b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/__init__.py
@@ -5,4 +5,4 @@ A module for providing a pure-Python HTTP/2 framing layer. """ -__version__ = '5.2.0' +__version__ = '6.0.1'
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/exceptions.py b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/exceptions.py new file mode 100644 index 0000000..d6adab2 --- /dev/null +++ b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/exceptions.py
@@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +""" +hyperframe/exceptions +~~~~~~~~~~~~~~~~~~~~~ + +Defines the exceptions that can be thrown by hyperframe. +""" + + +class HyperframeError(Exception): + """ + The base class for all exceptions for the hyperframe module. + + .. versionadded:: 6.0.0 + """ + + +class UnknownFrameError(HyperframeError): + """ + A frame of unknown type was received. + + .. versionchanged:: 6.0.0 + Changed base class from `ValueError` to :class:`HyperframeError` + """ + def __init__(self, frame_type: int, length: int) -> None: + #: The type byte of the unknown frame that was received. + self.frame_type = frame_type + + #: The length of the data portion of the unknown frame. + self.length = length + + def __str__(self) -> str: + return ( + "UnknownFrameError: Unknown frame type 0x%X received, " + "length %d bytes" % (self.frame_type, self.length) + ) + + +class InvalidPaddingError(HyperframeError): + """ + A frame with invalid padding was received. + + .. versionchanged:: 6.0.0 + Changed base class from `ValueError` to :class:`HyperframeError` + """ + pass + + +class InvalidFrameError(HyperframeError): + """ + Parsing a frame failed because the data was not laid out appropriately. + + .. versionadded:: 3.0.2 + + .. versionchanged:: 6.0.0 + Changed base class from `ValueError` to :class:`HyperframeError` + """ + pass + + +class InvalidDataError(HyperframeError): + """ + Content or data of a frame was is invalid or violates the specification. + + .. versionadded:: 6.0.0 + """ + pass
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/flags.py b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/flags.py new file mode 100644 index 0000000..f00cb99 --- /dev/null +++ b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/flags.py
@@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +hyperframe/flags +~~~~~~~~~~~~~~~~ + +Defines basic Flag and Flags data structures. +""" +from collections.abc import MutableSet +from typing import NamedTuple, Iterable, Set, Iterator + + +class Flag(NamedTuple): + name: str + bit: int + + +class Flags(MutableSet): # type: ignore + """ + A simple MutableSet implementation that will only accept known flags as + elements. + + Will behave like a regular set(), except that a ValueError will be thrown + when .add()ing unexpected flags. + """ + def __init__(self, defined_flags: Iterable[Flag]): + self._valid_flags = set(flag.name for flag in defined_flags) + self._flags: Set[str] = set() + + def __repr__(self) -> str: + return repr(sorted(list(self._flags))) + + def __contains__(self, x: object) -> bool: + return self._flags.__contains__(x) + + def __iter__(self) -> Iterator[str]: + return self._flags.__iter__() + + def __len__(self) -> int: + return self._flags.__len__() + + def discard(self, value: str) -> None: + return self._flags.discard(value) + + def add(self, value: str) -> None: + if value not in self._valid_flags: + raise ValueError( + "Unexpected flag: {}. Valid flags are: {}".format( + value, self._valid_flags + ) + ) + return self._flags.add(value)
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/frame.py b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/frame.py similarity index 68% rename from third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/frame.py rename to third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/frame.py index 7950572..f4e75e3 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/hyperframe/frame.py +++ b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/frame.py
@@ -11,9 +11,10 @@ import binascii from .exceptions import ( - UnknownFrameError, InvalidPaddingError, InvalidFrameError + UnknownFrameError, InvalidPaddingError, InvalidFrameError, InvalidDataError ) from .flags import Flag, Flags +from typing import Optional, Tuple, List, Iterable, Any, Dict, Type # The maximum initial length of a frame. Some frames have shorter maximum @@ -38,21 +39,21 @@ _STRUCT_B = struct.Struct(">B") -class Frame(object): +class Frame: """ The base class for all HTTP/2 frames. """ #: The flags defined on this type of frame. - defined_flags = [] + defined_flags: List[Flag] = [] #: The byte used to define the type of the frame. - type = None + type: Optional[int] = None # If 'has-stream', the frame's stream_id must be non-zero. If 'no-stream', # it must be zero. If 'either', it's not checked. - stream_association = None + stream_association: Optional[str] = None - def __init__(self, stream_id, flags=()): + def __init__(self, stream_id: int, flags: Iterable[str] = ()) -> None: #: The stream identifier for the stream this frame was received on. #: Set to 0 for frames sent on the connection (stream-id 0). self.stream_id = stream_id @@ -68,33 +69,63 @@ if (not self.stream_id and self.stream_association == _STREAM_ASSOC_HAS_STREAM): - raise ValueError('Stream ID must be non-zero') + raise InvalidDataError( + 'Stream ID must be non-zero for {}'.format( + type(self).__name__, + ) + ) if (self.stream_id and self.stream_association == _STREAM_ASSOC_NO_STREAM): - raise ValueError('Stream ID must be zero') + raise InvalidDataError( + 'Stream ID must be zero for {} with stream_id={}'.format( + type(self).__name__, + self.stream_id, + ) + ) - def __repr__(self): - flags = ", ".join(self.flags) or "None" - body = binascii.hexlify(self.serialize_body()).decode('ascii') - if len(body) > 20: - body = body[:20] + "..." + def __repr__(self) -> str: return ( - "{type}(Stream: {stream}; Flags: {flags}): {body}" + "{}(stream_id={}, flags={}): {}" ).format( - type=type(self).__name__, - stream=self.stream_id, - flags=flags, - body=body + type(self).__name__, + self.stream_id, + repr(self.flags), + self._body_repr(), ) + def _body_repr(self) -> str: + # More specific implementation may be provided by subclasses of Frame. + # This fallback shows the serialized (and truncated) body content. + return _raw_data_repr(self.serialize_body()) + @staticmethod - def parse_frame_header(header, strict=False): + def explain(data: memoryview) -> Tuple["Frame", int]: + """ + Takes a bytestring and tries to parse a single frame and print it. + + This function is only provided for debugging purposes. + + :param data: A memoryview object containing the raw data of at least + one complete frame (header and body). + + .. versionadded:: 6.0.0 + """ + frame, length = Frame.parse_frame_header(data[:9]) + frame.parse_body(data[9:9 + length]) + print(frame) + return frame, length + + @staticmethod + def parse_frame_header(header: memoryview, strict: bool = False) -> Tuple["Frame", int]: """ Takes a 9-byte frame header and returns a tuple of the appropriate Frame object and the length that needs to be read from the socket. This populates the flags field, and determines how long the body is. + :param header: A memoryview object containing the 9-byte frame header + data of a frame. Must not contain more or less. + :param strict: Whether to raise an exception when encountering a frame not defined by spec and implemented by hyperframe. @@ -125,14 +156,14 @@ frame.parse_flags(flags) return (frame, length) - def parse_flags(self, flag_byte): + def parse_flags(self, flag_byte: int) -> Flags: for flag, flag_bit in self.defined_flags: if flag_byte & flag_bit: self.flags.add(flag) return self.flags - def serialize(self): + def serialize(self) -> bytes: """ Convert a frame into a bytestring, representing the serialized form of the frame. @@ -158,10 +189,10 @@ return header + body - def serialize_body(self): + def serialize_body(self) -> bytes: raise NotImplementedError() - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: """ Given the body of a frame, parses it into frame data. This populates the non-header parts of the frame: that is, it does not populate the @@ -175,24 +206,24 @@ raise NotImplementedError() -class Padding(object): +class Padding: """ Mixin for frames that contain padding. Defines extra fields that can be used and set by frames that can be padded. """ - def __init__(self, stream_id, pad_length=0, **kwargs): - super(Padding, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int, pad_length: int = 0, **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) # type: ignore #: The length of the padding to use. self.pad_length = pad_length - def serialize_padding_data(self): - if 'PADDED' in self.flags: + def serialize_padding_data(self) -> bytes: + if 'PADDED' in self.flags: # type: ignore return _STRUCT_B.pack(self.pad_length) return b'' - def parse_padding_data(self, data): - if 'PADDED' in self.flags: + def parse_padding_data(self, data: memoryview) -> int: + if 'PADDED' in self.flags: # type: ignore try: self.pad_length = struct.unpack('!B', data[:1])[0] except struct.error: @@ -200,23 +231,30 @@ return 1 return 0 + #: .. deprecated:: 5.2.1 + #: Use self.pad_length instead. @property - def total_padding(self): + def total_padding(self) -> int: # pragma: no cover + import warnings + warnings.warn( + "total_padding contains the same information as pad_length.", + DeprecationWarning + ) return self.pad_length -class Priority(object): +class Priority: """ Mixin for frames that contain priority data. Defines extra fields that can be used and set by frames that contain priority data. """ def __init__(self, - stream_id, - depends_on=0x0, - stream_weight=0x0, - exclusive=False, - **kwargs): - super(Priority, self).__init__(stream_id, **kwargs) + stream_id: int, + depends_on: int = 0x0, + stream_weight: int = 0x0, + exclusive: bool = False, + **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) # type: ignore #: The stream ID of the stream on which this stream depends. self.depends_on = depends_on @@ -227,13 +265,13 @@ #: Whether the exclusive bit was set. self.exclusive = exclusive - def serialize_priority_data(self): + def serialize_priority_data(self) -> bytes: return _STRUCT_LB.pack( self.depends_on + (0x80000000 if self.exclusive else 0), self.stream_weight ) - def parse_priority_data(self, data): + def parse_priority_data(self, data: memoryview) -> int: try: self.depends_on, self.stream_weight = _STRUCT_LB.unpack(data[:5]) except struct.error: @@ -261,31 +299,31 @@ stream_association = _STREAM_ASSOC_HAS_STREAM - def __init__(self, stream_id, data=b'', **kwargs): - super(DataFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int, data: bytes = b'', **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) #: The data contained on this frame. self.data = data - def serialize_body(self): + def serialize_body(self) -> bytes: padding_data = self.serialize_padding_data() - padding = b'\0' * self.total_padding + padding = b'\0' * self.pad_length if isinstance(self.data, memoryview): self.data = self.data.tobytes() return b''.join([padding_data, self.data, padding]) - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: padding_data_length = self.parse_padding_data(data) self.data = ( - data[padding_data_length:len(data)-self.total_padding].tobytes() + data[padding_data_length:len(data)-self.pad_length].tobytes() ) self.body_len = len(data) - if self.total_padding and self.total_padding >= self.body_len: + if self.pad_length and self.pad_length >= self.body_len: raise InvalidPaddingError("Padding is too long.") @property - def flow_controlled_length(self): + def flow_controlled_length(self) -> int: """ The length of the frame that needs to be accounted for when considering flow control. @@ -294,7 +332,7 @@ if 'PADDED' in self.flags: # Account for extra 1-byte padding length field, which is still # present if possibly zero-valued. - padding_len = self.total_padding + 1 + padding_len = self.pad_length + 1 return len(self.data) + padding_len @@ -305,19 +343,32 @@ reprioritisation of existing streams. """ #: The flags defined for PRIORITY frames. - defined_flags = [] + defined_flags: List[Flag] = [] #: The type byte defined for PRIORITY frames. type = 0x02 stream_association = _STREAM_ASSOC_HAS_STREAM - def serialize_body(self): + def _body_repr(self) -> str: + return "exclusive={}, depends_on={}, stream_weight={}".format( + self.exclusive, + self.depends_on, + self.stream_weight + ) + + def serialize_body(self) -> bytes: return self.serialize_priority_data() - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: + if len(data) > 5: + raise InvalidFrameError( + "PRIORITY must have 5 byte body: actual length %s." % + len(data) + ) + self.parse_priority_data(data) - self.body_len = len(data) + self.body_len = 5 class RstStreamFrame(Frame): @@ -330,23 +381,28 @@ occurred. """ #: The flags defined for RST_STREAM frames. - defined_flags = [] + defined_flags: List[Flag] = [] #: The type byte defined for RST_STREAM frames. type = 0x03 stream_association = _STREAM_ASSOC_HAS_STREAM - def __init__(self, stream_id, error_code=0, **kwargs): - super(RstStreamFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int, error_code: int = 0, **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) #: The error code used when resetting the stream. self.error_code = error_code - def serialize_body(self): + def _body_repr(self) -> str: + return "error_code={}".format( + self.error_code, + ) + + def serialize_body(self) -> bytes: return _STRUCT_L.pack(self.error_code) - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: if len(data) != 4: raise InvalidFrameError( "RST_STREAM must have 4 byte body: actual length %s." % @@ -398,20 +454,33 @@ #: The byte that signals SETTINGS_ENABLE_CONNECT_PROTOCOL setting. ENABLE_CONNECT_PROTOCOL = 0x08 - def __init__(self, stream_id=0, settings=None, **kwargs): - super(SettingsFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int = 0, settings: Optional[Dict[int, int]] = None, **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) if settings and "ACK" in kwargs.get("flags", ()): - raise ValueError("Settings must be empty if ACK flag is set.") + raise InvalidDataError( + "Settings must be empty if ACK flag is set." + ) #: A dictionary of the setting type byte to the value of the setting. self.settings = settings or {} - def serialize_body(self): + def _body_repr(self) -> str: + return "settings={}".format( + self.settings, + ) + + def serialize_body(self) -> bytes: return b''.join([_STRUCT_HL.pack(setting & 0xFF, value) for setting, value in self.settings.items()]) - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: + if 'ACK' in self.flags and len(data) > 0: + raise InvalidDataError( + "SETTINGS ack frame must not have payload: got %s bytes" % + len(data) + ) + body_len = 0 for i in range(0, len(data), 6): try: @@ -441,8 +510,8 @@ stream_association = _STREAM_ASSOC_HAS_STREAM - def __init__(self, stream_id, promised_stream_id=0, data=b'', **kwargs): - super(PushPromiseFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int, promised_stream_id: int = 0, data: bytes = b'', **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) #: The stream ID that is promised by this frame. self.promised_stream_id = promised_stream_id @@ -451,13 +520,19 @@ #: stream. self.data = data - def serialize_body(self): + def _body_repr(self) -> str: + return "promised_stream_id={}, data={}".format( + self.promised_stream_id, + _raw_data_repr(self.data), + ) + + def serialize_body(self) -> bytes: padding_data = self.serialize_padding_data() - padding = b'\0' * self.total_padding + padding = b'\0' * self.pad_length data = _STRUCT_L.pack(self.promised_stream_id) return b''.join([padding_data, data, self.data, padding]) - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: padding_data_length = self.parse_padding_data(data) try: @@ -467,10 +542,18 @@ except struct.error: raise InvalidFrameError("Invalid PUSH_PROMISE body") - self.data = data[padding_data_length + 4:].tobytes() + self.data = ( + data[padding_data_length + 4:len(data)-self.pad_length].tobytes() + ) self.body_len = len(data) - if self.total_padding and self.total_padding >= self.body_len: + if self.promised_stream_id == 0 or self.promised_stream_id % 2 != 0: + raise InvalidDataError( + "Invalid PUSH_PROMISE promised stream id: %s" % + self.promised_stream_id + ) + + if self.pad_length and self.pad_length >= self.body_len: raise InvalidPaddingError("Padding is too long.") @@ -488,16 +571,21 @@ stream_association = _STREAM_ASSOC_NO_STREAM - def __init__(self, stream_id=0, opaque_data=b'', **kwargs): - super(PingFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int = 0, opaque_data: bytes = b'', **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) #: The opaque data sent in this PING frame, as a bytestring. self.opaque_data = opaque_data - def serialize_body(self): + def _body_repr(self) -> str: + return "opaque_data={!r}".format( + self.opaque_data, + ) + + def serialize_body(self) -> bytes: if len(self.opaque_data) > 8: raise InvalidFrameError( - "PING frame may not have more than 8 bytes of data, got %s" % + "PING frame may not have more than 8 bytes of data, got %r" % self.opaque_data ) @@ -505,7 +593,7 @@ data += b'\x00' * (8 - len(self.opaque_data)) return data - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: if len(data) != 8: raise InvalidFrameError( "PING frame must have 8 byte length: got %s" % len(data) @@ -523,7 +611,7 @@ connection. """ #: The flags defined for GOAWAY frames. - defined_flags = [] + defined_flags: List[Flag] = [] #: The type byte defined for GOAWAY frames. type = 0x07 @@ -531,12 +619,12 @@ stream_association = _STREAM_ASSOC_NO_STREAM def __init__(self, - stream_id=0, - last_stream_id=0, - error_code=0, - additional_data=b'', - **kwargs): - super(GoAwayFrame, self).__init__(stream_id, **kwargs) + stream_id: int = 0, + last_stream_id: int = 0, + error_code: int = 0, + additional_data: bytes = b'', + **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) #: The last stream ID definitely seen by the remote peer. self.last_stream_id = last_stream_id @@ -547,7 +635,14 @@ #: Any additional data sent in the GOAWAY. self.additional_data = additional_data - def serialize_body(self): + def _body_repr(self) -> str: + return "last_stream_id={}, error_code={}, additional_data={!r}".format( + self.last_stream_id, + self.error_code, + self.additional_data, + ) + + def serialize_body(self) -> bytes: data = _STRUCT_LL.pack( self.last_stream_id & 0x7FFFFFFF, self.error_code @@ -556,7 +651,7 @@ return data - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: try: self.last_stream_id, self.error_code = _STRUCT_LL.unpack( data[:8] @@ -584,28 +679,44 @@ original sender. """ #: The flags defined for WINDOW_UPDATE frames. - defined_flags = [] + defined_flags: List[Flag] = [] #: The type byte defined for WINDOW_UPDATE frames. type = 0x08 stream_association = _STREAM_ASSOC_EITHER - def __init__(self, stream_id, window_increment=0, **kwargs): - super(WindowUpdateFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int, window_increment: int = 0, **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) #: The amount the flow control window is to be incremented. self.window_increment = window_increment - def serialize_body(self): + def _body_repr(self) -> str: + return "window_increment={}".format( + self.window_increment, + ) + + def serialize_body(self) -> bytes: return _STRUCT_L.pack(self.window_increment & 0x7FFFFFFF) - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: + if len(data) > 4: + raise InvalidFrameError( + "WINDOW_UPDATE frame must have 4 byte length: got %s" % + len(data) + ) + try: self.window_increment = _STRUCT_L.unpack(data)[0] except struct.error: raise InvalidFrameError("Invalid WINDOW_UPDATE body") + if not 1 <= self.window_increment <= 2**31-1: + raise InvalidDataError( + "WINDOW_UPDATE increment must be between 1 to 2^31-1" + ) + self.body_len = 4 @@ -634,15 +745,23 @@ stream_association = _STREAM_ASSOC_HAS_STREAM - def __init__(self, stream_id, data=b'', **kwargs): - super(HeadersFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int, data: bytes = b'', **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) #: The HPACK-encoded header block. self.data = data - def serialize_body(self): + def _body_repr(self) -> str: + return "exclusive={}, depends_on={}, stream_weight={}, data={}".format( + self.exclusive, + self.depends_on, + self.stream_weight, + _raw_data_repr(self.data), + ) + + def serialize_body(self) -> bytes: padding_data = self.serialize_padding_data() - padding = b'\0' * self.total_padding + padding = b'\0' * self.pad_length if 'PRIORITY' in self.flags: priority_data = self.serialize_priority_data() @@ -651,7 +770,7 @@ return b''.join([padding_data, priority_data, self.data, padding]) - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: padding_data_length = self.parse_padding_data(data) data = data[padding_data_length:] @@ -662,10 +781,10 @@ self.body_len = len(data) self.data = ( - data[priority_data_length:len(data)-self.total_padding].tobytes() + data[priority_data_length:len(data)-self.pad_length].tobytes() ) - if self.total_padding and self.total_padding >= self.body_len: + if self.pad_length and self.pad_length >= self.body_len: raise InvalidPaddingError("Padding is too long.") @@ -687,16 +806,21 @@ stream_association = _STREAM_ASSOC_HAS_STREAM - def __init__(self, stream_id, data=b'', **kwargs): - super(ContinuationFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int, data: bytes = b'', **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) #: The HPACK-encoded header block. self.data = data - def serialize_body(self): + def _body_repr(self) -> str: + return "data={}".format( + _raw_data_repr(self.data), + ) + + def serialize_body(self) -> bytes: return self.data - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: self.data = data.tobytes() self.body_len = len(data) @@ -720,21 +844,27 @@ stream_association = _STREAM_ASSOC_EITHER - def __init__(self, stream_id, origin=b'', field=b'', **kwargs): - super(AltSvcFrame, self).__init__(stream_id, **kwargs) + def __init__(self, stream_id: int, origin: bytes = b'', field: bytes = b'', **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) if not isinstance(origin, bytes): - raise ValueError("AltSvc origin must be bytestring.") + raise InvalidDataError("AltSvc origin must be bytestring.") if not isinstance(field, bytes): - raise ValueError("AltSvc field must be a bytestring.") + raise InvalidDataError("AltSvc field must be a bytestring.") self.origin = origin self.field = field - def serialize_body(self): + def _body_repr(self) -> str: + return "origin={!r}, field={!r}".format( + self.origin, + self.field, + ) + + def serialize_body(self) -> bytes: origin_len = _STRUCT_H.pack(len(self.origin)) return b''.join([origin_len, self.origin, self.field]) - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: try: origin_len = _STRUCT_H.unpack(data[0:2])[0] self.origin = data[2:2+origin_len].tobytes() @@ -767,22 +897,30 @@ stream_association = _STREAM_ASSOC_EITHER - def __init__(self, type, stream_id, **kwargs): - super(ExtensionFrame, self).__init__(stream_id, **kwargs) + def __init__(self, type: int, stream_id: int, flag_byte: int = 0x0, body: bytes = b'', **kwargs: Any) -> None: + super().__init__(stream_id, **kwargs) self.type = type - self.flag_byte = None + self.flag_byte = flag_byte + self.body = body - def parse_flags(self, flag_byte): + def _body_repr(self) -> str: + return "type={}, flag_byte={}, body={}".format( + self.type, + self.flag_byte, + _raw_data_repr(self.body), + ) + + def parse_flags(self, flag_byte: int) -> None: # type: ignore """ For extension frames, we parse the flags by just storing a flag byte. """ self.flag_byte = flag_byte - def parse_body(self, data): + def parse_body(self, data: memoryview) -> None: self.body = data.tobytes() self.body_len = len(data) - def serialize(self): + def serialize(self) -> bytes: """ A broad override of the serialize method that ensures that the data comes back out exactly as it came in. This should not be used in most @@ -804,7 +942,16 @@ return header + self.body -_FRAME_CLASSES = [ +def _raw_data_repr(data: Optional[bytes]) -> str: + if not data: + return "None" + r = binascii.hexlify(data).decode('ascii') + if len(r) > 20: + r = r[:20] + "..." + return "<hex:" + r + ">" + + +_FRAME_CLASSES: List[Type[Frame]] = [ DataFrame, HeadersFrame, PriorityFrame,
diff --git a/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/py.typed b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/py.typed new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/wpt_tools/wpt/tools/third_party/hyperframe/src/hyperframe/py.typed
diff --git a/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/dispatch.py b/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/dispatch.py index 4ee943a5..56cbb3c 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/dispatch.py +++ b/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/dispatch.py
@@ -30,6 +30,7 @@ """ from __future__ import absolute_import +import io import logging import os import re @@ -179,7 +180,8 @@ def __init__(self, root_dir, scan_dir=None, - allow_handlers_outside_root_dir=True): + allow_handlers_outside_root_dir=True, + handler_encoding=None): """Construct an instance. Args: @@ -206,7 +208,8 @@ raise DispatchException('scan_dir:%s must be a directory under ' 'root_dir:%s.' % (scan_dir, root_dir)) self._source_handler_files_in_dir(root_dir, scan_dir, - allow_handlers_outside_root_dir) + allow_handlers_outside_root_dir, + handler_encoding) def add_resource_path_alias(self, alias_resource_path, existing_resource_path): @@ -346,7 +349,8 @@ return handler_suite def _source_handler_files_in_dir(self, root_dir, scan_dir, - allow_handlers_outside_root_dir): + allow_handlers_outside_root_dir, + handler_encoding): """Source all the handler source files in the scan_dir directory. The resource path is determined relative to root_dir. @@ -369,7 +373,7 @@ 'Canonical path of %s is not under root directory' % path) continue try: - with open(path) as handler_file: + with io.open(path, encoding=handler_encoding) as handler_file: handler_suite = _source_handler_file(handler_file.read()) except DispatchException as e: self._source_warnings.append('%s: %s' % (path, e))
diff --git a/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/standalone.py b/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/standalone.py index 0a3bcdb..bd321587 100755 --- a/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/standalone.py +++ b/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/standalone.py
@@ -361,6 +361,16 @@ type=int, default=_DEFAULT_REQUEST_QUEUE_SIZE, help='request queue size') + parser.add_argument( + '--handler-encoding', + '--handler_encoding', + dest='handler_encoding', + type=six.text_type, + default=None, + help=('Text encoding used for loading handlers. ' + 'By default, the encoding from the locale is used when ' + 'reading handler files, but this option can override it. ' + 'Any encoding supported by the codecs module may be used.')) return parser
diff --git a/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/websocket_server.py b/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/websocket_server.py index fa24bb9..9f67c9f 100644 --- a/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/websocket_server.py +++ b/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/mod_pywebsocket/websocket_server.py
@@ -85,11 +85,15 @@ if necessary. """ + # Fall back to None for embedders that don't know about the + # handler_encoding option. + handler_encoding = getattr(options, "handler_encoding", None) + # Share a Dispatcher among request handlers to save time for # instantiation. Dispatcher can be shared because it is thread-safe. options.dispatcher = dispatch.Dispatcher( options.websock_handlers, options.scan_dir, - options.allow_handlers_outside_root_dir) + options.allow_handlers_outside_root_dir, handler_encoding) if options.websock_handlers_map_file: _alias_handlers(options.dispatcher, options.websock_handlers_map_file)
diff --git a/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/setup.py b/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/setup.py index b65904c9..12c60d861 100755 --- a/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/setup.py +++ b/third_party/wpt_tools/wpt/tools/third_party/pywebsocket3/setup.py
@@ -67,7 +67,7 @@ python_requires='>=2.7', install_requires=['six'], url='https://github.com/GoogleChromeLabs/pywebsocket3', - version='3.0.1', + version='3.0.2', ) # vi:sts=4 sw=4 et
diff --git a/third_party/wpt_tools/wpt/tools/webdriver/webdriver/bidi/modules/browsing_context.py b/third_party/wpt_tools/wpt/tools/webdriver/webdriver/bidi/modules/browsing_context.py index 7d3ccf2..2938be2e 100644 --- a/third_party/wpt_tools/wpt/tools/webdriver/webdriver/bidi/modules/browsing_context.py +++ b/third_party/wpt_tools/wpt/tools/webdriver/webdriver/bidi/modules/browsing_context.py
@@ -178,5 +178,18 @@ return result["data"] @command - def set_viewport(self, context: str, viewport: Optional[Mapping[str, Any]] = None) -> Mapping[str, Any]: - return {"context": context, "viewport": viewport} + def set_viewport(self, + context: str, + viewport: Optional[Mapping[str, Any]] = None, + device_pixel_ratio: Optional[float] = None) -> Mapping[str, Any]: + params: MutableMapping[str, Any] = { + "context": context, + } + + if viewport is not None: + params["viewport"] = viewport + + if device_pixel_ratio is not None: + params["devicePixelRatio"] = device_pixel_ratio + + return params
diff --git a/third_party/wpt_tools/wpt/tools/wpt/browser.py b/third_party/wpt_tools/wpt/tools/wpt/browser.py index dda054f..ba7413b 100644 --- a/third_party/wpt_tools/wpt/tools/wpt/browser.py +++ b/third_party/wpt_tools/wpt/tools/wpt/browser.py
@@ -1008,7 +1008,13 @@ # If no ChromeDriver download URL reference file exists, # try to find a download URL based on the build version. self.logger.info(f"Searching for ChromeDriver downloads for version {version}.") - return self._get_webdriver_url_by_build(formatted_version) + download_url = self._get_webdriver_url_by_build(formatted_version) + if download_url is None: + milestone = version.split('.')[0] + self.logger.info(f'No ChromeDriver download found for build {formatted_version}. ' + f'Finding latest available download for milestone {milestone}') + download_url = self._get_webdriver_url_by_milestone(milestone) + return download_url def _get_old_webdriver_url(self, version): """Find a ChromeDriver download URL for Chrome version <= 114 @@ -1061,6 +1067,33 @@ return None return downloads_for_platform[0]["url"] + def _get_webdriver_url_by_milestone(self, milestone): + """Find a ChromeDriver download URL that is the latest available + for a Chrome milestone. + + Raises: RequestException if a bad responses is received from + Chrome for Testing sources. + + Returns: Download URL string or None if no matching milestone is found. + """ + + try: + # Get a list of builds with download URLs from Chrome for Testing. + resp = get(f"{CHROME_FOR_TESTING_ROOT_URL}" + "latest-versions-per-milestone.json") + except requests.RequestException as e: + raise requests.RequestException( + "Chrome for Testing versions not found", e) + milestones_json = resp.json() + milestones_dict = milestones_json["milestones"] + if milestone not in milestones_dict: + self.logger.info(f"No latest version found for milestone {milestone}.") + return None + version_available = self._get_build_version( + milestones_dict[milestone]["version"]) + + return self._get_webdriver_url_by_build(version_available) + def _get_download_urls_by_version(self, version): """Find Chrome for Testing and ChromeDriver download URLs matching a specific version. @@ -1305,9 +1338,16 @@ # Chrome and ChromeDriver versions should match on the same MAJOR.MINOR.BUILD version. if browser_version is not None and browser_version != chromedriver_version: - self.logger.warning( - f"ChromeDriver {chromedriver_version} does not match Chrome {browser_version}") - return False + # Consider the same milestone as matching. + # Workaround for https://github.com/web-platform-tests/wpt/issues/42545 + # TODO(DanielRyanSmith): Remove this logic when browser binary is + # downloaded from Chrome for Testing in CI runs. + browser_milestone = browser_version.split('.')[0] + chromedriver_milestone = chromedriver_version.split('.')[0] + if browser_milestone != chromedriver_milestone: + self.logger.warning( + f"ChromeDriver {chromedriver_version} does not match Chrome {browser_version}") + return False return True def version(self, binary=None, webdriver_binary=None): @@ -1315,7 +1355,6 @@ if not binary: self.logger.warning("No browser binary provided.") return None - if uname[0] == "Windows": return _get_fileversion(binary, self.logger)
diff --git a/third_party/wpt_tools/wpt/tools/wpt/utils.py b/third_party/wpt_tools/wpt/tools/wpt/utils.py index b015b95e..5899dc3f 100644 --- a/third_party/wpt_tools/wpt/tools/wpt/utils.py +++ b/third_party/wpt_tools/wpt/tools/wpt/utils.py
@@ -3,10 +3,10 @@ import errno import logging import os -import sys import shutil import stat import subprocess +import sys import tarfile import time import zipfile @@ -166,3 +166,16 @@ for chunk in iter(lambda: f.read(4096), b''): hash.update(chunk) return hash.hexdigest() + + +# see https://docs.python.org/3/whatsnew/3.12.html#imp +def load_source(modname, filename): + import importlib.machinery + import importlib.util + + loader = importlib.machinery.SourceFileLoader(modname, filename) + spec = importlib.util.spec_from_file_location(modname, filename, loader=loader) + module = importlib.util.module_from_spec(spec) + sys.modules[module.__name__] = module + loader.exec_module(module) + return module
diff --git a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/browsers/content_shell.py b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/browsers/content_shell.py index 14956ee..23f4e99 100644 --- a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/browsers/content_shell.py +++ b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/browsers/content_shell.py
@@ -5,6 +5,7 @@ import subprocess from multiprocessing import Queue, Event from threading import Thread +from urllib.parse import urljoin from . import chrome_spki_certs from .base import ( @@ -16,6 +17,7 @@ from .base import get_timeout_multiplier # noqa: F401 from .chrome import debug_args from ..executors import executor_kwargs as base_executor_kwargs +from ..executors.base import server_url from ..executors.executorcontentshell import ( # noqa: F401 ContentShellCrashtestExecutor, ContentShellPrintRefTestExecutor, @@ -82,7 +84,8 @@ return {"binary": kwargs["binary"], "binary_args": args, - "debug_info": kwargs["debug_info"]} + "debug_info": kwargs["debug_info"], + "pac_origin": server_url(config, "http")} def executor_kwargs(logger, test_type, test_environment, run_info_data, @@ -127,21 +130,27 @@ termination_timeout: float = 3 def __init__(self, logger, binary="content_shell", binary_args=None, - debug_info=None, **kwargs): + debug_info=None, pac_origin=None, **kwargs): super().__init__(logger) - debug_cmd_prefix, browser_cmd = browser_command(binary, binary_args or [], debug_info) - self._args = [*debug_cmd_prefix, *browser_cmd] + self._debug_cmd_prefix, self._browser_cmd = browser_command( + binary, binary_args or [], debug_info) self._output_handler = None self._proc = None + self._pac_origin = pac_origin + self._pac = None - def start(self, group_metadata, **kwargs): - self.logger.debug("Starting content shell: %s..." % self._args[0]) - self._output_handler = OutputHandler(self.logger, self._args) + def start(self, group_metadata, **settings): + browser_cmd, pac = list(self._browser_cmd), settings.get("pac") + if pac: + browser_cmd.insert(1, f"--proxy-pac-url={pac}") + self.logger.debug(f"Starting content shell: {browser_cmd[0]}...") + args = [*self._debug_cmd_prefix, *browser_cmd] + self._output_handler = OutputHandler(self.logger, args) if os.name == "posix": close_fds, preexec_fn = True, lambda: os.setpgid(0, 0) else: close_fds, preexec_fn = False, None - self._proc = subprocess.Popen(self._args, + self._proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, @@ -169,7 +178,7 @@ # Content shell is likely still in the process of initializing. The actual waiting # for the startup to finish is done in the ContentShellProtocol. self.logger.debug("Content shell has been started.") - self._output_handler.start(group_metadata=group_metadata, **kwargs) + self._output_handler.start(group_metadata=group_metadata, **settings) def stop(self, force=False): self.logger.debug("Stopping content shell...") @@ -239,6 +248,13 @@ def check_crash(self, process, test): return not self.is_alive() + def settings(self, test): + pac_path = test.environment.get("pac") + if self._pac_origin and pac_path: + self._pac = urljoin(self._pac_origin, pac_path) + return {"pac": self._pac} + return {} + def _create_reader_thread(self, name, stream, queue, prefix=b""): """This creates (and starts) a background thread which reads lines from `stream` and puts them into `queue` until `stream` reports EOF.
diff --git a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/base.py b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/base.py index 1e66e60..e89b57b57 100644 --- a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/base.py +++ b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/base.py
@@ -64,6 +64,16 @@ return urlunsplit(url_parts) +def server_url(server_config, protocol, subdomain=False): + scheme = "https" if protocol == "h2" else protocol + host = server_config["browser_host"] + if subdomain: + # The only supported subdomain filename flag is "www". + host = "{subdomain}.{host}".format(subdomain="www", host=host) + return "{scheme}://{host}:{port}".format(scheme=scheme, host=host, + port=server_config["ports"][protocol][0]) + + class TestharnessResultConverter: harness_codes = {0: "OK", 1: "ERROR", @@ -317,13 +327,7 @@ self.runner.send_message("test_ended", test, result) def server_url(self, protocol, subdomain=False): - scheme = "https" if protocol == "h2" else protocol - host = self.server_config["browser_host"] - if subdomain: - # The only supported subdomain filename flag is "www". - host = "{subdomain}.{host}".format(subdomain="www", host=host) - return "{scheme}://{host}:{port}".format(scheme=scheme, host=host, - port=self.server_config["ports"][protocol][0]) + return server_url(self.server_config, protocol, subdomain) def test_url(self, test): return urljoin(self.server_url(test.environment["protocol"],
diff --git a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executormarionette.py b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executormarionette.py index 05567a0..1f183f1 100644 --- a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executormarionette.py +++ b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executormarionette.py
@@ -130,8 +130,12 @@ while True: try: - return self.marionette.execute_async_script("""let callback = arguments[arguments.length - 1]; + rv = self.marionette.execute_async_script("""let callback = arguments[arguments.length - 1]; addEventListener("__test_restart", e => {e.preventDefault(); callback(true)})""") + # None can be returned if we try to run the script again before we've completed a navigation. + # In that case, keep retrying + if rv is not None: + return rv except errors.NoSuchWindowException: # The window closed break
diff --git a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/stability.py b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/stability.py index 9ac6249c..029b237 100644 --- a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/stability.py +++ b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/stability.py
@@ -2,7 +2,6 @@ import copy import functools -import imp import io import os from collections import OrderedDict, defaultdict @@ -10,16 +9,17 @@ from mozlog import reader from mozlog.formatters import JSONFormatter -from mozlog.handlers import BaseHandler, StreamHandler, LogLevelFilter +from mozlog.handlers import BaseHandler, LogLevelFilter, StreamHandler + +from tools.wpt.utils import load_source from . import wptrunner here = os.path.dirname(__file__) -localpaths = imp.load_source("localpaths", os.path.abspath(os.path.join(here, os.pardir, os.pardir, "localpaths.py"))) +localpaths = load_source("localpaths", os.path.abspath(os.path.join(here, os.pardir, os.pardir, "localpaths.py"))) # type: ignore from ci.tc.github_checks_output import get_gh_checks_outputter # type: ignore from wpt.markdown import markdown_adjust, table # type: ignore - # If a test takes more than (FLAKY_THRESHOLD*timeout) and does not consistently # time out, it is considered slow (potentially flaky). FLAKY_THRESHOLD = 0.8
diff --git a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/wptrunner.py b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/wptrunner.py index a4ad268d..b9e51901 100644 --- a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/wptrunner.py +++ b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/wptrunner.py
@@ -159,20 +159,30 @@ def get_pause_after_test(test_loader, **kwargs): - if kwargs["pause_after_test"] is None: - if kwargs["repeat_until_unexpected"]: - return False - if kwargs["headless"]: - return False - if kwargs["debug_test"]: - return True - tests = test_loader.tests - is_single_testharness = (sum(len(item) for item in tests.values()) == 1 and - len(tests.get("testharness", [])) == 1) - if kwargs["repeat"] == 1 and kwargs["rerun"] == 1 and is_single_testharness: - return True + if kwargs["pause_after_test"] is not None: + return kwargs["pause_after_test"] + if kwargs["repeat_until_unexpected"]: return False - return kwargs["pause_after_test"] + if kwargs["headless"]: + return False + if kwargs["debug_test"]: + return True + tests = test_loader.tests + is_single_testharness = True + testharness_count = 0 + for tests_by_type in tests.values(): + for test_type, tests in tests_by_type.items(): + if test_type != "testharness" and len(tests): + is_single_testharness = False + break + elif test_type == "testharness": + testharness_count += len(tests) + if testharness_count > 1: + is_single_testharness = False + break + return kwargs["repeat"] == 1 and kwargs["rerun"] == 1 and is_single_testharness + + def log_suite_start(tests_by_group, base_run_info, subsuites, run_by_dir):
diff --git a/tools/fuchsia/3pp/OWNERS b/tools/fuchsia/3pp/OWNERS deleted file mode 100644 index 37c955a..0000000 --- a/tools/fuchsia/3pp/OWNERS +++ /dev/null
@@ -1 +0,0 @@ -file://build/fuchsia/test/OWNERS
diff --git a/tools/fuchsia/3pp/fetch.py b/tools/fuchsia/3pp/fetch.py deleted file mode 100755 index e21889f..0000000 --- a/tools/fuchsia/3pp/fetch.py +++ /dev/null
@@ -1,56 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2023 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import json -import os -import urllib.request - -_GIT_HOST = 'https://chromium.googlesource.com/chromium/src.git/' -_COMMIT_URL = _GIT_HOST + '+log/refs/heads/main/build/fuchsia?n=1&format=json' -_ARCHIVE_URL = _GIT_HOST + '+archive/{}/build/fuchsia.tar.gz' - - -def get_last_commit(): - """Returns the last commit of build/fuchsia. - The approach is not very ideal since we may want to ignore unrelated - changes like the linux_internal.sdk.sha1 file. - """ - content = urllib.request.urlopen(_COMMIT_URL).read().decode('utf-8') - # Remove the leading json safety prefix. - assert content.startswith(")]}'") - return json.loads(content[4:])['log'][0]['commit'] - - -def do_latest(): - print(get_last_commit()) - - -def get_download_url(sha): - """Returns the manifest for the following download procedure.""" - partial_manifest = { - 'url': [_ARCHIVE_URL.format(sha)], - 'ext': '.tar.gz', - } - print(json.dumps(partial_manifest)) - - -def main(): - ap = argparse.ArgumentParser() - sub = ap.add_subparsers() - - latest = sub.add_parser("latest") - latest.set_defaults(func=do_latest) - - download = sub.add_parser("get_url") - download.set_defaults(func=lambda: get_download_url( - os.environ.get('_3PP_VERSION', get_last_commit()))) - - opts = ap.parse_args() - opts.func() - - -if __name__ == '__main__': - main()
diff --git a/tools/fuchsia/3pp/fetch_archive.py b/tools/fuchsia/3pp/fetch_archive.py new file mode 100755 index 0000000..ce01ccc --- /dev/null +++ b/tools/fuchsia/3pp/fetch_archive.py
@@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import argparse +import json +import os +import urllib.request + + +def _get_last_commit(commit_url): + """Returns the last commit of build/fuchsia. + The approach is not very ideal since we may want to ignore unrelated + changes like the linux_internal.sdk.sha1 file. + """ + content = urllib.request.urlopen(commit_url).read().decode('utf-8') + # Remove the leading json safety prefix. + assert content.startswith(")]}'") + return json.loads(content[4:])['log'][0]['commit'] + + +def _do_latest(commit_url): + print(_get_last_commit(commit_url)) + + +def _get_download_url(sha, archive_url): + """Returns the manifest for the following download procedure.""" + partial_manifest = { + 'url': [archive_url.format(sha)], + 'ext': '.tar.gz', + } + print(json.dumps(partial_manifest)) + + +def main(commit_url, archive_url): + ap = argparse.ArgumentParser() + sub = ap.add_subparsers() + + latest = sub.add_parser("latest") + latest.set_defaults(func=lambda: _do_latest(commit_url)) + + download = sub.add_parser("get_url") + download.set_defaults(func=lambda: _get_download_url( + os.environ.get('_3PP_VERSION', _get_last_commit(commit_url)), + archive_url)) + + opts = ap.parse_args() + opts.func()
diff --git a/tools/fuchsia/3pp/3pp.pb b/tools/fuchsia/3pp/gn-sdk/3pp/3pp.pb similarity index 85% rename from tools/fuchsia/3pp/3pp.pb rename to tools/fuchsia/3pp/gn-sdk/3pp/3pp.pb index fd6e8eb..c3e774b 100644 --- a/tools/fuchsia/3pp/3pp.pb +++ b/tools/fuchsia/3pp/gn-sdk/3pp/3pp.pb
@@ -12,5 +12,5 @@ upload { universal: true - pkg_prefix: "chromium/fuchsia/test-scripts" + pkg_prefix: "chromium/fuchsia" }
diff --git a/tools/fuchsia/3pp/gn-sdk/3pp/fetch.py b/tools/fuchsia/3pp/gn-sdk/3pp/fetch.py new file mode 100755 index 0000000..01d5896 --- /dev/null +++ b/tools/fuchsia/3pp/gn-sdk/3pp/fetch.py
@@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys + +sys.path.append( + os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) + +from fetch_archive import main + +_GIT_HOST = 'https://chromium.googlesource.com/chromium/src.git/' + +if __name__ == '__main__': + main( + _GIT_HOST + + '+log/refs/heads/main/third_party/fuchsia-gn-sdk?n=1&format=json', + _GIT_HOST + '+archive/{}/third_party/fuchsia-gn-sdk.tar.gz')
diff --git a/tools/fuchsia/3pp/install.sh b/tools/fuchsia/3pp/gn-sdk/3pp/install.sh similarity index 79% rename from tools/fuchsia/3pp/install.sh rename to tools/fuchsia/3pp/gn-sdk/3pp/install.sh index 4a9a7d6..c070035 100755 --- a/tools/fuchsia/3pp/install.sh +++ b/tools/fuchsia/3pp/gn-sdk/3pp/install.sh
@@ -7,6 +7,11 @@ set -x set -o pipefail +if [[ -z "$1" ]]; then + echo "Expect a prefix as the first argument." + exit 1 +fi + PREFIX="$1" # Use "--parents" to reserve the relative paths, e.g.
diff --git a/tools/fuchsia/3pp/3pp.pb b/tools/fuchsia/3pp/test-scripts/3pp/3pp.pb similarity index 85% copy from tools/fuchsia/3pp/3pp.pb copy to tools/fuchsia/3pp/test-scripts/3pp/3pp.pb index fd6e8eb..c3e774b 100644 --- a/tools/fuchsia/3pp/3pp.pb +++ b/tools/fuchsia/3pp/test-scripts/3pp/3pp.pb
@@ -12,5 +12,5 @@ upload { universal: true - pkg_prefix: "chromium/fuchsia/test-scripts" + pkg_prefix: "chromium/fuchsia" }
diff --git a/tools/fuchsia/3pp/README.md b/tools/fuchsia/3pp/test-scripts/3pp/README.md similarity index 100% rename from tools/fuchsia/3pp/README.md rename to tools/fuchsia/3pp/test-scripts/3pp/README.md
diff --git a/tools/fuchsia/3pp/test-scripts/3pp/fetch.py b/tools/fuchsia/3pp/test-scripts/3pp/fetch.py new file mode 100755 index 0000000..cb29903 --- /dev/null +++ b/tools/fuchsia/3pp/test-scripts/3pp/fetch.py
@@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# Copyright 2023 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys + +sys.path.append( + os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) + +from fetch_archive import main + +_GIT_HOST = 'https://chromium.googlesource.com/chromium/src.git/' + +if __name__ == '__main__': + main(_GIT_HOST + '+log/refs/heads/main/build/fuchsia?n=1&format=json', + _GIT_HOST + '+archive/{}/build/fuchsia.tar.gz')
diff --git a/tools/fuchsia/3pp/install.sh b/tools/fuchsia/3pp/test-scripts/3pp/install.sh similarity index 79% copy from tools/fuchsia/3pp/install.sh copy to tools/fuchsia/3pp/test-scripts/3pp/install.sh index 4a9a7d6..c070035 100755 --- a/tools/fuchsia/3pp/install.sh +++ b/tools/fuchsia/3pp/test-scripts/3pp/install.sh
@@ -7,6 +7,11 @@ set -x set -o pipefail +if [[ -z "$1" ]]; then + echo "Expect a prefix as the first argument." + exit 1 +fi + PREFIX="$1" # Use "--parents" to reserve the relative paths, e.g.
diff --git a/tools/gritsettings/translation_expectations.pyl b/tools/gritsettings/translation_expectations.pyl index a16d80d..aff01063 100644 --- a/tools/gritsettings/translation_expectations.pyl +++ b/tools/gritsettings/translation_expectations.pyl
@@ -39,7 +39,7 @@ "chrome/browser/resources/accessibility/strings/extension_strings.grd", "chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings.grd", "chrome/browser/recent_tabs/internal/android/java/strings/android_restore_tabs_strings.grd", - "chrome/browser/touch_to_fill/password_manager/android/internal/java/strings/android_touch_to_fill_strings.grd", + "chrome/browser/touch_to_fill/android/internal/java/strings/android_touch_to_fill_strings.grd", "chrome/browser/ui/android/fast_checkout/internal/java/strings/android_fast_checkout_strings.grd", "chrome/browser/ui/android/strings/android_chrome_strings.grd", "chrome/credential_provider/gaiacp/gaia_resources.grd",
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 0c09a6dd..5eca22ce 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -256,56 +256,10 @@ }, 'chromium.clang': { - 'CFI Linux CF': 'cfi_full_cfi_icall_cfi_diag_recover_release_static_reclient', - 'CFI Linux ToT': 'clang_tot_cfi_full_cfi_icall_cfi_diag_thin_lto_release_static_dcheck_always_on', - 'CrWinAsan': 'asan_clang_fuzzer_static_v8_heap_minimal_symbols_release_tot', - 'CrWinAsan(dll)': 'asan_clang_shared_v8_heap_minimal_symbols_release_tot', - - 'ToTAndroid': 'android_clang_tot_release_minimal_symbols', - 'ToTAndroid (dbg)': 'android_clang_tot_dbg', - 'ToTAndroid x64': 'android_clang_tot_x64', - 'ToTAndroid x86': 'android_clang_tot_x86', - 'ToTAndroid64': 'android_clang_tot_release_arm64', - 'ToTAndroidASan': 'android_clang_tot_asan', - 'ToTAndroidCoverage x86': 'android_clang_tot_coverage_x86', - 'ToTAndroidOfficial': 'android_clang_tot_official_arm64', - 'ToTChromeOS': 'lacros_on_linux_tot_release', - 'ToTChromeOS (dbg)': 'lacros_on_linux_tot_debug', - 'ToTFuchsia x64': 'fuchsia_clang_tot_release_x64', - 'ToTFuchsiaOfficial arm64': 'fuchsia_clang_tot_official_arm64', - 'ToTLinux': 'clang_tot_linux_full_symbols_shared_release', - 'ToTLinux (dbg)': 'clang_tot_shared_debug', - 'ToTLinuxASan': 'clang_tot_asan_lsan_static_release', - 'ToTLinuxASanLibfuzzer': 'libfuzzer_asan_clang_tot_release', - 'ToTLinuxCoverage': 'clang_tot_coverage_minimal_symbols_release', - 'ToTLinuxMSan': 'clang_tot_msan_release', 'ToTLinuxOfficial': 'clang_tot_official', - 'ToTLinuxPGO': 'clang_tot_official_pgo', - 'ToTLinuxTSan': 'clang_tot_tsan_release', - 'ToTLinuxUBSanVptr': 'clang_tot_ubsan_vptr_no_recover_hack_static_release', - 'ToTMac': 'clang_tot_minimal_symbols_shared_release', - 'ToTMac (dbg)': 'clang_tot_shared_debug', - 'ToTMacASan': 'asan_disable_nacl_clang_tot_minimal_symbols_static_release', - 'ToTMacArm64': 'clang_tot_minimal_symbols_release_arm64', - 'ToTMacArm64PGO': 'clang_tot_official_pgo_arm64', - 'ToTMacCoverage': 'clang_tot_coverage_minimal_symbols_release', 'ToTMacOfficial': 'mac_clang_tot_official', - 'ToTMacPGO': 'clang_tot_official_pgo_x64', - 'ToTWin': 'clang_tot_minimal_symbols_static_release_x86', - 'ToTWin(dbg)': 'clang_tot_shared_debug_x86', - 'ToTWin(dll)': 'clang_tot_minimal_symbols_shared_release_x86_dcheck', - 'ToTWin64': 'clang_tot_minimal_symbols_static_release', - 'ToTWin64(dbg)': 'clang_tot_shared_debug', - 'ToTWin64(dll)': 'clang_tot_shared_release_dcheck', - 'ToTWin64PGO': 'clang_tot_official_pgo', - 'ToTWinASanLibfuzzer': 'libfuzzer_windows_asan_clang_tot_release_bot', - 'ToTWinArm64PGO': 'clang_tot_official_pgo_arm64', 'ToTWinOfficial': 'clang_tot_win_official_full_symbols_static_x86', 'ToTWinOfficial64': 'clang_tot_win_official_full_symbols_static', - 'ToTWindowsCoverage': 'clang_tot_coverage_minimal_symbols_release', - 'ToTiOS': 'ios_clang_tot_xctest', - 'ToTiOSDevice': 'ios_clang_device_tot_xctest', - 'linux-win_cross-rel': 'clang_tot_win_release_cross', }, 'chromium.coverage': { @@ -1107,7 +1061,7 @@ 'lacros-arm64-generic-rel-skylab-fyi': 'chromeos_arm64-generic_lacros_rel_skylab_reclient', 'linux-cfm-rel': 'linux_cfm_release_trybot_reclient', 'linux-chromeos-annotator-rel': 'chromeos_with_codecs_release_trybot_code_coverage_reclient', - 'linux-chromeos-compile-dbg': 'chromeos_with_codecs_debug_trybot_reclient', + 'linux-chromeos-compile-dbg': 'chromeos_with_codecs_debug_trybot_reclient_no_symbols', 'linux-chromeos-dbg': 'chromeos_with_codecs_debug_trybot_reclient', 'linux-chromeos-rel': 'chromeos_with_codecs_release_trybot_code_coverage_reclient', 'linux-lacros-dbg': 'lacros_on_linux_debug_bot_reclient_with_cups', @@ -1511,44 +1465,6 @@ 'android', 'clang', 'asan', 'release_trybot_reclient', 'strip_debug_info', 'minimal_symbols', ], - 'android_clang_tot_asan': [ - 'android_without_codecs', 'clang_tot', 'asan', 'shared', 'debug', 'minimal_symbols', - 'strip_debug_info', - ], - - 'android_clang_tot_coverage_x86': [ - 'android_without_codecs', 'clang_tot', 'shared', 'x86', 'release', - 'dcheck_always_on', 'use_clang_coverage', - ], - - 'android_clang_tot_dbg': [ - 'android_without_codecs', 'clang_tot', 'shared', 'debug', - ], - - 'android_clang_tot_official_arm64': [ - 'android', 'release', 'static', 'minimal_symbols', 'official_optimize', - 'clang_tot', 'arm64', - ], - - 'android_clang_tot_release_arm64': [ - 'android_without_codecs', 'clang_tot', 'release', 'arm64', - ], - - 'android_clang_tot_release_minimal_symbols': [ - 'android', 'release', 'static', 'minimal_symbols', - 'strip_debug_info', 'clang_tot', - ], - - 'android_clang_tot_x64': [ - 'android_without_codecs', 'clang_tot', 'shared', 'x64', 'release', - 'dcheck_always_on', - ], - - 'android_clang_tot_x86': [ - 'android_without_codecs', 'clang_tot', 'shared', 'x86', 'release', - 'dcheck_always_on', - ], - 'android_cronet_debug_static_bot_arm64_reclient': [ 'android', 'cronet_android', 'debug_static_bot_reclient', 'arm64', ], @@ -1911,22 +1827,10 @@ 'asan', 'fuzzer', 'static', 'v8_heap', 'minimal_symbols', 'release_bot_reclient', ], - 'asan_clang_fuzzer_static_v8_heap_minimal_symbols_release_tot': [ - 'asan', 'clang_tot', 'fuzzer', 'static', 'v8_heap', 'minimal_symbols', 'release', - ], - - 'asan_clang_shared_v8_heap_minimal_symbols_release_tot': [ - 'asan', 'clang_tot', 'shared', 'v8_heap', 'minimal_symbols', 'release', - ], - 'asan_dcheck_disable_nacl_release_bot_reclient': [ 'asan', 'dcheck_always_on', 'disable_nacl', 'release_bot_reclient', ], - 'asan_disable_nacl_clang_tot_minimal_symbols_static_release': [ - 'asan', 'disable_nacl', 'clang_tot', 'minimal_symbols', 'static', 'release', - ], - 'asan_disable_nacl_fuzzer_v8_heap_chrome_with_codecs_release_bot_reclient': [ 'asan', 'disable_nacl', 'fuzzer', 'v8_heap', 'chrome_with_codecs', 'release_bot_reclient', ], @@ -2019,10 +1923,6 @@ 'optimize_for_fuzzing', 'shared_release_bot_reclient', 'disable_seed_corpus', ], - 'cfi_full_cfi_icall_cfi_diag_recover_release_static_reclient': [ - 'cfi_full', 'cfi_icall', 'cfi_diag', 'cfi_recover', 'thin_lto', 'release', 'static', 'reclient', - ], - 'cfi_full_cfi_icall_cfi_diag_thin_lto_release_static_dcheck_always_on_reclient': [ 'cfi_full', 'cfi_icall', 'cfi_diag', 'thin_lto', 'release', 'static', 'dcheck_always_on', 'reclient', ], @@ -2358,6 +2258,10 @@ 'chromeos_with_codecs', 'debug_bot_reclient', 'use_cups', 'use_dummy_lastchange', ], + 'chromeos_with_codecs_debug_trybot_reclient_no_symbols': [ + 'chromeos_with_codecs', 'debug_bot_reclient', 'no_symbols', 'use_cups', 'use_dummy_lastchange', + ], + 'chromeos_with_codecs_release_bot_coverage_reclient': [ 'chromeos_with_codecs', 'release_bot_reclient', 'use_clang_coverage', ], @@ -2400,84 +2304,10 @@ 'release_bot_reclient', 'clang', 'use_clang_coverage', 'no_symbols', 'chrome_with_codecs', ], - 'clang_tot_asan_lsan_static_release': [ - 'clang_tot', 'asan', 'lsan', 'static', 'release', - ], - - 'clang_tot_cfi_full_cfi_icall_cfi_diag_thin_lto_release_static_dcheck_always_on': [ - 'clang_tot', 'cfi_full', 'cfi_icall', 'cfi_diag', 'thin_lto', 'release', 'static', 'dcheck_always_on', - ], - - 'clang_tot_coverage_minimal_symbols_release': [ - 'clang_tot', 'use_clang_coverage', 'minimal_symbols', 'release', - ], - - 'clang_tot_linux_full_symbols_shared_release': [ - # Enable debug info, as on official builders, to catch issues with - # optimized debug info. - 'clang_tot', 'full_symbols', 'shared', 'release', - ], - - 'clang_tot_minimal_symbols_release_arm64': [ - 'clang_tot', 'minimal_symbols', 'arm64', 'release', - ], - - 'clang_tot_minimal_symbols_shared_release': [ - 'clang_tot', 'minimal_symbols', 'shared', 'release', - ], - - 'clang_tot_minimal_symbols_shared_release_x86_dcheck': [ - 'clang_tot', 'minimal_symbols', 'shared', 'release', 'x86', 'dcheck_always_on', - ], - - 'clang_tot_minimal_symbols_static_release': [ - 'clang_tot', 'minimal_symbols', 'static', 'release', - ], - - 'clang_tot_minimal_symbols_static_release_x86': [ - 'clang_tot', 'minimal_symbols', 'static', 'release', 'x86', - ], - - 'clang_tot_msan_release': [ - 'clang_tot', 'msan', 'release', - ], - 'clang_tot_official': [ 'clang_tot', 'official', ], - 'clang_tot_official_pgo': [ - 'clang_tot', 'official_optimize', 'no_symbols', 'pgo_phase_1', - ], - - 'clang_tot_official_pgo_arm64': [ - 'clang_tot', 'official_optimize', 'no_symbols', 'pgo_phase_1', 'arm64', - ], - - 'clang_tot_official_pgo_x64': [ - 'clang_tot', 'official_optimize', 'no_symbols', 'pgo_phase_1', 'x64', - ], - - 'clang_tot_shared_debug': [ - 'clang_tot', 'shared', 'debug', - ], - - 'clang_tot_shared_debug_x86': [ - 'clang_tot', 'shared', 'debug', 'x86', - ], - - 'clang_tot_shared_release_dcheck': [ - 'clang_tot', 'shared', 'release', 'dcheck_always_on', - ], - - 'clang_tot_tsan_release': [ - 'clang_tot', 'tsan', 'release', - ], - - 'clang_tot_ubsan_vptr_no_recover_hack_static_release': [ - 'clang_tot', 'ubsan_vptr_no_recover_hack', 'static', 'release', - ], - 'clang_tot_win_official_full_symbols_static': [ 'clang_tot', 'official', 'full_symbols', 'static', 'win_linker_timing', ], @@ -2486,10 +2316,6 @@ 'clang_tot', 'official', 'full_symbols', 'static', 'x86', 'win_linker_timing', ], - 'clang_tot_win_release_cross': [ - 'clang_tot', 'win_cross', 'minimal_symbols', 'shared', 'release', 'dcheck_always_on', - ], - 'codesearch_gen_chromium_android_bot_reclient': [ 'codesearch_reclient', 'android_without_codecs', 'static', ], @@ -2623,15 +2449,6 @@ 'use_clang_coverage', ], - 'fuchsia_clang_tot_official_arm64': [ - 'official_optimize', 'fuchsia', 'arm64', 'clang_tot', 'static', - 'arm64_host', - ], - - 'fuchsia_clang_tot_release_x64': [ - 'fuchsia', 'release', 'clang_tot', 'static', - ], - 'fuchsia_official_optimize_reclient': [ 'official_optimize_reclient', 'fuchsia', ], @@ -2915,14 +2732,6 @@ 'compile_only', 'debug_static_bot_reclient', 'ios', 'ios_catalyst', 'ios_cpu_x64', 'asan', 'libfuzzer', 'no_dsyms', 'no_remoting', ], - 'ios_clang_device_tot_xctest': [ - 'clang_tot', 'ios', 'ios_device', 'ios_cpu_arm64', 'release', 'ios_chromium_cert', 'xctest', - ], - - 'ios_clang_tot_xctest': [ - 'clang_tot', 'ios', 'ios_simulator', 'ios_cpu_x64', 'ios_disable_code_signing', 'release', 'static', 'xctest', - ], - 'ios_device_release_compile_only': [ 'ios_device_release_compile_only', ], @@ -3012,18 +2821,6 @@ 'lacros_on_linux_release_trybot_reclient', 'clang', 'use_clang_coverage', 'use_cups', 'partial_code_coverage_instrumentation', 'use_dummy_lastchange', ], - 'lacros_on_linux_tot_debug': [ - 'lacros_on_linux', 'debug', 'also_build_ash_chrome', 'clang_tot', - ], - - 'lacros_on_linux_tot_release': [ - 'lacros_on_linux', 'release', 'also_build_ash_chrome', 'clang_tot', - ], - - 'libfuzzer_asan_clang_tot_release': [ - 'libfuzzer', 'asan', 'clang_tot', 'release', 'shared', 'chromeos_codecs', 'pdf_xfa', 'disable_nacl', 'optimize_for_fuzzing', 'mojo_fuzzer', - ], - 'libfuzzer_asan_debug_bot_reclient': [ 'libfuzzer', 'asan', 'debug_bot_reclient', 'shared', 'chromeos_codecs', 'pdf_xfa', 'disable_nacl', 'optimize_for_fuzzing', 'disable_seed_corpus', ], @@ -3087,10 +2884,6 @@ 'libfuzzer', 'ubsan_security_non_vptr', 'release_bot_reclient', 'chromeos_codecs', 'pdf_xfa', 'disable_nacl', 'optimize_for_fuzzing', 'disable_seed_corpus', 'shared', ], - 'libfuzzer_windows_asan_clang_tot_release_bot': [ - 'libfuzzer', 'asan', 'clang_tot', 'release', 'chrome_with_codecs', 'pdf_xfa', 'disable_nacl', 'minimal_symbols', - ], - # Meant for local development of fuzzers where no reclient/goma is needed. 'libfuzzer_windows_asan_local': [ 'libfuzzer', 'asan', 'no_reclient', 'release', 'chrome_with_codecs', 'pdf_xfa', 'disable_nacl', 'minimal_symbols', 'mojo_fuzzer', @@ -3913,10 +3706,6 @@ 'gn_args': 'use_cfi_icall=true', }, - 'cfi_recover': { - 'gn_args': 'use_cfi_recover=true', - }, - 'cfm': { 'gn_args': 'is_cfm=true', }, @@ -4279,10 +4068,6 @@ 'gn_args': 'target_environment="catalyst"', }, - 'ios_chromium_cert': { - 'gn_args': 'ios_code_signing_identity_description=\"iPhone Developer\"', - }, - 'ios_cpu_arm64': { 'gn_args': 'target_cpu="arm64"', }, @@ -4791,10 +4576,6 @@ 'gn_args': 'system_webview_package_name="com.google.android.webview.debug"', }, - 'win_cross': { - 'gn_args': 'target_os="win"', - }, - 'win_linker_timing': { 'gn_args': 'win_linker_timing=true', },
diff --git a/tools/mb/mb_config_expectations/chromium.clang.json b/tools/mb/mb_config_expectations/chromium.clang.json index 404076ce..93ca073 100644 --- a/tools/mb/mb_config_expectations/chromium.clang.json +++ b/tools/mb/mb_config_expectations/chromium.clang.json
@@ -1,267 +1,4 @@ { - "CFI Linux CF": { - "gn_args": { - "dcheck_always_on": false, - "is_cfi": true, - "is_component_build": false, - "is_debug": false, - "use_cfi_cast": true, - "use_cfi_diag": true, - "use_cfi_icall": true, - "use_cfi_recover": true, - "use_remoteexec": true, - "use_thin_lto": true - } - }, - "CFI Linux ToT": { - "gn_args": { - "dcheck_always_on": true, - "is_cfi": true, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "llvm_force_head_revision": true, - "use_cfi_cast": true, - "use_cfi_diag": true, - "use_cfi_icall": true, - "use_thin_lto": true - } - }, - "CrWinAsan": { - "gn_args": { - "dcheck_always_on": false, - "enable_ipc_fuzzer": true, - "is_asan": true, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "v8_enable_verify_heap": true - } - }, - "CrWinAsan(dll)": { - "gn_args": { - "dcheck_always_on": false, - "is_asan": true, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "v8_enable_verify_heap": true - } - }, - "ToTAndroid": { - "gn_args": { - "dcheck_always_on": false, - "debuggable_apks": false, - "ffmpeg_branding": "Chrome", - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "llvm_force_head_revision": true, - "proprietary_codecs": true, - "strip_debug_info": true, - "symbol_level": 1, - "target_os": "android" - } - }, - "ToTAndroid (dbg)": { - "gn_args": { - "debuggable_apks": false, - "is_clang": true, - "is_component_build": true, - "is_debug": true, - "llvm_force_head_revision": true, - "target_os": "android" - } - }, - "ToTAndroid x64": { - "gn_args": { - "dcheck_always_on": true, - "debuggable_apks": false, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "target_cpu": "x64", - "target_os": "android" - } - }, - "ToTAndroid x86": { - "gn_args": { - "dcheck_always_on": true, - "debuggable_apks": false, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "target_cpu": "x86", - "target_os": "android" - } - }, - "ToTAndroid64": { - "gn_args": { - "dcheck_always_on": false, - "debuggable_apks": false, - "is_clang": true, - "is_debug": false, - "llvm_force_head_revision": true, - "target_cpu": "arm64", - "target_os": "android" - } - }, - "ToTAndroidASan": { - "gn_args": { - "debuggable_apks": false, - "is_asan": true, - "is_clang": true, - "is_component_build": true, - "is_debug": true, - "llvm_force_head_revision": true, - "strip_debug_info": true, - "symbol_level": 1, - "target_os": "android" - } - }, - "ToTAndroidCoverage x86": { - "gn_args": { - "dcheck_always_on": true, - "debuggable_apks": false, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "target_cpu": "x86", - "target_os": "android", - "use_clang_coverage": true - } - }, - "ToTAndroidOfficial": { - "gn_args": { - "dcheck_always_on": false, - "debuggable_apks": false, - "ffmpeg_branding": "Chrome", - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "is_official_build": true, - "llvm_force_head_revision": true, - "proprietary_codecs": true, - "symbol_level": 1, - "target_cpu": "arm64", - "target_os": "android" - } - }, - "ToTChromeOS": { - "gn_args": { - "also_build_ash_chrome": true, - "chromeos_is_browser_only": true, - "dcheck_always_on": false, - "is_clang": true, - "is_debug": false, - "llvm_force_head_revision": true, - "target_os": "chromeos" - } - }, - "ToTChromeOS (dbg)": { - "gn_args": { - "also_build_ash_chrome": true, - "chromeos_is_browser_only": true, - "is_clang": true, - "is_debug": true, - "llvm_force_head_revision": true, - "target_os": "chromeos" - } - }, - "ToTFuchsia x64": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "llvm_force_head_revision": true, - "target_os": "fuchsia" - } - }, - "ToTFuchsiaOfficial arm64": { - "gn_args": { - "is_clang": true, - "is_component_build": false, - "is_official_build": true, - "llvm_force_head_revision": true, - "target_cpu": "arm64", - "target_os": "fuchsia", - "test_host_cpu": "arm64" - } - }, - "ToTLinux": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 2 - } - }, - "ToTLinux (dbg)": { - "gn_args": { - "is_clang": true, - "is_component_build": true, - "is_debug": true, - "llvm_force_head_revision": true - } - }, - "ToTLinuxASan": { - "gn_args": { - "dcheck_always_on": false, - "is_asan": true, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "is_lsan": true, - "llvm_force_head_revision": true - } - }, - "ToTLinuxASanLibfuzzer": { - "gn_args": { - "dcheck_always_on": false, - "enable_mojom_fuzzer": true, - "enable_nacl": false, - "ffmpeg_branding": "ChromeOS", - "is_asan": true, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "optimize_for_fuzzing": true, - "pdf_enable_xfa": true, - "proprietary_codecs": true, - "use_libfuzzer": true - } - }, - "ToTLinuxCoverage": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "use_clang_coverage": true - } - }, - "ToTLinuxMSan": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_debug": false, - "is_msan": true, - "llvm_force_head_revision": true, - "msan_track_origins": 2 - } - }, "ToTLinuxOfficial": { "gn_args": { "is_chrome_branded": true, @@ -270,97 +7,6 @@ "llvm_force_head_revision": true } }, - "ToTLinuxPGO": { - "gn_args": { - "chrome_pgo_phase": 1, - "is_clang": true, - "is_official_build": true, - "is_on_release_branch": true, - "llvm_force_head_revision": true, - "symbol_level": 0 - } - }, - "ToTLinuxTSan": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_debug": false, - "is_tsan": true, - "llvm_force_head_revision": true - } - }, - "ToTLinuxUBSanVptr": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "is_ubsan_no_recover": true, - "is_ubsan_vptr": true, - "llvm_force_head_revision": true - } - }, - "ToTMac": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1 - } - }, - "ToTMac (dbg)": { - "gn_args": { - "is_clang": true, - "is_component_build": true, - "is_debug": true, - "llvm_force_head_revision": true - } - }, - "ToTMacASan": { - "gn_args": { - "dcheck_always_on": false, - "enable_nacl": false, - "is_asan": true, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1 - } - }, - "ToTMacArm64": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "target_cpu": "arm64" - } - }, - "ToTMacArm64PGO": { - "gn_args": { - "chrome_pgo_phase": 1, - "is_clang": true, - "is_official_build": true, - "is_on_release_branch": true, - "llvm_force_head_revision": true, - "symbol_level": 0, - "target_cpu": "arm64" - } - }, - "ToTMacCoverage": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "use_clang_coverage": true - } - }, "ToTMacOfficial": { "gn_args": { "ignore_missing_widevine_signing_cert": true, @@ -370,111 +16,6 @@ "llvm_force_head_revision": true } }, - "ToTMacPGO": { - "gn_args": { - "chrome_pgo_phase": 1, - "is_clang": true, - "is_official_build": true, - "is_on_release_branch": true, - "llvm_force_head_revision": true, - "symbol_level": 0, - "target_cpu": "x64" - } - }, - "ToTWin": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "target_cpu": "x86" - } - }, - "ToTWin(dbg)": { - "gn_args": { - "is_clang": true, - "is_component_build": true, - "is_debug": true, - "llvm_force_head_revision": true, - "target_cpu": "x86" - } - }, - "ToTWin(dll)": { - "gn_args": { - "dcheck_always_on": true, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "target_cpu": "x86" - } - }, - "ToTWin64": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1 - } - }, - "ToTWin64(dbg)": { - "gn_args": { - "is_clang": true, - "is_component_build": true, - "is_debug": true, - "llvm_force_head_revision": true - } - }, - "ToTWin64(dll)": { - "gn_args": { - "dcheck_always_on": true, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true - } - }, - "ToTWin64PGO": { - "gn_args": { - "chrome_pgo_phase": 1, - "is_clang": true, - "is_official_build": true, - "is_on_release_branch": true, - "llvm_force_head_revision": true, - "symbol_level": 0 - } - }, - "ToTWinASanLibfuzzer": { - "gn_args": { - "dcheck_always_on": false, - "enable_nacl": false, - "ffmpeg_branding": "Chrome", - "is_asan": true, - "is_clang": true, - "is_debug": false, - "llvm_force_head_revision": true, - "pdf_enable_xfa": true, - "proprietary_codecs": true, - "symbol_level": 1, - "use_libfuzzer": true - } - }, - "ToTWinArm64PGO": { - "gn_args": { - "chrome_pgo_phase": 1, - "is_clang": true, - "is_official_build": true, - "is_on_release_branch": true, - "llvm_force_head_revision": true, - "symbol_level": 0, - "target_cpu": "arm64" - } - }, "ToTWinOfficial": { "gn_args": { "is_chrome_branded": true, @@ -497,53 +38,5 @@ "symbol_level": 2, "win_linker_timing": true } - }, - "ToTWindowsCoverage": { - "gn_args": { - "dcheck_always_on": false, - "is_clang": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "use_clang_coverage": true - } - }, - "ToTiOS": { - "gn_args": { - "dcheck_always_on": false, - "enable_run_ios_unittests_with_xctest": true, - "ios_enable_code_signing": false, - "is_clang": true, - "is_component_build": false, - "is_debug": false, - "llvm_force_head_revision": true, - "target_cpu": "x64", - "target_environment": "simulator", - "target_os": "ios" - } - }, - "ToTiOSDevice": { - "gn_args": { - "dcheck_always_on": false, - "enable_run_ios_unittests_with_xctest": true, - "ios_code_signing_identity_description": "iPhone Developer", - "is_clang": true, - "is_debug": false, - "llvm_force_head_revision": true, - "target_cpu": "arm64", - "target_environment": "device", - "target_os": "ios" - } - }, - "linux-win_cross-rel": { - "gn_args": { - "dcheck_always_on": true, - "is_clang": true, - "is_component_build": true, - "is_debug": false, - "llvm_force_head_revision": true, - "symbol_level": 1, - "target_os": "win" - } } } \ No newline at end of file
diff --git a/tools/mb/mb_config_expectations/tryserver.chromium.chromiumos.json b/tools/mb/mb_config_expectations/tryserver.chromium.chromiumos.json index ae4a13f..74f34a6e 100644 --- a/tools/mb/mb_config_expectations/tryserver.chromium.chromiumos.json +++ b/tools/mb/mb_config_expectations/tryserver.chromium.chromiumos.json
@@ -323,7 +323,7 @@ "is_component_build": true, "is_debug": true, "proprietary_codecs": true, - "symbol_level": 1, + "symbol_level": 0, "target_os": "chromeos", "use_cups": true, "use_dummy_lastchange": true,
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index c006d8b..50f45f0 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -13098,6 +13098,12 @@ </description> </action> +<action name="IOSLaunchedByAddBookmarkToChromeIntent"> + <owner>nicolasmacbeth@google.com</owner> + <owner>bling-get-set-up@google.com</owner> + <description>User added bookmarks to Chrome via Apple Shortcuts.</description> +</action> + <action name="IOSLaunchedByOpenInChromeIntent"> <owner>justincohen@chromium.org</owner> <owner>rohitrao@chromium.org</owner>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 8067f0e..5484c17 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -4119,6 +4119,9 @@ </enum> <enum name="AutofillFormControlType"> + <obsolete> + Deprecated as of 11/2023. Replaced by AutofillFormControlType2. + </obsolete> <int value="0" label="Empty"/> <int value="1" label="Other"/> <int value="2" label="Text"/> @@ -7969,11 +7972,6 @@ <int value="1" label="Duplicate"/> </enum> -<enum name="BooleanEligible"> - <int value="0" label="Not elibible"/> - <int value="1" label="Eligible"/> -</enum> - <enum name="BooleanEmpty"> <int value="0" label="Not Empty"/> <int value="1" label="Empty"/> @@ -9158,14 +9156,6 @@ <int value="1" label="OPEN_LOGIN_PAGE"/> </enum> -<enum name="CaptivePortalStatus"> - <int value="0" label="UNKNOWN"/> - <int value="1" label="OFFLINE"/> - <int value="2" label="ONLINE"/> - <int value="3" label="PORTAL"/> - <int value="4" label="PROXY_AUTH_REQUIRED"/> -</enum> - <enum name="CaptureModeBarButtonType"> <int value="0" label="Screen Capture Button"/> <int value="1" label="Screen Record Button"/> @@ -13847,13 +13837,6 @@ <int value="5" label=":-( Partial fill"/> </enum> -<enum name="CrFullscreenState"> - <int value="0" label="Entering Fullscreen State"/> - <int value="1" label="Exiting Fullscreen State"/> - <int value="2" label="In Fullscreen"/> - <int value="3" label="Not In Fullscreen"/> -</enum> - <enum name="CriticalCHRestart"> <int value="0" label="Navigation started"/> <int value="1" label="Header present"/> @@ -17097,17 +17080,6 @@ bar"/> </enum> -<enum name="DesktopIOSPasswordPromoAction"> - <int value="0" label="Dismissed"/> - <int value="1" label="ExplicitlyClosed"/> - <int value="2" label="GetStartedClicked"/> -</enum> - -<enum name="DesktopIOSPasswordPromoImpression"> - <int value="0" label="FirstImpression"/> - <int value="1" label="SecondImpression"/> -</enum> - <enum name="DetachableBasePairResult"> <int value="0" label="UnknownError"/> <int value="1" label="ChallengePassed"/> @@ -22915,15 +22887,6 @@ <int value="285212672" label="NonZeroGbbFlags"/> </enum> -<enum name="ExperienceKitCalendarTypes"> - <summary> - This list corresponds to the calendar providers supported by Experience Kit - on iOS. - </summary> - <int value="0" label="Google Calendar"/> - <int value="1" label="Apple Calendar"/> -</enum> - <enum name="Experiment3pcBlockStatus"> <int value="0" label="kAllowedAndExperimentBlocked"/> <int value="1" label="kAllowedAndExperimentAllowed"/> @@ -31408,6 +31371,14 @@ label="StorageAccessAPI_requestStorageAccess_BeyondCookies_estimate"/> <int value="4724" label="StorageAccessAPI_requestStorageAccess_BeyondCookies_estimate_Use"/> + <int value="4725" + label="StorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL"/> + <int value="4726" + label="StorageAccessAPI_requestStorageAccess_BeyondCookies_createObjectURL_Use"/> + <int value="4727" + label="StorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL"/> + <int value="4728" + label="StorageAccessAPI_requestStorageAccess_BeyondCookies_revokeObjectURL_Use"/> </enum> <enum name="FeaturePolicyFeature"> @@ -31803,6 +31774,9 @@ <int value="5" label="kRejected"/> <int value="6" label="kTaskFailedUnknownError"/> <int value="7" label="kTaskTimeoutAbort"/> + <int value="8" label="kExampleSelectorCriteriaParsingError"/> + <int value="9" label="kTaskNameEmptyError"/> + <int value="10" label="kGetNextExampleInvalidArgumentError"/> </enum> <enum name="FederatedServiceEvent"> @@ -32704,13 +32678,6 @@ <int value="2" label="YV12 format with Native Pixmaps"/> </enum> -<enum name="FormInputAccessoryAction"> - <int value="0" label="PreviousElement"/> - <int value="1" label="NextElement"/> - <int value="2" label="Done"/> - <int value="3" label="Unkown"/> -</enum> - <enum name="FoundBuyableProductAnnotation"> <summary> Whether a buyable product annotation was found in the response from an @@ -36119,15 +36086,6 @@ <int value="39" label="kFileSystemAccessLockingContention"/> </enum> -<enum name="InactiveTabsThresholdSettingType"> - <int value="0" label="Unknown"/> - <int value="1" label="Never Move"/> - <int value="2" label="One Week"/> - <int value="3" label="Two Weeks"/> - <int value="4" label="Three Weeks"/> - <int value="5" label="Default Value"/> -</enum> - <enum name="IncidentType"> <int value="1" label="TrackedPreference"/> <int value="2" label="BinaryIntegrity"/> @@ -36150,21 +36108,6 @@ <int value="3" label="Incognito switch and forced"/> </enum> -<enum name="IncognitoInterstitialActionType"> - <int value="0" label="Unknown"/> - <int value="1" label="Open in Chrome Incognito"/> - <int value="2" label="Open in Chrome (in a normal tab)"/> - <int value="3" label="Cancel"/> - <int value="4" label="Learn more about Incognito"/> - <int value="5" label="Dismissed by external event"/> -</enum> - -<enum name="IncognitoInterstitialSettingsActionType"> - <int value="0" label="Unknown"/> - <int value="1" label="Enabled"/> - <int value="2" label="Disabled"/> -</enum> - <enum name="IncognitoMessageEvent"> <int value="0" label="Download message shown"/> <int value="1" label="Download message accepted"/> @@ -37211,19 +37154,6 @@ label="App state was UIApplicationStateBackground during XTE."/> </enum> -<enum name="IOSBringAndroidTabsPromptActionType"> - <int value="0" label="Review tabs"/> - <int value="1" label="Open tabs"/> - <int value="2" label="Cancel"/> - <int value="3" label="Swipe to dismiss"/> -</enum> - -<enum name="IOSBringAndroidTabsTabsListActionType"> - <int value="0" label="Cancel"/> - <int value="1" label="Swipe down"/> - <int value="2" label="Open tabs"/> -</enum> - <enum name="IOSColdStartType"> <int value="0" label="Cold start"/> <int value="1" label="Cold start with FRE"/> @@ -37251,54 +37181,6 @@ <int value="12" label="AccessibilityExtraExtraExtraLarge"/> </enum> -<enum name="iOSCredentialIdentityStoreErrorForReporting"> - <int value="0" label="Unknown Error"/> - <int value="1" label="Internal Error"/> - <int value="2" label="Store Disabled"/> - <int value="3" label="Store Busy"/> -</enum> - -<enum name="IOSCredentialProviderNewCredentialUsername"> - <int value="0" label="Credential With Username"/> - <int value="1" label="Credential Without Username"/> -</enum> - -<enum name="IOSCredentialProviderPasswordCreated"> - <int value="0" label="Password Manually Added"/> - <int value="1" label="Password Suggested"/> - <int value="2" label="Password Suggested and Manually Changed"/> -</enum> - -<enum name="IOSCredentialProviderPromoAction"> - <int value="0" label="Learn More"/> - <int value="1" label="Go To Settings"/> - <int value="2" label="Remind me later"/> - <int value="3" label="No"/> -</enum> - -<enum name="IOSCredentialProviderPromoSource"> - <int value="0" label="Unknown"/> - <int value="1" label="Password Copied"/> - <int value="2" label="Password Saved"/> - <int value="3" label="Autofill Used"/> - <int value="4" label="Set Up List"/> -</enum> - -<enum name="IOSDefaultBrowserFullscreenPromoAction"> - <int value="0" label="Action Button"/> - <int value="1" label="Cancel"/> - <int value="2" label="Remind Me Later"/> - <int value="3" label="Dismiss"/> -</enum> - -<enum name="IOSDefaultBrowserPromoNonModalAction"> - <int value="0" label="Accepted"/> - <int value="1" label="Appear"/> - <int value="2" label="Dismiss"/> - <int value="3" label="Timeout"/> - <int value="4" label="Background prevented impression"/> -</enum> - <enum name="IOSDefaultBrowserPromoSource"> <int value="0" label="Settings"/> <int value="1" label="Omnibox"/> @@ -37306,19 +37188,6 @@ <int value="3" label="Set Up List"/> </enum> -<enum name="IOSDefaultBrowserPromoType"> - <int value="0" label="General"/> - <int value="1" label="Made for iOS"/> - <int value="2" label="Stay Safe"/> - <int value="3" label="All Tabs"/> -</enum> - -<enum name="IOSDefaultBrowserVideoPromoAction"> - <int value="0" label="Primary Action Button"/> - <int value="1" label="Secondary Action Button"/> - <int value="2" label="Swipe Down"/> -</enum> - <enum name="IOSDeviceRestoreSignedinState"> <int value="0" label="User not signed in before iOS device restore"/> <int value="1" @@ -37334,144 +37203,12 @@ <int value="4" label="4-Critical"/> </enum> -<enum name="IOSEditMenuActions"> - <int value="0" label="Invalid"/> - <int value="1" label="NativeCut"/> - <int value="2" label="NativeCopy"/> - <int value="3" label="NativePaste"/> - <int value="4" label="NativeDelete"/> - <int value="5" label="NativeSelect"/> - <int value="6" label="NativeSelectAll"/> - <int value="7" label="NativeReplace"/> - <int value="8" label="NativeTransliterateChinese"/> - <int value="9" label="NativeInsertDrawing"/> - <int value="10" label="NativeScanText"/> - <int value="11" label="NativeStyleBold"/> - <int value="12" label="NativeStyleItalic"/> - <int value="13" label="NativeStyleUnderline"/> - <int value="14" label="NativeRTL"/> - <int value="15" label="NativeLTR"/> - <int value="16" label="NativeFindSelection"/> - <int value="17" label="NativeDefine"/> - <int value="18" label="NativeTranslate"/> - <int value="19" label="NativeLearn"/> - <int value="20" label="NativeSpeak"/> - <int value="21" label="NativeSpeakMore"/> - <int value="22" label="NativePause"/> - <int value="23" label="NativeShare"/> - <int value="24" label="ChromeLinkToText"/> - <int value="25" label="ChromePartialTranslate"/> - <int value="26" label="CommandOther"/> - <int value="27" label="SearchWeb"/> - <int value="28" label="CreateEvent"/> - <int value="29" label="CreateReminder"/> - <int value="30" label="ShowCalendar"/> - <int value="31" label="SendMail"/> - <int value="32" label="SendMessage"/> - <int value="33" label="AddToContacts"/> - <int value="34" label="Call"/> - <int value="35" label="GetDirections"/> - <int value="36" label="OpenMaps"/> - <int value="37" label="UnitConversion"/> - <int value="38" label="OtherDataDetector"/> - <int value="39" label="ActionOther"/> - <int value="40" label="UnknownMenuAction"/> - <int value="41" label="OpenURL"/> - <int value="42" label="AddToReadingList"/> - <int value="43" label="SearchWith"/> -</enum> - -<enum name="IOSEditMenuError"> - <int value="0" label="First method install failed"/> - <int value="1" label="Second method install failed"/> - <int value="2" label="Unexpected paramters on dismiss"/> - <int value="3" label="Unexpected object structure on dismiss"/> -</enum> - -<enum name="IOSEditMenuPage"> - <int value="0" label="Invalid"/> - <int value="1" label="1 out of 1"/> - <int value="2" label="1 out of 2"/> - <int value="3" label="2 out of 2"/> - <int value="4" label="1 out of 3"/> - <int value="5" label="2 out of 3"/> - <int value="6" label="3 out of 3"/> - <int value="7" label="1 out of 4"/> - <int value="8" label="2 out of 4"/> - <int value="9" label="3 out of 4"/> - <int value="10" label="4 out of 4"/> - <int value="11" label="1 out of N"/> - <int value="12" label="2 out of N"/> - <int value="13" label="3 out of N"/> - <int value="14" label="4 out of N"/> - <int value="15" label="5 out of N"/> - <int value="16" label="6 out of N"/> - <int value="17" label="7 out of N"/> - <int value="18" label="8 out of N"/> - <int value="19" label="9 out of N"/> - <int value="20" label="10 out of N"/> - <int value="21" label="More Than Ten"/> -</enum> - -<enum name="IOSErrorPagePresentationFailed"> - <int value="0" label="Unknown"/> - <int value="1" label="Web View Released Error"/> - <int value="2" label="JavaScript Exception Occurred"/> - <int value="3" label="Other WKErrorDomain Error"/> -</enum> - <enum name="IOSExternalURLRequestStatus"> <int value="0" label="MainFrameAllowed"/> <int value="1" label="SubframeAllowed"/> <int value="2" label="SubframeBlocked"/> </enum> -<enum name="IOSHandoffOrigin"> - <int value="0" label="Unknown Origin"/> - <int value="1" label="Chrome on iOS"/> - <int value="2" label="Chrome on Mac"/> -</enum> - -<enum name="IOSHomeActionType"> - <int value="0" label="Most Visited Tiles"/> - <int value="1" label="Shortcuts"/> - <int value="2" label="Return to Recent Tab tile"/> - <int value="3" label="Feed Card"/> - <int value="4" label="Fake Omnibox tap"/> - <int value="5" label="Set Up List"/> - <int value="6" label="Omnibox navigation"/> - <int value="7" label="Safety Check tile"/> - <int value="8" label="Parcel Tracking tile"/> - <int value="9" label="Distant tab resumption tile"/> -</enum> - -<enum name="IOSITunesURLsStoreKitHandlingResult"> - <int value="0" label="Handling failed"/> - <int value="1" label="Single App URL, handled"/> - <int value="2" label="App Bundle URL, handled"/> - <int value="3" label="App Bundle URL, not handled"/> -</enum> - -<enum name="IOSJavascriptContentBlockType"> - <int value="0" label="Cookie"/> - <int value="1" label="Local Storage"/> - <int value="2" label="Session Storage"/> -</enum> - -<enum name="IOSLaunchSource"> - <summary>The way the app was launched on iOS.</summary> - <int value="0" label="App Icon"/> - <int value="1" label="Long Press on App Icon"/> - <int value="2" label="Widget"/> - <int value="3" label="Spotlight Chrome (e.g. bookmark)"/> - <int value="4" label="Link Opened by OS - Default Intent"/> - <int value="5" label="Link Opened Specifically in Chrome from App"/> - <int value="6" label="Siri Shortcut"/> - <int value="7" label="X-Callback (incl. link shared to Chrome)"/> - <int value="8" label="Handoff"/> - <int value="9" label="Notification"/> -</enum> - <enum name="IOSLensSupportStatus"> <summary>Whether lens is supported and if not the reason why.</summary> <int value="0" label="Lens Search Supported"/> @@ -37488,35 +37225,6 @@ <int value="1" label="Malformed response"/> </enum> -<enum name="IOSMagicStackModuleType"> - <int value="0" label="Most Visited Tiles"/> - <int value="1" label="Shortcuts"/> - <int value="2" label="Set Up List Sync"/> - <int value="3" label="Set Up List Default Browser"/> - <int value="4" label="Set Up List Autofill"/> - <int value="5" label="Set Up List Compacted"/> - <int value="6" label="Set Up List All Set"/> - <int value="7" label="Safety Check"/> - <int value="8" label="Safety Check Multi Row"/> - <int value="9" label="Safety Check Multi Row Overflow"/> - <int value="10" label="Tab Resumption"/> - <int value="11" label="Parcel Tracking"/> - <int value="12" label="Parcel Tracking See More"/> -</enum> - -<enum name="IOSMainThreadFreezeDetectionNotRunningAfterReportBlock"> - <int value="0" label="After Breakpad Ref"> - Freeze detection stopped after obtaining the breakpad lock. - </int> - <int value="1" label="After FileManager UTE move"> - Freeze detection stopped after moving the hang report out of the Breakpad - directory and into the |UTE| directory. - </int> - <int value="2" label="After Crashpad DumpWithoutCrash"> - Freeze detection stopped after calling DumpWithCrash from Crashpad. - </int> -</enum> - <enum name="IOSMenuAction"> <int value="0" label="Open in New Tab"/> <int value="1" label="Open in New Incognito Tab"/> @@ -37586,144 +37294,6 @@ <int value="19" label="Inactive Tabs entry"/> </enum> -<enum name="IOSMiniMapConsentOutcome"> - <int value="0" label="Consent was not required"/> - <int value="1" label="Consent was skipped (already granted)."/> - <int value="2" label="User accepted"/> - <int value="3" label="User declined"/> - <int value="4" label="User opened settings (double count)"/> - <int value="5" label="User dismissed"/> - <int value="6" label="Popover displayed"/> -</enum> - -<enum name="IOSMultiWindowConfiguration"> - <int value="0" label="Unspecified"/> - <int value="1" label="Fullscreen"/> - <int value="2" label="Fullscreen with Slideover"/> - <int value="3" label="Shared Standard"/> - <int value="4" label="Shared Standard with Slideover"/> - <int value="5" label="Shared Compact"/> - <int value="6" label="Shared Compact with Slideover"/> - <int value="7" label="Slideover"/> - <int value="8" label="Standard beside Standard"/> - <int value="9" label="Standard beside Standard with Slideover"/> - <int value="10" label="Standard beside Compact"/> - <int value="11" label="Standard beside Compact with Slideover"/> - <int value="12" label="Compact beside Compact"/> - <int value="13" label="Compact beside Compact with Slideover"/> -</enum> - -<enum name="IOSNTPImpressionType"> - <int value="0" label="Feed disabled"/> - <int value="1" label="Feed visible"/> - <int value="2" label="Feed collapsed"/> -</enum> - -<enum name="IOSNTPNewBadgeShownResult"> - <int value="0" label="Shown"/> - <int value="1" label="Not shown due to limit reached"/> - <int value="2" - label="Not shown due to the button already having been pressed"/> -</enum> - -<enum name="IOSNTPOverscrollAction"> - <int value="0" label="Open New Tab"/> - <int value="1" label="Pull to Refresh"/> - <int value="2" label="Close Tab"/> -</enum> - -<enum name="IOSOpenExtensionOutcome"> - <int value="0" label="Open Extension Success"/> - <int value="1" label="Open Extension Invalid outcome"/> - <int value="2" label="Open Extension Invalid URL"/> - <int value="3" label="Open Extension URL not found"/> - <int value="4" label="Open Extension Method not found"/> - <int value="5" label="Open Extension Unsupported scheme"/> -</enum> - -<enum name="IOSOpenInDownloadResult"> - <int value="0" label="Download Succeeded"/> - <int value="1" label="Download Canceled"> - User canceled the download manually. - </int> - <int value="2" label="Download Failed"> - Download failed either by getting a corrupted file or no file at all. - </int> -</enum> - -<enum name="IOSOpenInMimeType"> - <int value="0" label="Not handled"/> - <int value="1" label="PDF"/> - <int value="2" label="Microsof tWord"/> - <int value="3" label="Microsoft Word OpenXML"/> - <int value="4" label="JPEG"/> - <int value="5" label="PNG"/> - <int value="6" label="Microsoft PowerPoint"/> - <int value="7" label="Microsoft PowerPoint OpenXML"/> - <int value="8" label="RTF"/> - <int value="9" label="SVG"/> - <int value="10" label="Microsoft Excel"/> - <int value="11" label="Microsoft Excel OpenXML"/> -</enum> - -<enum name="IOSOverflowMenuAction"> - <int value="0" label="Reload"/> - <int value="1" label="NewTab"/> - <int value="2" label="NewIncognitoTab"/> - <int value="3" label="NewWindow"/> - <int value="4" label="Follow"/> - <int value="5" label="Bookmark"/> - <int value="6" label="ReadingList"/> - <int value="7" label="ClearBrowsingData"/> - <int value="8" label="Translate"/> - <int value="9" label="DesktopSite"/> - <int value="10" label="FindInPage"/> - <int value="11" label="TextZoom"/> - <int value="12" label="ReportAnIssue"/> - <int value="13" label="Help"/> - <int value="14" label="ShareChrome"/> - <int value="15" label="EditActions"/> -</enum> - -<enum name="IOSOverflowMenuActionType"> - <int value="0" label="No scroll, no action"/> - <int value="1" label="Scroll, no action"/> - <int value="2" label="No scroll, action"/> - <int value="3" label="Scroll, action"/> -</enum> - -<enum name="IOSOverflowMenuDestination"> - <int value="0" label="Bookmarks"/> - <int value="1" label="History"/> - <int value="2" label="ReadingList"/> - <int value="3" label="Passwords"/> - <int value="4" label="Downloads"/> - <int value="5" label="RecentTabs"/> - <int value="6" label="SiteInfo"/> - <int value="7" label="Settings"/> - <int value="8" label="WhatsNew"/> - <int value="9" label="SpotlightDebugger"/> - <int value="10" label="PriceNotifications"/> -</enum> - -<enum name="IOSOverflowMenuReorderingReason"> - <int value="0" label="Error Badge"/> - <int value="1" label="New Badge"/> - <int value="2" label="Both Badges"/> -</enum> - -<enum name="IOSOverflowMenuSmartSortingChange"> - <int value="0" label="Newly Enabled"/> - <int value="1" label="Newly Disabled"/> -</enum> - -<enum name="IOSPageLoadCountNavigationType"> - <int value="0" label="Chrome URL Navigation"/> - <int value="1" label="Same Document Web Navigation"/> - <int value="2" label="Page Load Navigation"/> - <int value="3" label="Obsolete - Loading Started"/> -</enum> - <enum name="IOSParcelCarrier"> <int value="0" label="Unkown"/> <int value="1" label="Fedex"/> @@ -37739,26 +37309,6 @@ <int value="11" label="CarrierIParcel"/> </enum> -<enum name="IOSParcelTrackingOptInActionOnPrompt"> - <int value="0" label="AskEveryTime"/> - <int value="1" label="AlwaysTrack"/> - <int value="2" label="NoThanks"/> - <int value="3" label="SwipeToDismiss"/> -</enum> - -<enum name="IOSPermissionEvent"> - <int value="0" label="Camera permission disabled"/> - <int value="1" label="Camera permission enabled"/> - <int value="2" label="Microphone permission disabled"/> - <int value="3" label="Microphone permission enabled"/> -</enum> - -<enum name="IOSPermissionRequest"> - <int value="0" label="Camera permission"/> - <int value="1" label="Microphone permission"/> - <int value="2" label="Camera and Microphone permissions"/> -</enum> - <enum name="IOSPostCrashAction"> <int value="0" label="Restore tabs normally after a clean shutdown"/> <int value="1" label="Restore tabs normally after an unclean shutdown"/> @@ -37767,147 +37317,6 @@ <int value="4" label="Show safe mode"/> </enum> -<enum name="IOSPostRestoreDefaultBrowserActionOnPrompt"> - <int value="0" label="No Thanks"/> - <int value="1" label="Go To Settings"/> - <int value="2" label="Swipe to Dismiss"/> -</enum> - -<enum name="IOSPostRestoreSigninChoice"> - <int value="0" label="Continue"/> - <int value="1" label="Dismiss"/> -</enum> - -<enum name="IOSPromosManagerPromo"> - <int value="0" label="Test Promo"/> -<!-- Default Browser (Fullscreen) not in use, yet.--> - - <int value="1" label="Default Browser (Fullscreen)"/> - <int value="2" label="App Store Rating"/> -<!-- Credential Provider Extension not in use, yet.--> - - <int value="3" label="Credential Provider Extension"/> - <int value="4" label="Post Restore Sign-In (Fullscreen)"/> - <int value="5" label="Post Restore Sign-In (Alert)"/> - <int value="6" label="What's New"/> - <int value="7" label="Choice Promo"/> - <int value="8" label="Post Restore Default Browser (Alert)"/> - <int value="9" label="Default Browser Remind Me Later"/> -</enum> - -<enum name="IOSPromosManagerPromoImpressionLimitEvaluationType"> - <int value="0" label="Valid"/> - <int value="1" label="Invalid (Promo-specific limit triggered)"/> - <int value="2" label="Invalid (Promo-agnostic limit triggered)"/> - <int value="3" label="Invalid (Global limit triggered)"/> -</enum> - -<enum name="IOSPromosManagerPromoType"> - <int value="0" label="StandardPromoViewProvider"/> - <int value="1" label="BanneredPromoViewProvider"/> - <int value="2" label="StandardPromoAlertProvider"/> - <int value="3" label="StandardPromoDisplayHandler"/> -</enum> - -<enum name="IOSPromptAndroidTabsStatus"> - <int value="0" label="Sync Disabled"/> - <int value="1" label="Segmentation Incomplete"/> - <int value="2" label="Prompt Shown and Dismissed"/> - <int value="3" label="Tab Sync Disabled"/> - <int value="4" label="No Active Tabs"/> - <int value="5" label="Not Android Switcher"/> - <int value="6" label="Success"/> -</enum> - -<enum name="IOSSaveToPhotosAccountPickerType"> - <int value="0" - label="Account picker not presented because a default account exists"/> - <int value="1" label="User tapped 'Cancel' in the account picker"/> - <int value="2" label="User selected an identity in the account picker"/> -</enum> - -<enum name="IOSSaveToPhotosContextMenuType"> - <int value="0" - label="'Save to Google Photos' action was unavailable and the user - tapped 'Save to Photos' (saved image locally)"/> - <int value="2" - label="'Save to Google Photos' action was available but the user tapped - 'Save to Photos' (saved image locally)"/> - <int value="3" - label="'Save to Google Photos' action was available and the user tapped - 'Save to Google Photos'"/> -</enum> - -<enum name="IOSSaveToPhotosSettingsType"> - <int value="0" - label="User has NOT set a default Save to Photos account and did NOT - opt-in to skip the account picker"/> - <int value="1" - label="User has set a default Save to Photos account which exists on - device and did NOT opt-in to skip the account picker"/> - <int value="2" - label="User has set a default Save to Photos account but it is not on - device anymore and did NOT opt-in to skip the account picker"/> - <int value="3" - label="User has set a default Save to Photos account which exists on - device and did opt-in to skip the account picker"/> - <int value="4" - label="User has set a default Save to Photos account but it is not on - device anymore; the user did opt-in to skip the account picker"/> -</enum> - -<enum name="IOSSaveToPhotosType"> - <int value="0" label="Failure - WebState destroyed"/> - <int value="1" label="Failure - User signed-out"/> - <int value="2" - label="Failure - User cancelled in 'This File Could Not Be Uploaded' - alert"/> - <int value="3" label="Failure - Cancelled with account picker"/> - <int value="4" label="Failure - Cancelled with snackbar button"/> - <int value="5" label="Success - No post-upload action"/> - <int value="6" label="Success - Photo opened in Photos app"/> - <int value="7" - label="Success - StoreKit opened and app not installed (maybe dismissed - before full installation)"/> - <int value="8" label="Success - StoreKit opened and app installed"/> -</enum> - -<enum name="IOSSearchExtensionAction"> - <int value="0" label="No Action"/> - <int value="1" label="New Search"/> - <int value="2" label="New Incognito Search"/> - <int value="3" label="New Voice Search"/> - <int value="4" label="New QR Code Search"/> - <int value="5" label="Open URL"/> - <int value="6" label="Search Text"/> - <int value="7" label="Search Image"/> - <int value="8" label="Search Image with Lens"/> -</enum> - -<enum name="IOSSearchWithContext"> - <int value="0" label="Normal Mode, Google Search engine"/> - <int value="1" label="Normal Mode, Other Search engine"/> - <int value="2" label="Incognito Mode, Google Search engine"/> - <int value="3" label="Incognito Mode, Other Search engine"/> -</enum> - -<enum name="IOSSessionMigration"> - <int value="0" label="No Migration"/> - <int value="1" label="Migration Failed"/> - <int value="2" label="No Session To Migrate"/> - <int value="3" label="Migrated Pre-MW to Multi Scenes"/> - <int value="4" label="Migrated Pre-MW to Single Scene"/> - <int value="5" label="Migrated Single Scene to Multi Scenes"/> - <int value="6" label="Migrated Multi Scenes to Single Scene"/> -</enum> - -<enum name="IOSSetUpListItemType"> - <int value="1" label="SignIn Sync"/> - <int value="2" label="Default Browser"/> - <int value="3" label="Autofill"/> - <int value="4" label="Follow"/> -</enum> - <enum name="IOSShareAction"> <int value="0" label="Unknown"/> <int value="1" label="Cancel"/> @@ -37931,66 +37340,6 @@ <int value="19" label="Add to Home"/> </enum> -<enum name="IOSShareExtensionReceivedEntrySource"> - <int value="0" label="Unknown Application"/> - <int value="1" label="Chrome share extension"/> -</enum> - -<enum name="IOSShareExtensionReceivedEntryType"> - <int value="0" label="Invalid item"/> - <int value="1" label="Cancelled item"/> - <int value="2" label="Reading list item"/> - <int value="3" label="Bookmark item"/> - <int value="4" label="Open in Chrome item"/> -</enum> - -<enum name="IOSSpotlightAction"> - <int value="0" label="New Tab"/> - <int value="1" label="New Incognito Tab"/> - <int value="2" label="Voice Search"/> - <int value="3" label="QR Code Scanner"/> - <int value="4" label="Set Default Browser"/> - <int value="5" label="Search with Lens"/> -</enum> - -<enum name="IOSSpotlightAvailability"> - <int value="0" label="Unsupported"/> - <int value="1" label="Unavailable"/> - <int value="2" label="Available"/> -</enum> - -<enum name="IOSSpotlightDonatedIntentType"> - <int value="0" label="Search In Chrome"/> - <int value="1" label="Open Reading List"/> - <int value="2" label="Open Bookmarks"/> - <int value="3" label="Open Recent Tabs"/> - <int value="4" label="Open Tab Grid"/> - <int value="5" label="Open Voice Search"/> - <int value="6" label="Open New Tab"/> - <int value="7" label="Play Dino Game"/> - <int value="8" label="Set Default Browser"/> - <int value="9" label="View History"/> - <int value="10" label="Open Latest Tab"/> - <int value="11" label="Start Lens"/> - <int value="12" label="Clear Browsing Data"/> - <int value="13" label="Open In Chrome"/> - <int value="14" label="Open In Incognito"/> - <int value="15" label="Open New Incognito Tab"/> - <int value="16" label="Manage Payment Methods"/> - <int value="17" label="Run Safety Check"/> - <int value="18" label="Manage Passwords"/> - <int value="19" label="Manage Settings"/> -</enum> - -<enum name="IOSSpotlightOrigin"> - <int value="0" label="Unknown Origin"/> - <int value="1" label="Bookmark"/> - <int value="2" label="Top Sites"/> - <int value="3" label="Actions"/> - <int value="4" label="Reading list"/> - <int value="5" label="Open tab"/> -</enum> - <enum name="IOSStabilityUserVisibleTerminationType"> <summary> One of several separate stability metrics. The values are non-contiguous as @@ -38004,101 +37353,6 @@ locked for 9+ seconds and the app was quit by OS or the user)."/> </enum> -<enum name="IOSStorageCapacity"> - <int value="0" label="Unknown"/> - <int value="1" label="0 GB"/> - <int value="2" label="16 GB"/> - <int value="3" label="32 GB"/> - <int value="4" label="64 GB"/> - <int value="5" label="128 GB"/> - <int value="6" label="256 GB"/> - <int value="7" label="512 GB"/> - <int value="8" label="1 TB"/> - <int value="9" label="2 TB"/> -</enum> - -<enum name="IOSTabSwitcherDragDropTabs"> - <int value="0" label="A tab is dragged."/> - <int value="1" label="A tab is dropped at the same index position."/> - <int value="2" label="A tab is dropped at a new index position."/> - <int value="3" label="A tab is dropped outside of its collection view."/> -</enum> - -<enum name="IOSTabSwitcherDragOrigin"> - <int value="0" - label="The item is from the same collection in the same Chrome window."/> - <int value="1" label="The item is from the same Chrome window."/> - <int value="2" label="The item is from another Chrome window."/> - <int value="3" label="The item is not a Chrome Tab."/> -</enum> - -<enum name="IOSTabSwitcherPageChangeInteraction"> - <int value="0" label="Unknown Interaction"/> - <int value="1" label="Scroll View Drag"/> - <int value="2" label="Page Control Tap"/> - <int value="3" label="Page Control Drag"/> - <int value="4" label="Item Drag"/> -</enum> - -<enum name="IOSUserInterfaceStyle"> - <int value="0" label="Unspecified"/> - <int value="1" label="Light"/> - <int value="2" label="Dark"/> -</enum> - -<enum name="IOSWebFileInputAttributes"> - <int value="0" label="No Accept"/> - <int value="1" label="No Accept, Multiple files"/> - <int value="2" label="Mixed"/> - <int value="3" label="Mixed, Multiple files"/> - <int value="4" label="Unknown"/> - <int value="5" label="Unknown, Multiple files"/> - <int value="6" label="Image"/> - <int value="7" label="Image, Multiple files"/> - <int value="8" label="Video"/> - <int value="9" label="Video, Multiple files"/> - <int value="10" label="Audio"/> - <int value="11" label="Audio, Multiple files"/> - <int value="12" label="Archive"/> - <int value="13" label="Archive, Multiple files"/> - <int value="14" label="PDF"/> - <int value="15" label="PDF, Multiple files"/> - <int value="16" label="Doc"/> - <int value="17" label="Doc, Multiple files"/> - <int value="18" label="Apple"/> - <int value="19" label="Apple, Multiple files"/> -</enum> - -<enum name="IOSWidgetKitAction"> - <int value="0" label="Dino Widget - Game"/> - <int value="1" label="Search Widget - Search"/> - <int value="2" label="Quick Actions Widget - Search"/> - <int value="3" label="Quick Actions Widget - Incognito"/> - <int value="4" label="Quick Actions Widget - Voice Search"/> - <int value="5" label="Quick Actions Widget - QR Reader"/> - <int value="6" label="Lockscreen Launcher Widget - Search"/> - <int value="7" label="Lockscreen Launcher Widget - Incognito"/> - <int value="8" label="Lockscreen Launcher Widget - Voice Search"/> - <int value="9" label="Lockscreen Launcher Widget - Dino Game"/> - <int value="10" label="Quick Actions Widget - Lens"/> - <int value="11" label="Shortcuts Widget - Search"/> - <int value="12" label="Shortcuts Widget - Open Shortcut"/> - <int value="13" label="Search Passwords Widget - Search Passwords"/> -</enum> - -<enum name="IOSWidgetKitExtensionKind"> - <int value="0" label="Dino game widget"/> - <int value="1" label="Search widget"/> - <int value="2" label="Quick actions widget"/> - <int value="3" label="A widget that has become obsolete"/> - <int value="4" label="Lockscreen launcher widget - Search"/> - <int value="5" label="Lockscreen launcher widget - Incognito"/> - <int value="6" label="Lockscreen launcher widget - Voice Search"/> - <int value="7" label="Lockscreen launcher widget - Dino Game"/> - <int value="8" label="Shortcuts widget"/> - <int value="9" label="Search Passwords widget"/> -</enum> - <enum name="IPCAttachmentBrokerPrivilegedBrokerAttachmentError"> <int value="0" label="DESTINATION_FOUND"> The brokerable attachment had a valid destination. This is the success case. @@ -38248,24 +37502,6 @@ </int> </enum> -<enum name="JpegColorSpace"> - <int value="0" label="Unknown color space"> - This is the bucket that counts the images that did not fall under any of the - other categories. - </int> - <int value="1" label="Grayscale"/> - <int value="2" label="RGB"/> - <int value="3" label="CMYK"/> - <int value="4" label="YCCK"/> - <int value="5" label="YCbCr 4:1:0"/> - <int value="6" label="YCbCr 4:1:1"/> - <int value="7" label="YCbCr 4:2:0"/> - <int value="8" label="YCbCr 4:2:2"/> - <int value="9" label="YCbCr 4:4:0"/> - <int value="10" label="YCbCr 4:4:4"/> - <int value="11" label="YCbCr with other subsampling"/> -</enum> - <enum name="JsonParserExtension"> <int value="0" label="C style comment (/**/)"/> <int value="1" label="C++ style comment (//)"/> @@ -38788,21 +38024,6 @@ </int> </enum> -<enum name="LanguageDetectionComparison"> - <int value="0" label="Language detected by TFLite only (CLD3 failed)"/> - <int value="1" label="Language detected by CLD3 only (TFLite failed)"/> - <int value="2" label="No language detected (both model failed)"/> - <int value="3" label="Both model succeeded and agree"/> - <int value="4" label="Both model succeeded bug disagreed"/> -</enum> - -<enum name="LanguageDetectionMethod"> - <int value="0" label="TFLite model"/> - <int value="1" label="CLD3 (TFLite model unavailable)"/> - <int value="2" label="CLD3 (TFLite model disabled)"/> - <int value="3" label="CLD3 (TFLite model run but is ignored)"/> -</enum> - <enum name="LanguageDetectionModelState"> <int value="0" label="Unknown"/> <int value="1" label="Model File Invalid"/> @@ -40015,19 +39236,6 @@ <int value="6" label="Empty selector"/> </enum> -<enum name="LinkToTextShouldOfferResult"> - <int value="0" label="Success"/> - <int value="1" label="Rejected in JavaScript (deprecated)"/> - <int value="2" label="Blocklisted"/> - <int value="3" label="Unable to invoke JavaScript"/> - <int value="4" label="Web layer task timeout (deprecated)"/> - <int value="5" label="Dispatched timeout (deprecated)"/> - <int value="6" label="Selection empty"/> - <int value="7" label="User editing"/> - <int value="8" label="Text Input view not found"/> - <int value="9" label="Success, with lower certainty"/> -</enum> - <enum name="LinuxDistro3"> <int value="0" label="Unknown"/> <int value="1" label="Other"/> @@ -41881,6 +41089,7 @@ <int value="-1701728664" label="TrackingProtectionSentimentSurvey:enabled"/> <int value="-1701123067" label="ShowManagedUi:enabled"/> <int value="-1700764114" label="HelpAppBackgroundPage:enabled"/> + <int value="-1700068858" label="HelpAppCrosComponents:disabled"/> <int value="-1699960514" label="ChromeOSSyncedSessionSharing:enabled"/> <int value="-1699700244" label="VirtualKeyboardMultipasteSuggestion:disabled"/> @@ -42208,7 +41417,6 @@ label="EarlyDocumentSwapForBackForwardTransitions:enabled"/> <int value="-1551197844" label="AssistMultiWord:enabled"/> <int value="-1550675387" label="CriticalPersistedTabData:enabled"/> - <int value="-1550649310" label="FillMultiLine:enabled"/> <int value="-1550541457" label="DisplayIdentification:disabled"/> <int value="-1549871007" label="OneGoogleBarOnLocalNtp:disabled"/> <int value="-1549356351" label="SyncPseudoUSSExtensionSettings:enabled"/> @@ -42534,6 +41742,7 @@ <int value="-1405349891" label="PictureInPictureAPI:enabled"/> <int value="-1405048637" label="OfflinePagesResourceBasedSnapshot:enabled"/> <int value="-1404469375" label="RemoteCopyProgressNotification:enabled"/> + <int value="-1404088616" label="TetheringExperimentalFunctionality:enabled"/> <int value="-1400745093" label="SystemEmojiPickerSearchExtension:enabled"/> <int value="-1400693146" label="LauncherImageSearchIca:enabled"/> <int value="-1399753480" label="disable-harfbuzz-rendertext"/> @@ -43146,6 +42355,7 @@ <int value="-1113746031" label="AppDeduplicationService:enabled"/> <int value="-1113373128" label="WebUIDownloadShelf:enabled"/> <int value="-1112782121" label="AndroidSigninPromos:disabled"/> + <int value="-1111269978" label="FluentOverlayScrollbar:enabled"/> <int value="-1111094917" label="Cormorant:enabled"/> <int value="-1111056156" label="AdvancedPeripheralsSupportTabStrip:enabled"/> <int value="-1110928012" label="force-companion-pinned-state"/> @@ -43514,6 +42724,7 @@ <int value="-936652950" label="AutofillEnableManualFallbackForVirtualCards:disabled"/> <int value="-936308513" label="CompactBubbleLauncher:enabled"/> + <int value="-934900747" label="FluentOverlayScrollbar:disabled"/> <int value="-934444201" label="Hotspot:enabled"/> <int value="-934163513" label="EcheSWA:enabled"/> <int value="-933377608" @@ -44609,6 +43820,7 @@ <int value="-399333540" label="FiltersInRecents:disabled"/> <int value="-398922143" label="IframeOneGoogleBar:enabled"/> <int value="-398623652" label="CCTTargetTranslateLanguage:enabled"/> + <int value="-398325847" label="HelpAppCrosComponents:enabled"/> <int value="-398012541" label="CertificateTransparency2022PolicyAllCerts:enabled"/> <int value="-397959190" label="ClipboardHistory:enabled"/> @@ -47786,7 +46998,6 @@ <int value="1139756271" label="WebOTPCrossDevice:enabled"/> <int value="1140513364" label="IdentityStatusConsistency:disabled"/> <int value="1140541604" label="WinrtGeolocationImplementation:enabled"/> - <int value="1140597384" label="FillMultiLine:disabled"/> <int value="1140776731" label="WebViewForceDarkModeMatchTheme:disabled"/> <int value="1140903063" label="FuseBox:enabled"/> <int value="1141918949" label="ContextualSearchLongpressPanelHelp:enabled"/> @@ -48521,6 +47732,7 @@ <int value="1491212579" label="ChromeTipsInMainMenuNewBadge:enabled"/> <int value="1491593531" label="EnableExtensionsPermissionsForSupervisedUsersOnDesktop:disabled"/> + <int value="1491996914" label="TetheringExperimentalFunctionality:disabled"/> <int value="1492079800" label="AutofillUpstreamAllowAllEmailDomains:enabled"/> <int value="1492255992" label="OnDeviceGrammarCheck:enabled"/> <int value="1492541927" label="QuickAnswersTranslationCloudAPI:enabled"/> @@ -51671,19 +50883,6 @@ <int value="6" label="XHTML-MP document type"/> </enum> -<enum name="MetricKitExitData"> - <int value="0" label="App exited normally"/> - <int value="1" label="App exited abnormally"/> - <int value="2" label="Watchdog terminated the app"/> - <int value="3" label="App used too much CPU time"/> - <int value="4" label="App used too much memory"/> - <int value="5" label="Terminated to free up memory"/> - <int value="6" label="Suspended while having file locks"/> - <int value="7" label="Invalid memory access"/> - <int value="8" label="Illegal or undefined instruction"/> - <int value="9" label="Exceeded allocated time for background task"/> -</enum> - <enum name="MetricState"> <int value="0" label="Correctly not logged"/> <int value="1" label="Correctly logged"/> @@ -55032,13 +54231,6 @@ </int> </enum> -<enum name="OmniboxDeviceSwitcherResult"> - <int value="1" label="Unavailable"/> - <int value="2" label="Top omnibox by default"/> - <int value="3" label="Bottom omnibox by default"/> - <int value="4" label="Not a new user (user is new for 30 days after FRE)"/> -</enum> - <enum name="OmniboxFocusReason"> <int value="0" label="Omnibox tapped."/> <int value="1" label="Omnibox long-pressed (obsolete)."/> @@ -55058,11 +54250,6 @@ <int value="15" label="Drag and drop on the omnibox."/> </enum> -<enum name="OmniboxPositionType"> - <int value="0" label="Top"/> - <int value="1" label="Bottom"/> -</enum> - <!-- Not used in current metrics, see OmniboxSearchEngineType instead. --> <enum name="OmniboxSearchEngineType"> @@ -56241,15 +55428,6 @@ <int value="1" label="Restore from back-forward cache"/> </enum> -<enum name="PageLoadedSnapshotResult"> - <int value="0" label="Snapshot not attempted, page load failed"> - Snapshot was not attempted because the page load failed and would result in - a stale snapshot. - </int> - <int value="1" label="Snapshot was attempted, but the snapshot failed."/> - <int value="2" label="Snapshot was successfully taken."/> -</enum> - <enum name="PageLoadPrerenderEvent"> <int value="0" label="Prerendered Main Frame Navigation"/> <int value="1" label="Prerender Activation Navigation"/> @@ -56551,16 +55729,6 @@ label="Translate button in target language selection view clicked"/> </enum> -<enum name="PartialTranslateOutcome"> - <int value="0" label="Partial Translate success"/> - <int value="1" label="Selection too long, user cancelled"/> - <int value="2" label="Selection too long, user pressed full translate"/> - <int value="3" label="Selection empty, user cancelled"/> - <int value="4" label="Selection empty, user pressed full translate"/> - <int value="5" label="Partial translate failed, user cancelled"/> - <int value="6" label="Partial translate failed, user pressed full translate"/> -</enum> - <enum name="PartialTranslateTranslationStatus"> <int value="0" label="Partial Translate success"/> <int value="1" label="Partial Translate error"/> @@ -56801,13 +55969,6 @@ </int> </enum> -<enum name="PasswordSuggestionBottomSheetExitReason"> - <int value="0" label="Bottom Sheet dismissed"/> - <int value="1" label="Used password suggestion"/> - <int value="2" label="Accessed Password Manager through the long press menu"/> - <int value="3" label="Accessed Password Details through the long press menu"/> -</enum> - <enum name="PaymentRequestCheckoutFunnelSteps"> <int value="0" label="Initiated"/> <int value="1" label="Show() called"/> @@ -56841,13 +56002,6 @@ <int value="2" label="Regular"/> </enum> -<enum name="PaymentsSuggestionBottomSheetExitReason"> - <int value="0" label="Bottom Sheet dismissed"/> - <int value="1" label="Used payment suggestion"/> - <int value="2" label="Accessed Payment Methods through the long press menu"/> - <int value="3" label="Accessed Payment Details through the long press menu"/> -</enum> - <enum name="PDFFormTypes"> <int value="0" label="None"/> <int value="1" label="AcroForm"/> @@ -61091,11 +60245,6 @@ <int value="5" label="Legacy"/> </enum> -<enum name="PromoWithInstructionsAction"> - <int value="0" label="Close"/> - <int value="1" label="Open Instructions"/> -</enum> - <enum name="ProtoDatabaseInitState"> <summary> Track the failure and success states of proto database migration. @@ -61236,27 +60385,6 @@ <int value="8" label="No live Service Worker"/> </enum> -<enum name="PushNotificationLifecycleEvent"> - <int value="0" label="Notification received on device"/> - <int value="1" - label="Notification presented on device while is in foreground"/> - <int value="2" label="User tapped on notification"/> -</enum> - -<enum name="PushNotificationPermissionPromptStatus"> - <int value="0" label="Accpeted"/> - <int value="1" label="Declined"/> - <int value="2" label="Error"/> -</enum> - -<enum name="PushNotificationSettingsAuthorizationStatus"> - <int value="0" label="Not Determined"/> - <int value="1" label="Denied"/> - <int value="2" label="Authorized"/> - <int value="3" label="Provisional"/> - <int value="4" label="Ephemeral"/> -</enum> - <enum name="PushRegistrationStatus"> <int value="0" label="Successful - from push service"/> <int value="1" label="Service Worker not found"/> @@ -67089,17 +66217,6 @@ <int value="1" label="SearchEngine"/> </enum> -<enum name="TextSelectionDetectedEntityType"> - <int value="0" label="Unknown"/> - <int value="1" label="None"/> - <int value="2" label="Datetime"/> - <int value="3" label="Address"/> - <int value="4" label="Phone number"/> - <int value="5" label="Email"/> - <int value="6" label="ParcelTracking"/> - <int value="7" label="Measurement"/> -</enum> - <enum name="TextToSpeechEvent"> <int value="0" label="Start"/> <int value="1" label="End"/> @@ -69492,18 +68609,6 @@ <int value="23" label="Focus Mode Tray"/> </enum> -<enum name="TrendingQueryIndex"> - <summary> - Index of a trending query view on the new tab page. This is only an enum so - that the dashboard won't produce misleading statistics like averages. - </summary> - <int value="0" label="0"/> - <int value="1" label="1"/> - <int value="2" label="2"/> - <int value="3" label="3"/> - <int value="4" label="kMaxValue"/> -</enum> - <enum name="TrendingTileEvent"> <int value="0" label="Tile was shown"/> <int value="1" label="Tile was removed"/> @@ -69691,24 +68796,6 @@ <int value="4" label="Uninstall by app migration."/> </enum> -<enum name="UnitChangeTypes"> - <int value="0" label="Unchanged"/> - <int value="1" label="Imperial Area"/> - <int value="2" label="Metric Area"/> - <int value="3" label="Imperial Information Storage"/> - <int value="4" label="Metric Information Storage"/> - <int value="5" label="Imperial Length"/> - <int value="6" label="Metric Length"/> - <int value="7" label="Imperial Mass"/> - <int value="8" label="Metric Mass"/> - <int value="9" label="Imperial Speed"/> - <int value="10" label="Metric Speed"/> - <int value="11" label="Imperial Temperature"/> - <int value="12" label="Metric Temperature"/> - <int value="13" label="Imperial Volume"/> - <int value="14" label="Metric Volume"/> -</enum> - <enum name="UnlockType"> <int value="0" label="Password"/> <int value="1" label="Pin"/> @@ -70382,19 +69469,6 @@ </int> </enum> -<enum name="VariationsFirstRunSeedApplicationStage"> - <int value="0" label="Seed missing"> - No seed in native variations seed store - </int> - <int value="1" label="Seed stored"> - Seed stored in native variations seed store - </int> - <int value="2" label="Seed imported"> - Variations service imported seed from native variations seed store - </int> - <int value="3" label="Seed used">Seed is applied by variations service</int> -</enum> - <enum name="VariationsSeedExpiry"> <int value="0" label="Not Expired"/> <int value="1" label="Fetch Time Missing"/> @@ -70812,6 +69886,8 @@ <int value="3" label="Variant emoji from the popup"/> <int value="4" label="Base emoji from the chromium emoji picker"/> <int value="5" label="Variant emoji from the chromium emoji picker"/> + <int value="6" label="GIF inserted from the chromium emoji picker"/> + <int value="7" label="GIF copied from the chromium emoji picker"/> </enum> <enum name="VirtualKeyboardErrorTypeHashes"> @@ -73099,22 +72175,6 @@ <int value="6" label="Page is overridden by a different first run page"/> </enum> -<enum name="WhatsNewType"> - <int value="-1" label="Error"/> - <int value="0" label="Search Tabs"/> - <int value="1" label="New Overflow Menu"/> - <int value="2" label="Shared Highlighting"/> - <int value="3" label="Add Password Manually"/> - <int value="4" label="Use Chrome By Default"/> - <int value="5" label="Passwords In Ither Apps"/> - <int value="6" label="Autofill"/> - <int value="7" label="Incognito Tabs From Other Apps"/> - <int value="8" label="Incognito Lock"/> - <int value="9" label="Calendar Event"/> - <int value="10" label="Chrome Actions"/> - <int value="11" label="Mini Maps"/> -</enum> - <enum name="WidgetClosedReason"> <int value="0" label="Unspecified"/> <int value="1" label="EscKeyPressed"/> @@ -73136,22 +72196,6 @@ wlan0"/> </enum> -<enum name="WindowActivityOrigin"> - <int value="0" label="WindowActivityUnknwonOrigin"/> - <int value="1" label="WindowActivityExternalOrigin"/> - <int value="2" label="WindowActivityRestoredOrigin"/> - <int value="3" label="WindowActivityContextMenuOrigin"/> - <int value="4" label="WindowActivityReadingListOrigin"/> - <int value="5" label="WindowActivityBookmarksOrigin"/> - <int value="6" label="WindowActivityHistoryOrigin"/> - <int value="7" label="WindowActivityToolsOrigin"/> - <int value="8" label="WindowActivityRecentTabsOrigin"/> - <int value="9" label="WindowActivityLocationBarSteadyViewOrigin"/> - <int value="10" label="WindowActivityContentSuggestionsOrigin"/> - <int value="11" label="WindowActivityTabDragOrigin"/> - <int value="12" label="WindowActivityKeyCommandOrigin"/> -</enum> - <enum name="WindowOpenDisposition"> <int value="0" label="Unknown"/> <int value="1" label="Current Tab"/>
diff --git a/tools/metrics/histograms/histograms_index.txt b/tools/metrics/histograms/histograms_index.txt index 7223c90..28d25982 100644 --- a/tools/metrics/histograms/histograms_index.txt +++ b/tools/metrics/histograms/histograms_index.txt
@@ -80,6 +80,7 @@ tools/metrics/histograms/metadata/installer/histograms.xml tools/metrics/histograms/metadata/interstitial/histograms.xml tools/metrics/histograms/metadata/invalidation/histograms.xml +tools/metrics/histograms/metadata/ios/enums.xml tools/metrics/histograms/metadata/ios/histograms.xml tools/metrics/histograms/metadata/kerberos/histograms.xml tools/metrics/histograms/metadata/kiosk/histograms.xml
diff --git a/tools/metrics/histograms/metadata/android/histograms.xml b/tools/metrics/histograms/metadata/android/histograms.xml index 69a11e1..44793c1 100644 --- a/tools/metrics/histograms/metadata/android/histograms.xml +++ b/tools/metrics/histograms/metadata/android/histograms.xml
@@ -1086,7 +1086,7 @@ </histogram> <histogram name="Android.DragDrop.Image.OpenFileTime.AllExpired" units="ms" - expires_after="2023-12-17"> + expires_after="2024-04-28"> <owner>shuyng@google.com</owner> <owner>clank-large-form-factors@google.com</owner> <summary> @@ -1106,7 +1106,7 @@ </histogram> <histogram name="Android.DragDrop.Image.OpenFileTime.FirstAttempt" units="ms" - expires_after="2023-12-17"> + expires_after="2024-04-28"> <owner>shuyng@google.com</owner> <owner>clank-large-form-factors@google.com</owner> <summary> @@ -1120,7 +1120,7 @@ </histogram> <histogram name="Android.DragDrop.Image.OpenFileTime.FirstExpired" units="ms" - expires_after="2023-12-17"> + expires_after="2024-04-28"> <owner>shuyng@google.com</owner> <owner>clank-large-form-factors@google.com</owner> <summary> @@ -1139,7 +1139,7 @@ </histogram> <histogram name="Android.DragDrop.Image.OpenFileTime.LastAttempt" units="ms" - expires_after="2023-12-17"> + expires_after="2024-04-28"> <owner>shuyng@google.com</owner> <owner>clank-large-form-factors@google.com</owner> <summary> @@ -1166,7 +1166,7 @@ </histogram> <histogram name="Android.DragDrop.Image.UriCreatedInterval" units="ms" - expires_after="2023-12-17"> + expires_after="2024-04-28"> <owner>shuyng@google.com</owner> <owner>clank-large-form-factors@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/auto/histograms.xml b/tools/metrics/histograms/metadata/auto/histograms.xml index e8224c4..3aea35c 100644 --- a/tools/metrics/histograms/metadata/auto/histograms.xml +++ b/tools/metrics/histograms/metadata/auto/histograms.xml
@@ -29,7 +29,7 @@ <histogram name="AutoScreenBrightness.AdapterDecisionAtUserChange.BrightnessChange.Cause" - enum="AutoScreenBrightnessBrightnessChangeCause" expires_after="2023-10-31"> + enum="AutoScreenBrightnessBrightnessChangeCause" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -41,7 +41,7 @@ <histogram base="true" name="AutoScreenBrightness.AdapterDecisionAtUserChange.ModelIteration" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <!-- Name completed by histogram_suffixes name="AdapterDecision" --> <owner>thanhdng@chromium.org</owner> @@ -56,7 +56,7 @@ <histogram name="AutoScreenBrightness.AdapterDecisionAtUserChange.NoBrightnessChange.Cause" enum="AutoScreenBrightnessNoBrightnessChangeCause" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -68,7 +68,7 @@ <histogram name="AutoScreenBrightness.AdapterDecisionAtUserChange.Unknown.AlsStd" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <!-- Name completed by histogram_suffixes name="AdapterDecision" --> <owner>thanhdng@chromium.org</owner> @@ -83,7 +83,7 @@ <histogram name="AutoScreenBrightness.AdapterDecisionAtUserChange.{AlsBrightnessDirection}AlsDelta" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -100,7 +100,7 @@ <histogram name="AutoScreenBrightness.AdapterDecisionAtUserChange.{AlsBrightnessDirection}AlsStd" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -124,14 +124,14 @@ </histogram> <histogram name="AutoScreenBrightness.BrightnessChange.Cause" - enum="AutoScreenBrightnessBrightnessChangeCause" expires_after="2023-10-31"> + enum="AutoScreenBrightnessBrightnessChangeCause" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary>Reason for the model to change brightness. Chrome OS only.</summary> </histogram> <histogram name="AutoScreenBrightness.BrightnessChange.ElapsedTime" units="ms" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -140,7 +140,7 @@ </histogram> <histogram name="AutoScreenBrightness.BrightnessChange.ModelIteration" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -151,7 +151,7 @@ <histogram name="AutoScreenBrightness.BrightnessMonitorStatus" enum="AutoScreenBrightnessBrightnessMonitorStatus" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -161,7 +161,7 @@ </histogram> <histogram name="AutoScreenBrightness.DailyUserAdjustment.Atlas" units="count" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -177,7 +177,7 @@ </histogram> <histogram name="AutoScreenBrightness.DailyUserAdjustment.Eve" units="count" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -208,7 +208,7 @@ </histogram> <histogram name="AutoScreenBrightness.DailyUserAdjustment.NoAls" units="count" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -223,7 +223,7 @@ </histogram> <histogram name="AutoScreenBrightness.DailyUserAdjustment.Nocturne" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -239,7 +239,7 @@ </histogram> <histogram name="AutoScreenBrightness.DailyUserAdjustment.SupportedAls" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -254,7 +254,7 @@ </histogram> <histogram name="AutoScreenBrightness.DailyUserAdjustment.UnsupportedAls" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -269,7 +269,7 @@ </histogram> <histogram name="AutoScreenBrightness.DataError" - enum="AutoScreenBrightnessDataError" expires_after="2023-10-31"> + enum="AutoScreenBrightnessDataError" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -280,7 +280,7 @@ <histogram name="AutoScreenBrightness.ElapsedTimeBetweenModelAndUserAdjustments" - units="ms" expires_after="2023-10-31"> + units="ms" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -297,7 +297,7 @@ </histogram> <histogram name="AutoScreenBrightness.InvalidCurveReason" - enum="AutoScreenBrightnessInvalidCurveReason" expires_after="2023-10-31"> + enum="AutoScreenBrightnessInvalidCurveReason" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -329,7 +329,7 @@ </histogram> <histogram name="AutoScreenBrightness.ModelIterationCountAtInitialization" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>napper@chromium.org</owner> <owner>tby@chromium.org</owner> @@ -339,7 +339,7 @@ </histogram> <histogram name="AutoScreenBrightness.ModelLoadingStatus" - enum="AutoScreenBrightnessModelLoadingStatus" expires_after="2023-10-31"> + enum="AutoScreenBrightnessModelLoadingStatus" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>napper@chromium.org</owner> <owner>tby@chromium.org</owner> @@ -348,7 +348,7 @@ <histogram name="AutoScreenBrightness.ModelTraining.BrightnessChange" enum="AutoScreenBrightnessBoundedBrightnessChange" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -358,7 +358,7 @@ </histogram> <histogram name="AutoScreenBrightness.ModelTraining.BrightnessOutlier" - enum="Boolean" expires_after="2023-10-31"> + enum="Boolean" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -368,7 +368,7 @@ </histogram> <histogram name="AutoScreenBrightness.ModelTraining.Inaccuracy.NoUpdate" - units="%" expires_after="2023-10-31"> + units="%" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>napper@chromium.org</owner> <owner>tby@chromium.org</owner> @@ -380,7 +380,7 @@ </histogram> <histogram name="AutoScreenBrightness.ModelTraining.Inaccuracy.Update" - units="%" expires_after="2023-10-31"> + units="%" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>napper@chromium.org</owner> <owner>tby@chromium.org</owner> @@ -392,7 +392,7 @@ </histogram> <histogram name="AutoScreenBrightness.ModelTraining.ModelUserConsistent" - enum="Boolean" expires_after="2023-10-31"> + enum="Boolean" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -402,7 +402,7 @@ </histogram> <histogram name="AutoScreenBrightness.NewCurveSaved.Duration" units="ms" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -413,7 +413,7 @@ </histogram> <histogram name="AutoScreenBrightness.NewCurveSaved.Success" - enum="BooleanSuccess" expires_after="2023-10-31"> + enum="BooleanSuccess" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -423,7 +423,7 @@ </histogram> <histogram name="AutoScreenBrightness.Opposite.UserModelBrightnessAdjustments" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -435,7 +435,7 @@ </histogram> <histogram name="AutoScreenBrightness.ParameterError" - enum="AutoScreenBrightnessParameterError" expires_after="2023-10-31"> + enum="AutoScreenBrightnessParameterError" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -445,7 +445,7 @@ </histogram> <histogram name="AutoScreenBrightness.PersonalCurveValid" enum="BooleanValid" - expires_after="2023-10-31"> + expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -454,7 +454,7 @@ </histogram> <histogram name="AutoScreenBrightness.Same.UserModelBrightnessAdjustments" - units="count" expires_after="2023-10-31"> + units="count" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -466,7 +466,7 @@ </histogram> <histogram name="AutoScreenBrightness.TrainingCompleteDuration.NewCurve" - units="ms" expires_after="2023-10-31"> + units="ms" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary> @@ -476,7 +476,7 @@ </histogram> <histogram name="AutoScreenBrightness.TrainingCompleteDuration.NoNewCurve" - units="ms" expires_after="2023-10-31"> + units="ms" expires_after="2024-04-30"> <owner>thanhdng@chromium.org</owner> <owner>tby@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/blink/histograms.xml b/tools/metrics/histograms/metadata/blink/histograms.xml index fd7afcc..c6b13b66 100644 --- a/tools/metrics/histograms/metadata/blink/histograms.xml +++ b/tools/metrics/histograms/metadata/blink/histograms.xml
@@ -2438,18 +2438,6 @@ </summary> </histogram> -<histogram name="Blink.ImageDecoders.Jpeg.ColorSpace" enum="JpegColorSpace" - expires_after="2022-11-13"> - <owner>andrescj@chromium.org</owner> - <owner>mcasas@chromium.org</owner> - <summary> - JPEG color space of a decoded image as guessed by libjpeg_turbo. Recorded - after decoding is done by Blink's JPEG decoder (as opposed to, possibly, a - hardware decode accelerator). When the color space is YCbCr, the chroma - subsampling is also recorded. - </summary> -</histogram> - <histogram base="true" name="Blink.ImplCompositorCommit.UpdateTime" units="microseconds" expires_after="2024-06-01"> <!-- Name completed by histogram_suffixes name="BlinkUpdateTimePreFCPSuffixes" -->
diff --git a/tools/metrics/histograms/metadata/chromeos/histograms.xml b/tools/metrics/histograms/metadata/chromeos/histograms.xml index 3c0abad..ae105849 100644 --- a/tools/metrics/histograms/metadata/chromeos/histograms.xml +++ b/tools/metrics/histograms/metadata/chromeos/histograms.xml
@@ -2803,6 +2803,22 @@ </histogram> <histogram + name="ChromeOS.Settings.Device.{Peripheral}.ButtonRemapping.AcceleratorAction.Changed" + enum="AcceleratorAction" expires_after="2024-03-22"> + <owner>dpad@google.com</owner> + <owner>cros-peripherals@google.com</owner> + <summary> + Records the value of the button_remapping AcceleratorAction property when + the {Peripheral} device button_remapping is changed. + </summary> + <token key="Peripheral"> + <variant name="GraphicsTablet"/> + <variant name="GraphicsTabletPen"/> + <variant name="Mouse"/> + </token> +</histogram> + +<histogram name="ChromeOS.Settings.Device.{Peripheral}.ButtonRemapping.AcceleratorAction.Initial" enum="AcceleratorAction" expires_after="2024-03-22"> <owner>dpad@google.com</owner> @@ -2819,6 +2835,26 @@ </histogram> <histogram + name="ChromeOS.Settings.Device.{Peripheral}.ButtonRemapping.KeyEvent.Changed" + units="KeyEventEncodedInt" expires_after="2024-03-22"> + <owner>dpad@google.com</owner> + <owner>cros-peripherals@google.com</owner> + <summary> + Records the value of the button_remapping KeyEvent property when the + {Peripheral} device button_remapping is changed. A KeyEvent is encoded as an + int where the low 16 bits represent the KeyEvent's KeyboardCode/vkey, and + the high 16 bits represent the KeyEvent's modifiers. See + ui/events/keycodes/keyboard_codes_posix.h for the KeyboardCode values. and + ui/events/event_constants.h for the modifier values. + </summary> + <token key="Peripheral"> + <variant name="GraphicsTablet"/> + <variant name="GraphicsTabletPen"/> + <variant name="Mouse"/> + </token> +</histogram> + +<histogram name="ChromeOS.Settings.Device.{Peripheral}.ButtonRemapping.KeyEvent.Initial" units="KeyEventEncodedInt" expires_after="2024-03-22"> <owner>dpad@google.com</owner> @@ -2873,6 +2909,22 @@ </histogram> <histogram + name="ChromeOS.Settings.Device.{Peripheral}.ButtonRemapping.StaticShortcutAction.Changed" + enum="DeviceSettingsStaticShortcutAction" expires_after="2024-03-22"> + <owner>dpad@google.com</owner> + <owner>cros-peripherals@google.com</owner> + <summary> + Records the value of the button_remapping StaticShortcutAction property when + the {Peripheral} device button_remapping is changed. + </summary> + <token key="Peripheral"> + <variant name="GraphicsTablet"/> + <variant name="GraphicsTabletPen"/> + <variant name="Mouse"/> + </token> +</histogram> + +<histogram name="ChromeOS.Settings.Device.{Peripheral}.ButtonRemapping.StaticShortcutAction.Initial" enum="DeviceSettingsStaticShortcutAction" expires_after="2024-03-22"> <owner>dpad@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/compose/histograms.xml b/tools/metrics/histograms/metadata/compose/histograms.xml index 9aba7784..35a0507 100644 --- a/tools/metrics/histograms/metadata/compose/histograms.xml +++ b/tools/metrics/histograms/metadata/compose/histograms.xml
@@ -45,6 +45,16 @@ </summary> </histogram> +<histogram name="Compose.Dialog.OpenLatency" units="ms" + expires_after="2024-03-31"> + <owner>cuianthony@chromium.org</owner> + <owner>chrome-compose-frontend@google.com</owner> + <summary> + Time in milliseconds between triggering the Compose dialog to open and it + being shown and interactable. Logged each time the dialog is shown. + </summary> +</histogram> + <histogram name="Compose.Response.Duration.Error" units="ms" expires_after="2024-03-31"> <owner>perrier@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/enterprise/histograms.xml b/tools/metrics/histograms/metadata/enterprise/histograms.xml index ccd7326..2553d3b 100644 --- a/tools/metrics/histograms/metadata/enterprise/histograms.xml +++ b/tools/metrics/histograms/metadata/enterprise/histograms.xml
@@ -2561,7 +2561,7 @@ </histogram> <histogram name="Enterprise.ProfileIdentifier.Error" - enum="EnterpriseProfileIdError" expires_after="2023-11-10"> + enum="EnterpriseProfileIdError" expires_after="2024-11-08"> <owner>hmare@google.com</owner> <owner>cbe-device-trust-eng@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/extensions/histograms.xml b/tools/metrics/histograms/metadata/extensions/histograms.xml index 6ffdb813..382e793 100644 --- a/tools/metrics/histograms/metadata/extensions/histograms.xml +++ b/tools/metrics/histograms/metadata/extensions/histograms.xml
@@ -1224,6 +1224,18 @@ chosen based on when the majority of events are ack'd. </summary> <token key="BackgroundContextType"> + <variant name="ExtensionPage" + summary="event page. However, unlike for other contexts that only + emit if the the event fired in the background page of the + extension, this will emit for all events that run in the + event page extension renderer process (event page, tabs, + popups, etc.). Note: this should not be used to perfectly + compare against other contexts like service workers where + the above is not true. But we are presuming that since the + other pages that run in the process are persistent, they + will generally never be stale and so won't skew the data + significantly in the failure case and are therefore mostly + comparable."/> <variant name="ExtensionServiceWorker2" summary="service worker. Replaced previous version because values were inconsistent with excluding
diff --git a/tools/metrics/histograms/metadata/file/histograms.xml b/tools/metrics/histograms/metadata/file/histograms.xml index 83218cf..e6fbec8 100644 --- a/tools/metrics/histograms/metadata/file/histograms.xml +++ b/tools/metrics/histograms/metadata/file/histograms.xml
@@ -54,6 +54,11 @@ 365"/> </variants> +<variants name="GraphApiGetDeltaCallType"> + <variant name="GetDeltaIncremental" summary="incremental delta HTTP call"/> + <variant name="GetDeltaInitial" summary="initial delta HTTP call"/> +</variants> + <variants name="GraphAPIMethod"> <variant name="CopyEntry"/> <variant name="CreateDirectory"/> @@ -70,6 +75,10 @@ summary="incremental delta fetch (sum of all result pages)"/> <variant name="GetDeltaAllInitial" summary="initial delta fetch (sum of all result pages)"/> + <variant name="GetDeltaIncremental" + summary="incremental delta HTTP call fetching a single results page"/> + <variant name="GetDeltaInitial" + summary="initial delta HTTP call fetching a single results page"/> <variant name="GetDrive"/> <variant name="GetEntry"/> <variant name="GetProfile"/> @@ -984,6 +993,19 @@ </histogram> <histogram + name="FileBrowser.OfficeFiles.ODFS.GraphAPI.LastResponseCode.{GetDeltaCallType}" + enum="OfficeGraphAPIResult" expires_after="M124"> + <owner>simmonsjosh@google.com</owner> + <owner>src/ui/file_manager/OWNERS</owner> + <summary> + Chrome OS File Browser: Records the status code of the last request in a + logical group of "get delta" calls, where each request fetches a + single page. + </summary> + <token key="GetDeltaCallType" variants="GraphApiGetDeltaCallType"/> +</histogram> + +<histogram name="FileBrowser.OfficeFiles.ODFS.GraphAPI.ResponseCode.{GraphAPIMethod}" enum="OfficeGraphAPIResult" expires_after="M124"> <owner>simmonsjosh@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/ios/enums.xml b/tools/metrics/histograms/metadata/ios/enums.xml new file mode 100644 index 0000000..b4c1f538 --- /dev/null +++ b/tools/metrics/histograms/metadata/ios/enums.xml
@@ -0,0 +1,989 @@ +<!-- +Copyright 2023 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<!-- + +This file describes the enumerations referenced by entries in histograms.xml for +this directory. Some enums may instead be listed in the central enums.xml file +at src/tools/metrics/histograms/enums.xml when multiple files use them. + +For best practices on writing enumerations descriptions, see +https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md#Enum-Histograms + +Please follow the instructions in the OWNERS file in this directory to find a +reviewer. If no OWNERS file exists, please consider signing up at +go/reviewing-metrics (Googlers only), as all subdirectories are expected to +have an OWNERS file. As a last resort you can send the CL to +chromium-metrics-reviews@google.com. +--> + +<histogram-configuration> + +<!-- Enum types --> + +<enums> + +<enum name="BooleanEligible"> + <int value="0" label="Not elibible"/> + <int value="1" label="Eligible"/> +</enum> + +<enum name="CaptivePortalStatus"> + <int value="0" label="UNKNOWN"/> + <int value="1" label="OFFLINE"/> + <int value="2" label="ONLINE"/> + <int value="3" label="PORTAL"/> + <int value="4" label="PROXY_AUTH_REQUIRED"/> +</enum> + +<enum name="CrFullscreenState"> + <int value="0" label="Entering Fullscreen State"/> + <int value="1" label="Exiting Fullscreen State"/> + <int value="2" label="In Fullscreen"/> + <int value="3" label="Not In Fullscreen"/> +</enum> + +<enum name="DesktopIOSPasswordPromoAction"> + <int value="0" label="Dismissed"/> + <int value="1" label="ExplicitlyClosed"/> + <int value="2" label="GetStartedClicked"/> +</enum> + +<enum name="DesktopIOSPasswordPromoImpression"> + <int value="0" label="FirstImpression"/> + <int value="1" label="SecondImpression"/> +</enum> + +<enum name="ExperienceKitCalendarTypes"> + <summary> + This list corresponds to the calendar providers supported by Experience Kit + on iOS. + </summary> + <int value="0" label="Google Calendar"/> + <int value="1" label="Apple Calendar"/> +</enum> + +<enum name="FormInputAccessoryAction"> + <int value="0" label="PreviousElement"/> + <int value="1" label="NextElement"/> + <int value="2" label="Done"/> + <int value="3" label="Unkown"/> +</enum> + +<enum name="InactiveTabsThresholdSettingType"> + <int value="0" label="Unknown"/> + <int value="1" label="Never Move"/> + <int value="2" label="One Week"/> + <int value="3" label="Two Weeks"/> + <int value="4" label="Three Weeks"/> + <int value="5" label="Default Value"/> +</enum> + +<enum name="IncognitoInterstitialActionType"> + <int value="0" label="Unknown"/> + <int value="1" label="Open in Chrome Incognito"/> + <int value="2" label="Open in Chrome (in a normal tab)"/> + <int value="3" label="Cancel"/> + <int value="4" label="Learn more about Incognito"/> + <int value="5" label="Dismissed by external event"/> +</enum> + +<enum name="IncognitoInterstitialSettingsActionType"> + <int value="0" label="Unknown"/> + <int value="1" label="Enabled"/> + <int value="2" label="Disabled"/> +</enum> + +<enum name="IOSBringAndroidTabsPromptActionType"> + <int value="0" label="Review tabs"/> + <int value="1" label="Open tabs"/> + <int value="2" label="Cancel"/> + <int value="3" label="Swipe to dismiss"/> +</enum> + +<enum name="IOSBringAndroidTabsTabsListActionType"> + <int value="0" label="Cancel"/> + <int value="1" label="Swipe down"/> + <int value="2" label="Open tabs"/> +</enum> + +<enum name="iOSCredentialIdentityStoreErrorForReporting"> + <int value="0" label="Unknown Error"/> + <int value="1" label="Internal Error"/> + <int value="2" label="Store Disabled"/> + <int value="3" label="Store Busy"/> +</enum> + +<enum name="IOSCredentialProviderNewCredentialUsername"> + <int value="0" label="Credential With Username"/> + <int value="1" label="Credential Without Username"/> +</enum> + +<enum name="IOSCredentialProviderPasswordCreated"> + <int value="0" label="Password Manually Added"/> + <int value="1" label="Password Suggested"/> + <int value="2" label="Password Suggested and Manually Changed"/> +</enum> + +<enum name="IOSCredentialProviderPromoAction"> + <int value="0" label="Learn More"/> + <int value="1" label="Go To Settings"/> + <int value="2" label="Remind me later"/> + <int value="3" label="No"/> +</enum> + +<enum name="IOSCredentialProviderPromoSource"> + <int value="0" label="Unknown"/> + <int value="1" label="Password Copied"/> + <int value="2" label="Password Saved"/> + <int value="3" label="Autofill Used"/> + <int value="4" label="Set Up List"/> +</enum> + +<enum name="IOSDefaultBrowserFullscreenPromoAction"> + <int value="0" label="Action Button"/> + <int value="1" label="Cancel"/> + <int value="2" label="Remind Me Later"/> + <int value="3" label="Dismiss"/> +</enum> + +<enum name="IOSDefaultBrowserPromoNonModalAction"> + <int value="0" label="Accepted"/> + <int value="1" label="Appear"/> + <int value="2" label="Dismiss"/> + <int value="3" label="Timeout"/> + <int value="4" label="Background prevented impression"/> +</enum> + +<enum name="IOSDefaultBrowserPromoType"> + <int value="0" label="General"/> + <int value="1" label="Made for iOS"/> + <int value="2" label="Stay Safe"/> + <int value="3" label="All Tabs"/> +</enum> + +<enum name="IOSDefaultBrowserVideoPromoAction"> + <int value="0" label="Primary Action Button"/> + <int value="1" label="Secondary Action Button"/> + <int value="2" label="Swipe Down"/> +</enum> + +<enum name="IOSEditMenuActions"> + <int value="0" label="Invalid"/> + <int value="1" label="NativeCut"/> + <int value="2" label="NativeCopy"/> + <int value="3" label="NativePaste"/> + <int value="4" label="NativeDelete"/> + <int value="5" label="NativeSelect"/> + <int value="6" label="NativeSelectAll"/> + <int value="7" label="NativeReplace"/> + <int value="8" label="NativeTransliterateChinese"/> + <int value="9" label="NativeInsertDrawing"/> + <int value="10" label="NativeScanText"/> + <int value="11" label="NativeStyleBold"/> + <int value="12" label="NativeStyleItalic"/> + <int value="13" label="NativeStyleUnderline"/> + <int value="14" label="NativeRTL"/> + <int value="15" label="NativeLTR"/> + <int value="16" label="NativeFindSelection"/> + <int value="17" label="NativeDefine"/> + <int value="18" label="NativeTranslate"/> + <int value="19" label="NativeLearn"/> + <int value="20" label="NativeSpeak"/> + <int value="21" label="NativeSpeakMore"/> + <int value="22" label="NativePause"/> + <int value="23" label="NativeShare"/> + <int value="24" label="ChromeLinkToText"/> + <int value="25" label="ChromePartialTranslate"/> + <int value="26" label="CommandOther"/> + <int value="27" label="SearchWeb"/> + <int value="28" label="CreateEvent"/> + <int value="29" label="CreateReminder"/> + <int value="30" label="ShowCalendar"/> + <int value="31" label="SendMail"/> + <int value="32" label="SendMessage"/> + <int value="33" label="AddToContacts"/> + <int value="34" label="Call"/> + <int value="35" label="GetDirections"/> + <int value="36" label="OpenMaps"/> + <int value="37" label="UnitConversion"/> + <int value="38" label="OtherDataDetector"/> + <int value="39" label="ActionOther"/> + <int value="40" label="UnknownMenuAction"/> + <int value="41" label="OpenURL"/> + <int value="42" label="AddToReadingList"/> + <int value="43" label="SearchWith"/> +</enum> + +<enum name="IOSEditMenuError"> + <int value="0" label="First method install failed"/> + <int value="1" label="Second method install failed"/> + <int value="2" label="Unexpected paramters on dismiss"/> + <int value="3" label="Unexpected object structure on dismiss"/> +</enum> + +<enum name="IOSEditMenuPage"> + <int value="0" label="Invalid"/> + <int value="1" label="1 out of 1"/> + <int value="2" label="1 out of 2"/> + <int value="3" label="2 out of 2"/> + <int value="4" label="1 out of 3"/> + <int value="5" label="2 out of 3"/> + <int value="6" label="3 out of 3"/> + <int value="7" label="1 out of 4"/> + <int value="8" label="2 out of 4"/> + <int value="9" label="3 out of 4"/> + <int value="10" label="4 out of 4"/> + <int value="11" label="1 out of N"/> + <int value="12" label="2 out of N"/> + <int value="13" label="3 out of N"/> + <int value="14" label="4 out of N"/> + <int value="15" label="5 out of N"/> + <int value="16" label="6 out of N"/> + <int value="17" label="7 out of N"/> + <int value="18" label="8 out of N"/> + <int value="19" label="9 out of N"/> + <int value="20" label="10 out of N"/> + <int value="21" label="More Than Ten"/> +</enum> + +<enum name="IOSErrorPagePresentationFailed"> + <int value="0" label="Unknown"/> + <int value="1" label="Web View Released Error"/> + <int value="2" label="JavaScript Exception Occurred"/> + <int value="3" label="Other WKErrorDomain Error"/> +</enum> + +<enum name="IOSHandoffOrigin"> + <int value="0" label="Unknown Origin"/> + <int value="1" label="Chrome on iOS"/> + <int value="2" label="Chrome on Mac"/> +</enum> + +<enum name="IOSHomeActionType"> + <int value="0" label="Most Visited Tiles"/> + <int value="1" label="Shortcuts"/> + <int value="2" label="Return to Recent Tab tile"/> + <int value="3" label="Feed Card"/> + <int value="4" label="Fake Omnibox tap"/> + <int value="5" label="Set Up List"/> + <int value="6" label="Omnibox navigation"/> + <int value="7" label="Safety Check tile"/> + <int value="8" label="Parcel Tracking tile"/> + <int value="9" label="Distant tab resumption tile"/> +</enum> + +<enum name="IOSITunesURLsStoreKitHandlingResult"> + <int value="0" label="Handling failed"/> + <int value="1" label="Single App URL, handled"/> + <int value="2" label="App Bundle URL, handled"/> + <int value="3" label="App Bundle URL, not handled"/> +</enum> + +<enum name="IOSJavascriptContentBlockType"> + <int value="0" label="Cookie"/> + <int value="1" label="Local Storage"/> + <int value="2" label="Session Storage"/> +</enum> + +<enum name="IOSLaunchSource"> + <summary>The way the app was launched on iOS.</summary> + <int value="0" label="App Icon"/> + <int value="1" label="Long Press on App Icon"/> + <int value="2" label="Widget"/> + <int value="3" label="Spotlight Chrome (e.g. bookmark)"/> + <int value="4" label="Link Opened by OS - Default Intent"/> + <int value="5" label="Link Opened Specifically in Chrome from App"/> + <int value="6" label="Siri Shortcut"/> + <int value="7" label="X-Callback (incl. link shared to Chrome)"/> + <int value="8" label="Handoff"/> + <int value="9" label="Notification"/> +</enum> + +<enum name="IOSMagicStackModuleType"> + <int value="0" label="Most Visited Tiles"/> + <int value="1" label="Shortcuts"/> + <int value="2" label="Set Up List Sync"/> + <int value="3" label="Set Up List Default Browser"/> + <int value="4" label="Set Up List Autofill"/> + <int value="5" label="Set Up List Compacted"/> + <int value="6" label="Set Up List All Set"/> + <int value="7" label="Safety Check"/> + <int value="8" label="Safety Check Multi Row"/> + <int value="9" label="Safety Check Multi Row Overflow"/> + <int value="10" label="Tab Resumption"/> + <int value="11" label="Parcel Tracking"/> + <int value="12" label="Parcel Tracking See More"/> +</enum> + +<enum name="IOSMainThreadFreezeDetectionNotRunningAfterReportBlock"> + <int value="0" label="After Breakpad Ref"> + Freeze detection stopped after obtaining the breakpad lock. + </int> + <int value="1" label="After FileManager UTE move"> + Freeze detection stopped after moving the hang report out of the Breakpad + directory and into the |UTE| directory. + </int> + <int value="2" label="After Crashpad DumpWithoutCrash"> + Freeze detection stopped after calling DumpWithCrash from Crashpad. + </int> +</enum> + +<enum name="IOSMiniMapConsentOutcome"> + <int value="0" label="Consent was not required"/> + <int value="1" label="Consent was skipped (already granted)."/> + <int value="2" label="User accepted"/> + <int value="3" label="User declined"/> + <int value="4" label="User opened settings (double count)"/> + <int value="5" label="User dismissed"/> + <int value="6" label="Popover displayed"/> +</enum> + +<enum name="IOSMultiWindowConfiguration"> + <int value="0" label="Unspecified"/> + <int value="1" label="Fullscreen"/> + <int value="2" label="Fullscreen with Slideover"/> + <int value="3" label="Shared Standard"/> + <int value="4" label="Shared Standard with Slideover"/> + <int value="5" label="Shared Compact"/> + <int value="6" label="Shared Compact with Slideover"/> + <int value="7" label="Slideover"/> + <int value="8" label="Standard beside Standard"/> + <int value="9" label="Standard beside Standard with Slideover"/> + <int value="10" label="Standard beside Compact"/> + <int value="11" label="Standard beside Compact with Slideover"/> + <int value="12" label="Compact beside Compact"/> + <int value="13" label="Compact beside Compact with Slideover"/> +</enum> + +<enum name="IOSNTPImpressionType"> + <int value="0" label="Feed disabled"/> + <int value="1" label="Feed visible"/> + <int value="2" label="Feed collapsed"/> +</enum> + +<enum name="IOSNTPNewBadgeShownResult"> + <int value="0" label="Shown"/> + <int value="1" label="Not shown due to limit reached"/> + <int value="2" + label="Not shown due to the button already having been pressed"/> +</enum> + +<enum name="IOSNTPOverscrollAction"> + <int value="0" label="Open New Tab"/> + <int value="1" label="Pull to Refresh"/> + <int value="2" label="Close Tab"/> +</enum> + +<enum name="IOSOpenExtensionOutcome"> + <int value="0" label="Open Extension Success"/> + <int value="1" label="Open Extension Invalid outcome"/> + <int value="2" label="Open Extension Invalid URL"/> + <int value="3" label="Open Extension URL not found"/> + <int value="4" label="Open Extension Method not found"/> + <int value="5" label="Open Extension Unsupported scheme"/> +</enum> + +<enum name="IOSOpenInDownloadResult"> + <int value="0" label="Download Succeeded"/> + <int value="1" label="Download Canceled"> + User canceled the download manually. + </int> + <int value="2" label="Download Failed"> + Download failed either by getting a corrupted file or no file at all. + </int> +</enum> + +<enum name="IOSOpenInMimeType"> + <int value="0" label="Not handled"/> + <int value="1" label="PDF"/> + <int value="2" label="Microsof tWord"/> + <int value="3" label="Microsoft Word OpenXML"/> + <int value="4" label="JPEG"/> + <int value="5" label="PNG"/> + <int value="6" label="Microsoft PowerPoint"/> + <int value="7" label="Microsoft PowerPoint OpenXML"/> + <int value="8" label="RTF"/> + <int value="9" label="SVG"/> + <int value="10" label="Microsoft Excel"/> + <int value="11" label="Microsoft Excel OpenXML"/> +</enum> + +<enum name="IOSOverflowMenuAction"> + <int value="0" label="Reload"/> + <int value="1" label="NewTab"/> + <int value="2" label="NewIncognitoTab"/> + <int value="3" label="NewWindow"/> + <int value="4" label="Follow"/> + <int value="5" label="Bookmark"/> + <int value="6" label="ReadingList"/> + <int value="7" label="ClearBrowsingData"/> + <int value="8" label="Translate"/> + <int value="9" label="DesktopSite"/> + <int value="10" label="FindInPage"/> + <int value="11" label="TextZoom"/> + <int value="12" label="ReportAnIssue"/> + <int value="13" label="Help"/> + <int value="14" label="ShareChrome"/> + <int value="15" label="EditActions"/> +</enum> + +<enum name="IOSOverflowMenuActionType"> + <int value="0" label="No scroll, no action"/> + <int value="1" label="Scroll, no action"/> + <int value="2" label="No scroll, action"/> + <int value="3" label="Scroll, action"/> +</enum> + +<enum name="IOSOverflowMenuDestination"> + <int value="0" label="Bookmarks"/> + <int value="1" label="History"/> + <int value="2" label="ReadingList"/> + <int value="3" label="Passwords"/> + <int value="4" label="Downloads"/> + <int value="5" label="RecentTabs"/> + <int value="6" label="SiteInfo"/> + <int value="7" label="Settings"/> + <int value="8" label="WhatsNew"/> + <int value="9" label="SpotlightDebugger"/> + <int value="10" label="PriceNotifications"/> +</enum> + +<enum name="IOSOverflowMenuReorderingReason"> + <int value="0" label="Error Badge"/> + <int value="1" label="New Badge"/> + <int value="2" label="Both Badges"/> +</enum> + +<enum name="IOSOverflowMenuSmartSortingChange"> + <int value="0" label="Newly Enabled"/> + <int value="1" label="Newly Disabled"/> +</enum> + +<enum name="IOSPageLoadCountNavigationType"> + <int value="0" label="Chrome URL Navigation"/> + <int value="1" label="Same Document Web Navigation"/> + <int value="2" label="Page Load Navigation"/> + <int value="3" label="Obsolete - Loading Started"/> +</enum> + +<enum name="IOSParcelTrackingOptInActionOnPrompt"> + <int value="0" label="AskEveryTime"/> + <int value="1" label="AlwaysTrack"/> + <int value="2" label="NoThanks"/> + <int value="3" label="SwipeToDismiss"/> +</enum> + +<enum name="IOSPermissionEvent"> + <int value="0" label="Camera permission disabled"/> + <int value="1" label="Camera permission enabled"/> + <int value="2" label="Microphone permission disabled"/> + <int value="3" label="Microphone permission enabled"/> +</enum> + +<enum name="IOSPermissionRequest"> + <int value="0" label="Camera permission"/> + <int value="1" label="Microphone permission"/> + <int value="2" label="Camera and Microphone permissions"/> +</enum> + +<enum name="IOSPostRestoreDefaultBrowserActionOnPrompt"> + <int value="0" label="No Thanks"/> + <int value="1" label="Go To Settings"/> + <int value="2" label="Swipe to Dismiss"/> +</enum> + +<enum name="IOSPostRestoreSigninChoice"> + <int value="0" label="Continue"/> + <int value="1" label="Dismiss"/> +</enum> + +<enum name="IOSPromosManagerPromo"> + <int value="0" label="Test Promo"/> +<!-- Default Browser (Fullscreen) not in use, yet.--> + + <int value="1" label="Default Browser (Fullscreen)"/> + <int value="2" label="App Store Rating"/> +<!-- Credential Provider Extension not in use, yet.--> + + <int value="3" label="Credential Provider Extension"/> + <int value="4" label="Post Restore Sign-In (Fullscreen)"/> + <int value="5" label="Post Restore Sign-In (Alert)"/> + <int value="6" label="What's New"/> + <int value="7" label="Choice Promo"/> + <int value="8" label="Post Restore Default Browser (Alert)"/> + <int value="9" label="Default Browser Remind Me Later"/> +</enum> + +<enum name="IOSPromosManagerPromoImpressionLimitEvaluationType"> + <int value="0" label="Valid"/> + <int value="1" label="Invalid (Promo-specific limit triggered)"/> + <int value="2" label="Invalid (Promo-agnostic limit triggered)"/> + <int value="3" label="Invalid (Global limit triggered)"/> +</enum> + +<enum name="IOSPromosManagerPromoType"> + <int value="0" label="StandardPromoViewProvider"/> + <int value="1" label="BanneredPromoViewProvider"/> + <int value="2" label="StandardPromoAlertProvider"/> + <int value="3" label="StandardPromoDisplayHandler"/> +</enum> + +<enum name="IOSPromptAndroidTabsStatus"> + <int value="0" label="Sync Disabled"/> + <int value="1" label="Segmentation Incomplete"/> + <int value="2" label="Prompt Shown and Dismissed"/> + <int value="3" label="Tab Sync Disabled"/> + <int value="4" label="No Active Tabs"/> + <int value="5" label="Not Android Switcher"/> + <int value="6" label="Success"/> +</enum> + +<enum name="IOSSaveToPhotosAccountPickerType"> + <int value="0" + label="Account picker not presented because a default account exists"/> + <int value="1" label="User tapped 'Cancel' in the account picker"/> + <int value="2" label="User selected an identity in the account picker"/> +</enum> + +<enum name="IOSSaveToPhotosContextMenuType"> + <int value="0" + label="'Save to Google Photos' action was unavailable and the user + tapped 'Save to Photos' (saved image locally)"/> + <int value="2" + label="'Save to Google Photos' action was available but the user tapped + 'Save to Photos' (saved image locally)"/> + <int value="3" + label="'Save to Google Photos' action was available and the user tapped + 'Save to Google Photos'"/> +</enum> + +<enum name="IOSSaveToPhotosSettingsType"> + <int value="0" + label="User has NOT set a default Save to Photos account and did NOT + opt-in to skip the account picker"/> + <int value="1" + label="User has set a default Save to Photos account which exists on + device and did NOT opt-in to skip the account picker"/> + <int value="2" + label="User has set a default Save to Photos account but it is not on + device anymore and did NOT opt-in to skip the account picker"/> + <int value="3" + label="User has set a default Save to Photos account which exists on + device and did opt-in to skip the account picker"/> + <int value="4" + label="User has set a default Save to Photos account but it is not on + device anymore; the user did opt-in to skip the account picker"/> +</enum> + +<enum name="IOSSaveToPhotosType"> + <int value="0" label="Failure - WebState destroyed"/> + <int value="1" label="Failure - User signed-out"/> + <int value="2" + label="Failure - User cancelled in 'This File Could Not Be Uploaded' + alert"/> + <int value="3" label="Failure - Cancelled with account picker"/> + <int value="4" label="Failure - Cancelled with snackbar button"/> + <int value="5" label="Success - No post-upload action"/> + <int value="6" label="Success - Photo opened in Photos app"/> + <int value="7" + label="Success - StoreKit opened and app not installed (maybe dismissed + before full installation)"/> + <int value="8" label="Success - StoreKit opened and app installed"/> +</enum> + +<enum name="IOSSearchExtensionAction"> + <int value="0" label="No Action"/> + <int value="1" label="New Search"/> + <int value="2" label="New Incognito Search"/> + <int value="3" label="New Voice Search"/> + <int value="4" label="New QR Code Search"/> + <int value="5" label="Open URL"/> + <int value="6" label="Search Text"/> + <int value="7" label="Search Image"/> + <int value="8" label="Search Image with Lens"/> +</enum> + +<enum name="IOSSearchWithContext"> + <int value="0" label="Normal Mode, Google Search engine"/> + <int value="1" label="Normal Mode, Other Search engine"/> + <int value="2" label="Incognito Mode, Google Search engine"/> + <int value="3" label="Incognito Mode, Other Search engine"/> +</enum> + +<enum name="IOSSessionMigration"> + <int value="0" label="No Migration"/> + <int value="1" label="Migration Failed"/> + <int value="2" label="No Session To Migrate"/> + <int value="3" label="Migrated Pre-MW to Multi Scenes"/> + <int value="4" label="Migrated Pre-MW to Single Scene"/> + <int value="5" label="Migrated Single Scene to Multi Scenes"/> + <int value="6" label="Migrated Multi Scenes to Single Scene"/> +</enum> + +<enum name="IOSSetUpListItemType"> + <int value="1" label="SignIn Sync"/> + <int value="2" label="Default Browser"/> + <int value="3" label="Autofill"/> + <int value="4" label="Follow"/> +</enum> + +<enum name="IOSShareExtensionReceivedEntrySource"> + <int value="0" label="Unknown Application"/> + <int value="1" label="Chrome share extension"/> +</enum> + +<enum name="IOSShareExtensionReceivedEntryType"> + <int value="0" label="Invalid item"/> + <int value="1" label="Cancelled item"/> + <int value="2" label="Reading list item"/> + <int value="3" label="Bookmark item"/> + <int value="4" label="Open in Chrome item"/> +</enum> + +<enum name="IOSSpotlightAction"> + <int value="0" label="New Tab"/> + <int value="1" label="New Incognito Tab"/> + <int value="2" label="Voice Search"/> + <int value="3" label="QR Code Scanner"/> + <int value="4" label="Set Default Browser"/> + <int value="5" label="Search with Lens"/> +</enum> + +<enum name="IOSSpotlightAvailability"> + <int value="0" label="Unsupported"/> + <int value="1" label="Unavailable"/> + <int value="2" label="Available"/> +</enum> + +<enum name="IOSSpotlightDonatedIntentType"> + <int value="0" label="Search In Chrome"/> + <int value="1" label="Open Reading List"/> + <int value="2" label="Open Bookmarks"/> + <int value="3" label="Open Recent Tabs"/> + <int value="4" label="Open Tab Grid"/> + <int value="5" label="Open Voice Search"/> + <int value="6" label="Open New Tab"/> + <int value="7" label="Play Dino Game"/> + <int value="8" label="Set Default Browser"/> + <int value="9" label="View History"/> + <int value="10" label="Open Latest Tab"/> + <int value="11" label="Start Lens"/> + <int value="12" label="Clear Browsing Data"/> + <int value="13" label="Open In Chrome"/> + <int value="14" label="Open In Incognito"/> + <int value="15" label="Open New Incognito Tab"/> + <int value="16" label="Manage Payment Methods"/> + <int value="17" label="Run Safety Check"/> + <int value="18" label="Manage Passwords"/> + <int value="19" label="Manage Settings"/> +</enum> + +<enum name="IOSSpotlightOrigin"> + <int value="0" label="Unknown Origin"/> + <int value="1" label="Bookmark"/> + <int value="2" label="Top Sites"/> + <int value="3" label="Actions"/> + <int value="4" label="Reading list"/> + <int value="5" label="Open tab"/> +</enum> + +<enum name="IOSStorageCapacity"> + <int value="0" label="Unknown"/> + <int value="1" label="0 GB"/> + <int value="2" label="16 GB"/> + <int value="3" label="32 GB"/> + <int value="4" label="64 GB"/> + <int value="5" label="128 GB"/> + <int value="6" label="256 GB"/> + <int value="7" label="512 GB"/> + <int value="8" label="1 TB"/> + <int value="9" label="2 TB"/> +</enum> + +<enum name="IOSTabSwitcherDragDropTabs"> + <int value="0" label="A tab is dragged."/> + <int value="1" label="A tab is dropped at the same index position."/> + <int value="2" label="A tab is dropped at a new index position."/> + <int value="3" label="A tab is dropped outside of its collection view."/> +</enum> + +<enum name="IOSTabSwitcherDragOrigin"> + <int value="0" + label="The item is from the same collection in the same Chrome window."/> + <int value="1" label="The item is from the same Chrome window."/> + <int value="2" label="The item is from another Chrome window."/> + <int value="3" label="The item is not a Chrome Tab."/> +</enum> + +<enum name="IOSTabSwitcherPageChangeInteraction"> + <int value="0" label="Unknown Interaction"/> + <int value="1" label="Scroll View Drag"/> + <int value="2" label="Page Control Tap"/> + <int value="3" label="Page Control Drag"/> + <int value="4" label="Item Drag"/> +</enum> + +<enum name="IOSUserInterfaceStyle"> + <int value="0" label="Unspecified"/> + <int value="1" label="Light"/> + <int value="2" label="Dark"/> +</enum> + +<enum name="IOSWebFileInputAttributes"> + <int value="0" label="No Accept"/> + <int value="1" label="No Accept, Multiple files"/> + <int value="2" label="Mixed"/> + <int value="3" label="Mixed, Multiple files"/> + <int value="4" label="Unknown"/> + <int value="5" label="Unknown, Multiple files"/> + <int value="6" label="Image"/> + <int value="7" label="Image, Multiple files"/> + <int value="8" label="Video"/> + <int value="9" label="Video, Multiple files"/> + <int value="10" label="Audio"/> + <int value="11" label="Audio, Multiple files"/> + <int value="12" label="Archive"/> + <int value="13" label="Archive, Multiple files"/> + <int value="14" label="PDF"/> + <int value="15" label="PDF, Multiple files"/> + <int value="16" label="Doc"/> + <int value="17" label="Doc, Multiple files"/> + <int value="18" label="Apple"/> + <int value="19" label="Apple, Multiple files"/> +</enum> + +<enum name="IOSWidgetKitAction"> + <int value="0" label="Dino Widget - Game"/> + <int value="1" label="Search Widget - Search"/> + <int value="2" label="Quick Actions Widget - Search"/> + <int value="3" label="Quick Actions Widget - Incognito"/> + <int value="4" label="Quick Actions Widget - Voice Search"/> + <int value="5" label="Quick Actions Widget - QR Reader"/> + <int value="6" label="Lockscreen Launcher Widget - Search"/> + <int value="7" label="Lockscreen Launcher Widget - Incognito"/> + <int value="8" label="Lockscreen Launcher Widget - Voice Search"/> + <int value="9" label="Lockscreen Launcher Widget - Dino Game"/> + <int value="10" label="Quick Actions Widget - Lens"/> + <int value="11" label="Shortcuts Widget - Search"/> + <int value="12" label="Shortcuts Widget - Open Shortcut"/> + <int value="13" label="Search Passwords Widget - Search Passwords"/> +</enum> + +<enum name="IOSWidgetKitExtensionKind"> + <int value="0" label="Dino game widget"/> + <int value="1" label="Search widget"/> + <int value="2" label="Quick actions widget"/> + <int value="3" label="A widget that has become obsolete"/> + <int value="4" label="Lockscreen launcher widget - Search"/> + <int value="5" label="Lockscreen launcher widget - Incognito"/> + <int value="6" label="Lockscreen launcher widget - Voice Search"/> + <int value="7" label="Lockscreen launcher widget - Dino Game"/> + <int value="8" label="Shortcuts widget"/> + <int value="9" label="Search Passwords widget"/> +</enum> + +<enum name="LanguageDetectionComparison"> + <int value="0" label="Language detected by TFLite only (CLD3 failed)"/> + <int value="1" label="Language detected by CLD3 only (TFLite failed)"/> + <int value="2" label="No language detected (both model failed)"/> + <int value="3" label="Both model succeeded and agree"/> + <int value="4" label="Both model succeeded bug disagreed"/> +</enum> + +<enum name="LanguageDetectionMethod"> + <int value="0" label="TFLite model"/> + <int value="1" label="CLD3 (TFLite model unavailable)"/> + <int value="2" label="CLD3 (TFLite model disabled)"/> + <int value="3" label="CLD3 (TFLite model run but is ignored)"/> +</enum> + +<enum name="LinkToTextShouldOfferResult"> + <int value="0" label="Success"/> + <int value="1" label="Rejected in JavaScript (deprecated)"/> + <int value="2" label="Blocklisted"/> + <int value="3" label="Unable to invoke JavaScript"/> + <int value="4" label="Web layer task timeout (deprecated)"/> + <int value="5" label="Dispatched timeout (deprecated)"/> + <int value="6" label="Selection empty"/> + <int value="7" label="User editing"/> + <int value="8" label="Text Input view not found"/> + <int value="9" label="Success, with lower certainty"/> +</enum> + +<enum name="MetricKitExitData"> + <int value="0" label="App exited normally"/> + <int value="1" label="App exited abnormally"/> + <int value="2" label="Watchdog terminated the app"/> + <int value="3" label="App used too much CPU time"/> + <int value="4" label="App used too much memory"/> + <int value="5" label="Terminated to free up memory"/> + <int value="6" label="Suspended while having file locks"/> + <int value="7" label="Invalid memory access"/> + <int value="8" label="Illegal or undefined instruction"/> + <int value="9" label="Exceeded allocated time for background task"/> +</enum> + +<enum name="OmniboxDeviceSwitcherResult"> + <int value="1" label="Unavailable"/> + <int value="2" label="Top omnibox by default"/> + <int value="3" label="Bottom omnibox by default"/> + <int value="4" label="Not a new user (user is new for 30 days after FRE)"/> +</enum> + +<enum name="OmniboxPositionType"> + <int value="0" label="Top"/> + <int value="1" label="Bottom"/> +</enum> + +<enum name="PageLoadedSnapshotResult"> + <int value="0" label="Snapshot not attempted, page load failed"> + Snapshot was not attempted because the page load failed and would result in + a stale snapshot. + </int> + <int value="1" label="Snapshot was attempted, but the snapshot failed."/> + <int value="2" label="Snapshot was successfully taken."/> +</enum> + +<enum name="PartialTranslateOutcome"> + <int value="0" label="Partial Translate success"/> + <int value="1" label="Selection too long, user cancelled"/> + <int value="2" label="Selection too long, user pressed full translate"/> + <int value="3" label="Selection empty, user cancelled"/> + <int value="4" label="Selection empty, user pressed full translate"/> + <int value="5" label="Partial translate failed, user cancelled"/> + <int value="6" label="Partial translate failed, user pressed full translate"/> +</enum> + +<enum name="PasswordSuggestionBottomSheetExitReason"> + <int value="0" label="Bottom Sheet dismissed"/> + <int value="1" label="Used password suggestion"/> + <int value="2" label="Accessed Password Manager through the long press menu"/> + <int value="3" label="Accessed Password Details through the long press menu"/> +</enum> + +<enum name="PaymentsSuggestionBottomSheetExitReason"> + <int value="0" label="Bottom Sheet dismissed"/> + <int value="1" label="Used payment suggestion"/> + <int value="2" label="Accessed Payment Methods through the long press menu"/> + <int value="3" label="Accessed Payment Details through the long press menu"/> +</enum> + +<enum name="PromoWithInstructionsAction"> + <int value="0" label="Close"/> + <int value="1" label="Open Instructions"/> +</enum> + +<enum name="PushNotificationLifecycleEvent"> + <int value="0" label="Notification received on device"/> + <int value="1" + label="Notification presented on device while is in foreground"/> + <int value="2" label="User tapped on notification"/> +</enum> + +<enum name="PushNotificationPermissionPromptStatus"> + <int value="0" label="Accpeted"/> + <int value="1" label="Declined"/> + <int value="2" label="Error"/> +</enum> + +<enum name="PushNotificationSettingsAuthorizationStatus"> + <int value="0" label="Not Determined"/> + <int value="1" label="Denied"/> + <int value="2" label="Authorized"/> + <int value="3" label="Provisional"/> + <int value="4" label="Ephemeral"/> +</enum> + +<enum name="TextSelectionDetectedEntityType"> + <int value="0" label="Unknown"/> + <int value="1" label="None"/> + <int value="2" label="Datetime"/> + <int value="3" label="Address"/> + <int value="4" label="Phone number"/> + <int value="5" label="Email"/> + <int value="6" label="ParcelTracking"/> + <int value="7" label="Measurement"/> +</enum> + +<enum name="TrendingQueryIndex"> + <summary> + Index of a trending query view on the new tab page. This is only an enum so + that the dashboard won't produce misleading statistics like averages. + </summary> + <int value="0" label="0"/> + <int value="1" label="1"/> + <int value="2" label="2"/> + <int value="3" label="3"/> + <int value="4" label="kMaxValue"/> +</enum> + +<enum name="UnitChangeTypes"> + <int value="0" label="Unchanged"/> + <int value="1" label="Imperial Area"/> + <int value="2" label="Metric Area"/> + <int value="3" label="Imperial Information Storage"/> + <int value="4" label="Metric Information Storage"/> + <int value="5" label="Imperial Length"/> + <int value="6" label="Metric Length"/> + <int value="7" label="Imperial Mass"/> + <int value="8" label="Metric Mass"/> + <int value="9" label="Imperial Speed"/> + <int value="10" label="Metric Speed"/> + <int value="11" label="Imperial Temperature"/> + <int value="12" label="Metric Temperature"/> + <int value="13" label="Imperial Volume"/> + <int value="14" label="Metric Volume"/> +</enum> + +<enum name="VariationsFirstRunSeedApplicationStage"> + <int value="0" label="Seed missing"> + No seed in native variations seed store + </int> + <int value="1" label="Seed stored"> + Seed stored in native variations seed store + </int> + <int value="2" label="Seed imported"> + Variations service imported seed from native variations seed store + </int> + <int value="3" label="Seed used">Seed is applied by variations service</int> +</enum> + +<enum name="WhatsNewType"> + <int value="-1" label="Error"/> + <int value="0" label="Search Tabs"/> + <int value="1" label="New Overflow Menu"/> + <int value="2" label="Shared Highlighting"/> + <int value="3" label="Add Password Manually"/> + <int value="4" label="Use Chrome By Default"/> + <int value="5" label="Passwords In Ither Apps"/> + <int value="6" label="Autofill"/> + <int value="7" label="Incognito Tabs From Other Apps"/> + <int value="8" label="Incognito Lock"/> + <int value="9" label="Calendar Event"/> + <int value="10" label="Chrome Actions"/> + <int value="11" label="Mini Maps"/> +</enum> + +<enum name="WindowActivityOrigin"> + <int value="0" label="WindowActivityUnknwonOrigin"/> + <int value="1" label="WindowActivityExternalOrigin"/> + <int value="2" label="WindowActivityRestoredOrigin"/> + <int value="3" label="WindowActivityContextMenuOrigin"/> + <int value="4" label="WindowActivityReadingListOrigin"/> + <int value="5" label="WindowActivityBookmarksOrigin"/> + <int value="6" label="WindowActivityHistoryOrigin"/> + <int value="7" label="WindowActivityToolsOrigin"/> + <int value="8" label="WindowActivityRecentTabsOrigin"/> + <int value="9" label="WindowActivityLocationBarSteadyViewOrigin"/> + <int value="10" label="WindowActivityContentSuggestionsOrigin"/> + <int value="11" label="WindowActivityTabDragOrigin"/> + <int value="12" label="WindowActivityKeyCommandOrigin"/> +</enum> + +</enums> + +</histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/safe_browsing/histograms.xml b/tools/metrics/histograms/metadata/safe_browsing/histograms.xml index a30be68..7d4110e 100644 --- a/tools/metrics/histograms/metadata/safe_browsing/histograms.xml +++ b/tools/metrics/histograms/metadata/safe_browsing/histograms.xml
@@ -525,6 +525,23 @@ </summary> </histogram> +<histogram name="SafeBrowsing.Enhanced.ProtegoRequestSentInLast24Hours2" + enum="SafeBrowsingEnhancedProtegoPingType" expires_after="2024-11-07"> + <owner>zackhan@chromium.org</owner> + <owner>chrome-counter-abuse-alerts@google.com</owner> + <summary> + Similar to the metric SafeBrowsing.Enhanced.ProtegoRequestSentInLast24Hours. + Records whether an ESB user has sent a Protego ping to the Safe Browsing + consumer API servers within the last 24 hours. If a ping was sent since the + last time this metric was logged, then this metric will report the type of + that ping, otherwise it will report that none was sent. Different from + ProtegoRequestSentInLast24Hours, if the user has sent a ping of multiple + types since the last time this metric was logged, kWithToken will be + reported. This metric is logged at most once per day and only for users that + have enhanced protection enabled. + </summary> +</histogram> + <histogram name="SafeBrowsing.EsbDisabled.LastBypassEventType" enum="SBMetricsCollectorEventType" expires_after="2024-03-23"> <owner>xinghuilu@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/uma/histograms.xml b/tools/metrics/histograms/metadata/uma/histograms.xml index 4b7548f..b3c7f3e 100644 --- a/tools/metrics/histograms/metadata/uma/histograms.xml +++ b/tools/metrics/histograms/metadata/uma/histograms.xml
@@ -945,16 +945,6 @@ </summary> </histogram> -<histogram name="UMA.TruncatedEvents.Omnibox" units="events" - expires_after="M85"> - <owner>rkaplow@chromium.org</owner> - <owner>src/base/metrics/OWNERS</owner> - <summary> - The number of omnibox events that existed in the metrics log before we - truncated them to save bandwidth. - </summary> -</histogram> - <histogram name="UMA.TruncatedEvents.UserAction" units="events" expires_after="2024-05-05"> <owner>rkaplow@chromium.org</owner>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index 26c187d..a9db08b 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -3672,6 +3672,9 @@ </summary> </metric> <metric name="FormControlType" enum="AutofillFormControlType"> + <obsolete> + Deprecated as of 11/2023. Replaced by FormControlType2. + </obsolete> <summary> A form control type of a web form-associated element. We only list the very common ones that are seen in autofill, such as text, textarea, @@ -4487,6 +4490,12 @@ IdentityCredential.revoke() call, once the browser knows the result. </summary> </metric> + <metric name="Status.SignInStateMatch" enum="FedCmSignInStateMatchStatus"> + <summary> + Records whether user sign-in states between IDP and browser match after + browser receives an account list from IDP prior to showing UI. + </summary> + </metric> <metric name="Timing.AccountsDialogShownDuration"> <summary> Records the duration from when an accounts dialog is shown to when dialog
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 5238b6bf..231a25d 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,24 +5,24 @@ "full_remote_path": "perfetto-luci-artifacts/3f522a981c45dc5d735a5e5d775c70188adff93c/linux-arm64/trace_processor_shell" }, "win": { - "hash": "04ef2b842e7214f0adf2858a872dda7a0335c347", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/86ba297f4358f76eced618085b9aa669446a6c51/trace_processor_shell.exe" + "hash": "5d77492b7818c6a771bb6a12c33fac7712cd8a60", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/ed90e2735442263d54f02f2aa7410762f653d9c8/trace_processor_shell.exe" }, "linux_arm": { "hash": "a6d798c6ea35705f2ab9ace2b224c32e376eb0ce", "full_remote_path": "perfetto-luci-artifacts/3f522a981c45dc5d735a5e5d775c70188adff93c/linux-arm/trace_processor_shell" }, "mac": { - "hash": "f5fb18b0518c9b46cbe8753bdec4b42864b1fba2", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/86ba297f4358f76eced618085b9aa669446a6c51/trace_processor_shell" + "hash": "45b46d282498b4fdcb51b6af2ca49cd9b66cca68", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/978c4586ae203718174455aa228b39d1f07defe3/trace_processor_shell" }, "mac_arm64": { "hash": "cc287491e9ff9fe2c4866e5574eaea04134895a0", "full_remote_path": "perfetto-luci-artifacts/v38.0/mac-arm64/trace_processor_shell" }, "linux": { - "hash": "ea38cf4ba84a1e287e558bdc15379fbd8466b1cc", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/3bd064fdb396091d3ca9923721d3cb1dcee2a189/trace_processor_shell" + "hash": "a14ea92aa7b1f40ceeee17ec855a71611dc72566", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/978c4586ae203718174455aa228b39d1f07defe3/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/typescript/definitions/autofill_private.d.ts b/tools/typescript/definitions/autofill_private.d.ts index 97cf00c3..f877e3c 100644 --- a/tools/typescript/definitions/autofill_private.d.ts +++ b/tools/typescript/definitions/autofill_private.d.ts
@@ -220,6 +220,7 @@ export function authenticateUserAndFlipMandatoryAuthToggle(): void; export function getLocalCard(guid: string): Promise<CreditCardEntry|null>; export function checkIfDeviceAuthAvailable(): Promise<boolean>; + export function bulkDeleteAllCvcs(): void; export const onPersonalDataChanged: ChromeEvent< (addresses: AddressEntry[], creditCards: CreditCardEntry[],
diff --git a/ui/file_manager/file_manager/common/js/translations.ts b/ui/file_manager/file_manager/common/js/translations.ts index fe8652f..163a25e 100644 --- a/ui/file_manager/file_manager/common/js/translations.ts +++ b/ui/file_manager/file_manager/common/js/translations.ts
@@ -159,7 +159,8 @@ return str('TRASH_ROOT_LABEL'); case VolumeManagerCommon.RootType.MEDIA_VIEW: const mediaViewRootType = - VolumeManagerCommon.getMediaViewRootTypeFromVolumeId(volumeInfoLabel); + VolumeManagerCommon.getMediaViewRootTypeFromVolumeId( + locationInfo.volumeInfo?.volumeId || ''); switch (mediaViewRootType) { case VolumeManagerCommon.MediaViewRootType.IMAGES: return str('MEDIA_VIEW_IMAGES_ROOT_LABEL');
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_table_list.ts b/ui/file_manager/file_manager/foreground/js/ui/file_table_list.ts index 71d9106..88cbc51 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_table_list.ts +++ b/ui/file_manager/file_manager/foreground/js/ui/file_table_list.ts
@@ -55,6 +55,10 @@ self.onMergeItems_ = null; } + override get table(): FileTable { + return super.table as FileTable; + } + override get dataModel(): FileListModel { return super.dataModel as FileListModel; } @@ -126,16 +130,14 @@ } get a11y(): A11yAnnounce { - // TODO: Remove the type case once FileTable is converted to TS. - return (this.table as unknown as FileTable).a11y!; + return this.table.a11y!; } /** * @param index Index of the list item. */ getItemLabel(index: number): string { - // TODO: Remove the type case once FileTable is converted to TS. - return (this.table as unknown as FileTable).getItemLabel(index); + return this.table.getItemLabel(index); } /**
diff --git a/ui/file_manager/file_manager/foreground/js/ui/list_selection_model.ts b/ui/file_manager/file_manager/foreground/js/ui/list_selection_model.ts index b44b0b1e..1180463 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/list_selection_model.ts +++ b/ui/file_manager/file_manager/foreground/js/ui/list_selection_model.ts
@@ -8,6 +8,27 @@ export type SelectionChangeEvent = Event&{changes: Array<{index: number, selected: boolean}>}; + +interface ListSelectionModelEventMap { + 'change': SelectionChangeEvent; +} + +export interface ListSelectionModel { + addEventListener<K extends keyof ListSelectionModelEventMap>( + type: K, listener: (e: ListSelectionModelEventMap[K]) => void, + options?: boolean|AddEventListenerOptions|undefined): void; + addEventListener( + type: string, callback: EventListenerOrEventListenerObject|null, + options?: AddEventListenerOptions|boolean): void; + removeEventListener<K extends keyof ListSelectionModelEventMap>( + type: K, listener: (ev: ListSelectionModelEventMap[K]) => any, + options?: boolean|EventListenerOptions): void; + removeEventListener( + type: string, listener: EventListenerOrEventListenerObject|null, + options?: boolean|EventListenerOptions): void; +} + + /** * Creates a new selection model that is to be used with lists. *
diff --git a/ui/file_manager/file_manager/foreground/js/ui/list_selection_model_unittest.ts b/ui/file_manager/file_manager/foreground/js/ui/list_selection_model_unittest.ts index ba71192..ba5c8599 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/list_selection_model_unittest.ts +++ b/ui/file_manager/file_manager/foreground/js/ui/list_selection_model_unittest.ts
@@ -269,8 +269,7 @@ let changes: SelectionChangeEvent['changes']|null = null; sm.addEventListener('change', function(e) { - const event = e as SelectionChangeEvent; - changes = event.changes; + changes = e.changes; }); sm.selectAll(); @@ -289,8 +288,7 @@ let changes: SelectionChangeEvent['changes']|null = null; sm.addEventListener('change', function(e) { - const event = e as SelectionChangeEvent; - changes = event.changes; + changes = e.changes; }); sm.selectAll();
diff --git a/ui/file_manager/integration_tests/file_manager/page_objects/directory_tree.js b/ui/file_manager/integration_tests/file_manager/page_objects/directory_tree.js index 3e17cf5..ab19a6a 100644 --- a/ui/file_manager/integration_tests/file_manager/page_objects/directory_tree.js +++ b/ui/file_manager/integration_tests/file_manager/page_objects/directory_tree.js
@@ -70,6 +70,10 @@ this.selectors_ = new DirectoryTreeSelectors_(useNewTree); } + get isNewTree() { + return this.useNewTree_; + } + /** * Returns the selector for the tree root. * @return {string} @@ -207,7 +211,6 @@ getItemLabel(item) { if (!item) { chrome.test.fail('Item is not a valid tree item.'); - return ''; } return this.useNewTree_ ? item.attributes['label'] : item.attributes['entry-label']; @@ -222,7 +225,6 @@ getItemVolumeType(item) { if (!item) { chrome.test.fail('Item is not a valid tree item.'); - return ''; } return item.attributes['volume-type-for-testing']; } @@ -235,7 +237,6 @@ assertItemDisabled(item) { if (!item) { chrome.test.fail('Item is not a valid tree item.'); - return; } // Empty value for "disabled" means it's disabled. chrome.test.assertEq('', item.attributes['disabled']);
diff --git a/ui/file_manager/integration_tests/file_manager/tab_index.js b/ui/file_manager/integration_tests/file_manager/tab_index.js index 797f5e73..ac648b2 100644 --- a/ui/file_manager/integration_tests/file_manager/tab_index.js +++ b/ui/file_manager/integration_tests/file_manager/tab_index.js
@@ -6,6 +6,7 @@ import {testcase} from '../testcase.js'; import {openAndWaitForClosingDialog, remoteCall, setupAndWaitUntilReady} from './background.js'; +import {DirectoryTreePageObject} from './page_objects/directory_tree.js'; import {BASIC_DRIVE_ENTRY_SET, BASIC_LOCAL_ENTRY_SET} from './test_data.js'; /** The id attribute of the dismiss button in the educational banner. */ @@ -67,9 +68,10 @@ await remoteCall.callRemoteTestUtil('getActiveElement', appId, []); chrome.test.assertEq('list', element.attributes['class']); - // Send Tab key events to cycle through the tabable elements. + // Send Tab key events to cycle through the tabbable elements. chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'directory-tree')); + // format: directory-tree#<tree item label> + await remoteCall.checkNextTabFocus(appId, 'directory-tree#My Drive')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, 'search-button')); chrome.test.assertTrue( @@ -105,9 +107,10 @@ await remoteCall.callRemoteTestUtil('getActiveElement', appId, []); chrome.test.assertEq('list', element.attributes['class']); - // Send Tab key events to cycle through the tabable elements. + // Send Tab key events to cycle through the tabbable elements. chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'directory-tree')); + // format: directory-tree#<tree item label> + await remoteCall.checkNextTabFocus(appId, 'directory-tree#Downloads')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, 'breadcrumbs')); chrome.test.assertTrue( @@ -171,7 +174,8 @@ // Send Tab key events to cycle through the tabable elements. chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'directory-tree')); + // format: directory-tree#<tree item label> + await remoteCall.checkNextTabFocus(appId, 'directory-tree#My Drive')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, pinnedToggleId)); chrome.test.assertTrue( @@ -228,10 +232,21 @@ ]); const selectAndCheckAndClose = async (appId) => { + const directoryTree = + await DirectoryTreePageObject.create(appId, remoteCall); + if (dialogParams.type === 'saveFile') { await remoteCall.waitForElement( appId, ['#filename-input-textbox:focus-within']); + } else if (directoryTree.isNewTree) { + await directoryTree.waitForFocusedItemByType(volumeType); } else { + // The openAndWaitForClosingDialog() below will select the tree item with + // the corresponding `volumeType` by fake mouse click, for new tree it + // will focus the tree item we do that programmatically, but for the old + // tree it won't focus the tree because it rely on "tabindex=0" on the + // <tree> element to focus which only works with physical mouse/touch, + // hence the checking of "file-list:focus" below. await remoteCall.waitForElement(appId, ['#file-list:focus']); } @@ -276,7 +291,8 @@ async (appId) => ['cancel-button', 'ok-button', - 'directory-tree', + // format: directory-tree#<tree item label> + 'directory-tree#Downloads', /* first breadcrumb */ 'first', 'search-button', 'view-button', @@ -309,7 +325,8 @@ 'gear-button', 'drive-learn-more-button', await getDismissButtonId(appId), - 'directory-tree', + // format: directory-tree#<tree item label> + 'directory-tree#My Drive', 'file-list', ]); }; @@ -327,7 +344,8 @@ async () => ['cancel-button', 'ok-button', - 'directory-tree', + // format: directory-tree#<tree item label> + 'directory-tree#Downloads', /* first breadcrumb */ 'first', 'search-button', 'view-button', @@ -353,7 +371,8 @@ async () => ['cancel-button', 'ok-button', - 'directory-tree', + // format: directory-tree#<tree item label> + 'directory-tree#My Drive', 'search-button', 'view-button', 'sort-button',
diff --git a/ui/file_manager/integration_tests/remote_call.js b/ui/file_manager/integration_tests/remote_call.js index c0afd607..173f06e7 100644 --- a/ui/file_manager/integration_tests/remote_call.js +++ b/ui/file_manager/integration_tests/remote_call.js
@@ -702,6 +702,23 @@ return repeatUntil(async () => { const element = await this.callRemoteTestUtil('getActiveElement', appId, []); + // TODO(b/285977941): Remove this special handling. + // For new directory tree implementation, directory tree itself + // ("#directory-tree") is not focusable, the underlying tree item will be + // focused, for directory tree related focus check, the `elementId` format + // will be "directory-tree#<tree item label>", so we need to check the + // label here for the new tree. + if (elementId.startsWith('directory-tree#')) { + const treeItemLabel = elementId.split('#')[1]; + // For new tree. + if (element && element.attributes['label'] === treeItemLabel) { + return true; + } + // For old tree. + if (element && element.attributes['id'] === 'directory-tree') { + return true; + } + } if (element && element.attributes['id'] === elementId) { return true; }
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc index 8fe0e2f..f87c5ab 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -440,11 +440,13 @@ : ZAURA_TOPLEVEL_ROTATE_HANDLED_STATE_NOT_HANDLED); } +void WaylandToplevelWindow::OnOverviewChange(uint32_t in_overview_as_int) { #if BUILDFLAG(IS_CHROMEOS_LACROS) -void WaylandToplevelWindow::OnOverviewModeChanged(bool in_overview) { + const bool in_overview = + in_overview_as_int == ZAURA_TOPLEVEL_IN_OVERVIEW_IN_OVERVIEW; delegate()->OnOverviewModeChanged(in_overview); -} #endif +} void WaylandToplevelWindow::LockFrame() { OnFrameLockingChanged(true);
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h index 1ede12a..9bd2994 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
@@ -100,10 +100,7 @@ void HideTooltip() override; void PropagateBufferScale(float new_scale) override; void OnRotateFocus(uint32_t serial, uint32_t direction, bool restart); - -#if BUILDFLAG(IS_CHROMEOS_LACROS) - void OnOverviewModeChanged(bool in_overview); -#endif + void OnOverviewChange(uint32_t in_overview_as_int); // WmDragHandler: bool ShouldReleaseCaptureForDrag(ui::OSExchangeData* data) const override;
diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc index 62665f1..2f69a87 100644 --- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
@@ -4938,21 +4938,20 @@ GTEST_SKIP(); } - testing::NiceMock<MockWaylandPlatformWindowDelegate> delegate; - std::unique_ptr<WaylandWindow> toplevel_window = - CreateWaylandWindowWithParams(PlatformWindowType::kWindow, - gfx::Rect(300, 300), &delegate); - - EXPECT_CALL(delegate, OnOverviewModeChanged(Eq(true))).Times(1); - PostToServerAndWait([](wl::TestWaylandServerThread* server) { - auto* const zaura_shell = server->zaura_shell()->resource(); - zaura_shell_send_set_overview_mode(zaura_shell); + EXPECT_CALL(delegate_, OnOverviewModeChanged(Eq(true))).Times(1); + PostToServerAndWait([&](wl::TestWaylandServerThread* server) { + auto* surface = server->GetObject<wl::MockSurface>(surface_id_); + auto* toplevel = surface->xdg_surface()->xdg_toplevel()->zaura_toplevel(); + zaura_toplevel_send_overview_change(toplevel->resource(), + ZAURA_TOPLEVEL_IN_OVERVIEW_IN_OVERVIEW); }); - EXPECT_CALL(delegate, OnOverviewModeChanged(Eq(false))).Times(1); - PostToServerAndWait([](wl::TestWaylandServerThread* server) { - auto* const zaura_shell = server->zaura_shell()->resource(); - zaura_shell_send_unset_overview_mode(zaura_shell); + EXPECT_CALL(delegate_, OnOverviewModeChanged(Eq(false))).Times(1); + PostToServerAndWait([&](wl::TestWaylandServerThread* server) { + auto* surface = server->GetObject<wl::MockSurface>(surface_id_); + auto* toplevel = surface->xdg_surface()->xdg_toplevel()->zaura_toplevel(); + zaura_toplevel_send_overview_change( + toplevel->resource(), ZAURA_TOPLEVEL_IN_OVERVIEW_NOT_IN_OVERVIEW); }); } #endif
diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc index b139770..be82545 100644 --- a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc +++ b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc
@@ -26,7 +26,7 @@ namespace { constexpr uint32_t kMinVersion = 1; -constexpr uint32_t kMaxVersion = 61; +constexpr uint32_t kMaxVersion = 62; } // namespace @@ -178,27 +178,11 @@ // static void WaylandZAuraShell::OnSetOverviewMode(void* data, struct zaura_shell* zaura_shell) { -#if BUILDFLAG(IS_CHROMEOS_LACROS) - auto* self = static_cast<WaylandZAuraShell*>(data); - for (auto* window : self->connection_->window_manager()->GetAllWindows()) { - if (auto* toplevel_window = window->AsWaylandToplevelWindow()) { - toplevel_window->OnOverviewModeChanged(true); - } - } -#endif } // static void WaylandZAuraShell::OnUnsetOverviewMode(void* data, struct zaura_shell* zaura_shell) { -#if BUILDFLAG(IS_CHROMEOS_LACROS) - auto* self = static_cast<WaylandZAuraShell*>(data); - for (auto* window : self->connection_->window_manager()->GetAllWindows()) { - if (auto* toplevel_window = window->AsWaylandToplevelWindow()) { - toplevel_window->OnOverviewModeChanged(false); - } - } -#endif } // static
diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_shell.h b/ui/ozone/platform/wayland/host/wayland_zaura_shell.h index 3917b311..a13e7382 100644 --- a/ui/ozone/platform/wayland/host/wayland_zaura_shell.h +++ b/ui/ozone/platform/wayland/host/wayland_zaura_shell.h
@@ -77,8 +77,11 @@ struct zaura_shell* zaura_shell, struct wl_surface* gained_active, struct wl_surface* lost_active); + + // TODO(sammiequon): Remove these two deprecated functions. static void OnSetOverviewMode(void* data, struct zaura_shell* zaura_shell); static void OnUnsetOverviewMode(void* data, struct zaura_shell* zaura_shell); + static void OnCompositorVersion(void* data, struct zaura_shell* zaura_shell, const char* version_label);
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc index bd3f0ce..c881aca 100644 --- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc +++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
@@ -430,6 +430,16 @@ toplevel_window->OnRotateFocus(serial, direction, restart); } +// static +void XDGToplevelWrapperImpl::OnOverviewChange(void* data, + zaura_toplevel* aura_toplevel, + uint32_t in_overview_as_uint) { + auto* self = static_cast<XDGToplevelWrapperImpl*>(data); + CHECK(self); + self->wayland_window_->AsWaylandToplevelWindow()->OnOverviewChange( + in_overview_as_uint); +} + void XDGToplevelWrapperImpl::SetTopLevelDecorationMode( DecorationMode requested_mode) { if (!zxdg_toplevel_decoration_ || requested_mode == decoration_mode_) @@ -565,7 +575,8 @@ .configure = &OnAuraToplevelConfigure, .origin_change = &OnOriginChange, .configure_raster_scale = &OnConfigureRasterScale, - .rotate_focus = &OnRotateFocus}; + .rotate_focus = &OnRotateFocus, + .overview_change = &OnOverviewChange}; zaura_toplevel_add_listener(aura_toplevel_.get(), &kAuraToplevelListener, this); }
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h index fd3ae89..e269593a 100644 --- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h +++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.h
@@ -124,6 +124,9 @@ uint32_t serial, uint32_t direction, uint32_t restart); + static void OnOverviewChange(void* data, + zaura_toplevel* aura_toplevel, + uint32_t in_overview_as_uint); // Send request to wayland compositor to enable a requested decoration mode. void SetTopLevelDecorationMode(DecorationMode requested_mode);
diff --git a/ui/webui/resources/cr_elements/chromeos/cros_color_overrides.css b/ui/webui/resources/cr_elements/chromeos/cros_color_overrides.css index 8379c7b..68c6bf01 100644 --- a/ui/webui/resources/cr_elements/chromeos/cros_color_overrides.css +++ b/ui/webui/resources/cr_elements/chromeos/cros_color_overrides.css
@@ -77,7 +77,7 @@ --cr-toggle-ripple-diameter: 32px; } -:host-context([cros]) cr-toggle:focus { +:host-context([cros]):host-context(.focus-outline-visible) cr-toggle:focus { --cr-toggle-ripple-ring: 2px solid var(--cros-focus-ring-color); } @@ -309,7 +309,8 @@ --cr-toggle-ripple-diameter: 32px; } -:host-context(body.jelly-enabled) cr-toggle:focus { +:host-context(body.jelly-enabled):host-context(.focus-outline-visible) + cr-toggle:focus { --cr-toggle-ripple-ring: 2px solid var(--cros-sys-focus_ring); } @@ -333,6 +334,7 @@ --cr-toggle-disabled-opacity: var(--cros-disabled-opacity); } -:host-context([cros][chrome-refresh-2023]) cr-toggle:focus { +:host-context([cros][chrome-refresh-2023]):host-context(.focus-outline-visible) + cr-toggle:focus { --cr-toggle-ripple-ring: none; }
diff --git a/v8 b/v8 index d8629e1..fbf289b 160000 --- a/v8 +++ b/v8
@@ -1 +1 @@ -Subproject commit d8629e1b3fd3f577927bc834b67b7b67daddd471 +Subproject commit fbf289b1de521d0d07e777cd3c8355c8d8480767