diff --git a/BUILD.gn b/BUILD.gn index accd220..09bc9bd 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -987,7 +987,6 @@ "//media:media_unittests", "//media/midi:midi_unittests", "//net:net_unittests", - "//printing:printing_unittests", "//sql:sql_unittests", "//third_party/breakpad:symupload", "//ui/base:ui_base_unittests", @@ -996,6 +995,10 @@ "//ui/views:views_unittests", "//url:url_unittests", ] + + if (enable_printing || enable_printing_tests) { + deps += [ "//printing:printing_unittests" ] + } } } @@ -1100,25 +1103,55 @@ ] } - if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos) { - _common_wpt_test_args = [ - "--build-directory", - rebase_path(get_path_info(root_build_dir, "dir"), "."), - "--target", - get_path_info(root_build_dir, "name"), + # Options shared by all script test targets that call `run_web_tests.py` or + # `run_wpt_tests.py`. + _common_web_test_options = [ + "--no-show-results", + "--zero-tests-executed-ok", + ] + if (is_debug) { + _common_web_test_options += [ "--debug" ] + } else { + _common_web_test_options += [ "--release" ] + } + if (is_asan) { + _common_web_test_options += [ + "--enable-sanitizer", + "--additional-expectations", + "@WrappedPath(" + + rebase_path("//third_party/blink/web_tests/ASANExpectations", + root_out_dir) + ")", ] - if (is_debug) { - _common_wpt_test_args += [ "--debug" ] - } else { - _common_wpt_test_args += [ "--release" ] - } + } + if (is_msan) { + _common_web_test_options += [ + "--enable-sanitizer", + "--additional-expectations", + "@WrappedPath(" + + rebase_path("//third_party/blink/web_tests/MSANExpectations", + root_out_dir) + ")", + ] + } + if (is_fuchsia) { + _common_web_test_options += [ + "--out-dir", + "@WrappedPath(.)", + ] + } else { + base_out_dir = rebase_path(get_path_info(root_build_dir, "dir"), ".") + out_dir = get_path_info(root_build_dir, "name") + _common_web_test_options += [ + "--build-directory", + base_out_dir, + "--target", + out_dir, + ] + } + + if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos) { script_test("chrome_wpt_tests") { script = "//third_party/blink/tools/run_wpt_tests.py" - args = _common_wpt_test_args + [ - "--product=chrome", - "--no-show-results", - "--zero-tests-executed-ok", - ] + args = _common_web_test_options + [ "--product=chrome" ] if (dcheck_always_on) { args += [ "--timeout-multiplier=2" ] } else { @@ -1134,11 +1167,9 @@ } script_test("headless_shell_wpt") { script = "//third_party/blink/tools/run_wpt_tests.py" - args = _common_wpt_test_args + [ + args = _common_web_test_options + [ "--product=headless_shell", "--no-wpt-internal", - "--no-show-results", - "--zero-tests-executed-ok", ] data_deps = [ ":blink_web_tests_expectations", @@ -1283,26 +1314,19 @@ "@WrappedPath(" + rebase_path("//build/fuchsia/test/run_test.py", root_build_dir) + ")", "blink", - "--out-dir", - "@WrappedPath(.)", + "--platform", + "fuchsia", + "--jobs", + "1", ] } else { - base_out_dir = rebase_path(get_path_info(root_build_dir, "dir"), ".") - out_dir = get_path_info(root_build_dir, "name") - _common_web_test_args = [ - "@WrappedPath(" + - rebase_path("//third_party/blink/tools/run_web_tests.py", - root_build_dir) + ")", - "--build-directory", - base_out_dir, - "--target", - out_dir, - ] + _common_web_test_args = [ "@WrappedPath(" + rebase_path( + "//third_party/blink/tools/run_web_tests.py", + root_build_dir) + ")" ] } - if (is_debug) { - _common_web_test_args += [ "--debug" ] - } else { - _common_web_test_args += [ "--release" ] + _common_web_test_args += _common_web_test_options + + if (!is_debug) { if (dcheck_always_on) { _common_web_test_args += [ "--timeout-ms=12000" ] } else if (v8_enable_debugging_features) { @@ -1322,21 +1346,10 @@ ] } - if (is_fuchsia) { - _common_web_test_args += [ - "--platform", - "fuchsia", - "--jobs", - "1", - ] - } - _common_web_test_args += [ "--seed", "4", "--debug-rwt-logging", - "--no-show-results", - "--zero-tests-executed-ok", "--clobber-old-results", ] @@ -1451,15 +1464,20 @@ "//third_party/blink/web_tests/virtual/", # List all test expectations here - "//third_party/blink/web_tests/ASANExpectations", "//third_party/blink/web_tests/LeakExpectations", - "//third_party/blink/web_tests/MSANExpectations", "//third_party/blink/web_tests/NeverFixTests", "//third_party/blink/web_tests/SlowTests", "//third_party/blink/web_tests/StaleTestExpectations", "//third_party/blink/web_tests/TestExpectations", ] + if (is_asan) { + data += [ "//third_party/blink/web_tests/ASANExpectations" ] + } + if (is_msan) { + data += [ "//third_party/blink/web_tests/MSANExpectations" ] + } + if (is_win || is_linux || is_fuchsia) { data += [ "//third_party/blink/web_tests/platform/win/",
diff --git a/DEPS b/DEPS index dac89c7..a84d056 100644 --- a/DEPS +++ b/DEPS
@@ -267,7 +267,7 @@ # reclient CIPD package 'reclient_package': 'infra/rbe/client/', # reclient CIPD package version - 'reclient_version': 're_client_version:0.158.0.ddc2270e-gomaip', + 'reclient_version': 're_client_version:0.159.2.996d35d3-gomaip', # screen-ai CIPD packages 'screen_ai_linux': 'version:126.5', @@ -304,19 +304,19 @@ # 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': '42cf8c1ffc1fdf58a78971155e3e99ac7a1b5b20', + 'skia_revision': '5515c08c2e444dca4d18fa252ea5e629f27850aa', # 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': 'cf1d29a1bbb0f125d9400dcf002ddf1d7db6826c', + 'v8_revision': '225c383245605b717d45c0debf45b8f6b4fabc5b', # 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': 'e5532e6c7f2e04dcc586b8d9d5ac426cbce8e35f', + 'angle_revision': '177d15b3807b2db8df7168f5fef51705bd600592', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': '3c4bdf66d81d01a215b88bfea3ac4cc8ca507779', + 'swiftshader_revision': '5561c71fa64e5f7f726f74f23a8aac5cc308d18a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -372,7 +372,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': '21462dff937ce89720e90a43b7dc58425c82535d', + 'catapult_revision': '663fc204a73a11aaeb16b736f157f3d6369c7a8b', # 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. @@ -380,7 +380,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling CrossBench # and whatever else without interference from each other. - 'crossbench_revision': '1a18b08fa770e397437c44944955169370a111cb', + 'crossbench_revision': '8a7bae5d9b97c561304527e3c192a11eb49453dc', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -396,7 +396,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': '4d982f5fa22ed2bb960119d79f74b161d98645bc', + 'devtools_frontend_revision': 'b12a19e856d1c4696a5dd7f078b34a94a0296a82', # 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. @@ -1287,7 +1287,7 @@ 'src/clank': { 'url': Var('chrome_git') + '/clank/internal/apps.git' + '@' + - '39daeb7b11d9f4e7fbe38fc90d861ea0ce881389', + '13f9fa6614f55af1da0a158af6c69ea6e4686179', 'condition': 'checkout_android and checkout_src_internal', }, @@ -1725,7 +1725,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' + '@' + '440263466a043eec253592e5ba53d67dc68448fa', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '63ab822153c82b58bcd90754c99695cf52570d04', 'condition': 'checkout_chromeos', }, @@ -1766,7 +1766,7 @@ Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), 'src/third_party/devtools-frontend-internal': { - 'url': Var('chrome_git') + '/devtools/devtools-internal.git' + '@' + 'e86d9e749a81f3ea6c928d79ae6f2492b0c180f9', + 'url': Var('chrome_git') + '/devtools/devtools-internal.git' + '@' + 'eafa1f8d0782656b27401d12d223eac3e87ef834', 'condition': 'checkout_src_internal', }, @@ -2020,7 +2020,7 @@ }, 'src/third_party/leveldatabase/src': - Var('chromium_git') + '/external/leveldb.git' + '@' + 'eb31d19999fdf2018df4ae815a0fe130dd407532', + Var('chromium_git') + '/external/leveldb.git' + '@' + '23e35d792b9154f922b8b575b12596a4d8664c65', 'src/third_party/libFuzzer/src': Var('chromium_git') + '/external/github.com/llvm/llvm-project/compiler-rt/lib/fuzzer.git' + '@' + Var('libfuzzer_revision'), @@ -2252,7 +2252,7 @@ Var('pdfium_git') + '/pdfium.git' + '@' + Var('pdfium_revision'), 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '4acdcdfaa037f456d793ba8e08c44f1756069971', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f2aa5c0df5f4b73f14b024288da6f900955b118a', 'src/base/tracing/test/data': { 'bucket': 'perfetto', @@ -2427,7 +2427,7 @@ 'version': 'Y1B0M_fCpPZ058xErMX6GQOJEVRBWR342juuxNLpVnkC', }, ], - 'condition': 'checkout_android', + 'condition': 'checkout_android and non_git_source', 'dep_type': 'cipd', }, @@ -2444,7 +2444,7 @@ Var('chromium_git') + '/external/github.com/google/snappy.git' + '@' + 'c9f9edf6d75bb065fa47468bf035e051a57bec7c', 'src/third_party/sqlite/src': - Var('chromium_git') + '/chromium/deps/sqlite.git' + '@' + '8368e7f47150c9f226bc1948745243dacbbe5c18', + Var('chromium_git') + '/chromium/deps/sqlite.git' + '@' + '360e7d4402ca7182adbb7a46e554779beb474f3b', 'src/third_party/sqlite4java/cipd': { 'packages': [ @@ -2453,7 +2453,7 @@ 'version': 'LofjKH9dgXIAJhRYCPQlMFywSwxYimrfDeBmaHc-Z5EC', }, ], - 'condition': 'checkout_android', + 'condition': 'checkout_android and non_git_source', 'dep_type': 'cipd', }, @@ -2528,7 +2528,7 @@ 'dep_type': 'cipd', }, - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@aa237b66d8cc42000940a7ea1f116b142a0f40e7', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@5e29f5c97fc482e48e04309b4460b0d9be3804f3', 'src/third_party/glslang/src': '{chromium_git}/external/github.com/KhronosGroup/glslang@a496a34b439022750d41d2ba04fbbe416ef81c9a', 'src/third_party/spirv-cross/src': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3', 'src/third_party/spirv-headers/src': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Headers@efb6b4099ddb8fa60f62956dee592c4b94ec6a49', @@ -2537,7 +2537,7 @@ 'src/third_party/vulkan-loader/src': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-Loader@d25bd69eb7d386bc584cbca4f0f005c7ee57535f', 'src/third_party/vulkan-tools/src': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-Tools@4c63e845962ff3b197855f3ae4907a47d0863f5a', 'src/third_party/vulkan-utility-libraries/src': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@fbb4db92c6b2ac09003b2b8e5ceb978f4f2dda71', - 'src/third_party/vulkan-validation-layers/src': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-ValidationLayers@f6381d64213a21d351a1cf83034be78e07f76301', + 'src/third_party/vulkan-validation-layers/src': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-ValidationLayers@a44622ed6e1dfaa2754a65eec35ef1b19ec3e782', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + '56300b29fbfcc693ee6609ddad3fdd5b7a449a21', @@ -2574,7 +2574,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '1b6371436a0a60e6b9a4ae2a40a8eba198e3af02', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '9b30f7a02d172ce36d138c02614d0a5a1edbfa72', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '07d31bdbc0cdde5dc561d563d4898f6ed7dae38c', 'src/third_party/webrtc': Var('webrtc_git') + '/src.git' + '@' + '55ed9501d22f8f4e3b93714b790ef15ed3504314', @@ -2717,7 +2717,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'SxXe5ITiv6fcMMr77bTxBOZzTKHSH__6-B3jEinF3swC', + 'version': '1zvxr_uZ6Gt3zGp9r9dPyUqiYWnSd3q_6ltiWpKLrwYC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -2728,7 +2728,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'AmZSsSryrI9zHaPLWHRksN3AuDkD74Y1qBnQSSysSn8C', + 'version': 'scDjZNhYR98DamFP_9x4_FaKYVZCouyTp2dNdQSEJJIC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -4585,7 +4585,7 @@ 'src/components/optimization_guide/internal': { 'url': Var('chrome_git') + '/chrome/components/optimization_guide.git' + '@' + - '1b3d4a8fafe6ebba72ef42555c0429db029b6d71', + 'bae07ac124624f1389990348b3d2df951083f28d', 'condition': 'checkout_src_internal', }, @@ -4645,7 +4645,7 @@ 'src/ios_internal': { 'url': Var('chrome_git') + '/chrome/ios_internal.git' + '@' + - 'bdca260aab34fa4e5b2998c7d38fcdb88cae3ea2', + 'e1ff46553ed49b436b1625eb106928181bfb4a2c', 'condition': 'checkout_ios and checkout_src_internal', },
diff --git a/android_webview/browser/sensitive_content/aw_sensitive_content_client.cc b/android_webview/browser/sensitive_content/aw_sensitive_content_client.cc index ca48244..bc991b4 100644 --- a/android_webview/browser/sensitive_content/aw_sensitive_content_client.cc +++ b/android_webview/browser/sensitive_content/aw_sensitive_content_client.cc
@@ -18,4 +18,8 @@ void AwSensitiveContentClient::SetContentSensitivity( bool content_is_sensitive) {} +std::string_view AwSensitiveContentClient::GetHistogramPrefix() { + return "SensitiveContent.WebView."; +} + } // namespace sensitive_content
diff --git a/android_webview/browser/sensitive_content/aw_sensitive_content_client.h b/android_webview/browser/sensitive_content/aw_sensitive_content_client.h index e471db7..d921663b 100644 --- a/android_webview/browser/sensitive_content/aw_sensitive_content_client.h +++ b/android_webview/browser/sensitive_content/aw_sensitive_content_client.h
@@ -27,6 +27,8 @@ void SetContentSensitivity(bool content_is_sensitive) override; + std::string_view GetHistogramPrefix() override; + private: SensitiveContentManager manager_; };
diff --git a/ash/clipboard/clipboard_history_item.cc b/ash/clipboard/clipboard_history_item.cc index f491610..52c0b6e 100644 --- a/ash/clipboard/clipboard_history_item.cc +++ b/ash/clipboard/clipboard_history_item.cc
@@ -12,6 +12,7 @@ #include "ash/clipboard/clipboard_history_util.h" #include "ash/strings/grit/ash_strings.h" #include "base/callback_list.h" +#include "base/check.h" #include "base/containers/contains.h" #include "base/notreached.h" #include "base/strings/escape.h" @@ -95,9 +96,7 @@ std::u16string sources; std::vector<std::u16string_view> source_list; clipboard_history_util::GetSplitFileSystemData(data, &source_list, &sources); - if (sources.empty()) { - NOTREACHED(); - } + CHECK(!sources.empty()); size_t file_count = source_list.size(); if (chromeos::features::IsClipboardHistoryRefreshEnabled() &&
diff --git a/ash/constants/ash_switches.cc b/ash/constants/ash_switches.cc index b13b526..e97f983 100644 --- a/ash/constants/ash_switches.cc +++ b/ash/constants/ash_switches.cc
@@ -934,8 +934,6 @@ // Supply secret key for the mahi feature. const char kMahiFeatureKey[] = "mahi-feature-key"; -const char kMahiRestrictionsOverride[] = "mahi-restrictions-override"; - // Supply secret key for the sparky feature. const char kSparkyFeatureKey[] = "sparky-feature-key";
diff --git a/ash/constants/ash_switches.h b/ash/constants/ash_switches.h index 9efe53b2..8b8cdfa 100644 --- a/ash/constants/ash_switches.h +++ b/ash/constants/ash_switches.h
@@ -285,7 +285,6 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDisableDisallowLacros[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEnableLacrosForTesting[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kMahiFeatureKey[]; -COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kMahiRestrictionsOverride[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kSparkyFeatureKey[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kSparkyServerUrl[]; COMPONENT_EXPORT(ASH_CONSTANTS)
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 738c6db..362ff34 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc
@@ -100,11 +100,18 @@ // display::DisplayObserver: void OnDisplayAdded(const display::Display& new_display) override { if (!base::Contains(added_displays_, new_display)) { + EXPECT_TRUE(base::Contains(active_display_list(), new_display)); added_displays_.push_back(new_display); } } + void OnWillRemoveDisplays(const Displays& removed_displays) override { + for (const auto& display : removed_displays) { + EXPECT_TRUE(base::Contains(active_display_list(), display)); + } + } void OnDisplaysRemoved(const display::Displays& removed_displays) override { for (const auto& display : removed_displays) { + EXPECT_FALSE(base::Contains(active_display_list(), display)); if (!base::Contains(added_displays_, display)) { removed_displays_.push_back(display); } @@ -112,6 +119,7 @@ } void OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) override { + EXPECT_TRUE(base::Contains(active_display_list(), display)); if (!base::Contains(changed_displays_, display)) { changed_displays_.push_back(display); } @@ -150,6 +158,10 @@ changed_metrics_.clear(); } + const display::Displays& active_display_list() { + return Shell::Get()->display_manager()->active_display_list(); + } + private: bool processing_display_changes_ = false; vector<display::Display> added_displays_;
diff --git a/ash/quick_pair/common/fake_bluetooth_adapter.cc b/ash/quick_pair/common/fake_bluetooth_adapter.cc index e99df00..ffb724fa 100644 --- a/ash/quick_pair/common/fake_bluetooth_adapter.cc +++ b/ash/quick_pair/common/fake_bluetooth_adapter.cc
@@ -54,6 +54,11 @@ pairing_delegate_->ConfirmPasskey(device, passkey); } +void FakeBluetoothAdapter::NotifyDisplayPasskey(device::BluetoothDevice* device, + uint32_t passkey) { + pairing_delegate_->DisplayPasskey(device, passkey); +} + void FakeBluetoothAdapter::NotifyDevicePairedChanged( device::BluetoothDevice* device, bool new_paired_status) {
diff --git a/ash/quick_pair/common/fake_bluetooth_adapter.h b/ash/quick_pair/common/fake_bluetooth_adapter.h index a797f37..6ad61c6 100644 --- a/ash/quick_pair/common/fake_bluetooth_adapter.h +++ b/ash/quick_pair/common/fake_bluetooth_adapter.h
@@ -43,6 +43,7 @@ device::BluetoothRemoteGattCharacteristic* characteristic); void NotifyConfirmPasskey(uint32_t passkey, device::BluetoothDevice* device); + void NotifyDisplayPasskey(device::BluetoothDevice* device, uint32_t passkey); void NotifyDevicePairedChanged(device::BluetoothDevice* device, bool new_paired_status);
diff --git a/ash/quick_pair/keyed_service/quick_pair_mediator.cc b/ash/quick_pair/keyed_service/quick_pair_mediator.cc index ae0e1e60..8c8c549 100644 --- a/ash/quick_pair/keyed_service/quick_pair_mediator.cc +++ b/ash/quick_pair/keyed_service/quick_pair_mediator.cc
@@ -393,6 +393,11 @@ } } +void Mediator::OnDisplayPasskey(std::u16string device_name, uint32_t passkey) { + CD_LOG(VERBOSE, Feature::FP) << __func__ << ": Device=" << device_name; + ui_broker_->ShowPasskey(device_name, passkey); +} + void Mediator::UpdateDiscoveryBlockList(scoped_refptr<Device> device) { auto it = discovery_notification_block_list_.find( std::make_pair(device->metadata_id(), device->protocol()));
diff --git a/ash/quick_pair/keyed_service/quick_pair_mediator.h b/ash/quick_pair/keyed_service/quick_pair_mediator.h index b4479a7..d01df14 100644 --- a/ash/quick_pair/keyed_service/quick_pair_mediator.h +++ b/ash/quick_pair/keyed_service/quick_pair_mediator.h
@@ -97,6 +97,7 @@ PairFailure failure) override; void OnAccountKeyWrite(scoped_refptr<Device> device, std::optional<AccountKeyFailure> error) override; + void OnDisplayPasskey(std::u16string device_name, uint32_t passkey) override; // UIBroker::Observer void OnDiscoveryAction(scoped_refptr<Device> device,
diff --git a/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc b/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc index 42d821a..0bc3e169 100644 --- a/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc +++ b/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc
@@ -1065,5 +1065,12 @@ mock_pairer_broker_->NotifyDevicePaired(initial_device_); } +TEST_F(MediatorTest, ShowPasskey_OnDisplayPasskey) { + feature_status_tracker_->SetIsFastPairEnabled(true); + EXPECT_CALL(*mock_ui_broker_, ShowPasskey); + mock_pairer_broker_->NotifyDisplayPasskey(/*device name=*/std::u16string(), + /*passkey=*/0); +} + } // namespace quick_pair } // namespace ash
diff --git a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc index a75a5590..cc84ff6 100644 --- a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc +++ b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.cc
@@ -91,20 +91,21 @@ pair_failed_callback, base::OnceCallback<void(scoped_refptr<Device>, AccountKeyFailure)> account_key_failure_callback, + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey, base::OnceCallback<void(scoped_refptr<Device>)> pairing_procedure_complete) { if (g_test_factory_) { return g_test_factory_->CreateInstance( std::move(adapter), std::move(device), std::move(paired_callback), std::move(pair_failed_callback), - std::move(account_key_failure_callback), + std::move(account_key_failure_callback), std::move(display_passkey), std::move(pairing_procedure_complete)); } return base::WrapUnique(new FastPairPairerImpl( std::move(adapter), std::move(device), std::move(paired_callback), std::move(pair_failed_callback), std::move(account_key_failure_callback), - std::move(pairing_procedure_complete))); + std::move(display_passkey), std::move(pairing_procedure_complete))); } // static @@ -123,12 +124,14 @@ pair_failed_callback, base::OnceCallback<void(scoped_refptr<Device>, AccountKeyFailure)> account_key_failure_callback, + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey, base::OnceCallback<void(scoped_refptr<Device>)> pairing_procedure_complete) : adapter_(std::move(adapter)), device_(std::move(device)), paired_callback_(std::move(paired_callback)), pair_failed_callback_(std::move(pair_failed_callback)), account_key_failure_callback_(std::move(account_key_failure_callback)), + display_passkey_(std::move(display_passkey)), pairing_procedure_complete_(std::move(pairing_procedure_complete)) { adapter_observation_.Observe(adapter_.get()); @@ -751,7 +754,10 @@ void FastPairPairerImpl::DisplayPasskey(device::BluetoothDevice* device, uint32_t passkey) { - // Left unimplemented. + if (ash::features::IsFastPairKeyboardsEnabled() && + floss::features::IsFlossEnabled()) { + std::move(display_passkey_).Run(device->GetNameForDisplay(), passkey); + } } void FastPairPairerImpl::KeysEntered(device::BluetoothDevice* device,
diff --git a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.h b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.h index df8bfc0c..f46f8790 100644 --- a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.h +++ b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl.h
@@ -51,6 +51,7 @@ pair_failed_callback, base::OnceCallback<void(scoped_refptr<Device>, AccountKeyFailure)> account_key_failure_callback, + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey, base::OnceCallback<void(scoped_refptr<Device>)> pairing_procedure_complete); @@ -67,6 +68,7 @@ pair_failed_callback, base::OnceCallback<void(scoped_refptr<Device>, AccountKeyFailure)> account_key_failure_callback, + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey, base::OnceCallback<void(scoped_refptr<Device>)> pairing_procedure_complete) = 0; @@ -82,6 +84,7 @@ pair_failed_callback, base::OnceCallback<void(scoped_refptr<Device>, AccountKeyFailure)> account_key_failure_callback, + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey, base::OnceCallback<void(scoped_refptr<Device>)> pairing_procedure_complete); FastPairPairerImpl(const FastPairPairerImpl&) = delete; @@ -193,6 +196,7 @@ pair_failed_callback_; base::OnceCallback<void(scoped_refptr<Device>, AccountKeyFailure)> account_key_failure_callback_; + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey_; base::OnceCallback<void(scoped_refptr<Device>)> pairing_procedure_complete_; raw_ptr<FastPairHandshake, DanglingUntriaged> fast_pair_handshake_ = nullptr; base::ScopedObservation<device::BluetoothAdapter,
diff --git a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc index a0256b1f..795bfa2 100644 --- a/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc +++ b/ash/quick_pair/pairing/fast_pair/fast_pair_pairer_impl_unittest.cc
@@ -411,6 +411,10 @@ adapter_->NotifyDevicePairedChanged(fake_bluetooth_device_ptr_, true); } + void NotifyDisplayPasskey() { + adapter_->NotifyDisplayPasskey(fake_bluetooth_device_ptr_, kValidPasskey); + } + template <typename T> void ExpectStepMetrics(std::string metric, std::vector<T> steps) { histogram_tester().ExpectTotalCount(metric, steps.size()); @@ -426,7 +430,8 @@ adapter_, device_, paired_callback_.Get(), base::BindOnce(&FastPairPairerImplTest::PairFailedCallback, weak_ptr_factory_.GetWeakPtr()), - account_key_failure_callback_.Get(), pairing_procedure_complete_.Get()); + account_key_failure_callback_.Get(), display_passkey_.Get(), + pairing_procedure_complete_.Get()); } void CreatePairerAsFactory() { @@ -434,7 +439,8 @@ adapter_, device_, paired_callback_.Get(), base::BindOnce(&FastPairPairerImplTest::PairFailedCallback, weak_ptr_factory_.GetWeakPtr()), - account_key_failure_callback_.Get(), pairing_procedure_complete_.Get()); + account_key_failure_callback_.Get(), display_passkey_.Get(), + pairing_procedure_complete_.Get()); } void CreateDevice(DeviceFastPairVersion version) { @@ -482,6 +488,8 @@ base::MockCallback< base::OnceCallback<void(scoped_refptr<Device>, AccountKeyFailure)>> account_key_failure_callback_; + base::MockCallback<base::OnceCallback<void(std::u16string, uint32_t)>> + display_passkey_; base::MockCallback<base::OnceCallback<void(scoped_refptr<Device>)>> pairing_procedure_complete_; std::unique_ptr<FakeFastPairRepository> fast_pair_repository_; @@ -2782,5 +2790,45 @@ EXPECT_FALSE(IsAccountKeySavedToFootprints()); } +TEST_F(FastPairPairerImplTest, DisplayPasskey) { + base::test::ScopedFeatureList feature_list; + feature_list.InitWithFeatures( + /*enabled_features=*/{features::kFastPairKeyboards, + floss::features::kFlossEnabled}, + /*disabled_features=*/{}); + + Login(user_manager::UserType::kRegular); + + CreateMockDevice(DeviceFastPairVersion::kHigherThanV1, + /*protocol=*/Protocol::kFastPairInitial); + + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. 'SetGetDeviceNullptr' tells the adapter + // to return null when queried for the device to mock this behavior. + SetGetDeviceNullptr(); + AddConnectedHandshake(); + CreatePairer(); + + EXPECT_CALL(display_passkey_, Run); + NotifyDisplayPasskey(); +} + +TEST_F(FastPairPairerImplTest, DoNotDisplayPasskey) { + Login(user_manager::UserType::kRegular); + + CreateMockDevice(DeviceFastPairVersion::kHigherThanV1, + /*protocol=*/Protocol::kFastPairInitial); + + // When pairing starts, if the classic address can't be resolved to + // a device then we pair via address. 'SetGetDeviceNullptr' tells the adapter + // to return null when queried for the device to mock this behavior. + SetGetDeviceNullptr(); + AddConnectedHandshake(); + CreatePairer(); + + EXPECT_CALL(display_passkey_, Run).Times(0); + NotifyDisplayPasskey(); +} + } // namespace quick_pair } // namespace ash
diff --git a/ash/quick_pair/pairing/mock_pairer_broker.cc b/ash/quick_pair/pairing/mock_pairer_broker.cc index 5850f41..d91f3b38 100644 --- a/ash/quick_pair/pairing/mock_pairer_broker.cc +++ b/ash/quick_pair/pairing/mock_pairer_broker.cc
@@ -44,6 +44,13 @@ obs.OnPairingStart(device); } +void MockPairerBroker::NotifyDisplayPasskey(std::u16string device_name, + uint32_t passkey) { + for (auto& obs : observers_) { + obs.OnDisplayPasskey(device_name, passkey); + } +} + void MockPairerBroker::NotifyHandshakeComplete(scoped_refptr<Device> device) { for (auto& obs : observers_) obs.OnHandshakeComplete(device);
diff --git a/ash/quick_pair/pairing/mock_pairer_broker.h b/ash/quick_pair/pairing/mock_pairer_broker.h index 49a17088..5fd10930 100644 --- a/ash/quick_pair/pairing/mock_pairer_broker.h +++ b/ash/quick_pair/pairing/mock_pairer_broker.h
@@ -39,6 +39,7 @@ void NotifyPairComplete(scoped_refptr<Device> device); void NotifyAccountKeyWrite(scoped_refptr<Device> device, std::optional<AccountKeyFailure> error); + void NotifyDisplayPasskey(std::u16string device_name, uint32_t passkey); private: base::ObserverList<Observer> observers_;
diff --git a/ash/quick_pair/pairing/pairer_broker.h b/ash/quick_pair/pairing/pairer_broker.h index 2e509007..c5d921b 100644 --- a/ash/quick_pair/pairing/pairer_broker.h +++ b/ash/quick_pair/pairing/pairer_broker.h
@@ -30,6 +30,8 @@ virtual void OnDevicePaired(scoped_refptr<Device> device) {} virtual void OnAccountKeyWrite(scoped_refptr<Device> device, std::optional<AccountKeyFailure> error) {} + virtual void OnDisplayPasskey(std::u16string device_name, + uint32_t passkey) {} virtual void OnPairingComplete(scoped_refptr<Device> device) {} virtual void OnPairFailure(scoped_refptr<Device> device, PairFailure failure) {}
diff --git a/ash/quick_pair/pairing/pairer_broker_impl.cc b/ash/quick_pair/pairing/pairer_broker_impl.cc index 1e442747..3527c6dc 100644 --- a/ash/quick_pair/pairing/pairer_broker_impl.cc +++ b/ash/quick_pair/pairing/pairer_broker_impl.cc
@@ -287,6 +287,8 @@ weak_pointer_factory_.GetWeakPtr()), base::BindOnce(&PairerBrokerImpl::OnAccountKeyFailure, weak_pointer_factory_.GetWeakPtr()), + base::BindOnce(&PairerBrokerImpl::OnDisplayPasskey, + weak_pointer_factory_.GetWeakPtr()), base::BindOnce(&PairerBrokerImpl::OnFastPairProcedureComplete, weak_pointer_factory_.GetWeakPtr())); } @@ -365,6 +367,15 @@ EraseHandshakeAndFromPairers(device); } +void PairerBrokerImpl::OnDisplayPasskey(std::u16string device_name, + uint32_t passkey) { + CD_LOG(VERBOSE, Feature::FP) << __func__ << ": Device=" << device_name; + + for (auto& observer : observers_) { + observer.OnDisplayPasskey(device_name, passkey); + } +} + void PairerBrokerImpl::OnFastPairProcedureComplete( scoped_refptr<Device> device) { CD_LOG(VERBOSE, Feature::FP) << __func__ << ": Device=" << device;
diff --git a/ash/quick_pair/pairing/pairer_broker_impl.h b/ash/quick_pair/pairing/pairer_broker_impl.h index db140fc..15b6fd4 100644 --- a/ash/quick_pair/pairing/pairer_broker_impl.h +++ b/ash/quick_pair/pairing/pairer_broker_impl.h
@@ -56,6 +56,7 @@ void OnAccountKeyFailure(scoped_refptr<Device> device, AccountKeyFailure failure); void OnFastPairProcedureComplete(scoped_refptr<Device> device); + void OnDisplayPasskey(std::u16string device_name, uint32_t passkey); void CreateHandshake(scoped_refptr<Device> device); void OnHandshakeComplete(scoped_refptr<Device> device, std::optional<PairFailure> failure);
diff --git a/ash/quick_pair/pairing/pairer_broker_impl_unittest.cc b/ash/quick_pair/pairing/pairer_broker_impl_unittest.cc index 97bdeb9..bdd9cc0d8 100644 --- a/ash/quick_pair/pairing/pairer_broker_impl_unittest.cc +++ b/ash/quick_pair/pairing/pairer_broker_impl_unittest.cc
@@ -42,6 +42,7 @@ constexpr char kTestDeviceAddress2[] = "test_address_2"; constexpr char kDeviceName[] = "test_device_name"; constexpr char kBluetoothCanonicalizedAddress[] = "0C:0E:4C:C8:05:08"; +const uint8_t kValidPasskey = 13; constexpr base::TimeDelta kCancelPairingRetryDelay = base::Seconds(1); const char kFastPairRetryCountMetricName[] = @@ -80,6 +81,7 @@ base::OnceCallback<void(scoped_refptr<ash::quick_pair::Device>, ash::quick_pair::AccountKeyFailure)> account_key_failure_callback, + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey, base::OnceCallback<void(scoped_refptr<ash::quick_pair::Device>)> pairing_procedure_complete) : adapter_(adapter), @@ -87,6 +89,7 @@ paired_callback_(std::move(paired_callback)), pair_failed_callback_(std::move(pair_failed_callback)), account_key_failure_callback_(std::move(account_key_failure_callback)), + display_passkey_(std::move(display_passkey)), pairing_procedure_complete_(std::move(pairing_procedure_complete)) {} ~FakeFastPairPairer() override = default; @@ -112,6 +115,11 @@ std::move(pair_failed_callback_).Run(device_, failure); } + void TriggerDisplayPasskeyCallback() { + EXPECT_TRUE(display_passkey_); + std::move(display_passkey_).Run(std::u16string(), kValidPasskey); + } + private: scoped_refptr<device::BluetoothAdapter> adapter_; scoped_refptr<ash::quick_pair::Device> device_; @@ -123,6 +131,7 @@ base::OnceCallback<void(scoped_refptr<ash::quick_pair::Device>, ash::quick_pair::AccountKeyFailure)> account_key_failure_callback_; + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey_; base::OnceCallback<void(scoped_refptr<ash::quick_pair::Device>)> pairing_procedure_complete_; }; @@ -141,12 +150,13 @@ base::OnceCallback<void(scoped_refptr<ash::quick_pair::Device>, ash::quick_pair::AccountKeyFailure)> account_key_failure_callback, + base::OnceCallback<void(std::u16string, uint32_t)> display_passkey, base::OnceCallback<void(scoped_refptr<ash::quick_pair::Device>)> pairing_procedure_complete) override { auto fake_fast_pair_pairer = std::make_unique<FakeFastPairPairer>( std::move(adapter), std::move(device), std::move(paired_callback), std::move(pair_failed_callback), - std::move(account_key_failure_callback), + std::move(account_key_failure_callback), std::move(display_passkey), std::move(pairing_procedure_complete)); fake_fast_pair_pairer_ = fake_fast_pair_pairer.get(); return fake_fast_pair_pairer; @@ -299,6 +309,10 @@ handshake_complete_ = true; } + void OnDisplayPasskey(std::u16string device_name, uint32_t passkey) override { + display_passkey_ = passkey; + } + void OnPairingComplete(scoped_refptr<Device> device) override { device_pair_complete_ = true; } @@ -321,6 +335,7 @@ int device_paired_count_ = 0; int pair_failure_count_ = 0; int account_key_write_count_ = 0; + uint32_t display_passkey_ = 0; bool pairing_started_ = false; bool handshake_complete_ = false; bool device_pair_complete_ = false; @@ -876,5 +891,19 @@ 1); } +TEST_F(PairerBrokerImplTest, DisplayPasskeySuccess) { + CreateMockDevice(DeviceFastPairVersion::kHigherThanV1, + /*protocol=*/Protocol::kFastPairInitial); + pairer_broker_->PairDevice(device_); + InvokeHandshakeLookupCallbackSuccess(); + + EXPECT_TRUE(pairer_broker_->IsPairing()); + + fast_pair_pairer_factory_->fake_fast_pair_pairer() + ->TriggerDisplayPasskeyCallback(); + + EXPECT_EQ(display_passkey_, kValidPasskey); +} + } // namespace quick_pair } // namespace ash
diff --git a/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.cc b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.cc index 63a28dbd..5380acfa 100644 --- a/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.cc +++ b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.cc
@@ -11,14 +11,14 @@ #include "base/functional/bind.h" #include "base/functional/callback_helpers.h" #include "base/memory/raw_ptr.h" +#include "base/strings/utf_string_conversions.h" #include "base/time/time.h" +#include "components/cross_device/logging/logging.h" #include "ui/base/l10n/l10n_util.h" #include "ui/message_center/message_center.h" #include "ui/message_center/public/cpp/notification.h" #include "ui/message_center/public/cpp/notification_delegate.h" -#include "components/cross_device/logging/logging.h" - using message_center::MessageCenter; using message_center::Notification; @@ -44,6 +44,8 @@ "cros_fast_pair_associate_account_notification_id"; const char kFastPairDiscoverySubsequentNotificationId[] = "cros_fast_pair_discovery_subsequent_notification_id"; +const char kFastPairDisplayPasskeyNotificationId[] = + "cros_fast_pair_display_passkey_notification_id"; // Values outside of the range (e.g. -1) will show an infinite loading // progress bar. @@ -479,6 +481,20 @@ message_center_->AddNotification(std::move(associate_account_notification)); } +void FastPairNotificationController::ShowPasskey( + const std::u16string& device_name, + uint32_t passkey) { + std::unique_ptr<message_center::Notification> passkey_notification = + CreateNotification(kFastPairDisplayPasskeyNotificationId, + message_center::SystemNotificationWarningLevel::NORMAL, + message_center_); + passkey_notification->set_message(l10n_util::GetStringFUTF16( + IDS_ASH_STATUS_TRAY_BLUETOOTH_DISPLAY_PASSKEY, device_name, + base::UTF8ToUTF16(base::StringPrintf("%06i", passkey)))); + + message_center_->AddNotification(std::move(passkey_notification)); +} + void FastPairNotificationController::RemoveNotifications() { message_center_->RemoveNotificationsForNotifierId(kNotifierFastPair); }
diff --git a/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.h b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.h index 256d5eb..21ea631 100644 --- a/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.h +++ b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller.h
@@ -86,6 +86,7 @@ base::RepeatingClosure on_save_clicked, base::RepeatingClosure on_learn_more_clicked, base::OnceCallback<void(FastPairNotificationDismissReason)> on_close); + void ShowPasskey(const std::u16string& device_name, uint32_t passkey); void RemoveNotifications(); void ExtendNotification();
diff --git a/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller_unittest.cc b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller_unittest.cc index 7e06ea6..29b4a1c 100644 --- a/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller_unittest.cc +++ b/ash/quick_pair/ui/fast_pair/fast_pair_notification_controller_unittest.cc
@@ -39,6 +39,8 @@ "cros_fast_pair_associate_account_notification_id"; const char kFastPairDiscoverySubsequentNotificationId[] = "cros_fast_pair_discovery_subsequent_notification_id"; +const char kFastPairDisplayPasskeyNotificationId[] = + "cros_fast_pair_display_passkey_notification_id"; constexpr base::TimeDelta kNotificationShortTimeDuration = base::Seconds(5); constexpr base::TimeDelta kNotificationTimeout = base::Seconds(12); @@ -1032,5 +1034,17 @@ kFastPairDiscoverySubsequentNotificationId)); } +TEST_F(FastPairNotificationControllerTest, ShowPasskey) { + EXPECT_FALSE(test_message_center_.FindVisibleNotificationById( + kFastPairDisplayPasskeyNotificationId)); + + fast_pair_notification_controller_->ShowPasskey( + /*device name=*/std::u16string(), /*passkey=*/0); + base::RunLoop().RunUntilIdle(); + + EXPECT_TRUE(test_message_center_.FindVisibleNotificationById( + kFastPairDisplayPasskeyNotificationId)); +} + } // namespace quick_pair } // namespace ash
diff --git a/ash/quick_pair/ui/fast_pair/fast_pair_presenter.h b/ash/quick_pair/ui/fast_pair/fast_pair_presenter.h index 0da3e1de..375feba 100644 --- a/ash/quick_pair/ui/fast_pair/fast_pair_presenter.h +++ b/ash/quick_pair/ui/fast_pair/fast_pair_presenter.h
@@ -38,6 +38,7 @@ CompanionAppCallback callback) = 0; virtual void ShowLaunchCompanionApp(scoped_refptr<Device> device, CompanionAppCallback callback) = 0; + virtual void ShowPasskey(std::u16string device_name, uint32_t passkey) = 0; virtual void RemoveNotifications() = 0; virtual void ExtendNotification() = 0;
diff --git a/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl.cc b/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl.cc index 17cd7c1..d4c275f 100644 --- a/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl.cc +++ b/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl.cc
@@ -582,6 +582,11 @@ } } +void FastPairPresenterImpl::ShowPasskey(std::u16string device_name, + uint32_t passkey) { + notification_controller_->ShowPasskey(device_name, passkey); +} + void FastPairPresenterImpl::RemoveNotifications() { notification_controller_->RemoveNotifications(); }
diff --git a/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl.h b/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl.h index 1ebea2f..781c6a8 100644 --- a/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl.h +++ b/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl.h
@@ -66,6 +66,7 @@ CompanionAppCallback callback) override; void ShowLaunchCompanionApp(scoped_refptr<Device> device, CompanionAppCallback callback) override; + void ShowPasskey(std::u16string device_name, uint32_t passkey) override; void RemoveNotifications() override; void ExtendNotification() override;
diff --git a/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl_unittest.cc b/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl_unittest.cc index 1461ff6..9cb1e85 100644 --- a/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl_unittest.cc +++ b/ash/quick_pair/ui/fast_pair/fast_pair_presenter_impl_unittest.cc
@@ -61,6 +61,8 @@ "cros_fast_pair_associate_account_notification_id"; const char kFastPairDiscoverySubsequentNotificationId[] = "cros_fast_pair_discovery_subsequent_notification_id"; +const char kFastPairDisplayPasskeyNotificationId[] = + "cros_fast_pair_display_passkey_notification_id"; constexpr char kRetroactiveSuccessFunnelMetric[] = "FastPair.RetroactivePairing"; @@ -1532,5 +1534,21 @@ EXPECT_EQ(discovery_action_, DiscoveryAction::kDismissedByOs); } +TEST_F(FastPairPresenterImplTest, ShowPasskey) { + EXPECT_FALSE(test_message_center_.FindVisibleNotificationById( + kFastPairDisplayPasskeyNotificationId)); + + SetIdentityManager(identity_manager_); + + Login(user_manager::UserType::kRegular); + base::RunLoop().RunUntilIdle(); + fast_pair_presenter_->ShowPasskey(/*device name=*/std::u16string(), + /*passkey=*/0); + base::RunLoop().RunUntilIdle(); + + EXPECT_TRUE(test_message_center_.FindVisibleNotificationById( + kFastPairDisplayPasskeyNotificationId)); +} + } // namespace quick_pair } // namespace ash
diff --git a/ash/quick_pair/ui/mock_ui_broker.h b/ash/quick_pair/ui/mock_ui_broker.h index bbff171..a3817e2 100644 --- a/ash/quick_pair/ui/mock_ui_broker.h +++ b/ash/quick_pair/ui/mock_ui_broker.h
@@ -34,6 +34,7 @@ ShowLaunchCompanionApp, (scoped_refptr<Device>), (override)); + MOCK_METHOD(void, ShowPasskey, (std::u16string, uint32_t), (override)); MOCK_METHOD(void, RemoveNotifications, (), (override)); MOCK_METHOD(void, ExtendNotification, (), (override));
diff --git a/ash/quick_pair/ui/ui_broker.h b/ash/quick_pair/ui/ui_broker.h index 3c1e979e..b8397f2 100644 --- a/ash/quick_pair/ui/ui_broker.h +++ b/ash/quick_pair/ui/ui_broker.h
@@ -40,6 +40,7 @@ virtual void ShowAssociateAccount(scoped_refptr<Device> device) = 0; virtual void ShowInstallCompanionApp(scoped_refptr<Device> device) = 0; virtual void ShowLaunchCompanionApp(scoped_refptr<Device> device) = 0; + virtual void ShowPasskey(std::u16string device_name, uint32_t passkey) = 0; virtual void RemoveNotifications() = 0; virtual void ExtendNotification() = 0; };
diff --git a/ash/quick_pair/ui/ui_broker_impl.cc b/ash/quick_pair/ui/ui_broker_impl.cc index 3a706a5e..27facc6 100644 --- a/ash/quick_pair/ui/ui_broker_impl.cc +++ b/ash/quick_pair/ui/ui_broker_impl.cc
@@ -117,6 +117,10 @@ } } +void UIBrokerImpl::ShowPasskey(std::u16string device_name, uint32_t passkey) { + fast_pair_presenter_->ShowPasskey(device_name, passkey); +} + void UIBrokerImpl::RemoveNotifications() { fast_pair_presenter_->RemoveNotifications(); }
diff --git a/ash/quick_pair/ui/ui_broker_impl.h b/ash/quick_pair/ui/ui_broker_impl.h index 86ac7ee..043bb72 100644 --- a/ash/quick_pair/ui/ui_broker_impl.h +++ b/ash/quick_pair/ui/ui_broker_impl.h
@@ -34,6 +34,7 @@ void ShowAssociateAccount(scoped_refptr<Device> device) override; void ShowInstallCompanionApp(scoped_refptr<Device> device) override; void ShowLaunchCompanionApp(scoped_refptr<Device> device) override; + void ShowPasskey(std::u16string device_name, uint32_t passkey) override; void RemoveNotifications() override; void ExtendNotification() override;
diff --git a/ash/quick_pair/ui/ui_broker_impl_unittest.cc b/ash/quick_pair/ui/ui_broker_impl_unittest.cc index 612810e..f7612ba 100644 --- a/ash/quick_pair/ui/ui_broker_impl_unittest.cc +++ b/ash/quick_pair/ui/ui_broker_impl_unittest.cc
@@ -66,6 +66,12 @@ callback.Run(ash::quick_pair::CompanionAppAction::kLaunchApp); } + void ShowPasskey(std::u16string device_name, uint32_t passkey) override { + show_passkey_ = true; + } + + bool show_passkey() { return show_passkey_; } + void RemoveNotifications() override { removed_ = true; } void ExtendNotification() override { notification_extended_ = true; } @@ -76,6 +82,7 @@ private: bool show_pairing_ = false; + bool show_passkey_ = false; bool removed_ = false; bool show_pairing_failed_ = false; bool notification_extended_ = false; @@ -387,6 +394,13 @@ EXPECT_EQ(companion_app_action_, CompanionAppAction::kLaunchApp); } +TEST_F(UIBrokerImplTest, ShowPasskey) { + ui_broker_->ShowPasskey(/*device name=*/std::u16string(), /*passkey=*/0); + base::RunLoop().RunUntilIdle(); + + EXPECT_TRUE(presenter_factory_->fake_fast_pair_presenter()->show_passkey()); +} + TEST_F(UIBrokerImplTest, RemoveNotifications_Initial) { auto device = base::MakeRefCounted<Device>(kValidModelId, kTestDeviceAddress, Protocol::kFastPairInitial);
diff --git a/ash/system/holding_space/holding_space_item_chip_view.cc b/ash/system/holding_space/holding_space_item_chip_view.cc index b2a10e5a..f831ecc4 100644 --- a/ash/system/holding_space/holding_space_item_chip_view.cc +++ b/ash/system/holding_space/holding_space_item_chip_view.cc
@@ -30,6 +30,7 @@ #include "ash/system/progress_indicator/progress_indicator.h" #include "ash/system/progress_indicator/progress_indicator_animation_registry.h" #include "ash/system/progress_indicator/progress_ring_animation.h" +#include "base/check.h" #include "base/functional/bind.h" #include "base/functional/overloaded.h" #include "base/memory/raw_ptr.h" @@ -522,11 +523,10 @@ secondary_action_pause_->GetVisible() ? HoldingSpaceCommandId::kPauseItem : HoldingSpaceCommandId::kResumeItem; - if (!holding_space_util::ExecuteInProgressCommand( - item(), command_id, - holding_space_metrics::EventSource::kHoldingSpaceItem)) { - NOTREACHED(); - } + const bool success = holding_space_util::ExecuteInProgressCommand( + item(), command_id, + holding_space_metrics::EventSource::kHoldingSpaceItem); + CHECK(success); } void HoldingSpaceItemChipView::UpdateImage() {
diff --git a/ash/system/holding_space/holding_space_item_view.cc b/ash/system/holding_space/holding_space_item_view.cc index 5447f81..12a2182 100644 --- a/ash/system/holding_space/holding_space_item_view.cc +++ b/ash/system/holding_space/holding_space_item_view.cc
@@ -19,6 +19,7 @@ #include "ash/style/dark_light_mode_controller_impl.h" #include "ash/system/holding_space/holding_space_util.h" #include "ash/system/holding_space/holding_space_view_delegate.h" +#include "base/check.h" #include "base/functional/bind.h" #include "chromeos/constants/chromeos_features.h" #include "ui/base/class_property.h" @@ -441,11 +442,10 @@ // Cancel. if (primary_action_cancel_->GetVisible()) { - if (!holding_space_util::ExecuteInProgressCommand( - item(), HoldingSpaceCommandId::kCancelItem, - holding_space_metrics::EventSource::kHoldingSpaceItem)) { - NOTREACHED(); - } + const bool success = holding_space_util::ExecuteInProgressCommand( + item(), HoldingSpaceCommandId::kCancelItem, + holding_space_metrics::EventSource::kHoldingSpaceItem); + CHECK(success); return; }
diff --git a/ash/system/holding_space/holding_space_view_delegate.cc b/ash/system/holding_space/holding_space_view_delegate.cc index f714d8c..323de1f 100644 --- a/ash/system/holding_space/holding_space_view_delegate.cc +++ b/ash/system/holding_space/holding_space_view_delegate.cc
@@ -22,6 +22,7 @@ #include "ash/system/holding_space/holding_space_item_view.h" #include "ash/system/holding_space/holding_space_tray.h" #include "ash/system/holding_space/holding_space_tray_bubble.h" +#include "base/check.h" #include "base/containers/contains.h" #include "base/memory/raw_ref.h" #include "base/memory/weak_ptr.h" @@ -558,17 +559,12 @@ holding_space_metrics::EventSource::kHoldingSpaceItemContextMenu); break; default: - if (holding_space_util::IsInProgressCommand(command_id)) { - for (const HoldingSpaceItem* item : items) { - if (!holding_space_util::ExecuteInProgressCommand( - item, command_id, - holding_space_metrics::EventSource:: - kHoldingSpaceItemContextMenu)) { - NOTREACHED(); - } - } - } else { - NOTREACHED(); + CHECK(holding_space_util::IsInProgressCommand(command_id)); + for (const HoldingSpaceItem* item : items) { + const bool success = holding_space_util::ExecuteInProgressCommand( + item, command_id, + holding_space_metrics::EventSource::kHoldingSpaceItemContextMenu); + CHECK(success); } break; }
diff --git a/ash/system/model/scoped_fake_power_status.cc b/ash/system/model/scoped_fake_power_status.cc index 5eebc7e..c976c39 100644 --- a/ash/system/model/scoped_fake_power_status.cc +++ b/ash/system/model/scoped_fake_power_status.cc
@@ -8,6 +8,7 @@ #include "ash/system/model/fake_power_status.h" #include "ash/system/power/power_status.h" +#include "base/check.h" #include "base/memory/ptr_util.h" #include "base/notreached.h" @@ -18,9 +19,7 @@ ScopedFakePowerStatus::ScopedFakePowerStatus() { // Only allow one scoped instance at a time. - if (instance_) { - NOTREACHED(); - } + CHECK(!instance_); instance_ = this; real_power_status_instance_ = PowerStatus::g_power_status_;
diff --git a/ash/system/model/scoped_fake_system_tray_model.cc b/ash/system/model/scoped_fake_system_tray_model.cc index c875602a..9b2f67b 100644 --- a/ash/system/model/scoped_fake_system_tray_model.cc +++ b/ash/system/model/scoped_fake_system_tray_model.cc
@@ -8,6 +8,7 @@ #include "ash/shell.h" #include "ash/system/model/fake_system_tray_model.h" #include "ash/system/model/system_tray_model.h" +#include "base/check.h" #include "base/notreached.h" namespace ash { @@ -17,9 +18,7 @@ ScopedFakeSystemTrayModel::ScopedFakeSystemTrayModel() { // Only allow one scoped instance at a time. - if (instance_) { - NOTREACHED(); - } + CHECK(!instance_); instance_ = this; real_system_tray_model_instance_ =
diff --git a/ash/webui/recorder_app_ui/resources.h b/ash/webui/recorder_app_ui/resources.h index 9e71eee..7e3fda2 100644 --- a/ash/webui/recorder_app_ui/resources.h +++ b/ash/webui/recorder_app_ui/resources.h
@@ -35,7 +35,11 @@ IDS_RECORDER_MAIN_RECORDINGS_LIST_LANDMARK_ARIA_LABEL}, {"mainSearchLandmarkAriaLabel", IDS_RECORDER_MAIN_SEARCH_LANDMARK_ARIA_LABEL}, + {"mainStartRecordButtonTooltip", + IDS_RECORDER_MAIN_START_RECORD_BUTTON_TOOLTIP}, {"mainStartRecordNudge", IDS_RECORDER_MAIN_START_RECORD_NUDGE}, + {"micSelectionMenuButtonTooltip", + IDS_RECORDER_MIC_SELECTION_MENU_BUTTON_TOOLTIP}, {"micSelectionMenuChromebookAudioOption", IDS_RECORDER_MIC_SELECTION_MENU_CHROMEBOOK_AUDIO_OPTION}, {"onboardingDialogSpeakerLabelAllowButton", @@ -121,10 +125,18 @@ IDS_RECORDER_RECORD_TRANSCRIPTION_OFF_DESCRIPTION}, {"recordTranscriptionOffHeader", IDS_RECORDER_RECORD_TRANSCRIPTION_OFF_HEADER}, + {"recordingItemOptionsButtonTooltip", + IDS_RECORDER_RECORDING_ITEM_OPTIONS_BUTTON_TOOLTIP}, + {"recordingItemPlayButtonTooltip", + IDS_RECORDER_RECORDING_ITEM_PLAY_BUTTON_TOOLTIP}, {"recordingListHeader", IDS_RECORDER_RECORDING_LIST_HEADER}, {"recordingListNoMatchText", IDS_RECORDER_RECORDING_LIST_NO_MATCH_TEXT}, {"recordingListSearchBoxPlaceholder", IDS_RECORDER_RECORDING_LIST_SEARCH_BOX_PLACEHOLDER}, + {"recordingListSearchButtonTooltip", + IDS_RECORDER_RECORDING_LIST_SEARCH_BUTTON_TOOLTIP}, + {"recordingListSortButtonTooltip", + IDS_RECORDER_RECORDING_LIST_SORT_BUTTON_TOOLTIP}, {"recordingListSortByDateOption", IDS_RECORDER_RECORDING_LIST_SORT_BY_DATE_OPTION}, {"recordingListSortByNameOption",
diff --git a/ash/webui/recorder_app_ui/resources/components/mic-selection-button.ts b/ash/webui/recorder_app_ui/resources/components/mic-selection-button.ts index dea4ae9..53df0b2 100644 --- a/ash/webui/recorder_app_ui/resources/components/mic-selection-button.ts +++ b/ash/webui/recorder_app_ui/resources/components/mic-selection-button.ts
@@ -71,6 +71,8 @@ shape="circle" anchor-corner="start-start" menu-corner="end-start" + role="combobox" + aria-label=${i18n.micSelectionMenuButtonTooltip} > <cra-icon slot="button-icon" name="mic"></cra-icon> ${map(microphones, (mic) => this.renderMicrophone(mic, selectedMic))}
diff --git a/ash/webui/recorder_app_ui/resources/components/recording-file-list-item.ts b/ash/webui/recorder_app_ui/resources/components/recording-file-list-item.ts index bd976f02..f590d9a 100644 --- a/ash/webui/recorder_app_ui/resources/components/recording-file-list-item.ts +++ b/ash/webui/recorder_app_ui/resources/components/recording-file-list-item.ts
@@ -19,6 +19,7 @@ styleMap, } from 'chrome://resources/mwc/lit/index.js'; +import {i18n} from '../core/i18n.js'; import {usePlatformHandler} from '../core/lit/context.js'; import {ReactiveLitElement} from '../core/reactive/lit.js'; import {signal} from '../core/reactive/signal.js'; @@ -413,6 +414,7 @@ shape="circle" @click=${this.onPlayClick} @pointerdown=${/* To prevent ripple on card. */ stopPropagation} + aria-label=${i18n.recordingItemPlayButtonTooltip} > <cra-icon slot="icon" .name=${playIcon}></cra-icon> </cra-icon-button> @@ -453,6 +455,7 @@ buttonstyle="floating" id="options" @click=${this.onOptionsClick} + aria-label=${i18n.recordingItemOptionsButtonTooltip} > <cra-icon slot="icon" name="more_vertical"></cra-icon> </cra-icon-button> @@ -462,6 +465,7 @@ buttonstyle="floating" ?disabled=${!this.menuShown.value} @click=${this.onShowRecordingInfoClick} + aria-label=${i18n.playbackMenuShowDetailOption} > <cra-icon slot="icon" name="info"></cra-icon> </cra-icon-button> @@ -469,6 +473,7 @@ buttonstyle="floating" ?disabled=${!this.menuShown.value} @click=${this.onExportRecordingClick} + aria-label=${i18n.playbackMenuExportOption} > <cra-icon slot="icon" name="export"></cra-icon> </cra-icon-button> @@ -476,6 +481,7 @@ buttonstyle="floating" ?disabled=${!this.menuShown.value} @click=${this.onDeleteRecordingClick} + aria-label=${i18n.playbackMenuDeleteOption} > <cra-icon slot="icon" name="delete"></cra-icon> </cra-icon-button>
diff --git a/ash/webui/recorder_app_ui/resources/components/recording-file-list.ts b/ash/webui/recorder_app_ui/resources/components/recording-file-list.ts index a4729af2..94275554 100644 --- a/ash/webui/recorder_app_ui/resources/components/recording-file-list.ts +++ b/ash/webui/recorder_app_ui/resources/components/recording-file-list.ts
@@ -240,10 +240,10 @@ buttonstyle="toggle" @click=${this.toggleSortMenu} .selected=${live(this.sortMenuOpened.value)} + aria-label=${i18n.recordingListSortButtonTooltip} > <cra-icon slot="icon" name="sort_by"></cra-icon> <cra-icon slot="selectedIcon" name="sort_by"></cra-icon> - <!-- TODO: b/336963138 - Add button tooltip --> </cra-icon-button> </div> ${this.renderSortMenu()}`;
diff --git a/ash/webui/recorder_app_ui/resources/components/recording-search-box.ts b/ash/webui/recorder_app_ui/resources/components/recording-search-box.ts index e9620d65..71e679e 100644 --- a/ash/webui/recorder_app_ui/resources/components/recording-search-box.ts +++ b/ash/webui/recorder_app_ui/resources/components/recording-search-box.ts
@@ -130,6 +130,7 @@ const searchButton = html`<cra-icon-button buttonstyle="floating" @click=${this.openSearchBox} + aria-label=${i18n.recordingListSearchButtonTooltip} > <cra-icon slot="icon" name="search"></cra-icon> </cra-icon-button>`;
diff --git a/ash/webui/recorder_app_ui/resources/components/secondary-button.ts b/ash/webui/recorder_app_ui/resources/components/secondary-button.ts index bab57c3..3735a4a6 100644 --- a/ash/webui/recorder_app_ui/resources/components/secondary-button.ts +++ b/ash/webui/recorder_app_ui/resources/components/secondary-button.ts
@@ -4,7 +4,13 @@ import './cra/cra-icon-button.js'; -import {css, html, LitElement} from 'chrome://resources/mwc/lit/index.js'; +import { + css, + html, + ifDefined, + LitElement, + PropertyDeclarations, +} from 'chrome://resources/mwc/lit/index.js'; import {ReactiveLitElement} from '../core/reactive/lit.js'; @@ -29,8 +35,17 @@ } `; + static override properties: PropertyDeclarations = { + ariaLabel: {type: String, reflect: true, attribute: 'aria-label'}, + }; + + override ariaLabel: string|null = null; + override render(): RenderResult { - return html`<cra-icon-button shape="circle"> + return html`<cra-icon-button + shape="circle" + aria-label=${ifDefined(this.ariaLabel)} + > <slot slot="icon" name="icon"></slot> </cra-icon-button>`; }
diff --git a/ash/webui/recorder_app_ui/resources/core/i18n.ts b/ash/webui/recorder_app_ui/resources/core/i18n.ts index acbdd04..40d9af3 100644 --- a/ash/webui/recorder_app_ui/resources/core/i18n.ts +++ b/ash/webui/recorder_app_ui/resources/core/i18n.ts
@@ -34,7 +34,9 @@ 'mainRecordingBarLandmarkAriaLabel', 'mainRecordingsListLandmarkAriaLabel', 'mainSearchLandmarkAriaLabel', + 'mainStartRecordButtonTooltip', 'mainStartRecordNudge', + 'micSelectionMenuButtonTooltip', 'micSelectionMenuChromebookAudioOption', 'onboardingDialogSpeakerLabelAllowButton', 'onboardingDialogSpeakerLabelDeferButton', @@ -83,9 +85,13 @@ 'recordTranscriptionEntryPointHeader', 'recordTranscriptionOffDescription', 'recordTranscriptionOffHeader', + 'recordingItemOptionsButtonTooltip', + 'recordingItemPlayButtonTooltip', 'recordingListHeader', 'recordingListNoMatchText', 'recordingListSearchBoxPlaceholder', + 'recordingListSearchButtonTooltip', + 'recordingListSortButtonTooltip', 'recordingListSortByDateOption', 'recordingListSortByNameOption', 'recordingListThisMonthHeader',
diff --git a/ash/webui/recorder_app_ui/resources/pages/main-page.ts b/ash/webui/recorder_app_ui/resources/pages/main-page.ts index 8a0817c..1240391 100644 --- a/ash/webui/recorder_app_ui/resources/pages/main-page.ts +++ b/ash/webui/recorder_app_ui/resources/pages/main-page.ts
@@ -282,6 +282,7 @@ shape="circle" @click=${this.onClickRecordButton} ${ref(this.startRecordingButton)} + aria-label=${i18n.mainStartRecordButtonTooltip} > <cra-icon slot="icon" name="circle_fill"></cra-icon> </cra-icon-button>`, @@ -292,7 +293,11 @@ const onClick = () => { this.settingsMenu?.show(); }; - return html`<secondary-button @click=${onClick}> + return html`<secondary-button + id="settings-header" + @click=${onClick} + aria-label=${i18n.settingsHeader} + > <cra-icon slot="icon" name="settings"></cra-icon> </secondary-button>`; }
diff --git a/ash/wm/overview/birch/birch_bar_unittest.cc b/ash/wm/overview/birch/birch_bar_unittest.cc index 94f87dd..7cbff606 100644 --- a/ash/wm/overview/birch/birch_bar_unittest.cc +++ b/ash/wm/overview/birch/birch_bar_unittest.cc
@@ -46,6 +46,7 @@ #include "ui/compositor/test/layer_animation_stopped_waiter.h" #include "ui/display/manager/display_manager.h" #include "ui/display/test/display_manager_test_api.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/menu/menu_item_view.h" #include "ui/views/controls/menu/submenu_view.h" #include "ui/views/test/views_test_utils.h" @@ -1587,7 +1588,7 @@ // `views::MenuItemView` calculates its accessible name by calling // `GetAccessibleNodeData()`. Test that it returns the correct string. ui::AXNodeData node_data; - item_view->GetAccessibleNodeData(&node_data); + item_view->GetViewAccessibility().GetAccessibleNodeData(&node_data); EXPECT_EQ(u"Weather", node_data.GetString16Attribute(ax::mojom::StringAttribute::kName)); }
diff --git a/ash/wm/overview/scoped_overview_hide_windows.cc b/ash/wm/overview/scoped_overview_hide_windows.cc index dee4ae5d..d0d49f1 100644 --- a/ash/wm/overview/scoped_overview_hide_windows.cc +++ b/ash/wm/overview/scoped_overview_hide_windows.cc
@@ -4,10 +4,10 @@ #include "ash/wm/overview/scoped_overview_hide_windows.h" +#include "base/check.h" #include "base/containers/adapters.h" #include "base/containers/contains.h" #include "base/memory/raw_ptr.h" -#include "base/notreached.h" #include "ui/aura/window.h" namespace ash { @@ -84,8 +84,7 @@ // It's expected that windows hidden in overview, unless they are forcefully // hidden should not be shown while in overview. - if (!force_hidden_) - NOTREACHED(); + CHECK(force_hidden_); // Do not let |window| change to visible during the lifetime of |this|. Also // update |window_visibility_| so that we can restore the window visibility
diff --git a/base/apple/foundation_util.mm b/base/apple/foundation_util.mm index 0ef597b3..fa3ff7f0 100644 --- a/base/apple/foundation_util.mm +++ b/base/apple/foundation_util.mm
@@ -16,10 +16,10 @@ #include "base/apple/bundle_locations.h" #include "base/apple/osstatus_logging.h" #include "base/apple/scoped_cftyperef.h" +#include "base/check.h" #include "base/containers/adapters.h" #include "base/files/file_path.h" #include "base/logging.h" -#include "base/notreached.h" #include "base/numerics/checked_math.h" #include "base/numerics/safe_conversions.h" #include "base/ranges/algorithm.h" @@ -85,9 +85,7 @@ void SetOverrideAmIBundled(bool value) { #if BUILDFLAG(IS_IOS) // It doesn't make sense not to be bundled on iOS. - if (!value) { - NOTREACHED(); - } + CHECK(value); #endif g_override_am_i_bundled = true; g_override_am_i_bundled_value = value;
diff --git a/base/files/file_enumerator_win.cc b/base/files/file_enumerator_win.cc index c795cf5..614548c 100644 --- a/base/files/file_enumerator_win.cc +++ b/base/files/file_enumerator_win.cc
@@ -7,6 +7,7 @@ #include <stdint.h> #include <string.h> +#include "base/check.h" #include "base/check_op.h" #include "base/notreached.h" #include "base/strings/string_util.h" @@ -125,9 +126,7 @@ FileEnumerator::FileInfo FileEnumerator::GetInfo() const { DCHECK(!(file_type_ & FileType::NAMES_ONLY)); - if (!has_find_data_) { - NOTREACHED(); - } + CHECK(has_find_data_); FileInfo ret; memcpy(&ret.find_data_, &find_data_, sizeof(find_data_)); return ret;
diff --git a/base/files/file_win.cc b/base/files/file_win.cc index e5cba3b2..b59ad44 100644 --- a/base/files/file_win.cc +++ b/base/files/file_win.cc
@@ -11,6 +11,7 @@ #include <tuple> +#include "base/check.h" #include "base/check_op.h" #include "base/files/file_util.h" #include "base/immediate_crash.h" @@ -399,9 +400,7 @@ disposition = TRUNCATE_EXISTING; } - if (!disposition) { - NOTREACHED(); - } + CHECK(disposition); DWORD access = 0; if (flags & FLAG_WRITE)
diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc index e0eed9a..2836099 100644 --- a/base/files/important_file_writer.cc +++ b/base/files/important_file_writer.cc
@@ -312,9 +312,7 @@ void ImportantFileWriter::WriteNow(std::string data) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (!IsValueInRangeForNumericType<int32_t>(data.length())) { - NOTREACHED(); - } + CHECK(IsValueInRangeForNumericType<int32_t>(data.length())); WriteNowWithBackgroundDataProducer(base::BindOnce( [](std::string data) { return std::make_optional(std::move(data)); },
diff --git a/base/message_loop/message_pump_android.cc b/base/message_loop/message_pump_android.cc index 77e87e0..2e669a52 100644 --- a/base/message_loop/message_pump_android.cc +++ b/base/message_loop/message_pump_android.cc
@@ -19,8 +19,8 @@ #include "base/android/input_hint_checker.h" #include "base/android/jni_android.h" #include "base/android/scoped_java_ref.h" +#include "base/check.h" #include "base/check_op.h" -#include "base/notreached.h" #include "base/numerics/safe_conversions.h" #include "base/run_loop.h" #include "base/task/task_features.h" @@ -290,8 +290,7 @@ run_loop_ = std::make_unique<RunLoop>(); // Since the RunLoop was just created above, BeforeRun should be guaranteed to // return true (it only returns false if the RunLoop has been Quit already). - if (!run_loop_->BeforeRun()) - NOTREACHED(); + CHECK(run_loop_->BeforeRun()); } void MessagePumpAndroid::Quit() {
diff --git a/base/message_loop/message_pump_fuchsia.cc b/base/message_loop/message_pump_fuchsia.cc index 670b17f..806d34a9 100644 --- a/base/message_loop/message_pump_fuchsia.cc +++ b/base/message_loop/message_pump_fuchsia.cc
@@ -12,6 +12,7 @@ #include <zircon/errors.h> #include "base/auto_reset.h" +#include "base/check.h" #include "base/fuchsia/fuchsia_logging.h" #include "base/logging.h" #include "base/trace_event/base_tracing.h" @@ -23,8 +24,8 @@ : async_wait_t({}), created_from_location_(from_here) {} MessagePumpFuchsia::ZxHandleWatchController::~ZxHandleWatchController() { - if (!StopWatchingZxHandle()) - NOTREACHED(); + const bool success = StopWatchingZxHandle(); + CHECK(success); } bool MessagePumpFuchsia::ZxHandleWatchController::WaitBegin() { @@ -156,8 +157,8 @@ ZxHandleWatchController(from_here) {} MessagePumpFuchsia::FdWatchController::~FdWatchController() { - if (!StopWatchingFileDescriptor()) - NOTREACHED(); + const bool success = StopWatchingFileDescriptor(); + CHECK(success); } bool MessagePumpFuchsia::FdWatchController::WaitBegin() { @@ -197,8 +198,8 @@ DCHECK(controller); DCHECK(delegate); - if (!controller->StopWatchingFileDescriptor()) - NOTREACHED(); + const bool success = controller->StopWatchingFileDescriptor(); + CHECK(success); controller->fd_ = fd; controller->watcher_ = delegate; @@ -245,8 +246,8 @@ DCHECK(handle == ZX_HANDLE_INVALID || !controller->is_active() || handle == controller->async_wait_t::object); - if (!controller->StopWatchingZxHandle()) - NOTREACHED(); + const bool success = controller->StopWatchingZxHandle(); + CHECK(success); controller->async_wait_t::object = handle; controller->persistent_ = persistent;
diff --git a/base/profiler/stack_copier_signal.cc b/base/profiler/stack_copier_signal.cc index 37289b8..ed8f1e1 100644 --- a/base/profiler/stack_copier_signal.cc +++ b/base/profiler/stack_copier_signal.cc
@@ -15,6 +15,7 @@ #include <cstring> #include <optional> +#include "base/check.h" #include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr_exclusion.h" #include "base/notreached.h" @@ -263,9 +264,7 @@ bool finished_waiting = wait_event.Wait(); TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cpu_profiler.debug"), "StackCopierSignal copy stack"); - if (!finished_waiting) { - NOTREACHED(); - } + CHECK(finished_waiting); // Ideally, an accurate timestamp is captured while the sampled thread is // paused. In rare cases, this may fail, in which case we resort to // capturing an delayed timestamp here instead.
diff --git a/base/profiler/stack_sampler.cc b/base/profiler/stack_sampler.cc index 461c24f..b8ce5fd9 100644 --- a/base/profiler/stack_sampler.cc +++ b/base/profiler/stack_sampler.cc
@@ -80,17 +80,10 @@ const MetadataRecorder::MetadataProvider* const metadata_provider_; }; -bool g_use_thread_pool = true; - } // namespace StackSampler::~StackSampler() = default; -// static -void StackSampler::SetUseThreadPool(bool use_thread_pool) { - g_use_thread_pool = use_thread_pool; -} - std::unique_ptr<StackBuffer> StackSampler::CreateStackBuffer() { size_t size = GetStackBufferSize(); if (size == 0) { @@ -102,17 +95,15 @@ void StackSampler::Initialize() { was_initialized_ = true; unwind_data_->Initialize(std::move(unwinders_factory_).Run()); - if (g_use_thread_pool) { - thread_pool_runner_ = base::ThreadPool::CreateSequencedTaskRunner({}); + thread_pool_runner_ = base::ThreadPool::CreateSequencedTaskRunner({}); - // The thread pool might not start right away (or it may never start), so we - // schedule a job and wait for it to become running before we schedule other - // work. - thread_pool_runner_->PostTaskAndReply( - FROM_HERE, base::DoNothing(), - base::BindOnce(&StackSampler::ThreadPoolRunning, - weak_ptr_factory_.GetWeakPtr())); - } + // The thread pool might not start right away (or it may never start), so we + // schedule a job and wait for it to become running before we schedule other + // work. + thread_pool_runner_->PostTaskAndReply( + FROM_HERE, base::DoNothing(), + base::BindOnce(&StackSampler::ThreadPoolRunning, + weak_ptr_factory_.GetWeakPtr())); } void StackSampler::ThreadPoolRunning() {
diff --git a/base/profiler/stack_sampler.h b/base/profiler/stack_sampler.h index a5f12a5..f32e9602 100644 --- a/base/profiler/stack_sampler.h +++ b/base/profiler/stack_sampler.h
@@ -67,9 +67,6 @@ // any StackSampler object. static std::unique_ptr<StackBuffer> CreateStackBuffer(); - // Set whether a thread pool should be used or not. - static void SetUseThreadPool(bool use_thread_pool); - // The following functions are all called on the SamplingThread (not the // thread being sampled).
diff --git a/base/sync_socket_win.cc b/base/sync_socket_win.cc index 7a6073f8..385836a 100644 --- a/base/sync_socket_win.cc +++ b/base/sync_socket_win.cc
@@ -9,10 +9,10 @@ #include <utility> +#include "base/check.h" #include "base/containers/span.h" #include "base/logging.h" #include "base/notimplemented.h" -#include "base/notreached.h" #include "base/rand_util.h" #include "base/threading/scoped_blocking_call.h" #include "base/win/scoped_handle.h" @@ -70,9 +70,7 @@ NULL)); } while (!handle_a.is_valid() && (GetLastError() == ERROR_PIPE_BUSY)); - if (!handle_a.is_valid()) { - NOTREACHED(); - } + CHECK(handle_a.is_valid()); // The SECURITY_ANONYMOUS flag means that the server side (handle_a) cannot // impersonate the client (handle_b). This allows us not to care which side
diff --git a/base/test/launcher/test_results_tracker.cc b/base/test/launcher/test_results_tracker.cc index c9a5234b..535ad1f4 100644 --- a/base/test/launcher/test_results_tracker.cc +++ b/base/test/launcher/test_results_tracker.cc
@@ -15,6 +15,7 @@ #include <utility> #include "base/base64.h" +#include "base/check.h" #include "base/command_line.h" #include "base/containers/span.h" #include "base/files/file.h" @@ -170,9 +171,7 @@ CHECK(thread_checker_.CalledOnValidThread()); // Prevent initializing twice. - if (out_) { - NOTREACHED(); - } + CHECK(!out_); print_temp_leaks_ = command_line.HasSwitch(switches::kTestLauncherPrintTempLeaks);
diff --git a/base/test/perf_log.cc b/base/test/perf_log.cc index 7b33ffb..154877c 100644 --- a/base/test/perf_log.cc +++ b/base/test/perf_log.cc
@@ -9,6 +9,7 @@ #include "base/test/perf_log.h" +#include "base/check.h" #include "base/files/file_util.h" #include "base/notreached.h" @@ -35,9 +36,7 @@ } void LogPerfResult(const char* test_name, double value, const char* units) { - if (!perf_log_file) { - NOTREACHED(); - } + CHECK(perf_log_file); fprintf(perf_log_file, "%s\t%g\t%s\n", test_name, value, units); printf("%s\t%g\t%s\n", test_name, value, units);
diff --git a/base/test/test_file_util_posix.cc b/base/test/test_file_util_posix.cc index d79ce5e..f79ace3b 100644 --- a/base/test/test_file_util_posix.cc +++ b/base/test/test_file_util_posix.cc
@@ -12,11 +12,11 @@ #include <string> +#include "base/check.h" #include "base/check_op.h" #include "base/files/file.h" #include "base/files/file_util.h" #include "base/notimplemented.h" -#include "base/notreached.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" @@ -115,8 +115,8 @@ } FilePermissionRestorer::~FilePermissionRestorer() { - if (!RestorePermissionInfo(path_, info_, length_)) - NOTREACHED(); + const bool success = RestorePermissionInfo(path_, info_, length_); + CHECK(success); } } // namespace base
diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc index 7e18f72..054064d 100644 --- a/base/test/test_file_util_win.cc +++ b/base/test/test_file_util_win.cc
@@ -13,11 +13,11 @@ #include <memory> +#include "base/check.h" #include "base/check_op.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/memory/ptr_util.h" -#include "base/notreached.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/threading/platform_thread.h" @@ -193,8 +193,8 @@ } FilePermissionRestorer::~FilePermissionRestorer() { - if (!RestorePermissionInfo(path_, info_, length_)) - NOTREACHED(); + const bool success = RestorePermissionInfo(path_, info_, length_); + CHECK(success); } std::wstring GetFileDacl(const FilePath& path) {
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 7c3ed83..0ee8320 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -98,8 +98,7 @@ # nonsensical for said projects. clang_use_default_sample_profile = chrome_pgo_phase == 0 && build_with_chromium && is_official_build && - ((is_android && (current_cpu == "arm" || current_cpu == "x86")) || - chromeos_is_browser_only) + (is_android || chromeos_is_browser_only) # This configuration is used to select a default profile in Chrome OS based on # the microarchitectures we are using. This is only used if @@ -217,15 +216,12 @@ declare_args() { chrome_orderfile_path = "" - # The orderfile is trained on PGO builds (for arm64) and AFDO builds (for - # arm32), so apply them only in these cases. - if (defined(default_chrome_orderfile)) { - if (((current_os == "arm64" || current_os == "x64") && - chrome_pgo_phase == 2) || - ((current_os == "arm32" || current_os == "x86") && - clang_use_default_sample_profile)) { - chrome_orderfile_path = default_chrome_orderfile - } + # The default orderfile should not be used when generating a new PGO + # profile (chrome_pgo_phase == 1) to avoid affecting profiling. + if (defined(default_chrome_orderfile) && chrome_pgo_phase != 1) { + # Allow downstream tools to set orderfile path with + # another variable. + chrome_orderfile_path = default_chrome_orderfile } } }
diff --git a/buildtools/checkdeps/java_checker.py b/buildtools/checkdeps/java_checker.py index 70e6daf..e04415e5 100644 --- a/buildtools/checkdeps/java_checker.py +++ b/buildtools/checkdeps/java_checker.py
@@ -5,8 +5,8 @@ """Checks Java files for illegal imports.""" - import codecs +import concurrent.futures import os import re @@ -83,9 +83,22 @@ # prescan logic into checkdeps.py itself? # Modify dirs in-place with slice assignment to avoid recursing into them. dirs[:] = [d for d in dirs if not self._IgnoreDir(d)] - for f in files: - if f.endswith('.java'): - self._PrescanFile(os.path.join(root, f), added_classset) + + java_files = [os.path.join(root, f) for f in files if f.endswith('.java')] + if not java_files: + continue + + with concurrent.futures.ThreadPoolExecutor() as executor: + # Read files in parallel. + futures_to_file = { + executor.submit(self._PrescanFile, os.path.join(root, f)): f + for f in java_files + } + for future in concurrent.futures.as_completed(futures_to_file): + full_class_name = future.result() + if full_class_name: + self._ProcessFile( + futures_to_file[future], full_class_name, added_classset) def _PrescanImportFiles(self, added_imports): """Build a set of fully-qualified class affected by this patch. @@ -113,27 +126,31 @@ classset.add(found_item.group(1)) return classset - def _PrescanFile(self, filepath, added_classset): + def _PrescanFile(self, filepath): + """Scans a file and returns its full class name, if any.""" if self._verbose: print('Prescanning: ' + filepath) full_class_name = self._GetClassFullName(filepath) - if full_class_name: - if full_class_name in self._classmap: - if self._verbose or full_class_name in added_classset: - if not any(re.match(i, filepath) for i in - self._allow_multiple_definitions): - print('WARNING: multiple definitions of %s:' % full_class_name) - print(' ' + filepath) - print(' ' + self._classmap[full_class_name]) - print() - # Prefer the public repo when multiple matches are found. - if self._classmap[full_class_name].startswith( - os.path.join(self._base_directory, 'clank')): - self._classmap[full_class_name] = filepath - else: - self._classmap[full_class_name] = filepath - elif self._verbose: + if not full_class_name and self._verbose: print('WARNING: no package definition found in %s' % filepath) + return full_class_name + + def _ProcessFile(self, filepath, full_class_name, added_classset): + """Populates _classmap based on the path and class name.""" + if full_class_name in self._classmap: + if self._verbose or full_class_name in added_classset: + if not any(re.match(i, filepath) for i in + self._allow_multiple_definitions): + print('WARNING: multiple definitions of %s:' % full_class_name) + print(' ' + filepath) + print(' ' + self._classmap[full_class_name]) + print() + # Prefer the public repo when multiple matches are found. + if self._classmap[full_class_name].startswith( + os.path.join(self._base_directory, 'clank')): + self._classmap[full_class_name] = filepath + else: + self._classmap[full_class_name] = filepath def CheckLine(self, rules, line, filepath, fail_on_temp_allow=False): """Checks the given line with the given rule set.
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/CloseAllTabsHelper.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/CloseAllTabsHelper.java index 00a1df9..9a167b3 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/CloseAllTabsHelper.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/CloseAllTabsHelper.java
@@ -12,16 +12,11 @@ import org.chromium.chrome.browser.hub.HubManager; import org.chromium.chrome.browser.hub.Pane; import org.chromium.chrome.browser.hub.PaneId; -import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab_ui.TabSwitcher; import org.chromium.chrome.browser.tabmodel.TabClosureParams; -import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelSelector; -import org.chromium.chrome.browser.tabmodel.TabModelUtils; import org.chromium.chrome.browser.tasks.tab_groups.TabGroupModelFilter; -import java.util.List; - /** Helper for closing all tabs via {@link CloseAllTabsDialog}. */ public class CloseAllTabsHelper { /** Closes all tabs hiding tab groups. */ @@ -63,10 +58,6 @@ TabModelSelector tabModelSelector, boolean isIncognitoOnly) { - boolean useCustomAnimation = ChromeFeatureList.sGtsCloseTabAnimation.isEnabled(); - boolean useQuickDeleteAnimation = - ChromeFeatureList.sGtsCloseTabAnimationCloseAllQuickDeleteAnimation.getValue(); - HubState hubState = getHubState(hubManagerSupplier); boolean isRegularHubPane = hubState.currentPaneId == PaneId.TAB_SWITCHER; boolean isIncognitoHubPane = hubState.currentPaneId == PaneId.INCOGNITO_TAB_SWITCHER; @@ -75,22 +66,13 @@ boolean canShowAnimation = hubState.isVisible && isPaneAndCloseCombinationValid; Runnable onAnimationFinished = () -> closeAllTabs(tabModelSelector, isIncognitoOnly); - if (canShowAnimation && (useCustomAnimation || useQuickDeleteAnimation)) { + if (canShowAnimation && ChromeFeatureList.sGtsCloseTabAnimation.isEnabled()) { TabSwitcher tabSwitcher = isIncognitoHubPane ? incognitoTabSwitcherSupplier.get() : regularTabSwitcherSupplier.get(); assert tabSwitcher != null; - - if (useQuickDeleteAnimation) { - TabModel tabModel = tabModelSelector.getModel(isIncognitoHubPane); - List<Tab> tabs = TabModelUtils.convertTabListToListOfTabs(tabModel); - tabSwitcher.showQuickDeleteAnimation(onAnimationFinished, tabs); - } else if (useCustomAnimation) { - tabSwitcher.showCloseAllTabsAnimation(onAnimationFinished); - } else { - assert false : "Not reached"; - } + tabSwitcher.showCloseAllTabsAnimation(onAnimationFinished); } else { onAnimationFinished.run(); }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/CloseAllTabsHelperUnitTest.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/CloseAllTabsHelperUnitTest.java index 5618fb8..8c08a38 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/CloseAllTabsHelperUnitTest.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/CloseAllTabsHelperUnitTest.java
@@ -4,7 +4,6 @@ package org.chromium.chrome.browser.tasks.tab_management; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.argThat; @@ -23,7 +22,6 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; -import org.chromium.base.FeatureList; import org.chromium.base.supplier.LazyOneshotSupplier; import org.chromium.base.supplier.ObservableSupplierImpl; import org.chromium.base.supplier.OneshotSupplierImpl; @@ -94,20 +92,6 @@ assertNotNull(mHubManagerSupplier.get()); } - private void setAnimationStateForTesting(boolean quickDeleteState) { - FeatureList.TestValues testValues = new FeatureList.TestValues(); - testValues.addFeatureFlagOverride(ChromeFeatureList.GTS_CLOSE_TAB_ANIMATION, true); - testValues.addFieldTrialParamOverride( - ChromeFeatureList.GTS_CLOSE_TAB_ANIMATION, - "close_all_quick_delete_animation", - quickDeleteState ? "true" : "false"); - FeatureList.setTestValues(testValues); - - assertEquals( - quickDeleteState, - ChromeFeatureList.sGtsCloseTabAnimationCloseAllQuickDeleteAnimation.getValue()); - } - @Test public void testCloseAllTabsHidingTabGroups() { CloseAllTabsHelper.closeAllTabsHidingTabGroups(mTabModelSelector); @@ -119,7 +103,6 @@ @Test @DisableFeatures(ChromeFeatureList.GTS_CLOSE_TAB_ANIMATION) public void testBuildCloseAllTabsRunnable_RegularDefault() { - setAnimationStateForTesting(false); Runnable r = CloseAllTabsHelper.buildCloseAllTabsRunnable( mHubManagerSupplier, @@ -139,7 +122,6 @@ @Test @DisableFeatures(ChromeFeatureList.GTS_CLOSE_TAB_ANIMATION) public void testBuildCloseAllTabsRunnable_IncognitoDefault() { - setAnimationStateForTesting(false); Runnable r = CloseAllTabsHelper.buildCloseAllTabsRunnable( mHubManagerSupplier, @@ -159,7 +141,6 @@ @Test public void testBuildCloseAllTabsRunnable_AnimationFallback_HubVisibleWrongPane() { - setAnimationStateForTesting(true); when(mPane.getPaneId()).thenReturn(PaneId.TAB_SWITCHER); mHubVisibilitySupplier.set(true); Runnable r = @@ -181,7 +162,6 @@ @Test public void testBuildCloseAllTabsRunnable_AnimationFallback_HubInvisibleRightPane() { - setAnimationStateForTesting(true); when(mPane.getPaneId()).thenReturn(PaneId.TAB_SWITCHER); Runnable r = CloseAllTabsHelper.buildCloseAllTabsRunnable( @@ -200,84 +180,7 @@ } @Test - public void testBuildCloseAllTabsRunnable_QuickDeleteAnimation_IncognitoOnly() { - setAnimationStateForTesting(true); - mHubVisibilitySupplier.set(true); - when(mPane.getPaneId()).thenReturn(PaneId.INCOGNITO_TAB_SWITCHER); - Runnable r = - CloseAllTabsHelper.buildCloseAllTabsRunnable( - mHubManagerSupplier, - mRegularTabSwitcherSupplier, - mIncognitoTabSwitcherSupplier, - mTabModelSelector, - /* isIncognitoOnly= */ true); - - doCallback(0, (Runnable onAnimationEnd) -> onAnimationEnd.run()) - .when(mIncognitoTabSwitcher) - .showQuickDeleteAnimation(any(), any()); - r.run(); - - verify(mIncognitoTabSwitcher).showQuickDeleteAnimation(any(), any()); - verify(mIncognitoTabModel).closeTabs(argThat(params -> params.isAllTabs)); - - verifyNoInteractions(mRegularTabSwitcher); - verify(mRegularTabGroupModelFilter, never()).closeTabs(any()); - verify(mIncognitoTabGroupModelFilter, never()).closeTabs(any()); - } - - @Test - public void testBuildCloseAllTabsRunnable_QuickDeleteAnimation_All_RegularPane() { - setAnimationStateForTesting(true); - mHubVisibilitySupplier.set(true); - when(mPane.getPaneId()).thenReturn(PaneId.TAB_SWITCHER); - Runnable r = - CloseAllTabsHelper.buildCloseAllTabsRunnable( - mHubManagerSupplier, - mRegularTabSwitcherSupplier, - mIncognitoTabSwitcherSupplier, - mTabModelSelector, - /* isIncognitoOnly= */ false); - - doCallback(0, (Runnable onAnimationEnd) -> onAnimationEnd.run()) - .when(mRegularTabSwitcher) - .showQuickDeleteAnimation(any(), any()); - r.run(); - - verify(mRegularTabSwitcher).showQuickDeleteAnimation(any(), any()); - verify(mRegularTabGroupModelFilter).closeTabs(argThat(params -> params.isAllTabs)); - verify(mIncognitoTabGroupModelFilter).closeTabs(argThat(params -> params.isAllTabs)); - - verifyNoInteractions(mIncognitoTabSwitcher); - } - - @Test - public void testBuildCloseAllTabsRunnable_QuickDeleteAnimation_All_IncognitoPane() { - setAnimationStateForTesting(true); - mHubVisibilitySupplier.set(true); - when(mPane.getPaneId()).thenReturn(PaneId.INCOGNITO_TAB_SWITCHER); - Runnable r = - CloseAllTabsHelper.buildCloseAllTabsRunnable( - mHubManagerSupplier, - mRegularTabSwitcherSupplier, - mIncognitoTabSwitcherSupplier, - mTabModelSelector, - /* isIncognitoOnly= */ false); - - doCallback(0, (Runnable onAnimationEnd) -> onAnimationEnd.run()) - .when(mIncognitoTabSwitcher) - .showQuickDeleteAnimation(any(), any()); - r.run(); - - verify(mIncognitoTabSwitcher).showQuickDeleteAnimation(any(), any()); - verify(mRegularTabGroupModelFilter).closeTabs(argThat(params -> params.isAllTabs)); - verify(mIncognitoTabGroupModelFilter).closeTabs(argThat(params -> params.isAllTabs)); - - verifyNoInteractions(mRegularTabSwitcher); - } - - @Test public void testBuildCloseAllTabsRunnable_CustomAnimation_IncognitoOnly() { - setAnimationStateForTesting(false); mHubVisibilitySupplier.set(true); when(mPane.getPaneId()).thenReturn(PaneId.INCOGNITO_TAB_SWITCHER); Runnable r = @@ -303,7 +206,6 @@ @Test public void testBuildCloseAllTabsRunnable_CustomAnimation_All_RegularPane() { - setAnimationStateForTesting(false); mHubVisibilitySupplier.set(true); when(mPane.getPaneId()).thenReturn(PaneId.TAB_SWITCHER); Runnable r = @@ -327,7 +229,6 @@ @Test public void testBuildCloseAllTabsRunnable_CloseAllAnimation_All_IncognitoPane() { - setAnimationStateForTesting(false); mHubVisibilitySupplier.set(true); when(mPane.getPaneId()).thenReturn(PaneId.INCOGNITO_TAB_SWITCHER); Runnable r =
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListCoordinator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListCoordinator.java index 42eadf2d..405ddae 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListCoordinator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListCoordinator.java
@@ -34,6 +34,7 @@ import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.lifecycle.DestroyObserver; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; @@ -872,15 +873,19 @@ } void showCloseAllTabsAnimation(Runnable closeTabs) { + boolean extendDuration = + ChromeFeatureList.sGtsCloseTabAnimationRemoveExtendDuration.getValue(); + @Nullable var itemAnimator = mRecyclerView.getItemAnimator(); - if (itemAnimator == null) { + if (itemAnimator == null || !extendDuration) { closeTabs.run(); return; } - // Temporarily double the duration of the animation until it is finished then reset the + // Temporarily increase the duration of the animation until it is finished then reset the // behavior to the default duration. - itemAnimator.setRemoveDuration(TabListItemAnimator.DEFAULT_REMOVE_DURATION * 2); + itemAnimator.setRemoveDuration( + Math.round(TabListItemAnimator.DEFAULT_REMOVE_DURATION * 1.5)); closeTabs.run(); Runnable restoreRemoveDuration = () -> {
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListItemAnimator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListItemAnimator.java index 60c3cb7..803efa284 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListItemAnimator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListItemAnimator.java
@@ -138,10 +138,10 @@ private AnimatorHolder mMoves = new AnimatorHolder("Move"); private AnimatorHolder mRemovals = new AnimatorHolder("Removal"); - private final boolean mRearrangeUseStandardEasing; + private final boolean mRemoveEmphasizedAccelerate; - TabListItemAnimator(boolean rearrangeUseStandardEasing) { - mRearrangeUseStandardEasing = rearrangeUseStandardEasing; + TabListItemAnimator(boolean removeEmphasizedAccelerate) { + mRemoveEmphasizedAccelerate = removeEmphasizedAccelerate; setRemoveDuration(DEFAULT_REMOVE_DURATION); } @@ -451,7 +451,7 @@ View view = holder.itemView; ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(view, View.ALPHA, 0f); alphaAnimator.setDuration(getRemoveDuration()); - alphaAnimator.setInterpolator(Interpolators.LINEAR_INTERPOLATOR); + alphaAnimator.setInterpolator(getGenericRemoveInterpolator()); alphaAnimator.addListener( new AnimatorListenerAdapter() { @Override @@ -524,8 +524,12 @@ } private Interpolator getRearrangeInterpolator() { - return mRearrangeUseStandardEasing - ? Interpolators.STANDARD_INTERPOLATOR - : Interpolators.LINEAR_INTERPOLATOR; + return Interpolators.STANDARD_INTERPOLATOR; + } + + private Interpolator getGenericRemoveInterpolator() { + return mRemoveEmphasizedAccelerate + ? Interpolators.EMPHASIZED_ACCELERATE + : Interpolators.STANDARD_ACCELERATE; } }
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListItemAnimatorUnitTest.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListItemAnimatorUnitTest.java index 9edfa46..64a2146 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListItemAnimatorUnitTest.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListItemAnimatorUnitTest.java
@@ -54,7 +54,7 @@ @Before public void setUp() { - mItemAnimator = spy(new TabListItemAnimator(/* rearrangeUseStandardEasing= */ true)); + mItemAnimator = spy(new TabListItemAnimator(/* removeEmphasizedAccelerate= */ true)); } private static void emptyBind(PropertyModel model, View view, PropertyKey key) {}
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListRecyclerView.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListRecyclerView.java index 95e06b4..aae7b5c 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListRecyclerView.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListRecyclerView.java
@@ -103,9 +103,9 @@ if (!ChromeFeatureList.sGtsCloseTabAnimation.isEnabled()) return; if (mTabListItemAnimator == null) { - boolean rearrangeUseStandardEasing = - ChromeFeatureList.sGtsCloseTabAnimationRearrangeStandardEasing.getValue(); - mTabListItemAnimator = new TabListItemAnimator(rearrangeUseStandardEasing); + boolean removeEmphasizedAccelerate = + ChromeFeatureList.sGtsCloseTabAnimationRemoveEmphasizedAccelerate.getValue(); + mTabListItemAnimator = new TabListItemAnimator(removeEmphasizedAccelerate); setItemAnimator(mTabListItemAnimator); } }
diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogViewBinderTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogViewBinderTest.java index 14221003..f61908a8 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogViewBinderTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogViewBinderTest.java
@@ -49,7 +49,6 @@ import androidx.test.filters.SmallTest; import org.hamcrest.Matchers; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -689,9 +688,4 @@ verify(mCardViewBackground).setTint(color); } - - @After - public void tearDown() { - ThreadUtils.runOnUiThreadBlocking(mMCP::destroy); - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java index 0f8fbb2..736a936 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java
@@ -41,6 +41,8 @@ import org.chromium.ui.resources.AndroidResourceType; import org.chromium.ui.resources.ResourceManager; +import java.util.Locale; + /** * The is the {@link View} displaying the ui compositor results; including webpages and tabswitcher. */ @@ -460,7 +462,14 @@ || width < 0 || height < 0) { JavaExceptionReporter.reportException( - new RuntimeException("w:" + width + " h:" + height)); + new RuntimeException( + String.format( + Locale.US, + "w:%d h:%d vw:%d vh:%d)", + width, + height, + getWidth(), + getHeight()))); } if (mNativeCompositorView == 0) return;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUiService.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUiService.java index ced354d9..707c16cf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUiService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUiService.java
@@ -9,9 +9,11 @@ import android.os.Handler; import android.text.TextUtils; +import androidx.annotation.IntDef; import androidx.annotation.Nullable; import org.chromium.base.Callback; +import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill.AddressNormalizerFactory; import org.chromium.chrome.browser.autofill.AutofillAddress; @@ -96,6 +98,20 @@ NormalizedAddressRequestDelegate, PaymentRequestUI.Client, LayoutStateObserver { + + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. + @IntDef({ + PaymentRequestAddressEditorMode.ADD_NEW_ADDRESS, + PaymentRequestAddressEditorMode.EDIT_EXISTING_ADDRESS, + PaymentRequestAddressEditorMode.COUNT, + }) + private @interface PaymentRequestAddressEditorMode { + int ADD_NEW_ADDRESS = 0; + int EDIT_EXISTING_ADDRESS = 1; + int COUNT = 2; + } + /** Limit in the number of suggested items in a section. */ /* package */ static final int SUGGESTIONS_LIMIT = 4; @@ -1049,6 +1065,16 @@ if (!mRetryQueue.isEmpty()) mHandler.post(mRetryQueue.remove()); } }); + + @PaymentRequestAddressEditorMode + int addressEditorMode = + toEdit == null + ? PaymentRequestAddressEditorMode.ADD_NEW_ADDRESS + : PaymentRequestAddressEditorMode.EDIT_EXISTING_ADDRESS; + RecordHistogram.recordEnumeratedHistogram( + "PaymentRequest.AddressEditorTrigerred", + addressEditorMode, + PaymentRequestAddressEditorMode.COUNT); } /**
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index 03da4eca..374b9700 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-130.0.6694.0_rc-r1-merged.afdo.bz2 +chromeos-chrome-amd64-130.0.6695.0_rc-r1-merged.afdo.bz2
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index fb2dba6..55acb89 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -754,6 +754,9 @@ =1 {1 reused password} other {{NUM_REUSED} reused passwords}} </message> + <message name="IDS_SETTINGS_AUTOFILL_PREDICTION_IMPROVEMENTS_PAGE_TITLE" desc="The title of the page in Settings that allows to manage the autofill improved predictions settings." translateable="false"> + Autofill prediction improvements + </message> <if expr="is_win or is_macosx"> <message name="IDS_AUTOFILL_MANAGE_PASSKEYS_LABEL" desc="The label on a button that a user can click in order to see and delete passkeys saved on their computer. For consistency, the word 'passkey' is in the glossary with translations already suggested.">
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 3d5316a2..ebc29ad 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3617,20 +3617,28 @@ kTabGroupCreationDialogAndroidShowSetting, std::size(kTabGroupCreationDialogAndroidShowSetting), nullptr}}; -const FeatureEntry::FeatureParam kGtsCloseTabAnimationUseStandardEasing[] = { - {"rearrange_standard_easing", "true"}}; -const FeatureEntry::FeatureParam - kGtsCloseTabAnimationCloseAllQuickDeleteAnimation[] = { - {"rearrange_standard_easing", "true"}, - {"close_all_quick_delete_animation", "true"}}; +const FeatureEntry::FeatureParam kGtsCloseTabAnimationRemoveStandard200[] = { + {"remove_emphasized_accelerate", "false"}, + {"remove_extend_duration", "false"}}; +const FeatureEntry::FeatureParam kGtsCloseTabAnimationRemoveStandard300[] = { + {"remove_emphasized_accelerate", "false"}, + {"remove_extend_duration", "true"}}; +const FeatureEntry::FeatureParam kGtsCloseTabAnimationRemoveEmphasized200[] = { + {"remove_emphasized_accelerate", "true"}, + {"remove_extend_duration", "false"}}; +const FeatureEntry::FeatureParam kGtsCloseTabAnimationRemoveEmphasized300[] = { + {"remove_emphasized_accelerate", "true"}, + {"remove_extend_duration", "true"}}; const FeatureEntry::FeatureVariation kGtsCloseTabAnimationVariations[] = { - {"Option C use standard easing for rearrange", - kGtsCloseTabAnimationUseStandardEasing, - std::size(kGtsCloseTabAnimationUseStandardEasing), nullptr}, - {"Option D close all uses quick delete animation", - kGtsCloseTabAnimationCloseAllQuickDeleteAnimation, - std::size(kGtsCloseTabAnimationCloseAllQuickDeleteAnimation), nullptr}, + {"Standard accelerate 200ms", kGtsCloseTabAnimationRemoveStandard200, + std::size(kGtsCloseTabAnimationRemoveStandard200), nullptr}, + {"Standard accelerate 300ms", kGtsCloseTabAnimationRemoveStandard300, + std::size(kGtsCloseTabAnimationRemoveStandard300), nullptr}, + {"Emphasized accelerate 200ms", kGtsCloseTabAnimationRemoveEmphasized200, + std::size(kGtsCloseTabAnimationRemoveEmphasized200), nullptr}, + {"Emphasized accelerate 300ms", kGtsCloseTabAnimationRemoveEmphasized300, + std::size(kGtsCloseTabAnimationRemoveEmphasized300), nullptr}, }; const FeatureEntry::FeatureParam kEdgeToEdgeBottomChinDebugFeatureParams[] = { @@ -5621,6 +5629,9 @@ {"enable-tls13-kyber", flag_descriptions::kEnableTLS13KyberName, flag_descriptions::kEnableTLS13KyberDescription, kOsAll, FEATURE_VALUE_TYPE(net::features::kPostQuantumKyber)}, + {"use-ml-kem", flag_descriptions::kUseMLKEMName, + flag_descriptions::kUseMLKEMDescription, kOsAll, + FEATURE_VALUE_TYPE(net::features::kUseMLKEM)}, #if BUILDFLAG(IS_ANDROID) {"feed-loading-placeholder", flag_descriptions::kFeedLoadingPlaceholderName, flag_descriptions::kFeedLoadingPlaceholderDescription, kOsAndroid, @@ -6407,14 +6418,6 @@ omnibox::kRichAutocompletion, kOmniboxRichAutocompletionPromisingVariations, "OmniboxBundledExperimentV1")}, - - {"omnibox-limit-keyword-mode-suggestions", - flag_descriptions::kOmniboxLimitKeywordModeSuggestionsName, - flag_descriptions::kOmniboxLimitKeywordModeSuggestionsDescription, - kOsDesktop, - FEATURE_VALUE_TYPE(omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions)}, - {"omnibox-starter-pack-expansion", flag_descriptions::kOmniboxStarterPackExpansionName, flag_descriptions::kOmniboxStarterPackExpansionDescription, kOsDesktop, @@ -8169,10 +8172,6 @@ #endif // BUILDFLAG(IS_CHROMEOS_ASH) - {"enable-fenced-frames", flag_descriptions::kEnableFencedFramesName, - flag_descriptions::kEnableFencedFramesDescription, kOsAll, - FEATURE_VALUE_TYPE(blink::features::kFencedFrames)}, - {"enable-fenced-frames-developer-mode", flag_descriptions::kEnableFencedFramesDeveloperModeName, flag_descriptions::kEnableFencedFramesDeveloperModeDescription, kOsAll,
diff --git a/chrome/browser/android/sensitive_content/chrome_sensitive_content_client.cc b/chrome/browser/android/sensitive_content/chrome_sensitive_content_client.cc index f899f17..4feafa3 100644 --- a/chrome/browser/android/sensitive_content/chrome_sensitive_content_client.cc +++ b/chrome/browser/android/sensitive_content/chrome_sensitive_content_client.cc
@@ -18,4 +18,8 @@ void ChromeSensitiveContentClient::SetContentSensitivity( bool content_is_sensitive) {} +std::string_view ChromeSensitiveContentClient::GetHistogramPrefix() { + return "SensitiveContent.Chrome."; +} + } // namespace sensitive_content
diff --git a/chrome/browser/android/sensitive_content/chrome_sensitive_content_client.h b/chrome/browser/android/sensitive_content/chrome_sensitive_content_client.h index bfb1dee0..2d7e428f 100644 --- a/chrome/browser/android/sensitive_content/chrome_sensitive_content_client.h +++ b/chrome/browser/android/sensitive_content/chrome_sensitive_content_client.h
@@ -28,6 +28,8 @@ void SetContentSensitivity(bool content_is_sensitive) override; + std::string_view GetHistogramPrefix() override; + private: SensitiveContentManager manager_; };
diff --git a/chrome/browser/ash/extensions/BUILD.gn b/chrome/browser/ash/extensions/BUILD.gn index f25cb651..2ddbeba 100644 --- a/chrome/browser/ash/extensions/BUILD.gn +++ b/chrome/browser/ash/extensions/BUILD.gn
@@ -68,6 +68,7 @@ "//chrome/browser/ash/policy/core", "//chrome/browser/ash/profiles", "//chrome/browser/ash/url_handler", + "//chrome/browser/extensions/api/input_ime", "//chrome/browser/profiles:profile", "//chrome/browser/resources/chromeos:app_icon_resources", "//chrome/browser/ui/ash/keyboard",
diff --git a/chrome/browser/ash/login/wizard_controller_browsertest.cc b/chrome/browser/ash/login/wizard_controller_browsertest.cc index e154d9b..25d4629 100644 --- a/chrome/browser/ash/login/wizard_controller_browsertest.cc +++ b/chrome/browser/ash/login/wizard_controller_browsertest.cc
@@ -351,7 +351,6 @@ policy::EnrollmentStateFetcher::RlweClientFactory rlwe_client_factory, policy::DeviceManagementService* device_management_service, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - ash::SystemClockClient* system_clock_client, policy::ServerBackedStateKeysBroker* state_key_broker, ash::DeviceSettingsService* device_settings_service, OobeConfiguration* oobe_configuration) {
diff --git a/chrome/browser/ash/magic_boost/magic_boost_browsertest.cc b/chrome/browser/ash/magic_boost/magic_boost_browsertest.cc index 7e71f3bd..566c399 100644 --- a/chrome/browser/ash/magic_boost/magic_boost_browsertest.cc +++ b/chrome/browser/ash/magic_boost/magic_boost_browsertest.cc
@@ -33,6 +33,7 @@ #include "chromeos/components/magic_boost/public/cpp/magic_boost_state.h" #include "chromeos/components/mahi/public/cpp/mahi_switches.h" #include "chromeos/constants/chromeos_features.h" +#include "chromeos/constants/chromeos_switches.h" #include "components/prefs/testing_pref_service.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" @@ -101,7 +102,7 @@ } void SetUpCommandLine(base::CommandLine* command_line) override { - command_line->AppendSwitch(switches::kMahiRestrictionsOverride); + command_line->AppendSwitch(chromeos::switches::kMahiRestrictionsOverride); InProcessBrowserTest::SetUpCommandLine(command_line); }
diff --git a/chrome/browser/ash/mahi/mahi_availability.cc b/chrome/browser/ash/mahi/mahi_availability.cc index c718d5df..a475bf1 100644 --- a/chrome/browser/ash/mahi/mahi_availability.cc +++ b/chrome/browser/ash/mahi/mahi_availability.cc
@@ -4,13 +4,13 @@ #include "chrome/browser/ash/mahi/mahi_availability.h" -#include "ash/constants/ash_switches.h" #include "base/command_line.h" #include "base/containers/fixed_flat_set.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/manta/manta_service_factory.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chromeos/constants/chromeos_switches.h" #include "components/manta/features.h" #include "components/manta/manta_service.h" #include "components/variations/service/variations_service.h" @@ -23,7 +23,7 @@ } if (base::CommandLine::ForCurrentProcess()->HasSwitch( - ash::switches::kMahiRestrictionsOverride)) { + chromeos::switches::kMahiRestrictionsOverride)) { return true; }
diff --git a/chrome/browser/ash/mahi/mahi_manager_impl_unittest.cc b/chrome/browser/ash/mahi/mahi_manager_impl_unittest.cc index e66430c2..07d3570 100644 --- a/chrome/browser/ash/mahi/mahi_manager_impl_unittest.cc +++ b/chrome/browser/ash/mahi/mahi_manager_impl_unittest.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/ash/mahi/mahi_cache_manager.h" #include "chromeos/components/magic_boost/public/cpp/magic_boost_state.h" #include "chromeos/constants/chromeos_features.h" +#include "chromeos/constants/chromeos_switches.h" #include "chromeos/crosapi/mojom/mahi.mojom-forward.h" #include "chromeos/crosapi/mojom/mahi.mojom.h" #include "components/signin/public/identity_manager/identity_test_environment.h" @@ -108,7 +109,7 @@ /*disabled_features=*/{}); NoSessionAshTestBase::SetUp(); base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kMahiRestrictionsOverride); + chromeos::switches::kMahiRestrictionsOverride); magic_boost_state_ = std::make_unique<MagicBoostStateAsh>(); mahi_manager_impl_ = std::make_unique<MahiManagerImpl>();
diff --git a/chrome/browser/ash/mahi/mahi_ui_browser_test_base.cc b/chrome/browser/ash/mahi/mahi_ui_browser_test_base.cc index c5e0816..ec171225 100644 --- a/chrome/browser/ash/mahi/mahi_ui_browser_test_base.cc +++ b/chrome/browser/ash/mahi/mahi_ui_browser_test_base.cc
@@ -22,6 +22,7 @@ #include "chrome/browser/ui/views/mahi/mahi_menu_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "chromeos/constants/chromeos_features.h" +#include "chromeos/constants/chromeos_switches.h" #include "components/manta/mahi_provider.h" #include "components/manta/manta_service.h" #include "components/manta/manta_service_callbacks.h" @@ -145,7 +146,7 @@ MahiUiBrowserTestBase::~MahiUiBrowserTestBase() = default; void MahiUiBrowserTestBase::SetUpCommandLine(base::CommandLine* command_line) { - command_line->AppendSwitch(switches::kMahiRestrictionsOverride); + command_line->AppendSwitch(chromeos::switches::kMahiRestrictionsOverride); InProcessBrowserTest::SetUpCommandLine(command_line); }
diff --git a/chrome/browser/ash/policy/enrollment/auto_enrollment_controller.cc b/chrome/browser/ash/policy/enrollment/auto_enrollment_controller.cc index 2bc6af39..9e8af239 100644 --- a/chrome/browser/ash/policy/enrollment/auto_enrollment_controller.cc +++ b/chrome/browser/ash/policy/enrollment/auto_enrollment_controller.cc
@@ -278,8 +278,8 @@ weak_ptr_factory_.GetWeakPtr()), g_browser_process->local_state(), psm_rlwe_client_factory_, device_management_service_, shared_url_loader_factory_, - ash::SystemClockClient::Get(), state_keys_broker_, - device_settings_service_, ash::OobeConfiguration::Get()); + state_keys_broker_, device_settings_service_, + ash::OobeConfiguration::Get()); enrollment_state_fetcher_->Start(); return;
diff --git a/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher.cc b/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher.cc index db37ed1..322b521c 100644 --- a/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher.cc +++ b/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher.cc
@@ -33,9 +33,6 @@ #include "chrome/browser/ash/settings/device_settings_service.h" #include "chrome/browser/browser_process.h" #include "chrome/common/pref_names.h" -#include "chromeos/ash/components/dbus/system_clock/system_clock_client.h" -#include "chromeos/ash/components/dbus/system_clock/system_clock_sync_observation.h" -#include "chromeos/ash/components/system/factory_ping_embargo_check.h" #include "chromeos/ash/components/system/statistics_provider.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/dmserver_job_configurations.h" @@ -129,10 +126,6 @@ // Must be set before sequence starts. scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory; - // Interface for retrieving synchronized clock time. - // Must be set before sequence starts. - raw_ptr<ash::SystemClockClient> system_clock_client; - // Used to retrieve device state keys. // Must be set before sequence starts. raw_ptr<ServerBackedStateKeysBroker> state_key_broker; @@ -170,35 +163,6 @@ em::DeviceRegisterRequest::PSM_RESULT_ERROR); } -// Class to synchronize the system clock. -// -// This is a step in enrollment state fetch (see Sequence class below). -class SystemClock { - static constexpr base::TimeDelta kSystemClockSyncWaitTimeout = - base::Seconds(45); - - public: - SystemClock() = default; - SystemClock(const SystemClock&) = delete; - SystemClock& operator=(const SystemClock&) = delete; - - // This will attempt to synchronize the system clock within up to - // `kSystemClockSyncWaitTimeout`. - // It will report success (`true`) or failure (`false`) via the - // `completion_callback`. - void Sync(ash::SystemClockClient* system_clock_client, - base::OnceCallback<void(bool)> completion_callback) { - system_clock_sync_observation_ = - ash::SystemClockSyncObservation::WaitForSystemClockSync( - system_clock_client, kSystemClockSyncWaitTimeout, - std::move(completion_callback)); - } - - // Utility for waiting until the system clock has been synchronized. - std::unique_ptr<ash::SystemClockSyncObservation> - system_clock_sync_observation_; -}; - // Class to check device ownership. // // This is a step in enrollment state fetch (see Sequence class below). @@ -220,29 +184,6 @@ } }; -// Class to check whether embargo date has passed. -// -// Must be used only after system clock has been synchronized. -// This is a step in enrollment state fetch (see Sequence class below). -class EmbargoDate { - public: - EmbargoDate() = default; - EmbargoDate(const EmbargoDate&) = delete; - EmbargoDate& operator=(const EmbargoDate&) = delete; - - bool Passed(DeterminationContext& context) { - const ash::system::FactoryPingEmbargoState embargo_state = - ash::system::GetRlzPingEmbargoState(context.statistics_provider); - if (embargo_state == ash::system::FactoryPingEmbargoState::kNotPassed) { - LOG(WARNING) << "Embargo date not passed"; - return false; - } - // When embargo date is missing, malformed or invalid, we assume it has - // passed and proceed with the enrollment. - return true; - } -}; - // Class to obtain brand code and serial number. // // This is a step in enrollment state fetch (see Sequence class below). @@ -881,7 +822,6 @@ RlweClientFactory rlwe_client_factory, DeviceManagementService* device_management_service, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - ash::SystemClockClient* system_clock_client, ServerBackedStateKeysBroker* state_key_broker, ash::DeviceSettingsService* device_settings_service, ash::OobeConfiguration* oobe_configuration) { @@ -890,7 +830,6 @@ DCHECK(rlwe_client_factory); DCHECK(device_management_service); DCHECK(url_loader_factory); - DCHECK(system_clock_client); DCHECK(state_key_broker); DCHECK(device_settings_service); DCHECK(oobe_configuration); @@ -900,8 +839,7 @@ DeterminationContext{std::move(rlwe_client_factory), ash::system::StatisticsProvider::GetInstance(), device_management_service, url_loader_factory, - system_clock_client, state_key_broker, - device_settings_service, + state_key_broker, device_settings_service, GetEnrollmentToken(oobe_configuration)}); } @@ -955,33 +893,12 @@ } step_started_ = base::TimeTicks::Now(); - system_clock_.Sync(context_.system_clock_client, - base::BindOnce(&Sequence::OnSystemClockSynced, - weak_factory_.GetWeakPtr())); - } - - private: - void OnSystemClockSynced(bool synchronized) { - ReportStepDurationAndResetTimer(kUMASuffixSystemClockSync); - base::UmaHistogramBoolean(kUMAStateDeterminationSystemClockSynchronized, - synchronized); - if (!synchronized) { - LOG(ERROR) << "System clock failed to synchronize"; - return ReportResult( - base::unexpected(AutoEnrollmentSystemClockSyncError{})); - } - - const bool passed = embargo_date_.Passed(context_); - base::UmaHistogramBoolean(kUMAStateDeterminationEmbargoDatePassed, passed); - if (!passed) { - return ReportResult(AutoEnrollmentResult::kNoEnrollment); - } - ownership_.Check(context_.device_settings_service, base::BindOnce(&Sequence::OnOwnershipChecked, weak_factory_.GetWeakPtr())); } + private: void OnOwnershipChecked(ash::DeviceSettingsService::OwnershipStatus status) { ReportStepDurationAndResetTimer(kUMASuffixOwnershipCheck); base::UmaHistogramEnumeration(kUMAStateDeterminationOwnershipStatus, @@ -1146,9 +1063,7 @@ raw_ptr<PrefService> local_state_ = nullptr; DeviceIdentifiers device_identifiers_; - SystemClock system_clock_; Ownership ownership_; - EmbargoDate embargo_date_; StateKeys state_keys_; RlweOprf oprf_; RlweQuery query_; @@ -1171,14 +1086,13 @@ RlweClientFactory rlwe_client_factory, DeviceManagementService* device_management_service, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - ash::SystemClockClient* system_clock_client, ServerBackedStateKeysBroker* state_key_broker, ash::DeviceSettingsService* device_settings_service, ash::OobeConfiguration* oobe_configuration) { return std::make_unique<EnrollmentStateFetcherImpl>( std::move(report_result), local_state, rlwe_client_factory, - device_management_service, url_loader_factory, system_clock_client, - state_key_broker, device_settings_service, oobe_configuration); + device_management_service, url_loader_factory, state_key_broker, + device_settings_service, oobe_configuration); } // static
diff --git a/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher.h b/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher.h index e12b467..f1ecf36 100644 --- a/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher.h +++ b/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher.h
@@ -21,7 +21,6 @@ namespace ash { class DeviceSettingsService; class OobeConfiguration; -class SystemClockClient; } namespace network { @@ -81,7 +80,6 @@ RlweClientFactory rlwe_client_factory, DeviceManagementService* device_management_service, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - ash::SystemClockClient* system_clock_client, ServerBackedStateKeysBroker* state_key_broker, ash::DeviceSettingsService* device_settings_service, ash::OobeConfiguration* oobe_configuration)>; @@ -95,7 +93,6 @@ RlweClientFactory rlwe_client_factory, DeviceManagementService* device_management_service, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - ash::SystemClockClient* system_clock_client, ServerBackedStateKeysBroker* state_key_broker, ash::DeviceSettingsService* device_settings_service, ash::OobeConfiguration* oobe_configuration);
diff --git a/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher_unittest.cc b/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher_unittest.cc index 44d1c83..29c33049 100644 --- a/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher_unittest.cc +++ b/chrome/browser/ash/policy/enrollment/enrollment_state_fetcher_unittest.cc
@@ -29,7 +29,6 @@ #include "chrome/browser/ash/policy/server_backed_state/server_backed_state_keys_broker.h" #include "chrome/browser/ash/settings/device_settings_service.h" #include "chrome/common/pref_names.h" -#include "chromeos/ash/components/dbus/system_clock/fake_system_clock_client.h" #include "chromeos/ash/components/install_attributes/stub_install_attributes.h" #include "chromeos/ash/components/system/fake_statistics_provider.h" #include "chromeos/ash/components/system/statistics_provider.h" @@ -217,7 +216,6 @@ command_line_.GetProcessCommandLine()->AppendSwitchASCII( ash::switches::kEnterpriseEnableUnifiedStateDetermination, AutoEnrollmentTypeChecker::kUnifiedStateDeterminationAlways); - system_clock_.SetNetworkSynchronized(true); DeviceCloudPolicyManagerAsh::RegisterPrefs(local_state_.registry()); EnrollmentStateFetcher::RegisterPrefs(local_state_.registry()); @@ -233,8 +231,8 @@ auto fetcher = EnrollmentStateFetcher::Create( future.GetCallback(), &local_state_, base::BindRepeating(&CreateRlweClientForTesting, psm_test_case_), - fake_dm_service_.get(), shared_url_loader_factory_, &system_clock_, - &state_key_broker_, &device_settings_service_, + fake_dm_service_.get(), shared_url_loader_factory_, &state_key_broker_, + &device_settings_service_, enrollment_test_helper_.oobe_configuration()); fetcher->Start(); return future.Get(); @@ -329,7 +327,6 @@ content::BrowserTaskEnvironment task_environment_; base::test::ScopedCommandLine command_line_; TestingPrefServiceSimple local_state_; - ash::FakeSystemClockClient system_clock_; ash::system::ScopedFakeStatisticsProvider statistics_provider_; ash::ScopedStubInstallAttributes install_attributes_; MockStateKeyBroker state_key_broker_; @@ -376,26 +373,6 @@ EXPECT_EQ(state, AutoEnrollmentResult::kNoEnrollment); } -TEST_F(EnrollmentStateFetcherTest, SystemClockNotSynchronized) { - system_clock_.DisableService(); - - const AutoEnrollmentState state = FetchEnrollmentState(); - - EXPECT_EQ(state, ToState(AutoEnrollmentSystemClockSyncError{})); -} - -TEST_F(EnrollmentStateFetcherTest, EmbargoDateNotPassed) { - statistics_provider_.SetMachineStatistic( - ash::system::kRlzEmbargoEndDateKey, - base::UnlocalizedTimeFormatWithPattern(base::Time::Now() + base::Days(7), - "yyyy-MM-dd", - icu::TimeZone::getGMT())); - - const AutoEnrollmentState state = FetchEnrollmentState(); - - EXPECT_EQ(state, AutoEnrollmentResult::kNoEnrollment); -} - TEST_F(EnrollmentStateFetcherTest, RlzBrandCodeMissing) { base::HistogramTester histograms; statistics_provider_.ClearMachineStatistic(ash::system::kRlzBrandCodeKey); @@ -582,9 +559,8 @@ "seed4567890123456789012345678912") .value(); }), - fake_dm_service_.get(), shared_url_loader_factory_, &system_clock_, - &state_key_broker_, &device_settings_service_, - enrollment_test_helper_.oobe_configuration()); + fake_dm_service_.get(), shared_url_loader_factory_, &state_key_broker_, + &device_settings_service_, enrollment_test_helper_.oobe_configuration()); fetcher->Start(); AutoEnrollmentState state = future.Get(); @@ -740,8 +716,6 @@ const char* step_d = kUMAStateDeterminationStepDuration; histograms.ExpectUniqueTimeSample( - base::StrCat({step_d, kUMASuffixSystemClockSync}), base::Seconds(0), 1); - histograms.ExpectUniqueTimeSample( base::StrCat({step_d, kUMASuffixOwnershipCheck}), base::Seconds(1), 1); histograms.ExpectUniqueTimeSample( base::StrCat({step_d, kUMASuffixOPRFRequest}), base::Seconds(2), 1); @@ -1492,13 +1466,9 @@ histograms.ExpectUniqueSample(kUMAStateDeterminationDeviceIdentifierStatus, 0 /*kAllPresent*/, 1); - histograms.ExpectUniqueSample(kUMAStateDeterminationEmbargoDatePassed, true, - 1); histograms.ExpectUniqueSample(kUMAStateDeterminationEnabled, true, 1); histograms.ExpectUniqueSample(kUMAStateDeterminationOnFlex, device_os_ == DeviceOs::Flex, 1); - histograms.ExpectUniqueSample(kUMAStateDeterminationSystemClockSynchronized, - true, 1); histograms.ExpectUniqueSample( kUMAStateDeterminationOwnershipStatus, ash::DeviceSettingsService::OwnershipStatus::kOwnershipNone, 1);
diff --git a/chrome/browser/ash/system_web_apps/apps/graduation_app_delegate.cc b/chrome/browser/ash/system_web_apps/apps/graduation_app_delegate.cc index 10ce513..d8a2f6d 100644 --- a/chrome/browser/ash/system_web_apps/apps/graduation_app_delegate.cc +++ b/chrome/browser/ash/system_web_apps/apps/graduation_app_delegate.cc
@@ -71,4 +71,8 @@ IsEligibleForGraduation(pref_service_); } +bool GraduationAppDelegate::ShouldCaptureNavigations() const { + return true; +} + } // namespace ash::graduation
diff --git a/chrome/browser/ash/system_web_apps/apps/graduation_app_delegate.h b/chrome/browser/ash/system_web_apps/apps/graduation_app_delegate.h index 690fe13..721ca96 100644 --- a/chrome/browser/ash/system_web_apps/apps/graduation_app_delegate.h +++ b/chrome/browser/ash/system_web_apps/apps/graduation_app_delegate.h
@@ -27,6 +27,7 @@ std::unique_ptr<web_app::WebAppInstallInfo> GetWebAppInfo() const override; bool ShouldShowInSearchAndShelf() const override; bool IsAppEnabled() const override; + bool ShouldCaptureNavigations() const override; private: raw_ptr<PrefService> pref_service_ = nullptr;
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc index 93980fe..53d86ea 100644 --- a/chrome/browser/autocomplete/search_provider_unittest.cc +++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -1134,14 +1134,6 @@ // Verifies AutocompleteControllers return results (including keyword // results) in the right order and set descriptions for them correctly. TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; - // Add an entry that corresponds to a keyword search with 'term2'. AddSearchToHistory(keyword_t_url_, u"term2", 1); profile_->BlockUntilHistoryProcessesPendingRequests(); @@ -1155,66 +1147,42 @@ controller.Start(input); const AutocompleteResult& result = controller.result(); - // There should be three matches, one for the keyword history, one for - // keyword provider's what-you-typed, and one for the default provider's - // what you typed, in that order. - ASSERT_EQ(3u, result.size()); + // There should be two matches, one for the keyword history, and one for + // keyword provider's what-you-typed, in that order. + ASSERT_EQ(2u, result.size()); EXPECT_EQ(AutocompleteMatchType::SEARCH_HISTORY, result.match_at(0).type); EXPECT_EQ(AutocompleteMatchType::SEARCH_OTHER_ENGINE, result.match_at(1).type); - EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, - result.match_at(2).type); EXPECT_GT(result.match_at(0).relevance, result.match_at(1).relevance); - EXPECT_GT(result.match_at(1).relevance, result.match_at(2).relevance); EXPECT_TRUE(result.match_at(0).allowed_to_be_default_match); EXPECT_TRUE(result.match_at(1).allowed_to_be_default_match); - EXPECT_FALSE(result.match_at(2).allowed_to_be_default_match); // The two keyword results should come with the keyword we expect. EXPECT_EQ(u"k", result.match_at(0).keyword); EXPECT_EQ(u"k", result.match_at(1).keyword); - // The default provider has a different keyword. (We don't explicitly - // set it during this test, so all we do is assert that it's different.) - EXPECT_NE(result.match_at(0).keyword, result.match_at(2).keyword); - // The top result will always have a description. The third result, - // coming from a different provider than the first two, should also. - // Whether the second result has one doesn't matter much. (If it was - // missing, people would infer that it's the same search provider as - // the one above it.) + // The top result will always have a description. Whether the second result + // has one doesn't matter much. (If it was missing, people would infer that + // it's the same search provider as the one above it.) EXPECT_FALSE(result.match_at(0).description.empty()); - EXPECT_FALSE(result.match_at(2).description.empty()); - EXPECT_NE(result.match_at(0).description, result.match_at(2).description); } TEST_F(SearchProviderTest, KeywordVerbatim) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; - TestData cases[] = { // Test a simple keyword input. {u"k foo", - 2, + 1, {ResultInfo(GURL("http://keyword/foo"), - AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k foo"), - ResultInfo(GURL("http://defaultturl/k%20foo"), - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false, + AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k foo")}}, // Make sure extra whitespace after the keyword doesn't change the // keyword verbatim query. Also verify that interior consecutive // whitespace gets trimmed. {u"k foo", - 2, + 1, {ResultInfo(GURL("http://keyword/foo"), - AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k foo"), - ResultInfo(GURL("http://defaultturl/k%20foo"), - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false, + AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k foo")}}, // Leading whitespace should be stripped before SearchProvider gets the // input; hence there are no tests here about how it handles those inputs. @@ -1222,47 +1190,35 @@ // Verify that interior consecutive whitespace gets trimmed in either // case. {u"k foo bar", - 2, + 1, {ResultInfo(GURL("http://keyword/foo%20bar"), AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, - u"k foo bar"), - ResultInfo(GURL("http://defaultturl/k%20foo%20bar"), - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false, u"k foo bar")}}, // Verify that trailing whitespace gets trimmed. {u"k foo bar ", - 2, + 1, {ResultInfo(GURL("http://keyword/foo%20bar"), AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, - u"k foo bar"), - ResultInfo(GURL("http://defaultturl/k%20foo%20bar"), - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false, u"k foo bar")}}, // Keywords can be prefixed by certain things that should get ignored // when constructing the keyword match. {u"www.k foo", - 2, + 1, {ResultInfo(GURL("http://keyword/foo"), - AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k foo"), - ResultInfo(GURL("http://defaultturl/www.k%20foo"), - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false, - u"www.k foo")}}, + AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, + u"k foo")}}, {u"http://k foo", - 2, + 1, {ResultInfo(GURL("http://keyword/foo"), - AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k foo"), - ResultInfo(GURL("http://defaultturl/http%3A//k%20foo"), - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false, - u"http://k foo")}}, + AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, + u"k foo")}}, {u"http://www.k foo", - 2, + 1, {ResultInfo(GURL("http://keyword/foo"), - AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k foo"), - ResultInfo(GURL("http://defaultturl/http%3A//www.k%20foo"), - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false, - u"http://www.k foo")}}, + AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, + u"k foo")}}, // A keyword with no remaining input shouldn't get a keyword // verbatim match. @@ -1332,38 +1288,30 @@ // when in keyword mode. This should happen regardless of whether the // keyword provider returns suggested relevance scores. TEST_F(SearchProviderTest, DefaultProviderNoSuggestRelevanceInKeywordMode) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; - struct { const std::string default_provider_json; const std::string keyword_provider_json; const std::string matches[5]; } cases[] = { - // First, try an input where the keyword provider does not deliver - // suggested relevance scores. - { "[\"k a\",[\"k adefault-query\", \"adefault.com\"],[],[]," - "{\"google:verbatimrelevance\":9700," - "\"google:suggesttype\":[\"QUERY\", \"NAVIGATION\"]," - "\"google:suggestrelevance\":[9900, 9800]}]", - "[\"a\",[\"akeyword-query\"],[],[],{\"google:suggesttype\":[\"QUERY\"]}]", - { "a", "akeyword-query", "k a", "adefault.com", "k adefault-query" } }, + // First, try an input where the keyword provider does not deliver + // suggested relevance scores. + {"[\"k a\",[\"k adefault-query\", \"adefault.com\"],[],[]," + "{\"google:verbatimrelevance\":9700," + "\"google:suggesttype\":[\"QUERY\", \"NAVIGATION\"]," + "\"google:suggestrelevance\":[9900, 9800]}]", + "[\"a\",[\"akeyword-query\"],[],[],{\"google:suggesttype\":[\"QUERY\"]}" + "]", + {"a", "akeyword-query", "", "", ""}}, - // Now try with keyword provider suggested relevance scores. - { "[\"k a\",[\"k adefault-query\", \"adefault.com\"],[],[]," - "{\"google:verbatimrelevance\":9700," - "\"google:suggesttype\":[\"QUERY\", \"NAVIGATION\"]," - "\"google:suggestrelevance\":[9900, 9800]}]", - "[\"a\",[\"akeyword-query\"],[],[],{\"google:suggesttype\":[\"QUERY\"]," - "\"google:verbatimrelevance\":9500," - "\"google:suggestrelevance\":[9600]}]", - { "akeyword-query", "a", "k a", "adefault.com", "k adefault-query" } } - }; + // Now try with keyword provider suggested relevance scores. + {"[\"k a\",[\"k adefault-query\", \"adefault.com\"],[],[]," + "{\"google:verbatimrelevance\":9700," + "\"google:suggesttype\":[\"QUERY\", \"NAVIGATION\"]," + "\"google:suggestrelevance\":[9900, 9800]}]", + "[\"a\",[\"akeyword-query\"],[],[],{\"google:suggesttype\":[\"QUERY\"]," + "\"google:verbatimrelevance\":9500," + "\"google:suggestrelevance\":[9600]}]", + {"akeyword-query", "a", "", "", ""}}}; for (size_t i = 0; i < std::size(cases); ++i) { // Send the query twice in order to have a synchronous pass after the first @@ -1649,12 +1597,7 @@ {omnibox::kUIExperimentMaxAutocompleteMatches, {{OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam, "6"}}}, }, - {omnibox::kDynamicMaxAutocomplete, - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions}); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; + {omnibox::kDynamicMaxAutocomplete}); struct KeywordFetcherMatch { std::string contents; @@ -1667,16 +1610,13 @@ const KeywordFetcherMatch matches[6]; const std::string inline_autocompletion; } cases[] = { - // clang-format off - // Ensure that suggest relevance scores reorder matches and that - // the keyword verbatim (lacking a suggested verbatim score) beats - // the default provider verbatim. + // clang-format off + // Ensure that suggest relevance scores reorder matches. { "[\"a\",[\"b\", \"c\"],[],[],{\"google:suggestrelevance\":[1, 2]}]", { { "a", true, true }, - { "k a", false, false }, { "c", true, false }, { "b", true, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // Again, check that relevance scores reorder matches, just this // time with navigation matches. This also checks that with @@ -1691,8 +1631,7 @@ { "d", true, false }, { "c.com", false, false }, { "b.com", false, false }, - { "k a", false, false }, - kEmptyMatch }, + kEmptyMatch, kEmptyMatch }, std::string() }, // Without suggested relevance scores, we should only allow one @@ -1701,8 +1640,7 @@ "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"]}]", { { "a", true, true }, { "b.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // Ensure that verbatimrelevance scores reorder or suppress verbatim. @@ -1711,28 +1649,24 @@ "\"google:suggestrelevance\":[9998]}]", { { "a", true, true }, { "a1", true, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9998," "\"google:suggestrelevance\":[9999]}]", { { "a1", true, true }, { "a", true, true }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, "1" }, { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0," "\"google:suggestrelevance\":[9999]}]", { { "a1", true, true }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, "1" }, { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":-1," "\"google:suggestrelevance\":[9999]}]", { { "a1", true, true }, { "a", true, true }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, "1" }, { "[\"a\",[\"http://a.com\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\"]," @@ -1740,8 +1674,7 @@ "\"google:suggestrelevance\":[9998]}]", { { "a", true, true }, { "a.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // Ensure that both types of relevance scores reorder matches together. @@ -1750,24 +1683,21 @@ { { "a1", true, true }, { "a", true, true }, { "a2", true, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, "1" }, // Check that an inlineable match appears first regardless of its score. { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999]}]", { { "a", true, true }, { "b", true, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"http://b.com\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\"]," "\"google:suggestrelevance\":[9999]}]", { { "a", true, true }, { "b.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // If there is no inlineable match, restore the keyword verbatim score. // The keyword verbatim match will then appear first. @@ -1775,8 +1705,7 @@ "\"google:verbatimrelevance\":0}]", { { "a", true, true }, { "b", true, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"http://b.com\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\"]," @@ -1784,8 +1713,7 @@ "\"google:verbatimrelevance\":0}]", { { "a", true, true }, { "b.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // The top result does not have to score as highly as calculated @@ -1793,46 +1721,41 @@ // this provider. { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0}]", { { "a1", true, true }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, "1" }, { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":10}]", { { "a1", true, true }, - { "k a", false, false }, { "a", true, true }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, "1" }, { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[10]," "\"google:verbatimrelevance\":0}]", { { "a1", true, true }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, "1" }, { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[10, 20]," "\"google:verbatimrelevance\":0}]", { { "a2", true, true }, - { "k a", false, false }, { "a1", true, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, "2" }, { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[10, 30]," "\"google:verbatimrelevance\":20}]", { { "a2", true, true }, - { "k a", false, false }, { "a", true, true }, { "a1", true, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, "2" }, // Ensure that all suggestions are considered, regardless of order. { "[\"a\",[\"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"],[],[]," "{\"google:suggestrelevance\":[10, 20, 30, 40, 50, 60, 70]}]", { { "a", true, true }, - { "k a", false, false }, { "h", true, false }, { "g", true, false }, { "f", true, false }, - { "e", true, false } }, + { "e", true, false }, + { "d", true, false }, }, std::string() }, { "[\"a\",[\"http://b.com\", \"http://c.com\", \"http://d.com\"," "\"http://e.com\", \"http://f.com\", \"http://g.com\"," @@ -1843,11 +1766,11 @@ "\"NAVIGATION\"]," "\"google:suggestrelevance\":[10, 20, 30, 40, 50, 60, 70]}]", { { "a", true, true }, - { "k a", false, false }, { "h.com", false, false }, { "g.com", false, false }, { "f.com", false, false }, - { "e.com", false, false } }, + { "e.com", false, false }, + { "d.com", false, false }, }, std::string() }, // Ensure that incorrectly sized suggestion relevance lists are ignored. @@ -1857,14 +1780,12 @@ { { "a", true, true }, { "a1", true, false }, { "a2", true, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]", { { "a", true, true }, { "a1", true, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // In this case, ignoring the suggested relevance scores means we keep // only one navsuggest result. @@ -1873,16 +1794,14 @@ "\"google:suggestrelevance\":[1]}]", { { "a", true, true }, { "a1.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"http://a1.com\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\"]," "\"google:suggestrelevance\":[9999, 1]}]", { { "a", true, true }, { "a1.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // Ensure that all 'verbatim' results are merged with their maximum score. @@ -1891,8 +1810,7 @@ { { "a2", true, true }, { "a", true, true }, { "a1", true, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, "2" }, { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[]," "{\"google:suggestrelevance\":[9998, 9997, 9999]," @@ -1900,8 +1818,7 @@ { { "a2", true, true }, { "a", true, true }, { "a1", true, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, "2" }, // Ensure that verbatim is always generated without other suggestions. @@ -1909,13 +1826,11 @@ // (except when suggested relevances are ignored). { "[\"a\",[],[],[],{\"google:verbatimrelevance\":1}]", { { "a", true, true }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]", { { "a", true, true }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // In reorder mode, navsuggestions will not need to be demoted (because @@ -1928,8 +1843,7 @@ { { "a", true, true }, { "a2.com", false, false }, { "a1.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"]," @@ -1938,16 +1852,14 @@ { { "a", true, true }, { "a1.com", false, false }, { "a2.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"https://a/\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\"]," "\"google:suggestrelevance\":[9999]}]", { { "a", true, true }, { "a", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // Check when navsuggest scores more than verbatim and there is query // suggestion but it scores lower. @@ -1959,8 +1871,7 @@ { "a2.com", false, false }, { "a1.com", false, false }, { "a3", true, false }, - { "k a", false, false }, - kEmptyMatch }, + kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"]," @@ -1970,8 +1881,7 @@ { "a1.com", false, false }, { "a2.com", false, false }, { "a3", true, false }, - { "k a", false, false }, - kEmptyMatch }, + kEmptyMatch, kEmptyMatch }, std::string() }, // Check when navsuggest scores more than a query suggestion. There is // a verbatim but it scores lower. @@ -1983,8 +1893,7 @@ { "a2.com", false, false }, { "a1.com", false, false }, { "a", true, true }, - { "k a", false, false }, - kEmptyMatch }, + kEmptyMatch, kEmptyMatch }, "3" }, { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"]," @@ -1994,8 +1903,7 @@ { "a1.com", false, false }, { "a2.com", false, false }, { "a", true, true }, - { "k a", false, false }, - kEmptyMatch }, + kEmptyMatch, kEmptyMatch }, "3" }, { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"]," @@ -2004,8 +1912,7 @@ { { "a3", true, true }, { "a2.com", false, false }, { "a1.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, "3" }, { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"]," @@ -2014,8 +1921,7 @@ { { "a3", true, true }, { "a1.com", false, false }, { "a2.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, "3" }, // Check when there is neither verbatim nor a query suggestion that, // because we can't demote navsuggestions below a query suggestion, @@ -2027,8 +1933,7 @@ { { "a", true, true }, { "a2.com", false, false }, { "a1.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"]," @@ -2037,8 +1942,7 @@ { { "a", true, true }, { "a1.com", false, false }, { "a2.com", false, false }, - { "k a", false, false }, - kEmptyMatch, kEmptyMatch }, + kEmptyMatch, kEmptyMatch, kEmptyMatch }, std::string() }, // More checks that everything works when it's not necessary to demote. { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[]," @@ -2049,8 +1953,7 @@ { "a2.com", false, false }, { "a1.com", false, false }, { "a", true, true }, - { "k a", false, false }, - kEmptyMatch }, + kEmptyMatch, kEmptyMatch }, "3" }, { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[]," "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"]," @@ -2060,10 +1963,9 @@ { "a1.com", false, false }, { "a2.com", false, false }, { "a", true, true }, - { "k a", false, false }, - kEmptyMatch }, + kEmptyMatch, kEmptyMatch }, "3" }, - // clang-format on + // clang-format on }; for (size_t i = 0; i < std::size(cases); ++i) { @@ -3285,14 +3187,6 @@ // A basic test that verifies the prefetch metadata parsing logic. TEST_F(SearchProviderTest, PrefetchMetadataParsing) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; - struct Match { std::string contents; bool allowed_to_be_prefetched; @@ -3370,10 +3264,10 @@ "\"google:suggestrelevance\":[9, 12]}]", "[\"a\",[\"b\", \"c\"],[],[],{\"google:suggestrelevance\":[1, 2]}]", {{"a", false, AutocompleteMatchType::SEARCH_OTHER_ENGINE, true}, - {"k a", false, AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false}, - {"ab", false, AutocompleteMatchType::SEARCH_SUGGEST, false}, {"c", false, AutocompleteMatchType::SEARCH_SUGGEST, true}, - {"b", false, AutocompleteMatchType::SEARCH_SUGGEST, true}}, + {"b", false, AutocompleteMatchType::SEARCH_SUGGEST, true}, + {"ab", false, AutocompleteMatchType::SEARCH_SUGGEST, false}, + kEmptyMatch}, }}; for (size_t i = 0; i < std::size(cases); ++i) { @@ -4235,14 +4129,6 @@ }; TEST_F(SearchProviderCommandLineOverrideTest, CommandLineOverrides) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; - TemplateURLService* turl_model = TemplateURLServiceFactory::GetForProfile(profile_.get()); @@ -4255,12 +4141,9 @@ TestData cases[] = { {u"k a", - 2, + 1, {ResultInfo(GURL("http://keyword/a"), - AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k a"), - ResultInfo(GURL("http://www.bar.com/k%20a?a=b"), - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, false, - u"k a")}}, + AutocompleteMatchType::SEARCH_OTHER_ENGINE, true, u"k a")}}, }; RunTest(cases, std::size(cases), false);
diff --git a/chrome/browser/chrome_browser_interface_binders.cc b/chrome/browser/chrome_browser_interface_binders.cc index d1bcf43..ac4b3ec 100644 --- a/chrome/browser/chrome_browser_interface_binders.cc +++ b/chrome/browser/chrome_browser_interface_binders.cc
@@ -1969,7 +1969,8 @@ if (base::FeatureList::IsEnabled( data_sharing::features::kDataSharingFeature)) { registry.ForWebUI<DataSharingUI>() - .Add<data_sharing::mojom::PageHandlerFactory>(); + .Add<data_sharing::mojom::PageHandlerFactory>() + .Add<color_change_listener::mojom::PageHandler>(); } #endif // !BUILDFLAG(IS_ANDROID)
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 91b3915..fe3e13d 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -6236,7 +6236,7 @@ mojo::PendingRemote<network::mojom::URLLoaderFactory> ChromeContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory( const std::string& scheme, - int frame_tree_node_id) { + content::FrameTreeNodeId frame_tree_node_id) { #if BUILDFLAG(ENABLE_EXTENSIONS_CORE) || BUILDFLAG(IS_CHROMEOS_ASH) || \ !BUILDFLAG(IS_ANDROID) content::WebContents* web_contents =
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index dd5a9ea..beb493f 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -638,8 +638,9 @@ const base::RepeatingCallback<content::WebContents*()>& wc_getter, int frame_tree_node_id) override; mojo::PendingRemote<network::mojom::URLLoaderFactory> - CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme, - int frame_tree_node_id) override; + CreateNonNetworkNavigationURLLoaderFactory( + const std::string& scheme, + content::FrameTreeNodeId frame_tree_node_id) override; void RegisterNonNetworkWorkerMainResourceURLLoaderFactories( content::BrowserContext* browser_context, NonNetworkURLLoaderFactoryMap* factories) override;
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index f11700f..6443e576 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -133,7 +133,7 @@ std::optional<ContentSetting> setting_to_match, const content_settings::PartitionKey& partition_key)); - MOCK_METHOD1(SetClockForTesting, void(base::Clock*)); + MOCK_METHOD1(SetClockForTesting, void(const base::Clock*)); }; class HostContentSettingsMapTest : public testing::Test {
diff --git a/chrome/browser/content_settings/one_time_permission_provider.cc b/chrome/browser/content_settings/one_time_permission_provider.cc index 477ebd3..4900b2c9 100644 --- a/chrome/browser/content_settings/one_time_permission_provider.cc +++ b/chrome/browser/content_settings/one_time_permission_provider.cc
@@ -221,7 +221,7 @@ RemoveAllObservers(); } -void OneTimePermissionProvider::SetClockForTesting(base::Clock* clock) { +void OneTimePermissionProvider::SetClockForTesting(const base::Clock* clock) { clock_ = clock; }
diff --git a/chrome/browser/content_settings/one_time_permission_provider.h b/chrome/browser/content_settings/one_time_permission_provider.h index 2e41485b..7240c62 100644 --- a/chrome/browser/content_settings/one_time_permission_provider.h +++ b/chrome/browser/content_settings/one_time_permission_provider.h
@@ -89,7 +89,7 @@ ContentSettingsType type, std::optional<ContentSetting> setting_to_match, const content_settings::PartitionKey& partition_key) override; - void SetClockForTesting(base::Clock* clock) override; + void SetClockForTesting(const base::Clock* clock) override; void ExpireWebsiteSetting( const ContentSettingsPattern& primary_pattern,
diff --git a/chrome/browser/dips/chrome_dips_delegate.cc b/chrome/browser/dips/chrome_dips_delegate.cc index 83d7a13..17f4fea 100644 --- a/chrome/browser/dips/chrome_dips_delegate.cc +++ b/chrome/browser/dips/chrome_dips_delegate.cc
@@ -5,46 +5,13 @@ #include "chrome/browser/dips/chrome_dips_delegate.h" #include <memory> -#include <set> -#include <string> -#include <vector> #include "base/check.h" -#include "base/functional/callback_forward.h" -#include "base/memory/scoped_refptr.h" -#include "base/no_destructor.h" -#include "base/task/thread_pool.h" -#include "base/time/time.h" -#include "chrome/browser/content_settings/host_content_settings_map_factory.h" -#include "chrome/browser/dips/dips_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_selections.h" -#include "components/content_settings/core/browser/host_content_settings_map.h" -#include "components/site_engagement/content/site_engagement_service.h" -#include "components/site_engagement/core/mojom/site_engagement_details.mojom.h" -#include "content/public/browser/browser_context.h" +#include "content/public/browser/dips_delegate.h" namespace { -std::vector<std::string> GetEngagedSitesInBackground( - base::Time now, - scoped_refptr<HostContentSettingsMap> map) { - std::set<std::string> unique_sites; - auto details = - site_engagement::SiteEngagementService::GetAllDetailsInBackground(now, - map); - for (const site_engagement::mojom::SiteEngagementDetails& detail : details) { - if (!detail.origin.SchemeIsHTTPOrHTTPS()) { - continue; - } - if (!site_engagement::SiteEngagementService::IsEngagementAtLeast( - detail.total_score, blink::mojom::EngagementLevel::MINIMAL)) { - continue; - } - unique_sites.insert(GetSiteForDIPS(detail.origin)); - } - - return std::vector(unique_sites.begin(), unique_sites.end()); -} ProfileSelections GetHumanProfileSelections() { return ProfileSelections::Builder() @@ -71,17 +38,3 @@ << "ApplyProfileSelection() returned a different profile"; return result == profile; } - -void ChromeDipsDelegate::GetEngagedSites( - content::BrowserContext* browser_context, - EngagedSitesCallback callback) { - base::ThreadPool::PostTaskAndReplyWithResult( - FROM_HERE, - {base::TaskPriority::USER_BLOCKING, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, - base::BindOnce( - &GetEngagedSitesInBackground, base::Time::Now(), - base::WrapRefCounted( - HostContentSettingsMapFactory::GetForProfile(browser_context))), - std::move(callback)); -}
diff --git a/chrome/browser/dips/chrome_dips_delegate.h b/chrome/browser/dips/chrome_dips_delegate.h index 0dbc7264..b5228c6b 100644 --- a/chrome/browser/dips/chrome_dips_delegate.h +++ b/chrome/browser/dips/chrome_dips_delegate.h
@@ -6,10 +6,7 @@ #define CHROME_BROWSER_DIPS_CHROME_DIPS_DELEGATE_H_ #include <memory> -#include <string> -#include <vector> -#include "base/functional/callback_forward.h" #include "content/public/browser/dips_delegate.h" namespace content { @@ -27,9 +24,6 @@ bool ShouldEnableDips(content::BrowserContext* browser_context) override; - void GetEngagedSites(content::BrowserContext* browser_context, - EngagedSitesCallback callback) override; - private: friend class ChromeContentBrowserClient; };
diff --git a/chrome/browser/dips/dips_service_unittest.cc b/chrome/browser/dips/dips_service_unittest.cc index bf6fab8..6c7d6f5 100644 --- a/chrome/browser/dips/dips_service_unittest.cc +++ b/chrome/browser/dips/dips_service_unittest.cc
@@ -32,7 +32,6 @@ #include "components/content_settings/core/common/content_settings_pattern.h" #include "components/content_settings/core/common/pref_names.h" #include "components/prefs/pref_service.h" -#include "components/site_engagement/content/site_engagement_service.h" #include "components/ukm/test_ukm_recorder.h" #include "content/public/common/content_features.h" #include "content/public/test/browser_task_environment.h" @@ -72,18 +71,6 @@ EXPECT_EQ(DIPSServiceImpl::Get(&profile), nullptr); } -TEST_F(DIPSServiceTest, NoPrepopulation) { - const GURL url("http://example.com/"); - TestingProfile profile; - site_engagement::SiteEngagementService::Get(&profile)->AddPointsForTesting( - url, 42); - - auto* dips_service = DIPSServiceImpl::Get(&profile); - // There was engagement on example.com, but database prepopulation was - // disabled, so there should NOT be a DIPS DB record for it: - ASSERT_FALSE(GetDIPSState(dips_service, url).has_value()); -} - // Verifies that if database persistence is disabled via Finch, then when the // DIPS Service is constructed, it deletes any DIPS Database files for the // associated BrowserContext.
diff --git a/chrome/browser/enterprise/connectors/common.cc b/chrome/browser/enterprise/connectors/common.cc index 55320e4..860e2d6 100644 --- a/chrome/browser/enterprise/connectors/common.cc +++ b/chrome/browser/enterprise/connectors/common.cc
@@ -34,6 +34,12 @@ using safe_browsing::BinaryUploadService; #endif // BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.h" +#include "chrome/browser/enterprise/connectors/reporting/realtime_reporting_client_factory.h" +#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h" +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + namespace enterprise_connectors { namespace { @@ -61,6 +67,30 @@ } #endif // BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) +#if BUILDFLAG(ENABLE_EXTENSIONS) +std::string EventResultToString( + extensions::api::enterprise_reporting_private::EventResult event_result) { + // Make sure the values returned by this function match the names in + // google3/chrome/cros/reporting/api/proto/browser_events.proto + if (event_result == + extensions::api::enterprise_reporting_private::EventResult::kNone) { + return "EVENT_RESULT_UNKNOWN"; + } + return ToString(event_result); +} + +std::string DetectorTypeToString( + extensions::api::enterprise_reporting_private::DetectorType detector_type) { + // Make sure the values returned by this function match the names in + // google3/chrome/cros/reporting/api/proto/browser_events.proto + if (detector_type == + extensions::api::enterprise_reporting_private::DetectorType::kNone) { + return "DETECTOR_TYPE_UNSPECIFIED"; + } + return ToString(detector_type); +} +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + } // namespace #if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) @@ -360,4 +390,63 @@ } #endif +#if BUILDFLAG(ENABLE_EXTENSIONS) +void ReportDataMaskingEvent( + content::BrowserContext* browser_context, + extensions::api::enterprise_reporting_private::DataMaskingEvent + data_masking_event) { + CHECK(browser_context); + + auto* reporting_client = + enterprise_connectors::RealtimeReportingClientFactory::GetForProfile( + browser_context); + std::optional<enterprise_connectors::ReportingSettings> settings = + reporting_client->GetReportingSettings(); + if (!settings.has_value() || + !base::Contains(settings->enabled_event_names, + enterprise_connectors::kKeySensitiveDataEvent)) { + return; + } + + base::Value::Dict event; + event.Set(extensions::SafeBrowsingPrivateEventRouter::kKeyUrl, + data_masking_event.url); + event.Set(extensions::SafeBrowsingPrivateEventRouter::kKeyTabUrl, + std::move(data_masking_event.url)); + event.Set(extensions::SafeBrowsingPrivateEventRouter::kKeyEventResult, + EventResultToString(data_masking_event.event_result)); + + base::Value::List triggered_rule_info; + triggered_rule_info.reserve(data_masking_event.triggered_rule_info.size()); + for (auto& rule : data_masking_event.triggered_rule_info) { + base::Value::Dict triggered_rule; + triggered_rule.Set( + extensions::SafeBrowsingPrivateEventRouter::kKeyTriggeredRuleId, + std::move(rule.rule_id)); + triggered_rule.Set( + extensions::SafeBrowsingPrivateEventRouter::kKeyTriggeredRuleName, + std::move(rule.rule_name)); + + base::Value::List matched_detectors; + for (auto& detector : rule.matched_detectors) { + base::Value::Dict detector_value; + detector_value.Set(kKeyDetectorId, std::move(detector.detector_id)); + detector_value.Set(kKeyDisplayName, std::move(detector.display_name)); + detector_value.Set(kKeyDetectorType, + DetectorTypeToString(detector.detector_type)); + matched_detectors.Append(std::move(detector_value)); + } + triggered_rule.Set(kKeyMatchedDetectors, std::move(matched_detectors)); + + triggered_rule_info.Append(std::move(triggered_rule)); + } + event.Set(extensions::SafeBrowsingPrivateEventRouter::kKeyTriggeredRuleInfo, + std::move(triggered_rule_info)); + + reporting_client->ReportRealtimeEvent( + enterprise_connectors::kKeySensitiveDataEvent, + std::move(settings.value()), std::move(event)); +} +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + } // namespace enterprise_connectors
diff --git a/chrome/browser/enterprise/connectors/common.h b/chrome/browser/enterprise/connectors/common.h index 615bb17..1ff75cb 100644 --- a/chrome/browser/enterprise/connectors/common.h +++ b/chrome/browser/enterprise/connectors/common.h
@@ -15,12 +15,17 @@ #include "components/enterprise/connectors/core/common.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "content/public/browser/download_manager_delegate.h" +#include "extensions/buildflags/buildflags.h" #if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) #include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h" #include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h" #endif // BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "chrome/common/extensions/api/enterprise_reporting_private.h" +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + class Profile; namespace content { @@ -127,6 +132,23 @@ Profile* GetMainProfileLacros(); #endif +#if BUILDFLAG(ENABLE_EXTENSIONS) + +// Constants used to build the report of a data masking event. +inline constexpr char kKeyDetectorId[] = "detectorId"; +inline constexpr char kKeyDisplayName[] = "displayName"; +inline constexpr char kKeyDetectorType[] = "detectorType"; +inline constexpr char kKeyMatchedDetectors[] = "matchedDetectors"; + +// Helper function to report events for the +// "chrome.enterprise.reportingPrivate.reportingDataMaskingEvent" extension +// API. It does nothing if reporting is not available. +void ReportDataMaskingEvent( + content::BrowserContext* browser_context, + extensions::api::enterprise_reporting_private::DataMaskingEvent + data_masking_event); +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + } // namespace enterprise_connectors #endif // CHROME_BROWSER_ENTERPRISE_CONNECTORS_COMMON_H_
diff --git a/chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.cc b/chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.cc index 50e07a0d..781f1ef6 100644 --- a/chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.cc +++ b/chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.cc
@@ -258,6 +258,35 @@ }); } +#if BUILDFLAG(ENABLE_EXTENSIONS) +void EventReportValidator::ExpectDataMaskingEvent( + const std::string& expected_profile_username, + const std::string& expected_profile_identifier, + extensions::api::enterprise_reporting_private::DataMaskingEvent + expected_event) { + event_key_ = enterprise_connectors::kKeySensitiveDataEvent; + url_ = expected_event.url; + tab_url_ = expected_event.url; + username_ = expected_profile_username; + profile_identifier_ = expected_profile_identifier; + expected_data_masking_rules_builder_ = base::BindRepeating( + [](const extensions::api::enterprise_reporting_private::DataMaskingEvent& + event) { return event.Clone(); }, + std::move(expected_event)); + EXPECT_CALL(*client_, UploadSecurityEventReport) + .WillOnce( + [this](content::BrowserContext* context, bool include_device_info, + base::Value::Dict report, + base::OnceCallback<void(policy::CloudPolicyClient::Result)> + callback) { + ValidateReport(&report); + if (!done_closure_.is_null()) { + done_closure_.Run(); + } + }); +} +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + void EventReportValidator::ExpectSensitiveDataEvents( const std::string& expected_url, const std::string& expected_tab_url, @@ -572,6 +601,9 @@ ValidateMimeType(event); ValidateRTLookupResponse(event); ValidateDataControlsAttributes(event); +#if BUILDFLAG(ENABLE_EXTENSIONS) + ValidateDataMaskingAttributes(event); +#endif // BUILDFLAG(ENABLE_EXTENSIONS) // This field is checked using other members for non URLF events, so // `url_filtering_event_result_` is always expected to be empty in other @@ -834,6 +866,26 @@ } } +#if BUILDFLAG(ENABLE_EXTENSIONS) +void EventReportValidator::ValidateDataMaskingAttributes( + const base::Value::Dict* event) { + if (expected_data_masking_rules_builder_) { + auto data_masking_rules = std::move(expected_data_masking_rules_builder_) + .Run() + .triggered_rule_info; + const base::Value::List* triggered_rules = + event->FindList(SafeBrowsingPrivateEventRouter::kKeyTriggeredRuleInfo); + ASSERT_TRUE(triggered_rules); + ASSERT_EQ(data_masking_rules.size(), triggered_rules->size()); + size_t rule_index = 0; + for (const base::Value& rule : *triggered_rules) { + ASSERT_EQ(rule.GetDict(), data_masking_rules[rule_index].ToValue()); + ++rule_index; + } + } +} +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + void EventReportValidator::ExpectNoReport() { EXPECT_CALL(*client_, UploadSecurityEventReport).Times(0); }
diff --git a/chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.h b/chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.h index 1946b5b..680207c 100644 --- a/chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.h +++ b/chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.h
@@ -21,6 +21,11 @@ #include "components/safe_browsing/core/common/proto/realtimeapi.pb.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/signin/public/identity_manager/identity_test_environment.h" +#include "extensions/buildflags/buildflags.h" + +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "chrome/common/extensions/api/enterprise_reporting_private.h" +#endif // BUILDFLAG(ENABLE_EXTENSIONS) namespace policy { class MockCloudPolicyClient; @@ -85,6 +90,14 @@ const std::string& expected_profile_identifier, int64_t expected_content_size); +#if BUILDFLAG(ENABLE_EXTENSIONS) + void ExpectDataMaskingEvent( + const std::string& expected_profile_username, + const std::string& expected_profile_identifier, + extensions::api::enterprise_reporting_private::DataMaskingEvent + expected_event); +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + void ExpectSensitiveDataEvents( const std::string& expected_url, const std::string& expected_tab_url, @@ -237,6 +250,9 @@ const std::string& field_key, const std::optional<bool>& expected_value); void ValidateDataControlsAttributes(const base::Value::Dict* event); +#if BUILDFLAG(ENABLE_EXTENSIONS) + void ValidateDataMaskingAttributes(const base::Value::Dict* event); +#endif // BUILDFLAG(ENABLE_EXTENSIONS) raw_ptr<policy::MockCloudPolicyClient> client_; @@ -265,6 +281,15 @@ std::optional<std::string> data_controls_result_ = std::nullopt; data_controls::Verdict::TriggeredRules data_controls_triggered_rules_; +#if BUILDFLAG(ENABLE_EXTENSIONS) + // `DataMaskingEvent`'s copy constructor is deleted, so to keep + // `EventReportValidator` copyable a lazy builder is used to store its + // expected value. + base::RepeatingCallback< + extensions::api::enterprise_reporting_private::DataMaskingEvent()> + expected_data_masking_rules_builder_; +#endif // BUILDFLAG(ENABLE_EXTENSIONS) + // When multiple files generate events, we don't necessarily know in which // order they will be reported. As such, we use maps to ensure all of them // are called as expected.
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 8995a39..086dd576b 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -1166,10 +1166,6 @@ "api/identity/launch_web_auth_flow_delegate_ash.h", "api/image_writer_private/operation_chromeos.cc", "api/image_writer_private/removable_storage_provider_chromeos.cc", - "api/input_ime/input_ime_api.cc", - "api/input_ime/input_ime_api.h", - "api/input_ime/input_ime_api_chromeos.cc", - "api/input_ime/input_ime_api_chromeos.h", "api/media_perception_private/media_perception_api_delegate_chromeos.cc", "api/media_perception_private/media_perception_api_delegate_chromeos.h", "api/messaging/native_message_host_chromeos.cc",
diff --git a/chrome/browser/extensions/api/BUILD.gn b/chrome/browser/extensions/api/BUILD.gn index d429c7b..ed3462e 100644 --- a/chrome/browser/extensions/api/BUILD.gn +++ b/chrome/browser/extensions/api/BUILD.gn
@@ -61,7 +61,10 @@ } if (is_chromeos_ash) { - public_deps += [ "//chrome/browser/extensions/api/crash_report_private" ] + public_deps += [ + "//chrome/browser/extensions/api/crash_report_private", + "//chrome/browser/extensions/api/input_ime", + ] } }
diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc index a62a1454..5f22579a 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc +++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
@@ -21,7 +21,10 @@ #include "base/task/thread_pool.h" #include "base/values.h" #include "build/build_config.h" +#include "chrome/browser/enterprise/connectors/common.h" #include "chrome/browser/enterprise/connectors/connectors_service.h" +#include "chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.h" +#include "chrome/browser/enterprise/connectors/reporting/realtime_reporting_client_factory.h" #include "chrome/browser/enterprise/signals/device_info_fetcher.h" #include "chrome/browser/enterprise/signals/signals_common.h" #include "chrome/browser/enterprise/util/affiliation.h" @@ -909,4 +912,24 @@ #endif // BUILDFLAG(IS_WIN) +// reportDataMaskingEvent + +EnterpriseReportingPrivateReportDataMaskingEventFunction:: + EnterpriseReportingPrivateReportDataMaskingEventFunction() = default; +EnterpriseReportingPrivateReportDataMaskingEventFunction:: + ~EnterpriseReportingPrivateReportDataMaskingEventFunction() = default; + +ExtensionFunction::ResponseAction +EnterpriseReportingPrivateReportDataMaskingEventFunction::Run() { + auto params = + api::enterprise_reporting_private::ReportDataMaskingEvent::Params::Create( + args()); + EXTENSION_FUNCTION_VALIDATE(params); + + enterprise_connectors::ReportDataMaskingEvent(browser_context(), + std::move(params->event)); + + return RespondNow(NoArguments()); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h index 387840b..e0e8ece 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h +++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h
@@ -380,6 +380,26 @@ #endif // BUILDFLAG(IS_WIN) +class EnterpriseReportingPrivateReportDataMaskingEventFunction + : public ExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION( + "enterprise.reportingPrivate.reportDataMaskingEvent", + ENTERPRISEREPORTINGPRIVATE_REPORTDATAMASKINGEVENT) + + EnterpriseReportingPrivateReportDataMaskingEventFunction(); + EnterpriseReportingPrivateReportDataMaskingEventFunction( + const EnterpriseReportingPrivateReportDataMaskingEventFunction&) = delete; + EnterpriseReportingPrivateReportDataMaskingEventFunction& operator=( + const EnterpriseReportingPrivateReportDataMaskingEventFunction&) = delete; + + private: + ~EnterpriseReportingPrivateReportDataMaskingEventFunction() override; + + // ExtensionFunction: + ExtensionFunction::ResponseAction Run() override; +}; + } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_REPORTING_PRIVATE_ENTERPRISE_REPORTING_PRIVATE_API_H_
diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_apitest.cc b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_apitest.cc index 23f0508..cc7235e 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_apitest.cc +++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_apitest.cc
@@ -11,12 +11,14 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/enterprise/browser_management/management_service_factory.h" +#include "chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.h" #include "chrome/browser/extensions/chrome_test_extension_loader.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/signin/chrome_signin_client_factory.h" #include "chrome/browser/signin/chrome_signin_client_test_util.h" #include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" +#include "chrome/common/extensions/api/enterprise_reporting_private.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/policy/core/common/management/management_service.h" #include "components/signin/public/identity_manager/account_info.h" @@ -24,6 +26,7 @@ #include "components/version_info/version_info.h" #include "content/public/test/browser_test.h" #include "extensions/common/extension.h" +#include "extensions/common/extension_features.h" #include "extensions/test/result_catcher.h" #include "extensions/test/test_extension_dir.h" #include "services/network/test/test_url_loader_factory.h" @@ -50,7 +53,6 @@ #endif // BUILDFLAG(IS_WIN) #if !BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.h" #include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h" #include "components/policy/core/common/cloud/cloud_policy_core.h" #include "components/policy/core/common/cloud/cloud_policy_store.h" @@ -128,8 +130,18 @@ public: EnterpriseReportingPrivateApiTest() { #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) + scoped_features_.InitWithFeatures( + /*enabled_features=*/ + { + extensions_features:: + kApiEnterpriseReportingPrivateReportDataMaskingEvent, + enterprise_signals::features::kNewEvSignalsEnabled, + }, + /*disabled_features=*/{}); +#else scoped_features_.InitAndEnableFeature( - enterprise_signals::features::kNewEvSignalsEnabled); + extensions_features:: + kApiEnterpriseReportingPrivateReportDataMaskingEvent); #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) #if !BUILDFLAG(IS_CHROMEOS_ASH) @@ -1165,4 +1177,90 @@ } #endif // BUILDFLAG(IS_CHROMEOS_LACROS) +class EnterpriseReportDataMaskingEventTest + : public EnterpriseReportingPrivateApiTest { + public: + static constexpr char kTestJS[] = R"( + chrome.test.assertEq( + 'function', + typeof chrome.enterprise.reportingPrivate.reportDataMaskingEvent); + chrome.enterprise.reportingPrivate.reportDataMaskingEvent( + { + "url": "https://foo.com", + "eventResult": "EVENT_RESULT_DATA_MASKED", + "triggeredRuleInfo": [ + { + "ruleId": "1234", + "ruleName": "Data Masking rule", + "matchedDetectors": [ + { + "detectorId": "5678", + "displayName": "Credit card matcher", + "detectorType": "PREDEFINED_DLP" + } + ] + } + ] + }, () => { + chrome.test.assertNoLastError(); + chrome.test.notifyPass(); + });)"; + + void SetUpOnMainThread() override { + EnterpriseReportingPrivateApiTest::SetUpOnMainThread(); + event_report_validator_helper_ = std::make_unique< + enterprise_connectors::test::EventReportValidatorHelper>( + profile(), /*browser_test=*/true); + } + + void TearDownOnMainThread() override { + event_report_validator_helper_.reset(); + EnterpriseReportingPrivateApiTest::TearDownOnMainThread(); + } + + protected: + std::unique_ptr<enterprise_connectors::test::EventReportValidatorHelper> + event_report_validator_helper_; +}; + +IN_PROC_BROWSER_TEST_F(EnterpriseReportDataMaskingEventTest, + ReportingPolicyDisabled) { + auto event_validator = event_report_validator_helper_->CreateValidator(); + event_validator.ExpectNoReport(); + enterprise_connectors::test::SetOnSecurityEventReporting( + profile()->GetPrefs(), false, {}, {}); + + RunTest(kTestJS); +} + +IN_PROC_BROWSER_TEST_F(EnterpriseReportDataMaskingEventTest, + ReportingPolicyEnabled) { + auto event_validator = event_report_validator_helper_->CreateValidator(); + + api::enterprise_reporting_private::TriggeredRuleInfo rule_info; + rule_info.rule_id = "1234"; + rule_info.rule_name = "Data Masking rule"; + rule_info.matched_detectors.push_back({}); + rule_info.matched_detectors[0].detector_id = "5678"; + rule_info.matched_detectors[0].display_name = "Credit card matcher"; + rule_info.matched_detectors[0].detector_type = + api::enterprise_reporting_private::DetectorType::kPredefinedDlp; + + api::enterprise_reporting_private::DataMaskingEvent event; + event.event_result = + api::enterprise_reporting_private::EventResult::kEventResultDataMasked; + event.url = "https://foo.com"; + event.triggered_rule_info.push_back(std::move(rule_info)); + event_validator.ExpectDataMaskingEvent("test-user@chromium.org", + profile()->GetPath().AsUTF8Unsafe(), + std::move(event)); + + // Explicitly only enable sensitive data events only to avoid having to handle + // assertions for extension install events. + enterprise_connectors::test::SetOnSecurityEventReporting( + profile()->GetPrefs(), true, {"sensitiveDataEvent"}, {}); + + RunTest(kTestJS); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/api/input_ime/BUILD.gn b/chrome/browser/extensions/api/input_ime/BUILD.gn new file mode 100644 index 0000000..77b29a6 --- /dev/null +++ b/chrome/browser/extensions/api/input_ime/BUILD.gn
@@ -0,0 +1,46 @@ +# Copyright 2024 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//chrome/common/features.gni") +import("//extensions/buildflags/buildflags.gni") + +assert(enable_extensions) +assert(is_chromeos_ash) + +source_set("input_ime") { + sources = [ + "input_ime_api.cc", + "input_ime_api.h", + "input_ime_api_chromeos.cc", + "input_ime_api_chromeos.h", + ] + + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + public_deps = [ + "//base", + "//build:chromeos_buildflags", + "//chrome/browser/ash/input_method", + "//chrome/browser/profiles:profile", + "//chrome/common/extensions/api", + "//components/keyed_service/core", + "//extensions/browser", + "//extensions/common", + "//ui/base/ime:text_input_types", + "//ui/base/ime/ash", + ] + + deps = [ + "//ash/constants", + "//ash/public/cpp", + "//chrome/browser/ash/login/session", + "//chrome/browser/ash/profiles", + "//chrome/browser/ui/ash/keyboard", + "//chromeos/ash/services/ime/public/cpp:structs", + "//ui/base:features", + "//ui/base/ime", + "//ui/events:dom_keycode_converter", + "//ui/events:events_base", + ] +}
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.h b/chrome/browser/extensions/api/input_ime/input_ime_api.h index 70d49db..a73ec13 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.h +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.h
@@ -16,6 +16,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/ash/input_method/input_method_engine.h" +#include "chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/input_ime.h" #include "components/keyed_service/core/keyed_service.h" @@ -29,10 +30,6 @@ #include "ui/base/ime/ash/text_input_method.h" #include "ui/base/ime/text_input_flags.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h" -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - class Profile; namespace extensions {
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc index 4badff07..757f637 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
@@ -17,7 +17,6 @@ #include "chrome/browser/ash/input_method/input_method_engine.h" #include "chrome/browser/ash/input_method/native_input_method_engine.h" #include "chrome/browser/ash/input_method/text_field_contextual_info_fetcher.h" -#include "chrome/browser/ash/login/lock/screen_locker.h" #include "chrome/browser/ash/login/session/user_session_manager.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h"
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc b/chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc index a37dd75f..34d2220 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc
@@ -219,17 +219,9 @@ // Now, peek into the controller to see if it has the results we expect. // First result should be to invoke the keyword with what we typed, 2-4 - // should be to invoke with suggestions from the extension, and the last - // should be to search for what we typed. + // should be to invoke with suggestions from the extension. const AutocompleteResult& result = autocomplete_controller->result(); - if (omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - ASSERT_EQ(4U, result.size()) << AutocompleteResultAsString(result); - } else { - ASSERT_EQ(5U, result.size()) << AutocompleteResultAsString(result); - } + ASSERT_EQ(4U, result.size()) << AutocompleteResultAsString(result); // Invoke the keyword with what we typed. EXPECT_EQ(u"alpha", result.match_at(0).keyword); @@ -281,18 +273,6 @@ EXPECT_EQ(simple_description, result.match_at(3).contents); VerifyMatchComponents(expected_components, result.match_at(3)); } - - if (!omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - // Final option, search what you typed. - AutocompleteMatch match = result.match_at(4); - EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, match.type); - EXPECT_EQ(AutocompleteProvider::TYPE_SEARCH, - result.match_at(4).provider->type()); - EXPECT_FALSE(match.deletable); - } } IN_PROC_BROWSER_TEST_P(OmniboxApiTest, OnInputEntered) { @@ -409,18 +389,10 @@ EXPECT_TRUE(incognito_controller->done()); } - // First result should be to invoke the keyword with what we typed, the - // second should be the provided suggestion from the extension, and the - // final should be to search for what we typed. + // First result should be to invoke the keyword with what we typed, and the + // second should be the provided suggestion from the extension. const AutocompleteResult& result = incognito_controller->result(); - if (omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - ASSERT_EQ(2u, result.size()); - } else { - ASSERT_EQ(3u, result.size()); - } + ASSERT_EQ(2u, result.size()); // First result. EXPECT_EQ(u"alpha", result.match_at(0).keyword); @@ -434,15 +406,6 @@ EXPECT_EQ(AutocompleteProvider::TYPE_KEYWORD, result.match_at(1).provider->type()); - if (!omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - // Third result: search what you typed. - EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, - result.match_at(2).type); - } - // Split-mode test: Send different input to the on-the-record and off-the- // record profiles, and wait for a message from each. Verify that the // extension received the proper input in each context. @@ -574,14 +537,7 @@ // Peek into the controller to see if it has the results we expect. const AutocompleteResult& result = autocomplete_controller->result(); - if (omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - ASSERT_EQ(4u, result.size()) << AutocompleteResultAsString(result); - } else { - ASSERT_EQ(5u, result.size()) << AutocompleteResultAsString(result); - } + ASSERT_EQ(4u, result.size()) << AutocompleteResultAsString(result); EXPECT_EQ(u"alpha input", result.match_at(0).fill_into_edit); EXPECT_EQ(AutocompleteProvider::TYPE_KEYWORD, @@ -603,16 +559,6 @@ result.match_at(3).provider->type()); EXPECT_FALSE(result.match_at(3).deletable); - if (!omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - EXPECT_EQ(u"alpha input", result.match_at(4).fill_into_edit); - EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, - result.match_at(4).type); - EXPECT_FALSE(result.match_at(3).deletable); - } - // This test portion is excluded from Mac because the Mac key combination // FN+SHIFT+DEL used to delete an omnibox suggestion cannot be reproduced. // This is because the FN key is not supported in interactive_test_util.h. @@ -643,24 +589,12 @@ delete_suggestion_listener.message()); // Verify that the second suggestion result was deleted. There should be one - // less suggestion result, 4 now instead of 5 (accept current input, two - // extension-provided suggestions, and "search what you typed"). - if (omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - ASSERT_EQ(3u, result.size()); - } else { - ASSERT_EQ(4u, result.size()); - } + // less suggestion result, 3 now instead of 4 (accept current input and two + // extension-provided suggestions). + ASSERT_EQ(3u, result.size()); EXPECT_EQ(u"alpha input", result.match_at(0).fill_into_edit); EXPECT_EQ(u"alpha input first", result.match_at(1).fill_into_edit); EXPECT_EQ(u"alpha input third", result.match_at(2).fill_into_edit); - if (!omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // Search-what-you-typed suggestion. - EXPECT_EQ(u"alpha input", result.match_at(3).fill_into_edit); - } #endif } @@ -863,14 +797,7 @@ EXPECT_TRUE(autocomplete_controller->done()); const AutocompleteResult& result = autocomplete_controller->result(); - if (omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - ASSERT_EQ(1u, result.size()) << AutocompleteResultAsString(result); - } else { - ASSERT_EQ(2u, result.size()) << AutocompleteResultAsString(result); - } + ASSERT_EQ(1u, result.size()) << AutocompleteResultAsString(result); { const AutocompleteMatch& match = result.match_at(0); @@ -890,13 +817,6 @@ }; VerifyMatchComponents(expected_components, match); } - - if (!omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - const AutocompleteMatch& match = result.match_at(1); - EXPECT_EQ(u"word d", match.fill_into_edit); - EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, match.type); - } } // Tests an extension passing empty suggestions. Regression test for @@ -944,18 +864,10 @@ EXPECT_TRUE(autocomplete_controller->done()); { - // We expect three results - sending the typed text to the extension, - // the single extension suggestion ("foo"), and to search what the user - // typed. + // We expect two results - sending the typed text to the extension, + // and the single extension suggestion ("foo"). const AutocompleteResult& result = autocomplete_controller->result(); - if (omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - ASSERT_EQ(2u, result.size()) << AutocompleteResultAsString(result); - } else { - ASSERT_EQ(3u, result.size()) << AutocompleteResultAsString(result); - } + ASSERT_EQ(2u, result.size()) << AutocompleteResultAsString(result); EXPECT_EQ(u"alpha d", result.match_at(0).fill_into_edit); EXPECT_EQ(AutocompleteProvider::TYPE_KEYWORD, @@ -964,16 +876,6 @@ EXPECT_EQ(u"alpha foo", result.match_at(1).fill_into_edit); EXPECT_EQ(AutocompleteProvider::TYPE_KEYWORD, result.match_at(1).provider->type()); - - if (!omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) { - // When LimitKeywordModeSuggestions is enabled, DSE and - // search-what-you-typed suggestions are not provided. - AutocompleteMatch match = result.match_at(2); - EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, match.type); - EXPECT_EQ(AutocompleteProvider::TYPE_SEARCH, - result.match_at(2).provider->type()); - } } // Now, hit the backspace key, so that the only text is "alpha ". The
diff --git a/chrome/browser/facilitated_payments/ui/android/internal/java/res/layout/facilitated_payments_progress_screen.xml b/chrome/browser/facilitated_payments/ui/android/internal/java/res/layout/facilitated_payments_progress_screen.xml index 2555126d..8130578 100644 --- a/chrome/browser/facilitated_payments/ui/android/internal/java/res/layout/facilitated_payments_progress_screen.xml +++ b/chrome/browser/facilitated_payments/ui/android/internal/java/res/layout/facilitated_payments_progress_screen.xml
@@ -23,6 +23,7 @@ <!-- TODO: b/348142430 - Make the track for the progress spinner visible. --> <com.google.android.material.progressindicator.CircularProgressIndicator + android:id="@+id/progress_bar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" @@ -37,4 +38,14 @@ android:layout_centerInParent="true" android:src="@drawable/lock_icon" android:importantForAccessibility="no" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_below="@+id/progress_bar" + android:layout_marginTop="@dimen/facilitated_payments_progress_message_margin_top" + android:textAlignment="center" + android:text="@string/pix_payment_progress_screen_message" + android:textAppearance="@style/TextAppearance.TextMedium.Secondary" /> </RelativeLayout>
diff --git a/chrome/browser/facilitated_payments/ui/android/internal/java/res/values/dimens.xml b/chrome/browser/facilitated_payments/ui/android/internal/java/res/values/dimens.xml index 7b82c27..7b3018a 100644 --- a/chrome/browser/facilitated_payments/ui/android/internal/java/res/values/dimens.xml +++ b/chrome/browser/facilitated_payments/ui/android/internal/java/res/values/dimens.xml
@@ -19,11 +19,12 @@ <dimen name="facilitated_payments_footer_button_height">40dp</dimen> <dimen name="facilitated_payments_footer_button_margin_vertical">10dp</dimen> <dimen name="facilitated_payments_footer_drawable_padding">16dp</dimen> - <dimen name="facilitated_payments_progress_screen_height">350dp</dimen> + <dimen name="facilitated_payments_progress_screen_height">338dp</dimen> <dimen name="facilitated_payments_progress_screen_margin_top">12dp</dimen> <dimen name="facilitated_payments_progress_bar_size">100dp</dimen> <dimen name="facilitated_payments_progress_bar_track_thickness">4dp</dimen> <dimen name="facilitated_payments_progress_screen_lock_size">40dp</dimen> + <dimen name="facilitated_payments_progress_message_margin_top">12dp</dimen> <dimen name="facilitated_payments_error_icon_size">32dp</dimen> <dimen name="facilitated_payments_error_icon_top_margin">18dp</dimen> <dimen name="facilitated_payments_error_icon_bottom_margin">8dp</dimen>
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 97348c18..267b0a5 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -3171,11 +3171,6 @@ "expiry_milestone": 130 }, { - "name": "enable-fenced-frames", - "owners": [ "dom@chromium.org", "shivanisha@chromium.org", "chrome-fenced-frames@google.com" ], - "expiry_milestone": 130 - }, - { "name": "enable-fenced-frames-cross-origin-automatic-beacons", "owners": [ "lbrady@google.com", "shivanisha@chromium.org", "chrome-fenced-frames-core@google.com" ], "expiry_milestone": 130 @@ -3183,7 +3178,7 @@ { "name": "enable-fenced-frames-developer-mode", "owners": [ "dom@chromium.org", "shivanisha@chromium.org", "chrome-fenced-frames@google.com" ], - "expiry_milestone": 130 + "expiry_milestone": 140 }, { "name": "enable-fenced-frames-reporting-attestations-changes", @@ -6529,14 +6524,6 @@ "expiry_milestone": 130 }, { - "name": "omnibox-limit-keyword-mode-suggestions", - "owners": [ - "yoangela@chromium.org", - "chrome-omnibox-team@google.com" - ], - "expiry_milestone": 130 - }, - { "name": "omnibox-local-history-zero-suggest-beyond-ntp", "owners": [ "mahmadi@chromium.org", "ender@chromium.org", "stkhapugin@chromium.org", "chrome-omnibox-team@google.com" ], "expiry_milestone": 130 @@ -8981,6 +8968,11 @@ "expiry_milestone": -1 }, { + "name": "use-ml-kem", + "owners": [ "agl@chromium.org", "davidben@chromium.org" ], + "expiry_milestone": 150 + }, + { "name": "use-ml-service-for-non-longform-handwriting-on-all-boards", "owners": [ "tranbaoduy@chromium.org", "mlcui@google.com", "cros-borders-eng@google.com"], "expiry_milestone": 130
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 36792d39..e5bd024 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1192,9 +1192,17 @@ "during the handshake when resuming a connection to a compatible TLS 1.3 " "server."; -const char kEnableTLS13KyberName[] = "TLS 1.3 hybridized Kyber support"; +const char kEnableTLS13KyberName[] = "TLS 1.3 post-quantum key agreement"; const char kEnableTLS13KyberDescription[] = - "This option enables a combination of X25519 and Kyber in TLS 1.3."; + "This option enables a post-quantum key agreement in TLS 1.3. " + "The #use-ml-kem flag controls whether ML-KEM or Kyber is used."; + +const char kUseMLKEMName[] = "Use ML-KEM in TLS 1.3"; +const char kUseMLKEMDescription[] = + "This option uses the ML-KEM standard as the post-quantum key agreement in " + "TLS 1.3, instead of the Kyber draft standard. Post-quantum key agreement " + "must be enabled (see #enable-tls13-kyber) for this option to have an " + "effect."; const char kAccessibilityAcceleratorName[] = "Experimental Accessibility accelerator"; @@ -2701,11 +2709,6 @@ "Send ON_CLOBBER focus type for zero-prefix requests with an empty input " "on Web/SRP."; -const char kOmniboxLimitKeywordModeSuggestionsName[] = - "Omnibox Limit Keyword Mode Suggestions"; -const char kOmniboxLimitKeywordModeSuggestionsDescription[] = - "Limit scope of suggestions in keyword mode"; - const char kOmniboxSuggestionAnswerMigrationName[] = "Omnibox SuggestionAnswer Migration"; const char kOmniboxSuggestionAnswerMigrationDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 8080437..d016f20 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -700,6 +700,9 @@ extern const char kEnableTLS13KyberName[]; extern const char kEnableTLS13KyberDescription[]; +extern const char kUseMLKEMName[]; +extern const char kUseMLKEMDescription[]; + extern const char kAccessibilityAcceleratorName[]; extern const char kAccessibilityAcceleratorDescription[]; @@ -1550,9 +1553,6 @@ extern const char kOmniboxOnClobberFocusTypeOnContentName[]; extern const char kOmniboxOnClobberFocusTypeOnContentDescription[]; -extern const char kOmniboxLimitKeywordModeSuggestionsName[]; -extern const char kOmniboxLimitKeywordModeSuggestionsDescription[]; - extern const char kOmniboxSuggestionAnswerMigrationName[]; extern const char kOmniboxSuggestionAnswerMigrationDescription[];
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java index e0ae3f5..33ea072 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
@@ -880,12 +880,11 @@ // Mutable*ParamWithSafeDefault instances. /* Alphabetical: */ public static final MutableBooleanParamWithSafeDefault - sGtsCloseTabAnimationCloseAllQuickDeleteAnimation = - sGtsCloseTabAnimation.newBooleanParam( - "close_all_quick_delete_animation", false); + sGtsCloseTabAnimationRemoveEmphasizedAccelerate = + sGtsCloseTabAnimation.newBooleanParam("remove_emphasized_accelerate", false); public static final MutableBooleanParamWithSafeDefault - sGtsCloseTabAnimationRearrangeStandardEasing = - sGtsCloseTabAnimation.newBooleanParam("rearrange_standard_easing", false); + sGtsCloseTabAnimationRemoveExtendDuration = + sGtsCloseTabAnimation.newBooleanParam("remove_extend_duration", false); public static final MutableBooleanParamWithSafeDefault sShouldBlockCapturesForFullscreenParam = sSuppressionToolbarCaptures.newBooleanParam("block_for_fullscreen", false); public static final MutableBooleanParamWithSafeDefault sAndroidTabDeclutterArchiveEnabled =
diff --git a/chrome/browser/media/router/mojo/media_router_desktop.cc b/chrome/browser/media/router/mojo/media_router_desktop.cc index 65cb08d..d77433a 100644 --- a/chrome/browser/media/router/mojo/media_router_desktop.cc +++ b/chrome/browser/media/router/mojo/media_router_desktop.cc
@@ -211,7 +211,7 @@ } else { const int frame_tree_node_id = web_contents ? web_contents->GetPrimaryMainFrame()->GetFrameTreeNodeId() - : kDefaultFrameTreeNodeId; + : content::FrameTreeNodeId(); media_route_providers_[provider_id]->CreateRoute( source_id, sink_id, presentation_id, origin, frame_tree_node_id, timeout, std::move(mr_callback)); @@ -243,7 +243,7 @@ const int frame_tree_node_id = web_contents ? web_contents->GetPrimaryMainFrame()->GetFrameTreeNodeId() - : kDefaultFrameTreeNodeId; + : content::FrameTreeNodeId(); auto mr_callback = base::BindOnce(&MediaRouterDesktop::RouteResponseReceived, weak_factory_.GetWeakPtr(), presentation_id, *provider_id, std::move(callback), true);
diff --git a/chrome/browser/notifications/notification_channels_provider_android.cc b/chrome/browser/notifications/notification_channels_provider_android.cc index d9a8da6..a22f7b8 100644 --- a/chrome/browser/notifications/notification_channels_provider_android.cc +++ b/chrome/browser/notifications/notification_channels_provider_android.cc
@@ -495,7 +495,7 @@ } void NotificationChannelsProviderAndroid::SetClockForTesting( - base::Clock* clock) { + const base::Clock* clock) { clock_ = clock; }
diff --git a/chrome/browser/notifications/notification_channels_provider_android.h b/chrome/browser/notifications/notification_channels_provider_android.h index ce76ea8..f71d2fc 100644 --- a/chrome/browser/notifications/notification_channels_provider_android.h +++ b/chrome/browser/notifications/notification_channels_provider_android.h
@@ -122,7 +122,7 @@ ContentSettingsType content_type, std::optional<ContentSetting> setting_to_match, const content_settings::PartitionKey& partition_key) override; - void SetClockForTesting(base::Clock* clock) override; + void SetClockForTesting(const base::Clock* clock) override; protected: // Migrates any notification settings from the passed-in provider to @@ -223,7 +223,7 @@ std::unique_ptr<NotificationChannelsBridge> bridge_; - raw_ptr<base::Clock> clock_; + raw_ptr<const base::Clock> clock_; // Map of origin - NotificationChannel. Channel status may be out of date. // This cache is completely refreshed every time GetRuleIterator is called;
diff --git a/chrome/browser/performance_manager/metrics/page_resource_monitor_unittest.cc b/chrome/browser/performance_manager/metrics/page_resource_monitor_unittest.cc index 9ceaefd..3004f30 100644 --- a/chrome/browser/performance_manager/metrics/page_resource_monitor_unittest.cc +++ b/chrome/browser/performance_manager/metrics/page_resource_monitor_unittest.cc
@@ -21,7 +21,6 @@ #include "base/strings/strcat.h" #include "base/system/sys_info.h" #include "base/test/metrics/histogram_tester.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/test/test_timeouts.h" #include "base/threading/platform_thread.h" @@ -65,12 +64,7 @@ class PageResourceMonitorUnitTest : public GraphTestHarness { public: - PageResourceMonitorUnitTest() { - scoped_feature_list_.InitAndEnableFeatureWithParameters( - features::kCPUInterventionEvaluationLogging, - {{"threshold_chrome_cpu_percent", "50"}}); - } - + PageResourceMonitorUnitTest() = default; ~PageResourceMonitorUnitTest() override = default; PageResourceMonitorUnitTest(const PageResourceMonitorUnitTest&) = delete; @@ -155,8 +149,6 @@ // `monitor_` to ensure that they outlive all delegates they create. SimulatedCPUMeasurementDelegateFactory cpu_delegate_factory_; FakeMemoryMeasurementDelegateFactory memory_delegate_factory_; - - base::test::ScopedFeatureList scoped_feature_list_; }; void PageResourceMonitorUnitTest::TriggerCollectPageResourceUsage() {
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 55c3907..b79e4da49 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -1769,12 +1769,14 @@ { key::kBrowserSwitcherChromeParameters, browser_switcher::prefs::kChromeParameters, base::Value::Type::LIST }, +#if BUILDFLAG(ENABLE_PRINTING) { key::kPrintPostScriptMode, prefs::kPrintPostScriptMode, base::Value::Type::INTEGER }, { key::kPrintRasterizationMode, prefs::kPrintRasterizationMode, base::Value::Type::INTEGER }, +#endif { key::kSafeBrowsingForTrustedSourcesEnabled, prefs::kSafeBrowsingForTrustedSourcesEnabled, base::Value::Type::BOOLEAN },
diff --git a/chrome/browser/privacy_sandbox/android/BUILD.gn b/chrome/browser/privacy_sandbox/android/BUILD.gn index 29a842e..8f8c80d 100644 --- a/chrome/browser/privacy_sandbox/android/BUILD.gn +++ b/chrome/browser/privacy_sandbox/android/BUILD.gn
@@ -196,7 +196,6 @@ "java/res/xml/privacy_sandbox_preferences_restricted.xml", "java/res/xml/topics_learn_more_preference.xml", "java/res/xml/topics_manage_preference.xml", - "java/res/xml/topics_preference.xml", "java/res/xml/topics_preference_v2.xml", ] deps = [
diff --git a/chrome/browser/privacy_sandbox/android/java/res/xml/topics_preference.xml b/chrome/browser/privacy_sandbox/android/java/res/xml/topics_preference.xml deleted file mode 100644 index 299ced61..0000000 --- a/chrome/browser/privacy_sandbox/android/java/res/xml/topics_preference.xml +++ /dev/null
@@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- -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. ---> - -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - - <org.chromium.components.browser_ui.settings.ChromeSwitchPreference - android:key="topics_toggle" - android:title="@string/settings_topics_page_toggle_label" - android:summary="@string/settings_topics_page_toggle_sub_label" /> - - <org.chromium.chrome.browser.privacy_sandbox.PreferenceCategoryWithClickableSummary - android:key="topics_heading" - android:title="@string/settings_topics_page_current_topics_heading" - android:summary="@string/settings_topics_page_current_topics_description" /> - - <PreferenceCategory - android:key="current_topics" - android:layout="@layout/preference_category_no_title_or_padding" /> - - <org.chromium.components.browser_ui.settings.TextMessagePreference - android:key="topics_disabled" - android:summary="@string/settings_topics_page_current_topics_description_disabled" /> - - <org.chromium.components.browser_ui.settings.TextMessagePreference - android:key="topics_empty" - android:summary="@string/settings_topics_page_current_topics_description_empty" /> - - <org.chromium.components.browser_ui.settings.ChromeBasePreference - android:key="blocked_topics" - android:title="@string/settings_topics_page_blocked_topics_heading" - android:fragment="org.chromium.chrome.browser.privacy_sandbox.TopicsBlockedFragment" - app:userAction="Settings.PrivacySandbox.Topics.BlockedTopicsOpened" /> - - <org.chromium.components.browser_ui.settings.ClickableSpansTextMessagePreference - android:key="topics_page_footer" - android:summary="@string/settings_topics_page_footer" - app:allowDividerBelow="false" /> - -</PreferenceScreen>
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FledgeFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FledgeFragment.java index f98af38..383faa6 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FledgeFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FledgeFragment.java
@@ -16,7 +16,6 @@ import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.ObservableSupplierImpl; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; @@ -104,25 +103,6 @@ "</link>", new NoUnderlineClickableSpan( getContext(), this::onLearnMoreClicked)))); - - if (!ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)) { - mFooterPreference.setSummary( - SpanApplier.applySpans( - getResources().getString(R.string.settings_fledge_page_footer), - new SpanApplier.SpanInfo( - "<link1>", - "</link1>", - new NoUnderlineClickableSpan( - getContext(), this::onFledgeSettingsLinkClicked)), - new SpanApplier.SpanInfo( - "<link2>", - "</link2>", - new NoUnderlineClickableSpan( - getContext(), this::onCookieSettingsLink)))); - mFledgeDescriptionPreference.setVisible(false); - return; - } mFooterPreference.setSummary( SpanApplier.applySpans( getResources().getString(R.string.settings_fledge_page_footer_new),
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/TopicsBlockedFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/TopicsBlockedFragment.java index 580205b..886845c 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/TopicsBlockedFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/TopicsBlockedFragment.java
@@ -15,7 +15,6 @@ import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.ObservableSupplierImpl; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.components.browser_ui.settings.SettingsUtils; @@ -33,12 +32,7 @@ @Override public void onCreatePreferences(@Nullable Bundle bundle, @Nullable String s) { super.onCreatePreferences(bundle, s); - if (ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)) { - mPageTitle.set(getString(R.string.settings_topics_page_blocked_topics_heading_new)); - } else { - mPageTitle.set(getString(R.string.settings_topics_page_blocked_topics_sub_page_title)); - } + mPageTitle.set(getString(R.string.settings_topics_page_blocked_topics_heading_new)); SettingsUtils.addPreferencesFromResource(this, R.xml.block_list_preference); mBlockedTopicsCategory = findPreference(BLOCKED_TOPICS_PREFERENCE); @@ -73,25 +67,14 @@ mBlockedTopicsCategory.removePreference(preference); updateBlockedTopicsDescription(); - if (ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)) { - var currentTopics = new HashSet<Topic>(getPrivacySandboxBridge().getCurrentTopTopics()); - if (!currentTopics.contains(topic)) { - showSnackbar( - R.string.settings_unblock_topic_toast_body, - null, - Snackbar.TYPE_ACTION, - Snackbar.UMA_PRIVACY_SANDBOX_ADD_INTEREST, - R.string.settings_unblock_topic_toast_button_text, - /* multiLine= */ true); - } - } else { + var currentTopics = new HashSet<Topic>(getPrivacySandboxBridge().getCurrentTopTopics()); + if (!currentTopics.contains(topic)) { showSnackbar( - R.string.settings_topics_page_add_topic_snackbar, + R.string.settings_unblock_topic_toast_body, null, Snackbar.TYPE_ACTION, Snackbar.UMA_PRIVACY_SANDBOX_ADD_INTEREST, - /* actionStringResId= */ 0, + R.string.settings_unblock_topic_toast_button_text, /* multiLine= */ true); } RecordUserAction.record("Settings.PrivacySandbox.Topics.TopicAdded"); @@ -116,18 +99,10 @@ } private void updateBlockedTopicsDescription() { - if (ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)) { - mBlockedTopicsCategory.setSummary(null); - if (mBlockedTopicsCategory.getPreferenceCount() == 0) { - mBlockedTopicsCategory.setSummary( - R.string.settings_topics_page_blocked_topics_description_empty_text_v2); - } - return; + mBlockedTopicsCategory.setSummary(null); + if (mBlockedTopicsCategory.getPreferenceCount() == 0) { + mBlockedTopicsCategory.setSummary( + R.string.settings_topics_page_blocked_topics_description_empty_text_v2); } - mBlockedTopicsCategory.setSummary( - mBlockedTopicsCategory.getPreferenceCount() == 0 - ? R.string.settings_topics_page_blocked_topics_description_empty - : R.string.settings_topics_page_blocked_topics_description); } }
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/TopicsFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/TopicsFragment.java index ae4ca9e..662d908 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/TopicsFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/TopicsFragment.java
@@ -15,7 +15,6 @@ import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.ObservableSupplierImpl; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; @@ -76,12 +75,7 @@ public void onCreatePreferences(@Nullable Bundle bundle, @Nullable String s) { super.onCreatePreferences(bundle, s); mPageTitle.set(getString(R.string.settings_topics_page_title)); - if (ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)) { - SettingsUtils.addPreferencesFromResource(this, R.xml.topics_preference_v2); - } else { - SettingsUtils.addPreferencesFromResource(this, R.xml.topics_preference); - } + SettingsUtils.addPreferencesFromResource(this, R.xml.topics_preference_v2); mTopicsTogglePreference = findPreference(TOPICS_TOGGLE_PREFERENCE); mTopicsExplanationPreference = findPreference(TOPICS_EXPLANATION_PREFERENCE); @@ -99,31 +93,6 @@ mTopicsTogglePreference.setOnPreferenceChangeListener(this); mTopicsTogglePreference.setManagedPreferenceDelegate(createManagedPreferenceDelegate()); - if (!ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)) { - mTopicsHeadingPreference.setSummary( - SpanApplier.applySpans(getResources().getString( - R.string.settings_topics_page_current_topics_description), - new SpanApplier.SpanInfo( - "<link>", - "</link>", - new NoUnderlineClickableSpan( - getContext(), this::onLearnMoreClicked)))); - mTopicsPageFooterPreference.setSummary( - SpanApplier.applySpans( - getResources().getString(R.string.settings_topics_page_footer), - new SpanApplier.SpanInfo( - "<link1>", - "</link1>", - new NoUnderlineClickableSpan( - getContext(), this::onFledgeSettingsLinkClicked)), - new SpanApplier.SpanInfo( - "<link2>", - "</link2>", - new NoUnderlineClickableSpan( - getContext(), this::onCookieSettingsLink)))); - return; - } mTopicsExplanationPreference.setSummary( SpanApplier.applySpans( getResources().getString(R.string.settings_topics_page_disclaimer_clank), @@ -157,11 +126,6 @@ return mPageTitle; } - private void onLearnMoreClicked(View view) { - RecordUserAction.record("Settings.PrivacySandbox.Topics.LearnMoreClicked"); - launchSettingsActivity(TopicsLearnMoreFragment.class); - } - private void onManagingAdPrivacyClicked(View view) { openUrlInCct(PrivacySandboxSettingsFragment.HELP_CENTER_URL); } @@ -249,11 +213,10 @@ boolean topicsEnabled = isTopicsPrefEnabled(getProfile()); boolean topicsEmpty = mCurrentTopicsCategory.getPreferenceCount() == 0; - // Visible when Topics are disabled. - mDisabledTopicsPreference.setVisible( - !topicsEnabled - && !ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)); + + // TODO(crbug.com/362973179): Set default values in xml. + // Always not visible. + mDisabledTopicsPreference.setVisible(false); // Visible when Topics are enabled, but the current Topics list is empty. mEmptyTopicsPreference.setVisible(topicsEnabled && topicsEmpty); @@ -262,12 +225,9 @@ mCurrentTopicsCategory.setVisible(topicsEnabled && !topicsEmpty); // The new UI hides all the sections when the Topics are disabled. - if (ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)) { - mActiveTopicsPreference.setVisible(topicsEnabled); - mBlockedTopicsPreference.setVisible(topicsEnabled); - mManageTopicsPreference.setVisible(topicsEnabled); - } + mActiveTopicsPreference.setVisible(topicsEnabled); + mBlockedTopicsPreference.setVisible(topicsEnabled); + mManageTopicsPreference.setVisible(topicsEnabled); } private ChromeManagedPreferenceDelegate createManagedPreferenceDelegate() {
diff --git a/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/FledgeFragmentTest.java b/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/FledgeFragmentTest.java index 9efa52d0..524e8ce 100644 --- a/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/FledgeFragmentTest.java +++ b/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/FledgeFragmentTest.java
@@ -45,11 +45,8 @@ import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.base.test.util.Features.DisableFeatures; -import org.chromium.base.test.util.Features.EnableFeatures; import org.chromium.base.test.util.JniMocker; import org.chromium.base.test.util.UserActionTester; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.profiles.ProfileManager; @@ -170,7 +167,6 @@ @Test @SmallTest @Feature({"RenderTest"}) - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testRenderFledgeOff() throws IOException { setFledgePrefEnabled(false); startFledgeSettings(); @@ -180,7 +176,6 @@ @Test @SmallTest @Feature({"RenderTest"}) - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testRenderFledgeEmpty() throws IOException { setFledgePrefEnabled(true); startFledgeSettings(); @@ -190,7 +185,6 @@ @Test @SmallTest @Feature({"RenderTest"}) - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testRenderFledgePopulated() throws IOException { setFledgePrefEnabled(true); mFakePrivacySandboxBridge.setCurrentFledgeSites(SITE_NAME_1, SITE_NAME_2); @@ -517,21 +511,6 @@ @Test @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testFooterTopicsLink() throws IOException { - setFledgePrefEnabled(true); - startFledgeSettings(); - // Open a Topics settings activity. - onView(withText(containsString("Ad topics"))).perform(clickOnClickableSpan(0)); - onViewWaiting(withText(R.string.settings_topics_page_toggle_sub_label)) - .check(matches(isDisplayed())); - // Close the additional activity by navigating back. - pressBack(); - } - - @Test - @SmallTest - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testFooterTopicsLinkV2() throws IOException { setFledgePrefEnabled(true); startFledgeSettings();
diff --git a/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragmentTest.java b/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragmentTest.java index f2f74887..b2ba3f3b 100644 --- a/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragmentTest.java +++ b/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragmentTest.java
@@ -32,10 +32,7 @@ import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.base.test.util.Features.DisableFeatures; -import org.chromium.base.test.util.Features.EnableFeatures; import org.chromium.base.test.util.UserActionTester; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.profiles.ProfileManager; @@ -178,19 +175,6 @@ @Test @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testNavigateToTopicsPage() { - startPrivacySandboxSettingsV4(); - onView(withText(R.string.ad_privacy_page_topics_link_row_label)).perform(click()); - - onViewWaiting(withText(R.string.settings_topics_page_toggle_sub_label)); - assertThat( - mUserActionTester.getActions(), hasItems("Settings.PrivacySandbox.Topics.Opened")); - } - - @Test - @SmallTest - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testNavigateToTopicsPageV2() { startPrivacySandboxSettingsV4(); onView(withText(R.string.ad_privacy_page_topics_link_row_label)).perform(click());
diff --git a/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/TopicsFragmentTest.java b/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/TopicsFragmentTest.java index 54f1995..dd6df734 100644 --- a/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/TopicsFragmentTest.java +++ b/chrome/browser/privacy_sandbox/android/javatests/src/org/chromium/chrome/browser/privacy_sandbox/TopicsFragmentTest.java
@@ -45,11 +45,8 @@ import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.base.test.util.Features.DisableFeatures; -import org.chromium.base.test.util.Features.EnableFeatures; import org.chromium.base.test.util.JniMocker; import org.chromium.base.test.util.UserActionTester; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.profiles.ProfileManager; @@ -128,11 +125,7 @@ } private View getTopicsRootView() { - if (ChromeFeatureList.isEnabled( - ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING)) { - return getRootViewSanitized(R.string.settings_topics_page_toggle_sub_label_v2); - } - return getRootViewSanitized(R.string.settings_topics_page_toggle_sub_label); + return getRootViewSanitized(R.string.settings_topics_page_toggle_sub_label_v2); } private View getBlockedTopicsRootView() { @@ -160,7 +153,6 @@ @Test @SmallTest @Feature({"RenderTest"}) - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testRenderTopicsOff() throws IOException { setTopicsPrefEnabled(false); startTopicsSettings(); @@ -170,7 +162,6 @@ @Test @SmallTest @Feature({"RenderTest"}) - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testRenderTopicsEmpty() throws IOException { setTopicsPrefEnabled(true); startTopicsSettings(); @@ -180,7 +171,6 @@ @Test @SmallTest @Feature({"RenderTest"}) - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testRenderTopicsPopulated() throws IOException { setTopicsPrefEnabled(true); mFakePrivacySandboxBridge.setCurrentTopTopics(TOPIC_NAME_1, TOPIC_NAME_2); @@ -191,7 +181,6 @@ @Test @SmallTest @Feature({"RenderTest"}) - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testRenderBlockedTopicsEmpty() throws IOException { setTopicsPrefEnabled(true); startTopicsSettings(); @@ -202,7 +191,6 @@ @Test @SmallTest @Feature({"RenderTest"}) - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testRenderBlockedTopicsPopulated() throws IOException { setTopicsPrefEnabled(true); mFakePrivacySandboxBridge.setBlockedTopics(TOPIC_NAME_1, TOPIC_NAME_2); @@ -213,24 +201,6 @@ @Test @SmallTest - @Feature({"RenderTest"}) - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testRenderLearnMore() throws IOException { - setTopicsPrefEnabled(true); - mFakePrivacySandboxBridge.setCurrentTopTopics(TOPIC_NAME_1, TOPIC_NAME_2); - startTopicsSettings(); - TopicsFragment fragment = mSettingsActivityTestRule.getFragment(); - ThreadUtils.runOnUiThreadBlocking( - () -> { - RecyclerView recyclerView = fragment.getView().findViewById(R.id.recycler_view); - recyclerView.scrollToPosition(recyclerView.getAdapter().getItemCount() - 1); - }); - onView(withText(containsString("Learn more"))).perform(clickOnClickableSpan(0)); - mRenderTestRule.render(getLearnMoreRootView(), "topics_learn_more"); - } - - @Test - @SmallTest public void testToggleUncheckedWhenTopicsOff() { setTopicsPrefEnabled(false); startTopicsSettings(); @@ -247,26 +217,6 @@ @Test @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testTurnTopicsOnWhenTopicListEmpty() { - setTopicsPrefEnabled(false); - startTopicsSettings(); - onView(getTopicsToggleMatcher()).perform(click()); - - assertTrue(mFakePrivacySandboxBridge.getLastTopicsToggleValue()); - assertTrue(isTopicsPrefEnabled()); - onViewWaiting(withText(R.string.settings_topics_page_current_topics_description_empty)) - .check(matches(isDisplayed())); - onView(withText(R.string.settings_topics_page_current_topics_description_disabled)) - .check(doesNotExist()); - - assertThat( - mUserActionTester.getActions(), hasItems("Settings.PrivacySandbox.Topics.Enabled")); - } - - @Test - @SmallTest - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testTurnTopicsOnWhenTopicListEmptyV2() { setTopicsPrefEnabled(false); startTopicsSettings(); @@ -312,27 +262,6 @@ @Test @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testTurnTopicsOff() { - setTopicsPrefEnabled(true); - startTopicsSettings(); - onView(getTopicsToggleMatcher()).perform(click()); - assertFalse(mFakePrivacySandboxBridge.getLastTopicsToggleValue()); - - assertFalse(isTopicsPrefEnabled()); - onViewWaiting(withText(R.string.settings_topics_page_current_topics_description_disabled)) - .check(matches(isDisplayed())); - onView(withText(R.string.settings_topics_page_current_topics_description_empty)) - .check(doesNotExist()); - - assertThat( - mUserActionTester.getActions(), - hasItems("Settings.PrivacySandbox.Topics.Disabled")); - } - - @Test - @SmallTest - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testTurnTopicsOffV2() { setTopicsPrefEnabled(true); startTopicsSettings(); @@ -361,43 +290,6 @@ @Test @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testBlockedTopicsAppearWhenTopicOff() { - setTopicsPrefEnabled(false); - mFakePrivacySandboxBridge.setBlockedTopics(TOPIC_NAME_1, TOPIC_NAME_2); - startTopicsSettings(); - onView(withText(R.string.settings_topics_page_blocked_topics_heading)).perform(click()); - - onViewWaiting(withText(R.string.settings_topics_page_blocked_topics_description)); - onView(withText(TOPIC_NAME_1)).check(matches(isDisplayed())); - onView(withText(TOPIC_NAME_2)).check(matches(isDisplayed())); - - assertThat( - mUserActionTester.getActions(), - hasItems("Settings.PrivacySandbox.Topics.BlockedTopicsOpened")); - } - - @Test - @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testBlockedTopicsAppearWhenTopicOn() { - setTopicsPrefEnabled(true); - mFakePrivacySandboxBridge.setBlockedTopics(TOPIC_NAME_1, TOPIC_NAME_2); - startTopicsSettings(); - onView(withText(R.string.settings_topics_page_blocked_topics_heading)).perform(click()); - - onViewWaiting(withText(R.string.settings_topics_page_blocked_topics_description)); - onView(withText(TOPIC_NAME_1)).check(matches(isDisplayed())); - onView(withText(TOPIC_NAME_2)).check(matches(isDisplayed())); - - assertThat( - mUserActionTester.getActions(), - hasItems("Settings.PrivacySandbox.Topics.BlockedTopicsOpened")); - } - - @Test - @SmallTest - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testBlockedTopicsAppearWhenTopicOnV2() { setTopicsPrefEnabled(true); mFakePrivacySandboxBridge.setBlockedTopics(TOPIC_NAME_1, TOPIC_NAME_2); @@ -415,47 +307,6 @@ @Test @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testBlockTopics() { - setTopicsPrefEnabled(true); - mFakePrivacySandboxBridge.setCurrentTopTopics(TOPIC_NAME_1, TOPIC_NAME_2); - startTopicsSettings(); - - // Remove the first Topic from the list. - clickImageButtonNextToText(TOPIC_NAME_1); - onView(withText(TOPIC_NAME_1)).check(doesNotExist()); - onView(withText(R.string.settings_topics_page_block_topic_snackbar)) - .check(matches(isDisplayed())); - - // Remove the second Topic from the list. - clickImageButtonNextToText(TOPIC_NAME_2); - onView(withText(TOPIC_NAME_2)).check(doesNotExist()); - onView(withText(R.string.settings_topics_page_block_topic_snackbar)) - .check(matches(isDisplayed())); - - // Check that the empty state UI is displayed when the Topic list is empty. - onView(withText(R.string.settings_topics_page_current_topics_description_empty)) - .check(matches(isDisplayed())); - - // Open the blocked topics sub-page - onView(withText(R.string.settings_topics_page_blocked_topics_heading)).perform(click()); - onViewWaiting(withText(R.string.settings_topics_page_blocked_topics_sub_page_title)); - - // Verify that the topics are blocked - onView(withText(TOPIC_NAME_1)).check(matches(isDisplayed())); - onView(withText(TOPIC_NAME_2)).check(matches(isDisplayed())); - - // Verify that actions are reported - assertThat( - mUserActionTester.getActions(), - hasItems( - "Settings.PrivacySandbox.Topics.BlockedTopicsOpened", - "Settings.PrivacySandbox.Topics.TopicRemoved")); - } - - @Test - @SmallTest - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testBlockTopicsV2() { setTopicsPrefEnabled(true); mFakePrivacySandboxBridge.setCurrentTopTopics(TOPIC_NAME_1, TOPIC_NAME_2); @@ -495,51 +346,6 @@ @Test @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testUnblockTopics() { - setTopicsPrefEnabled(true); - mFakePrivacySandboxBridge.setBlockedTopics(TOPIC_NAME_1, TOPIC_NAME_2); - startTopicsSettings(); - - // Open the blocked Topics sub-page - onView(withText(R.string.settings_topics_page_blocked_topics_heading)).perform(click()); - onViewWaiting(withText(R.string.settings_topics_page_blocked_topics_sub_page_title)); - - // Unblock the first Topic - clickImageButtonNextToText(TOPIC_NAME_1); - onView(withText(TOPIC_NAME_1)).check(doesNotExist()); - onView(withText(R.string.settings_topics_page_add_topic_snackbar)) - .check(matches(isDisplayed())); - - // Unblock the second Topic - clickImageButtonNextToText(TOPIC_NAME_2); - onView(withText(TOPIC_NAME_2)).check(doesNotExist()); - onView(withText(R.string.settings_topics_page_add_topic_snackbar)) - .check(matches(isDisplayed())); - - // Check that the empty state UI is displayed when the Topic list is empty. - onView(withText(R.string.settings_topics_page_blocked_topics_description_empty)) - .check(matches(isDisplayed())); - - // Go back to the main Topics fragment - pressBack(); - onViewWaiting(withText(R.string.settings_topics_page_toggle_sub_label)); - - // Verify that the Topics are unblocked - onView(withText(TOPIC_NAME_1)).check(matches(isDisplayed())); - onView(withText(TOPIC_NAME_2)).check(matches(isDisplayed())); - - // Verify that actions are sent - assertThat( - mUserActionTester.getActions(), - hasItems( - "Settings.PrivacySandbox.Topics.BlockedTopicsOpened", - "Settings.PrivacySandbox.Topics.TopicAdded")); - } - - @Test - @SmallTest - @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) public void testUnblockTopicsV2() { setTopicsPrefEnabled(true); mFakePrivacySandboxBridge.setBlockedTopics(TOPIC_NAME_1, TOPIC_NAME_2); @@ -599,29 +405,6 @@ @Test @SmallTest - @DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_PROACTIVE_TOPICS_BLOCKING) - public void testLearnMoreLink() { - startTopicsSettings(); - TopicsFragment fragment = mSettingsActivityTestRule.getFragment(); - ThreadUtils.runOnUiThreadBlocking( - () -> { - RecyclerView recyclerView = fragment.getView().findViewById(R.id.recycler_view); - recyclerView.scrollToPosition(recyclerView.getAdapter().getItemCount() - 1); - }); - // Open the Topics learn more activity - onView(withText(containsString("Learn more"))).perform(clickOnClickableSpan(0)); - onViewWaiting(withText(R.string.settings_topics_page_learn_more_heading)) - .check(matches(isDisplayed())); - // Close the additional activity by navigating back. - pressBack(); - // Verify that metrics are sent - assertThat( - mUserActionTester.getActions(), - hasItems("Settings.PrivacySandbox.Topics.LearnMoreClicked")); - } - - @Test - @SmallTest public void testFooterFledgeLink() throws IOException { setTopicsPrefEnabled(true); mFakePrivacySandboxBridge.setCurrentTopTopics(TOPIC_NAME_1, TOPIC_NAME_2);
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js index 5b94f2d..bc84e7d 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background_test.js
@@ -4156,9 +4156,16 @@ await mockFeedback.replay(); }); -AX_TEST_F('ChromeVoxBackgroundTest', 'OpenKeyboardShortcuts', async function() { - const mockFeedback = this.createMockFeedback(); - mockFeedback.call(doCmd('openKeyboardShortcuts')) - .expectSpeech('Search shortcuts') - .replay(); -}); +// TODO(crbug.com/361584737): Test is flaky on Linux Chromium OS ASan LSan. +GEN('#if defined(ADDRESS_SANITIZER) && defined(LEAK_SANITIZER)'); +GEN('#define MAYBE_OpenKeyboardShortcuts DISABLED_OpenKeyboardShortcuts'); +GEN('#else'); +GEN('#define MAYBE_OpenKeyboardShortcuts OpenKeyboardShortcuts'); +GEN('#endif'); +AX_TEST_F( + 'ChromeVoxBackgroundTest', 'MAYBE_OpenKeyboardShortcuts', async function() { + const mockFeedback = this.createMockFeedback(); + mockFeedback.call(doCmd('openKeyboardShortcuts')) + .expectSpeech('Search shortcuts') + .replay(); + });
diff --git a/chrome/browser/resources/commerce/product_specifications/app.html b/chrome/browser/resources/commerce/product_specifications/app.html index 4063306..1a33060e 100644 --- a/chrome/browser/resources/commerce/product_specifications/app.html +++ b/chrome/browser/resources/commerce/product_specifications/app.html
@@ -17,7 +17,7 @@ border-radius: 12px; display: flex; min-height: 50px; - min-width: 758px; + min-width: 726px; padding: 16px; width: fit-content; }
diff --git a/chrome/browser/resources/commerce/product_specifications/disclosure/app.css b/chrome/browser/resources/commerce/product_specifications/disclosure/app.css index 069929ac..b4afebc 100644 --- a/chrome/browser/resources/commerce/product_specifications/disclosure/app.css +++ b/chrome/browser/resources/commerce/product_specifications/disclosure/app.css
@@ -10,7 +10,7 @@ :host { display: flex; flex-direction: column; - max-width: 450px; + max-width: 470px; } #titleContainer {
diff --git a/chrome/browser/resources/commerce/product_specifications/disclosure/app.html.ts b/chrome/browser/resources/commerce/product_specifications/disclosure/app.html.ts index f5390eb..1fb38ef 100644 --- a/chrome/browser/resources/commerce/product_specifications/disclosure/app.html.ts +++ b/chrome/browser/resources/commerce/product_specifications/disclosure/app.html.ts
@@ -30,11 +30,11 @@ </div>`)} </div> </div> - <localized-link id="learnMoreLink" - .localizedString="${this.i18nAdvanced('disclosureLearnMore')}" - @link-clicked="${this.onLearnMoreClicked_}" - link-url="${this.i18n('compareLearnMoreUrl')}"> - </localized-link> + <a id="learnMoreLink" href="${this.i18n('compareLearnMoreUrl')}" + @click="${this.onLearnMoreClicked_}" target="_blank" + aria-label="${this.i18n('learnMoreA11yLabel')}"> + ${this.i18n('learnMore')} + </a> <div id="actionsContainer"> <cr-button class="tonal-button" @click=${this.declineDisclosure_}> ${this.i18n('declineDisclosure')}
diff --git a/chrome/browser/resources/commerce/product_specifications/disclosure/product_specifications_disclosure.html b/chrome/browser/resources/commerce/product_specifications/disclosure/product_specifications_disclosure.html index d522e34..f239bbd 100644 --- a/chrome/browser/resources/commerce/product_specifications/disclosure/product_specifications_disclosure.html +++ b/chrome/browser/resources/commerce/product_specifications/disclosure/product_specifications_disclosure.html
@@ -8,8 +8,9 @@ body { background-color: var(--color-product-specifications-disclosure-background); - margin: 0; - padding: 20px; + margin: 0 auto; + padding-top: 20px; + width: 470px; } </style> <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
diff --git a/chrome/browser/resources/data_sharing/BUILD.gn b/chrome/browser/resources/data_sharing/BUILD.gn index b627b9e..b3d2d28 100644 --- a/chrome/browser/resources/data_sharing/BUILD.gn +++ b/chrome/browser/resources/data_sharing/BUILD.gn
@@ -12,6 +12,7 @@ grd_prefix = "data_sharing" ts_deps = [ + "//ui/webui/resources/cr_components/color_change_listener:build_ts", "//ui/webui/resources/js:build_ts", "//ui/webui/resources/mojo:build_ts", ]
diff --git a/chrome/browser/resources/data_sharing/data_sharing.html b/chrome/browser/resources/data_sharing/data_sharing.html index ac45a47..b9be47d 100644 --- a/chrome/browser/resources/data_sharing/data_sharing.html +++ b/chrome/browser/resources/data_sharing/data_sharing.html
@@ -3,6 +3,7 @@ <head> <meta charset="utf-8"> <title>Data Sharing Placeholder</title> + <link rel="stylesheet" href="//theme/colors.css?sets=chrome"> </head> <body> <!--
diff --git a/chrome/browser/resources/data_sharing/data_sharing.ts b/chrome/browser/resources/data_sharing/data_sharing.ts index 3b9aaaf8..2353422a 100644 --- a/chrome/browser/resources/data_sharing/data_sharing.ts +++ b/chrome/browser/resources/data_sharing/data_sharing.ts
@@ -4,6 +4,7 @@ import './data_sharing_sdk.js'; +import {ColorChangeUpdater} from '//resources/cr_components/color_change_listener/colors_css_updater.js'; import {$} from 'chrome-untrusted://resources/js/util.js'; import {BrowserProxy} from './browser_proxy.js'; @@ -26,6 +27,7 @@ let initialized: boolean = false; function onDOMContentLoaded() { + ColorChangeUpdater.forDocument().start(); const browserProxy: BrowserProxy = BrowserProxy.getInstance(); browserProxy.callbackRouter.onAccessTokenFetched.addListener( (accessToken: string) => {
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn index 009d2ca..a9b3749 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn
@@ -71,6 +71,7 @@ "autofill_page/address_edit_dialog.ts", "autofill_page/address_remove_confirmation_dialog.ts", "autofill_page/autofill_page.ts", + "autofill_page/autofill_prediction_improvements_section.ts", "autofill_page/autofill_section.ts", "autofill_page/credit_card_edit_dialog.ts", "autofill_page/credit_card_list_entry.ts",
diff --git a/chrome/browser/resources/settings/autofill_page/autofill_page.html b/chrome/browser/resources/settings/autofill_page/autofill_page.html index f931e6e..b9e7528a 100644 --- a/chrome/browser/resources/settings/autofill_page/autofill_page.html +++ b/chrome/browser/resources/settings/autofill_page/autofill_page.html
@@ -24,6 +24,14 @@ sub-label="[[addressesSublabel_()]]" on-click="onAddressesClick_" role-description="$i18n{subpageArrowRoleDescription}"></cr-link-row> + <template is="dom-if" if="[[autofillPredictionImprovementsEnabled_]]"> + <!-- TODO(crbug.com/361437117): Set proper icon. --> + <!-- TODO(crbug.com/361437117): Add the beta label. --> + <cr-link-row id="autofillPredictionImprovementsManagerButton" + start-icon="settings:location-on" + label="$i18n{autofillPredictionImprovementsPageTitle}" + on-click="onAutofillPredictionImprovementsClick_"></cr-link-row> + </template> </div> <if expr="is_win or is_macosx"> <template is="dom-if" route-path="/passkeys"> @@ -55,4 +63,16 @@ </settings-autofill-section> </settings-subpage> </template> + <template is="dom-if" if="[[autofillPredictionImprovementsEnabled_]]"> + <template is="dom-if" route-path="/autofillPredictionImprovements"> + <settings-subpage + associated-control= + "[[$$('#autofillPredictionImprovementsManagerButton')]]" + page-title="$i18n{autofillPredictionImprovementsPageTitle}"> + <settings-autofill-prediction-improvements-section + id="autofillPredictionImprovementsSection"> + </settings-autofill-prediction-improvements-section> + </settings-subpage> + </template> + </template> </settings-animated-pages>
diff --git a/chrome/browser/resources/settings/autofill_page/autofill_page.ts b/chrome/browser/resources/settings/autofill_page/autofill_page.ts index 7704428..6076791 100644 --- a/chrome/browser/resources/settings/autofill_page/autofill_page.ts +++ b/chrome/browser/resources/settings/autofill_page/autofill_page.ts
@@ -85,6 +85,14 @@ // </if> }, }, + + autofillPredictionImprovementsEnabled_: { + type: Boolean, + value() { + return loadTimeData.getBoolean( + 'autofillPredictionImprovementsEnabled'); + }, + }, }; } @@ -120,6 +128,13 @@ } /** + * Shows the prediction improvements settings sub page. + */ + private onAutofillPredictionImprovementsClick_() { + Router.getInstance().navigateTo(routes.AUTOFILL_PREDICTION_IMPROVEMENTS); + } + + /** * @returns the sublabel of the address entry. */ private addressesSublabel_() {
diff --git a/chrome/browser/resources/settings/autofill_page/autofill_prediction_improvements_section.html b/chrome/browser/resources/settings/autofill_page/autofill_prediction_improvements_section.html new file mode 100644 index 0000000..873d525 --- /dev/null +++ b/chrome/browser/resources/settings/autofill_page/autofill_prediction_improvements_section.html
@@ -0,0 +1,3 @@ +<div> + <!-- TODO(crbug.com/361437117): Add content. --> +</div>
diff --git a/chrome/browser/resources/settings/autofill_page/autofill_prediction_improvements_section.ts b/chrome/browser/resources/settings/autofill_page/autofill_prediction_improvements_section.ts new file mode 100644 index 0000000..82e365ca --- /dev/null +++ b/chrome/browser/resources/settings/autofill_page/autofill_prediction_improvements_section.ts
@@ -0,0 +1,35 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @fileoverview 'settings-autofill-prediction-improvements-section' is + * the section containing configuration options for prediction improvements. + */ + +import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {getTemplate} from './autofill_prediction_improvements_section.html.js'; + + +export class SettingsAutofillPredictionImprovementsSectionElement extends + PolymerElement { + static get is() { + return 'settings-autofill-prediction-improvements-section'; + } + + static get template() { + return getTemplate(); + } +} + +declare global { + interface HTMLElementTagNameMap { + 'settings-autofill-prediction-improvements-section': + SettingsAutofillPredictionImprovementsSectionElement; + } +} + +customElements.define( + SettingsAutofillPredictionImprovementsSectionElement.is, + SettingsAutofillPredictionImprovementsSectionElement);
diff --git a/chrome/browser/resources/settings/lazy_load.ts b/chrome/browser/resources/settings/lazy_load.ts index d696f41..02e2f68 100644 --- a/chrome/browser/resources/settings/lazy_load.ts +++ b/chrome/browser/resources/settings/lazy_load.ts
@@ -5,6 +5,7 @@ // Subpages import './appearance_page/appearance_fonts_page.js'; import './autofill_page/autofill_section.js'; +import './autofill_page/autofill_prediction_improvements_section.js'; // <if expr="is_win or is_macosx"> import './autofill_page/passkeys_subpage.js'; // </if> @@ -115,6 +116,7 @@ export {CountryDetailManager, CountryDetailManagerImpl, SettingsAddressEditDialogElement} from './autofill_page/address_edit_dialog.js'; export {SettingsAddressRemoveConfirmationDialogElement} from './autofill_page/address_remove_confirmation_dialog.js'; export {AutofillManagerImpl, AutofillManagerProxy, PersonalDataChangedListener} from './autofill_page/autofill_manager_proxy.js'; +export {SettingsAutofillPredictionImprovementsSectionElement} from './autofill_page/autofill_prediction_improvements_section.js'; export {SettingsAutofillSectionElement} from './autofill_page/autofill_section.js'; export {SettingsCreditCardEditDialogElement} from './autofill_page/credit_card_edit_dialog.js'; export {SettingsCreditCardListEntryElement} from './autofill_page/credit_card_list_entry.js';
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts index 400e11eb..71de39e 100644 --- a/chrome/browser/resources/settings/route.ts +++ b/chrome/browser/resources/settings/route.ts
@@ -222,6 +222,11 @@ r.PAYMENTS = r.AUTOFILL.createChild('/payments'); r.ADDRESSES = r.AUTOFILL.createChild('/addresses'); + if (loadTimeData.getBoolean('autofillPredictionImprovementsEnabled')) { + r.AUTOFILL_PREDICTION_IMPROVEMENTS = + r.AUTOFILL.createChild('/autofillPredictionImprovements'); + } + // <if expr="is_win or is_macosx"> r.PASSKEYS = r.AUTOFILL.createChild('/passkeys'); // </if>
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts index 96170b0..41e0c3bd 100644 --- a/chrome/browser/resources/settings/router.ts +++ b/chrome/browser/resources/settings/router.ts
@@ -19,6 +19,7 @@ AI: Route; APPEARANCE: Route; AUTOFILL: Route; + AUTOFILL_PREDICTION_IMPROVEMENTS: Route; BASIC: Route; CAPTIONS: Route; CERTIFICATES: Route;
diff --git a/chrome/browser/storage_access_api/storage_access_api_service_impl_unittest.cc b/chrome/browser/storage_access_api/storage_access_api_service_impl_unittest.cc index f66d1e34..5111e3ca 100644 --- a/chrome/browser/storage_access_api/storage_access_api_service_impl_unittest.cc +++ b/chrome/browser/storage_access_api/storage_access_api_service_impl_unittest.cc
@@ -49,10 +49,8 @@ protected: Profile* profile() { return profile_; } - base::SimpleTestClock* clock() { return &clock_; } private: - base::SimpleTestClock clock_; content::BrowserTaskEnvironment env_{ base::test::TaskEnvironment::TimeSource::MOCK_TIME}; std::unique_ptr<TestingProfileManager> profile_manager_; @@ -65,14 +63,13 @@ url::Origin origin_b( url::Origin::Create(GURL(base::StrCat({"https://", kHostB})))); - clock()->SetNow(base::Time::Now()); - HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile()); - settings_map->SetClockForTesting(clock()); + settings_map->SetClockForTesting(env().GetMockClock()); - content_settings::ContentSettingConstraints constraints(clock()->Now()); + content_settings::ContentSettingConstraints constraints( + env().GetMockClock()->Now()); constraints.set_lifetime(base::Days(30)); settings_map->SetContentSettingDefaultScope( @@ -83,7 +80,7 @@ StorageAccessAPIServiceFactory::GetForBrowserContext(profile()); ASSERT_NE(nullptr, service); - clock()->Advance(base::Days(20)); + env().FastForwardBy(base::Days(20)); // 20 days into a 30 day lifetime, so the setting hasn't expired yet. EXPECT_EQ(CONTENT_SETTING_ALLOW, settings_map->GetContentSetting( @@ -92,13 +89,13 @@ EXPECT_TRUE(service->RenewPermissionGrant(origin_a, origin_b)); - clock()->Advance(base::Days(20)); + env().FastForwardBy(base::Days(20)); // The 30d lifetime was renewed 20 days ago, so it hasn't expired yet. EXPECT_EQ(CONTENT_SETTING_ALLOW, settings_map->GetContentSetting( origin_a.GetURL(), origin_b.GetURL(), ContentSettingsType::STORAGE_ACCESS)); - clock()->Advance(base::Days(11)); + env().FastForwardBy(base::Days(11)); // The 30d lifetime was renewed 31 days ago, so it has expired now. EXPECT_EQ(CONTENT_SETTING_ASK, settings_map->GetContentSetting( origin_a.GetURL(), origin_b.GetURL(), @@ -117,14 +114,13 @@ url::Origin origin_b( url::Origin::Create(GURL(base::StrCat({"https://", kHostB})))); - clock()->SetNow(base::Time::Now()); - HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile()); - settings_map->SetClockForTesting(clock()); + settings_map->SetClockForTesting(env().GetMockClock()); - content_settings::ContentSettingConstraints constraints(clock()->Now()); + content_settings::ContentSettingConstraints constraints( + env().GetMockClock()->Now()); constraints.set_lifetime(base::Days(30)); settings_map->SetContentSettingDefaultScope( @@ -135,7 +131,7 @@ StorageAccessAPIServiceFactory::GetForBrowserContext(profile()); ASSERT_NE(nullptr, service); - clock()->Advance(base::Days(20)); + env().FastForwardBy(base::Days(20)); // 20 days into a 30 day lifetime, so the setting hasn't expired yet. EXPECT_EQ(CONTENT_SETTING_BLOCK, settings_map->GetContentSetting( @@ -144,7 +140,7 @@ EXPECT_FALSE(service->RenewPermissionGrant(origin_a, origin_b)); - clock()->Advance(base::Days(20)); + env().FastForwardBy(base::Days(20)); // Denials are not renewed by user interaction, so the setting has expired by // now. EXPECT_EQ(CONTENT_SETTING_ASK, settings_map->GetContentSetting(
diff --git a/chrome/browser/supervised_user/advanced_content_restrictions_interactive_uitest.cc b/chrome/browser/supervised_user/advanced_content_restrictions_interactive_uitest.cc index 6ff0a8da..fcd493b 100644 --- a/chrome/browser/supervised_user/advanced_content_restrictions_interactive_uitest.cc +++ b/chrome/browser/supervised_user/advanced_content_restrictions_interactive_uitest.cc
@@ -66,7 +66,7 @@ // Set the cookies switch on FL confirm the setting is received by Chrome. RunTestSequence(WaitForStateSeeding( - kDefineStateObserverId, head_of_household(), child(), + kDefineStateObserverId, child(), BrowserState::AdvancedSettingsToggles({FamilyLinkToggleConfiguration( {.type = GetSwitchType(GetParam()), .state = GetSwitchTargetState(GetParam())})})));
diff --git a/chrome/browser/supervised_user/extensions_interactive_uitest.cc b/chrome/browser/supervised_user/extensions_interactive_uitest.cc index 79ea84f..fe03d8d 100644 --- a/chrome/browser/supervised_user/extensions_interactive_uitest.cc +++ b/chrome/browser/supervised_user/extensions_interactive_uitest.cc
@@ -320,7 +320,7 @@ // extension installation. RunTestSequence( Log("Set config that requires parental approvals."), - WaitForStateSeeding(kResetStateObserverId, head_of_household(), child(), + WaitForStateSeeding(kResetStateObserverId, child(), BrowserState::SetAdvancedSettingsDefault())); InstallExtension(child().browser()->profile()); @@ -330,7 +330,7 @@ // Parent sets both the FL Permissions and Extensions switches. // Only one of them impacts the handling of supervised user extensions. WaitForStateSeeding( - kDefineStateObserverId, head_of_household(), child(), + kDefineStateObserverId, child(), BrowserState::AdvancedSettingsToggles( {FamilyLinkToggleConfiguration( {.type = FamilyLinkToggleType::kExtensionsToggle,
diff --git a/chrome/browser/supervised_user/supervised_user_browser_utils.cc b/chrome/browser/supervised_user/supervised_user_browser_utils.cc index 5d325d64..2e316d4 100644 --- a/chrome/browser/supervised_user/supervised_user_browser_utils.cc +++ b/chrome/browser/supervised_user/supervised_user_browser_utils.cc
@@ -178,6 +178,7 @@ std::make_unique<SupervisedUserVerificationPage>( web_contents, profile->GetProfileUserName(), request_url, verification_purpose, child_account_service, + navigation_handle.GetNextPageUkmSourceId(), std::make_unique<SupervisedUserVerificationControllerClient>( web_contents, profile->GetPrefs(), g_browser_process->GetApplicationLocale(),
diff --git a/chrome/browser/supervised_user/supervised_user_verification_page.cc b/chrome/browser/supervised_user/supervised_user_verification_page.cc index c3a3d08..c901810 100644 --- a/chrome/browser/supervised_user/supervised_user_verification_page.cc +++ b/chrome/browser/supervised_user/supervised_user_verification_page.cc
@@ -13,6 +13,9 @@ #include "components/strings/grit/components_strings.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" +#include "services/metrics/public/cpp/metrics_utils.h" +#include "services/metrics/public/cpp/ukm_builders.h" +#include "services/metrics/public/cpp/ukm_recorder.h" #include "ui/base/l10n/l10n_util.h" using security_interstitials::MetricsHelper; @@ -28,6 +31,7 @@ const GURL& request_url, VerificationPurpose verification_purpose, supervised_user::ChildAccountService* child_account_service, + ukm::SourceId source_id, std::unique_ptr< security_interstitials::SecurityInterstitialControllerClient> controller_client) @@ -38,15 +42,16 @@ email_to_reauth_(email_to_reauth), request_url_(request_url), verification_purpose_(verification_purpose), - child_account_service_(child_account_service) { + child_account_service_(child_account_service), + source_id_(source_id) { if (child_account_service_) { // Reloads the interstitial to continue navigation once the supervised user // is authenticated. google_auth_state_subscription_ = child_account_service_->ObserveGoogleAuthState(base::BindRepeating( - &security_interstitials::SecurityInterstitialControllerClient:: - Reload, - base::Unretained(this->controller()))); + &SupervisedUserVerificationPage::OnReauthenticationCompleted, + base::Unretained(this))); + RecordYouTubeReauthStatusUkm(Status::SHOWN); } } @@ -57,6 +62,11 @@ return SupervisedUserVerificationPage::kTypeForTesting; } +void SupervisedUserVerificationPage::OnReauthenticationCompleted() { + RecordYouTubeReauthStatusUkm(Status::REAUTH_COMPLETED); + controller()->Reload(); +} + void SupervisedUserVerificationPage::PopulateInterstitialStrings( base::Value::Dict& load_time_data) { PopulateStringsForSharedHTML(load_time_data); @@ -118,6 +128,30 @@ load_time_data.Set("type", "SUPERVISED_USER_VERIFY"); } +void SupervisedUserVerificationPage::RecordYouTubeReauthStatusUkm( + Status status) { + if (verification_purpose_ != VerificationPurpose::REAUTH_REQUIRED_SITE) { + return; + } + + auto builder = + ukm::builders::FamilyLinkUser_ReauthenticationInterstitial(source_id_); + switch (status) { + case Status::SHOWN: + builder.SetInterstitialShown(true); + break; + case Status::REAUTH_STARTED: + builder.SetReauthenticationStarted(true); + break; + case Status::REAUTH_COMPLETED: + builder.SetReauthenticationCompleted(true); + break; + default: + NOTREACHED_NORETURN(); + } + builder.Record(ukm::UkmRecorder::Get()); +} + void SupervisedUserVerificationPage::CommandReceived( const std::string& command) { if (command == "\"pageLoadComplete\"") { @@ -131,6 +165,7 @@ switch (cmd) { case security_interstitials::CMD_OPEN_LOGIN: + RecordYouTubeReauthStatusUkm(Status::REAUTH_STARTED); controller()->OpenUrlInNewForegroundTab( signin::GetChromeReauthURL({.email = email_to_reauth_})); break;
diff --git a/chrome/browser/supervised_user/supervised_user_verification_page.h b/chrome/browser/supervised_user/supervised_user_verification_page.h index b83bc97..c093e261 100644 --- a/chrome/browser/supervised_user/supervised_user_verification_page.h +++ b/chrome/browser/supervised_user/supervised_user_verification_page.h
@@ -13,6 +13,7 @@ #include "components/security_interstitials/content/security_interstitial_page.h" #include "components/supervised_user/core/browser/child_account_service.h" #include "content/public/browser/web_contents.h" +#include "services/metrics/public/cpp/ukm_source_id.h" class GURL; @@ -30,6 +31,9 @@ // parent's approvals require re-authentication. }; + // The status of the interstitial used for metrics recording purposes. + enum class Status { SHOWN, REAUTH_STARTED, REAUTH_COMPLETED }; + // Interstitial type, used in tests. static const security_interstitials::SecurityInterstitialPage::TypeID kTypeForTesting; @@ -44,6 +48,7 @@ const GURL& request_url, VerificationPurpose verification_purpose, supervised_user::ChildAccountService* child_account_service, + ukm::SourceId source_id, std::unique_ptr< security_interstitials::SecurityInterstitialControllerClient> controller_client); @@ -59,6 +64,9 @@ security_interstitials::SecurityInterstitialPage::TypeID GetTypeForTesting() override; + // Reloads the interstitial page and records metrics if necessary. + void OnReauthenticationCompleted(); + protected: void CommandReceived(const std::string& command) override; void PopulateInterstitialStrings(base::Value::Dict& load_time_data) override; @@ -67,11 +75,13 @@ private: void PopulateStringsForSharedHTML(base::Value::Dict& load_time_data); + void RecordYouTubeReauthStatusUkm(Status status); base::CallbackListSubscription google_auth_state_subscription_; const std::string email_to_reauth_; const GURL request_url_; const VerificationPurpose verification_purpose_; raw_ptr<supervised_user::ChildAccountService> child_account_service_; + ukm::SourceId source_id_; }; #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_VERIFICATION_PAGE_H_
diff --git a/chrome/browser/supervised_user/url_filter_interactive_uitest.cc b/chrome/browser/supervised_user/url_filter_interactive_uitest.cc index 56fceef12..bd9dd7b 100644 --- a/chrome/browser/supervised_user/url_filter_interactive_uitest.cc +++ b/chrome/browser/supervised_user/url_filter_interactive_uitest.cc
@@ -149,10 +149,10 @@ GURL all_audiences_site_url(GetRoutedUrl("https://example.com")); RunTestSequence( - WaitForStateSeeding(kResetStateObserverId, head_of_household(), child(), + WaitForStateSeeding(kResetStateObserverId, child(), BrowserState::Reset()), - WaitForStateSeeding(kSetSafeSitesStateObserverId, head_of_household(), - child(), BrowserState::EnableSafeSites()), + WaitForStateSeeding(kSetSafeSitesStateObserverId, child(), + BrowserState::EnableSafeSites()), // Supervised user navigates to any page. InstrumentTab(kChildElementId, tab_index, child().browser()), @@ -161,7 +161,7 @@ PageWithMatchingTitle("Example Domain")), // Supervisor blocks that page and supervised user sees interstitial // blocked page screen. - WaitForStateSeeding(kDefineStateObserverId, head_of_household(), child(), + WaitForStateSeeding(kDefineStateObserverId, child(), BrowserState::BlockSite(all_audiences_site_url)), WaitForStateChange(kChildElementId, RemoteApprovalButtonAppeared())); } @@ -174,8 +174,8 @@ TurnOnSync(); // Clear all existing filters. - RunTestSequence(WaitForStateSeeding(kObserverId, head_of_household(), child(), - BrowserState::Reset())); + RunTestSequence( + WaitForStateSeeding(kObserverId, child(), BrowserState::Reset())); } IN_PROC_BROWSER_TEST_P(UrlFilterUiTest, ParentAllowsPageBlockedBySafeSites) { @@ -192,7 +192,7 @@ GURL mature_site_url(GetRoutedUrl("https://bestgore.com")); RunTestSequence( - WaitForStateSeeding(kResetStateObserverId, head_of_household(), child(), + WaitForStateSeeding(kResetStateObserverId, child(), BrowserState::Reset()), // Supervised user navigates to inappropriate page and is blocked. @@ -201,7 +201,7 @@ WaitForStateChange(kChildElementId, RemoteApprovalButtonAppeared()), // Supervisor allows that page and supervised user consumes content. - WaitForStateSeeding(kDefineStateObserverId, head_of_household(), child(), + WaitForStateSeeding(kDefineStateObserverId, child(), BrowserState::AllowSite(mature_site_url)), WaitForStateChange(kChildElementId, PageWithMatchingTitle("Best Gore"))); } @@ -220,7 +220,7 @@ int parent_tab_index = 0; RunTestSequence( - WaitForStateSeeding(kResetStateObserverId, head_of_household(), child(), + WaitForStateSeeding(kResetStateObserverId, child(), BrowserState::Reset()), // Supervised user navigates to inappropriate page and is blocked, and // makes approval request.
diff --git a/chrome/browser/ui/android/edge_to_edge/internal/java/src/org/chromium/chrome/browser/ui/edge_to_edge/EdgeToEdgeControllerImpl.java b/chrome/browser/ui/android/edge_to_edge/internal/java/src/org/chromium/chrome/browser/ui/edge_to_edge/EdgeToEdgeControllerImpl.java index 2a3720a..ce0b072 100644 --- a/chrome/browser/ui/android/edge_to_edge/internal/java/src/org/chromium/chrome/browser/ui/edge_to_edge/EdgeToEdgeControllerImpl.java +++ b/chrome/browser/ui/android/edge_to_edge/internal/java/src/org/chromium/chrome/browser/ui/edge_to_edge/EdgeToEdgeControllerImpl.java
@@ -453,7 +453,13 @@ newPaddings.bottom); } - int bottomInsetOnSafeArea = mIsDrawingToEdge ? mSystemInsets.bottom : 0; + // In fullscreen mode, we should never needed to add additional area to the bottom insets + // since nav bar will be hidden. This is another workaround that on some Android versions, + // during split screen mode, bottom insets are counted as part of the Chrome window even + // when Chrome does not draw into the system bar region. See https://crbug.com/359659885. + boolean hasBottomSafeArea = + (mIsDrawingToEdge && !mFullscreenManager.getPersistentFullscreenMode()); + int bottomInsetOnSafeArea = hasBottomSafeArea ? mSystemInsets.bottom : 0; mInsetObserver.updateBottomInsetForEdgeToEdge(bottomInsetOnSafeArea); }
diff --git a/chrome/browser/ui/android/edge_to_edge/internal/junit/src/org/chromium/chrome/browser/ui/edge_to_edge/EdgeToEdgeControllerTest.java b/chrome/browser/ui/android/edge_to_edge/internal/junit/src/org/chromium/chrome/browser/ui/edge_to_edge/EdgeToEdgeControllerTest.java index 6d7f3f4..8357bc9 100644 --- a/chrome/browser/ui/android/edge_to_edge/internal/junit/src/org/chromium/chrome/browser/ui/edge_to_edge/EdgeToEdgeControllerTest.java +++ b/chrome/browser/ui/android/edge_to_edge/internal/junit/src/org/chromium/chrome/browser/ui/edge_to_edge/EdgeToEdgeControllerTest.java
@@ -482,6 +482,7 @@ mEdgeToEdgeControllerImpl.onExitFullscreen(mTab); assertToNormalExpectations(); + assertBottomInsetForSafeArea(0); } @Test
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index 81c64ea..910b41a7 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -1191,12 +1191,6 @@ <!-- Privacy Sandbox v4 - Topics Page --> <!-- Where possible, these strings have been unified on Desktop & Android in privacy_sandox_strings.grdp. The strings here either only appear on one platform, or have platform specific requirements, e.g. the format of placeholders, and so cannot be unified. For the latter case, they have corresponding _CANONICAL representations used when consent is recorded on either platform, and so they must stay in sync --> - <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_SUB_PAGE_TITLE" desc="A page title. Topics that the user blocked appear on this page."> - Topics you blocked - </message> - <message name="IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION" desc="A description that appear beneath the 'Your topics' label. * 'You can block': There is a 'Block' button (or an X on mobile) that appears next to each topic in the list. * 'auto-deletes': this could also read 'Chrome deletes...' We included the 'auto' to reinforce that this is part of a system and the deletion is done regularly."> - You can block topics you don't want shared with sites. Chrome also auto-deletes your topics older than 4 weeks. <ph name="BEGIN_LINK"><link></ph>Learn more<ph name="END_LINK"></link></ph> - </message> <message name="IDS_SETTINGS_TOPICS_PAGE_LEARN_MORE_BULLET_3" desc="Paragraph 3 of 3 on the Learn more about ad topics page. * 'auto-deletes': this could also read 'Chrome deletes...' We included the 'auto' to reinforce that this is part of a system and the deletion is done regularly."> Chrome auto-deletes topics that are older than 4 weeks. As you keep browsing, a topic might reappear on the list. Or you can block topics you don’t want Chrome to share with sites. Learn more about <ph name="BEGIN_LINK"><link></ph>managing your ad privacy in Chrome.<ph name="END_LINK"></link></ph> </message> @@ -1206,9 +1200,6 @@ <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCK_TOPIC_SNACKBAR" desc="A confirmation that appears after a user blocks a topic. This page is only applicable if the user has the Ad topics setting turned on. If they do, Chrome estimates the user's topics of interests and then sites can ask for topics to help personalize ads. If a user dosn't like a specific topic, they can block it."> Blocked topic </message> - <message name="IDS_SETTINGS_TOPICS_PAGE_ADD_TOPIC_SNACKBAR" desc="A confirmation that appears after a user un-blocks a topic. This page is only applicable if the user has the Ad topics setting turned on. If they do, Chrome estimates the user's topics of interests and then sites can ask for topics to help personalize ads. If a user dosn't like a specific topic, they can block it. **** The user can also unblock a topic, the language is important, because 'unblocking' doesn't bring the topic back to the list of active topics. It simply adds a topic back to the list of potential topics that Chrome might estimate at a later time as the user continues browsing."> - Added topic back to potential topics - </message> <!-- Privacy Sandbox v4 - Fledge Page --> <message name="IDS_SETTINGS_FLEDGE_PAGE_TITLE" desc="A page title and the name of a new setting. **** CONTEXT PRIVACY SANDBOX **** Chrome’s Privacy Sandbox initiative 1) deprecates third-party cookies in Chrome, 2) supports free and open content on the web (by finding better ways to support ads online), 3) while providing stronger privacy protections for users. You can see a high-level description of this public project at www.privacysanbox.com. **** NEW SETTINGS SECTION IN CHROME **** 3 new ad-specific settings appear on an “Ad privacy” page in Chrome settings. For an equivalent structure, see “Security” on chrome://settings/privacy that opens chrome://settings/security. Likewise, “Ad privacy” on chrome://settings/privacy will open chrome://settings/AdPrivacy.">
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_ADD_TOPIC_SNACKBAR.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_ADD_TOPIC_SNACKBAR.png.sha1 deleted file mode 100644 index 1c3e517..0000000 --- a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_ADD_TOPIC_SNACKBAR.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -4f14d3f638794ddc6a499dc8394daba84d2f16d7 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_SUB_PAGE_TITLE.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_SUB_PAGE_TITLE.png.sha1 deleted file mode 100644 index e41689e..0000000 --- a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_SUB_PAGE_TITLE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -774ba4ad91243a125502ec243279afaccf956f6f \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION.png.sha1 deleted file mode 100644 index 63a45e3..0000000 --- a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -85c9f6f499a0f5cb0d71afb84d9876561c412be6 \ No newline at end of file
diff --git a/chrome/browser/ui/autofill/autofill_keyboard_accessory_controller_impl.cc b/chrome/browser/ui/autofill/autofill_keyboard_accessory_controller_impl.cc index 15ccf5c..f74e138d 100644 --- a/chrome/browser/ui/autofill/autofill_keyboard_accessory_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_keyboard_accessory_controller_impl.cc
@@ -473,7 +473,8 @@ barrier_for_accepting_ = NextIdleBarrier::CreateNextIdleBarrierWithDelay( kIgnoreEarlyClicksOnSuggestionsDuration); - delegate_->OnSuggestionsShown(); + // TODO(crbug.com/364165357): Use actually shown suggestions. + delegate_->OnSuggestionsShown(suggestions_); } void AutofillKeyboardAccessoryControllerImpl::SetKeepPopupOpenForTesting(
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc index a7de954..53beb17 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -286,7 +286,7 @@ SuggestionHidingReason::kFadeTimerExpired)); } - delegate_->OnSuggestionsShown(); + delegate_->OnSuggestionsShown(non_filtered_suggestions_); } if (ShouldLogPopupInteractionShown(trigger_source_)) {
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl_unittest.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl_unittest.cc index 90478b0..5a29c1e6 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl_unittest.cc +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl_unittest.cc
@@ -286,7 +286,7 @@ TEST_F(AutofillPopupControllerImplTest, DelegateMethodsAreCalledOnlyByRootPopup) { - EXPECT_CALL(manager().external_delegate(), OnSuggestionsShown()).Times(0); + EXPECT_CALL(manager().external_delegate(), OnSuggestionsShown).Times(0); ON_CALL(*client().sub_popup_view(), Show).WillByDefault(Return(true)); base::WeakPtr<AutofillSuggestionController> sub_controller = client().popup_controller(manager()).OpenSubPopup( @@ -301,7 +301,7 @@ } TEST_F(AutofillPopupControllerImplTest, EventsAreDelegatedToChildrenAndView) { - EXPECT_CALL(manager().external_delegate(), OnSuggestionsShown()).Times(0); + EXPECT_CALL(manager().external_delegate(), OnSuggestionsShown).Times(0); base::WeakPtr<AutofillSuggestionController> sub_controller = client().popup_controller(manager()).OpenSubPopup( {0, 0, 10, 10}, {}, AutoselectFirstSuggestion(false));
diff --git a/chrome/browser/ui/autofill/autofill_suggestion_controller_test_base.h b/chrome/browser/ui/autofill/autofill_suggestion_controller_test_base.h index e432df2..efc4cea 100644 --- a/chrome/browser/ui/autofill/autofill_suggestion_controller_test_base.h +++ b/chrome/browser/ui/autofill/autofill_suggestion_controller_test_base.h
@@ -214,7 +214,10 @@ ~AutofillExternalDelegateForPopupTest() override; MOCK_METHOD(void, ClearPreviewedForm, (), (override)); - MOCK_METHOD(void, OnSuggestionsShown, (), (override)); + MOCK_METHOD(void, + OnSuggestionsShown, + (base::span<const Suggestion>), + (override)); MOCK_METHOD(void, OnSuggestionsHidden, (), (override)); MOCK_METHOD(void, DidSelectSuggestion, (const Suggestion&), (override)); MOCK_METHOD(void,
diff --git a/chrome/browser/ui/autofill/autofill_suggestion_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_suggestion_controller_unittest.cc index 002f2a6..441a3055 100644 --- a/chrome/browser/ui/autofill/autofill_suggestion_controller_unittest.cc +++ b/chrome/browser/ui/autofill/autofill_suggestion_controller_unittest.cc
@@ -137,7 +137,7 @@ // Tests that the AED is informed when suggestions were shown. TEST_F(AutofillSuggestionControllerTest, ShowInformsDelegate) { - EXPECT_CALL(manager().external_delegate(), OnSuggestionsShown()); + EXPECT_CALL(manager().external_delegate(), OnSuggestionsShown); ShowSuggestions(manager(), {SuggestionType::kAddressEntry}); }
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client_interactive_uitest.cc b/chrome/browser/ui/autofill/chrome_autofill_client_interactive_uitest.cc index b852e9c..a4257f1 100644 --- a/chrome/browser/ui/autofill/chrome_autofill_client_interactive_uitest.cc +++ b/chrome/browser/ui/autofill/chrome_autofill_client_interactive_uitest.cc
@@ -43,7 +43,10 @@ : AutofillExternalDelegate(autofill_manager) {} ~MockAutofillExternalDelegate() override = default; - MOCK_METHOD(void, OnSuggestionsShown, (), (override)); + MOCK_METHOD(void, + OnSuggestionsShown, + (base::span<const Suggestion>), + (override)); }; // This test class is needed to make the constructor public.
diff --git a/chrome/browser/ui/cookie_controls/cookie_controls_controller_unittest.cc b/chrome/browser/ui/cookie_controls/cookie_controls_controller_unittest.cc index 0fd0128..d8d8fec 100644 --- a/chrome/browser/ui/cookie_controls/cookie_controls_controller_unittest.cc +++ b/chrome/browser/ui/cookie_controls/cookie_controls_controller_unittest.cc
@@ -1614,37 +1614,56 @@ class CookieControlsUserBypassTrackingProtectionUiTest : public CookieControlsUserBypassTest, - public testing::WithParamInterface<testing::tuple<bool, bool>> { + public testing::WithParamInterface<testing::tuple<bool, bool, bool>> { public: - CookieControlsUserBypassTrackingProtectionUiTest() { - feature_list_.InitWithFeatures( - { - privacy_sandbox::kFingerprintingProtectionUserBypass, - privacy_sandbox::kIpProtectionUserBypass, - privacy_sandbox::kIpProtectionV1, - }, - {}); - } + CookieControlsUserBypassTrackingProtectionUiTest() = default; ~CookieControlsUserBypassTrackingProtectionUiTest() override = default; + void SetUp() override { + CookieControlsUserBypassTest::SetUp(); + if (std::get<0>(GetParam())) { + cookie_settings()->SetThirdPartyCookieSetting( + GURL("https://example.com"), ContentSetting::CONTENT_SETTING_BLOCK); + } else { + tracking_protection_settings()->AddTrackingProtectionException( + GURL("https://example.com")); + cookie_settings()->SetThirdPartyCookieSetting( + GURL("https://example.com"), ContentSetting::CONTENT_SETTING_ALLOW); + } + + std::vector<base::test::FeatureRef> enabled_features = {}; + if (std::get<1>(GetParam())) { + enabled_features.push_back(privacy_sandbox::kIpProtectionUserBypass); + enabled_features.push_back(privacy_sandbox::kIpProtectionV1); + profile()->GetPrefs()->SetBoolean(prefs::kIpProtectionEnabled, true); + } + if (std::get<2>(GetParam())) { + enabled_features.push_back( + privacy_sandbox::kFingerprintingProtectionUserBypass); + } + feature_list_.InitWithFeatures(enabled_features, {}); + } + std::vector<TrackingProtectionFeature> GetFeatureVector( - CookieControlsEnforcement enforcement, - bool protections_on) { + CookieControlsEnforcement enforcement) { + bool protections_on = std::get<0>(GetParam()); std::vector<TrackingProtectionFeature> features_list; features_list.push_back( {FeatureType::kThirdPartyCookies, enforcement, protections_on ? BlockingStatus::kBlocked : BlockingStatus::kAllowed}); // Currently these ACT features do not support different enforcement types. - if (tracking_protection_settings()->IsIpProtectionEnabled()) { + if (std::get<1>(GetParam())) { features_list.push_back({FeatureType::kIpProtection, CookieControlsEnforcement::kNoEnforcement, protections_on ? BlockingStatus::kHidden : BlockingStatus::kVisible}); } - features_list.push_back( - {FeatureType::kFingerprintingProtection, - CookieControlsEnforcement::kNoEnforcement, - protections_on ? BlockingStatus::kLimited : BlockingStatus::kAllowed}); + if (std::get<2>(GetParam())) { + features_list.push_back({FeatureType::kFingerprintingProtection, + CookieControlsEnforcement::kNoEnforcement, + protections_on ? BlockingStatus::kLimited + : BlockingStatus::kAllowed}); + } return features_list; } @@ -1654,27 +1673,13 @@ TEST_P(CookieControlsUserBypassTrackingProtectionUiTest, AddsActFeaturesToVectorBasedOnFeatureAndExceptionStatus) { - bool protections_on = std::get<0>(GetParam()); - if (protections_on) { - cookie_settings()->SetThirdPartyCookieSetting( - GURL("https://example.com"), ContentSetting::CONTENT_SETTING_BLOCK); - } else { - tracking_protection_settings()->AddTrackingProtectionException( - GURL("https://example.com")); - cookie_settings()->SetThirdPartyCookieSetting( - GURL("https://example.com"), ContentSetting::CONTENT_SETTING_ALLOW); - } - profile()->GetPrefs()->SetBoolean(prefs::kIpProtectionEnabled, - std::get<1>(GetParam())); - NavigateAndCommit(GURL("https://example.com")); EXPECT_CALL(*mock(), OnStatusChanged( - /*controls_visible=*/true, protections_on, + /*controls_visible=*/true, std::get<0>(GetParam()), CookieControlsEnforcement::kNoEnforcement, CookieBlocking3pcdStatus::kNotIn3pcd, zero_expiration(), - GetFeatureVector(CookieControlsEnforcement::kNoEnforcement, - protections_on))); + GetFeatureVector(CookieControlsEnforcement::kNoEnforcement))); cookie_controls()->Update(web_contents()); testing::Mock::VerifyAndClearExpectations(mock()); @@ -1684,4 +1689,5 @@ All, CookieControlsUserBypassTrackingProtectionUiTest, testing::Combine(/*protections_on*/ testing::Bool(), - /*kIpProtectionEnabled*/ testing::Bool())); + /*kIpProtectionUserBypass*/ testing::Bool(), + /*kFingerprintingProtectionUserBypass*/ testing::Bool()));
diff --git a/chrome/browser/ui/lens/BUILD.gn b/chrome/browser/ui/lens/BUILD.gn index 0ca8e3b..7f5aa09 100644 --- a/chrome/browser/ui/lens/BUILD.gn +++ b/chrome/browser/ui/lens/BUILD.gn
@@ -111,6 +111,7 @@ "//components/lens:features", "//components/lens/proto/server:proto", "//components/metrics_services_manager:metrics_services_manager", + "//components/pdf/browser", "//components/prefs", "//components/sessions", "//components/signin/public/identity_manager",
diff --git a/chrome/browser/ui/lens/lens_overlay_controller.cc b/chrome/browser/ui/lens/lens_overlay_controller.cc index ff70342..968a930 100644 --- a/chrome/browser/ui/lens/lens_overlay_controller.cc +++ b/chrome/browser/ui/lens/lens_overlay_controller.cc
@@ -45,6 +45,7 @@ #include "components/find_in_page/find_tab_helper.h" #include "components/lens/lens_features.h" #include "components/lens/lens_overlay_permission_utils.h" +#include "components/pdf/browser/pdf_document_helper.h" #include "components/permissions/permission_request_manager.h" #include "components/sessions/content/session_tab_helper.h" #include "components/signin/public/identity_manager/identity_manager.h" @@ -181,6 +182,28 @@ return SkBitmap(); } +// Returns the PDFHelper associated with the given web contents. Returns nullptr +// if one does not exist. +pdf::PDFDocumentHelper* MaybeGetPdfHelper(content::WebContents* contents) { + pdf::PDFDocumentHelper* pdf_helper = nullptr; + // Iterate through each of the render frame hosts, because the frame + // associated to a PDFDocumentHelper is not guaranteed to be a specific frame. + // For example, if kPdfOopif feature is enabled, the frame is the top frame. + // If kPdfOopif is disabled, it is a child frame. + contents->ForEachRenderFrameHost( + [&pdf_helper](content::RenderFrameHost* rfh) { + if (pdf_helper) { + return; + } + auto* possible_pdf_helper = + pdf::PDFDocumentHelper::GetForCurrentDocument(rfh); + if (possible_pdf_helper) { + pdf_helper = possible_pdf_helper; + } + }); + return pdf_helper; +} + } // namespace LensOverlayController::LensOverlayController( @@ -1223,9 +1246,29 @@ initialization_data_ = std::make_unique<OverlayInitializationData>( screenshot, std::move(rgb_screenshot), color_palette, page_url, page_title); + AddBoundingBoxesToInitializationData(all_bounds); - // Initialize the overlay now that the initialization data is ready. + // Try and fetch the PDF bytes if enabled. + pdf::PDFDocumentHelper* pdf_helper = + lens::features::UsePdfsAsContext() + ? MaybeGetPdfHelper(active_web_contents) + : nullptr; + if (pdf_helper) { + // Fetch the PDF bytes then initialize the overlay. + pdf_helper->GetPdfBytes( + base::BindOnce(&LensOverlayController::OnPdfBytesReceived, + weak_factory_.GetWeakPtr())); + return; + } + + // Initialize since there are no PDF bytes to wait on. + InitializeOverlay(); +} + +void LensOverlayController::OnPdfBytesReceived( + const std::vector<uint8_t>& bytes) { + initialization_data_->pdf_bytes_ = bytes; InitializeOverlay(); } @@ -1470,6 +1513,7 @@ initialization_data_->current_screenshot_, initialization_data_->page_url_, initialization_data_->page_title_, std::move(initialization_data_->significant_region_boxes_), + initialization_data_->pdf_bytes_, device_scale_factor * page_scale_factor); } // TODO(b/352622136): We should not start the lens request until the overlay
diff --git a/chrome/browser/ui/lens/lens_overlay_controller.h b/chrome/browser/ui/lens/lens_overlay_controller.h index 10ce780..ef3bc64 100644 --- a/chrome/browser/ui/lens/lens_overlay_controller.h +++ b/chrome/browser/ui/lens/lens_overlay_controller.h
@@ -553,6 +553,10 @@ // The page title, if it is allowed to be shared. std::optional<std::string> page_title_; + // The bytes of the PDF the user is viewing, if the user is looking at a PDF + // and the bytes are able to be retrieved. + std::vector<uint8_t> pdf_bytes_; + // Bounding boxes for significant regions identified in the screenshot. std::vector<lens::mojom::CenterRotatedBoxPtr> significant_region_boxes_; @@ -628,6 +632,10 @@ const std::vector<gfx::Rect>& all_bounds, SkBitmap rgb_screenshot); + // Receives the PDF bytes from the IPC call to the PDF renderer and stores + // them in initialization data. + void OnPdfBytesReceived(const std::vector<uint8_t>& bytes); + // Adds bounding boxes to the initialization data. void AddBoundingBoxesToInitializationData( const std::vector<gfx::Rect>& bounds);
diff --git a/chrome/browser/ui/lens/lens_overlay_controller_browsertest.cc b/chrome/browser/ui/lens/lens_overlay_controller_browsertest.cc index 12672fcc3..389fec4c 100644 --- a/chrome/browser/ui/lens/lens_overlay_controller_browsertest.cc +++ b/chrome/browser/ui/lens/lens_overlay_controller_browsertest.cc
@@ -332,6 +332,7 @@ std::optional<GURL> page_url, std::optional<std::string> page_title, std::vector<lens::mojom::CenterRotatedBoxPtr> significant_region_boxes, + base::span<const uint8_t> pdf_bytes, float ui_scale_factor) override { // Send response for full image callback / HandleStartQueryResponse. std::vector<lens::mojom::OverlayObjectPtr> test_objects; @@ -349,6 +350,8 @@ base::SequencedTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, base::BindOnce(interaction_data_callback_, interaction_response)); + + last_sent_pdf_bytes_ = pdf_bytes; } void SendTaskCompletionGen204IfEnabled( @@ -406,6 +409,7 @@ last_queried_region_.reset(); last_queried_text_.clear(); last_queried_region_bytes_ = std::nullopt; + last_sent_pdf_bytes_ = base::span<const uint8_t>(); } bool full_image_request_should_return_error_ = false; @@ -413,6 +417,7 @@ lens::LensOverlaySelectionType last_lens_selection_type_; lens::mojom::CenterRotatedBoxPtr last_queried_region_; std::optional<SkBitmap> last_queried_region_bytes_; + base::span<const uint8_t> last_sent_pdf_bytes_; std::optional<lens::mojom::UserAction> last_user_action_; }; @@ -524,12 +529,15 @@ } }; +std::unique_ptr<tabs::TabFeatures> CreateTabFeatures() { + return std::make_unique<TabFeaturesFake>(); +} + class LensOverlayControllerBrowserTest : public InProcessBrowserTest { protected: LensOverlayControllerBrowserTest() { - tabs::TabFeatures::ReplaceTabFeaturesForTesting(base::BindRepeating( - &LensOverlayControllerBrowserTest::CreateTabFeatures, - base::Unretained(this))); + tabs::TabFeatures::ReplaceTabFeaturesForTesting( + base::BindRepeating(&CreateTabFeatures)); } void SetUp() override { @@ -572,10 +580,6 @@ }); } - std::unique_ptr<tabs::TabFeatures> CreateTabFeatures() { - return std::make_unique<TabFeaturesFake>(); - } - const SkBitmap CreateNonEmptyBitmap(int width, int height) { SkBitmap bitmap; bitmap.allocN32Pixels(width, height); @@ -3617,7 +3621,10 @@ public PDFExtensionTestBase { public: LensOverlayControllerBrowserPDFTest() - : base::test::WithFeatureOverride(chrome_pdf::features::kPdfOopif) {} + : base::test::WithFeatureOverride(chrome_pdf::features::kPdfOopif) { + tabs::TabFeatures::ReplaceTabFeaturesForTesting( + base::BindRepeating(&CreateTabFeatures)); + } void SetUpOnMainThread() override { PDFExtensionTestBase::SetUpOnMainThread(); @@ -3672,6 +3679,33 @@ })); } +IN_PROC_BROWSER_TEST_P(LensOverlayControllerBrowserPDFTest, + PdfBytesExcludedInRequest) { + // Open the PDF document and wait for it to finish loading. + const GURL url = embedded_test_server()->GetURL(kPdfDocument); + content::RenderFrameHost* extension_host = LoadPdfGetExtensionHost(url); + ASSERT_TRUE(extension_host); + + // State should start in off. + auto* controller = browser() + ->tab_strip_model() + ->GetActiveTab() + ->tab_features() + ->lens_overlay_controller(); + ASSERT_EQ(controller->state(), State::kOff); + + // Open the overlay. + controller->ShowUI(LensOverlayInvocationSource::kAppMenu); + ASSERT_EQ(controller->state(), State::kScreenshot); + ASSERT_TRUE(base::test::RunUntil( + [&]() { return controller->state() == State::kOverlay; })); + + // Verify PDF bytes were excluded from the query. + auto* fake_query_controller = static_cast<LensOverlayQueryControllerFake*>( + controller->get_lens_overlay_query_controller_for_testing()); + ASSERT_TRUE(fake_query_controller->last_sent_pdf_bytes_.empty()); +} + // This test is wrapped in this BUILDFLAG block because the fallback region // search functionality will not be enabled if the flag is unset. #if BUILDFLAG(ENABLE_LENS_DESKTOP_GOOGLE_BRANDED_FEATURES) @@ -3712,9 +3746,50 @@ } #endif // BUILDFLAG(ENABLE_LENS_DESKTOP_GOOGLE_BRANDED_FEATURES) +class LensOverlayControllerBrowserPDFContextualizationTest + : public LensOverlayControllerBrowserPDFTest { + public: + std::vector<base::test::FeatureRefAndParams> GetEnabledFeatures() + const override { + auto enabled = PDFExtensionTestBase::GetEnabledFeatures(); + enabled.push_back( + {lens::features::kLensOverlay, {{"use-pdfs-as-context", "true"}}}); + return enabled; + } +}; + +IN_PROC_BROWSER_TEST_P(LensOverlayControllerBrowserPDFContextualizationTest, + PdfBytesIncludedInRequest) { + // Open the PDF document and wait for it to finish loading. + const GURL url = embedded_test_server()->GetURL(kPdfDocument); + content::RenderFrameHost* extension_host = LoadPdfGetExtensionHost(url); + ASSERT_TRUE(extension_host); + + // State should start in off. + auto* controller = browser() + ->tab_strip_model() + ->GetActiveTab() + ->tab_features() + ->lens_overlay_controller(); + ASSERT_EQ(controller->state(), State::kOff); + + // Open the overlay. + controller->ShowUI(LensOverlayInvocationSource::kAppMenu); + ASSERT_EQ(controller->state(), State::kScreenshot); + ASSERT_TRUE(base::test::RunUntil( + [&]() { return controller->state() == State::kOverlay; })); + + // Verify PDF bytes were included in the query. + auto* fake_query_controller = static_cast<LensOverlayQueryControllerFake*>( + controller->get_lens_overlay_query_controller_for_testing()); + ASSERT_FALSE(fake_query_controller->last_sent_pdf_bytes_.empty()); +} + // TODO(crbug.com/40268279): Stop testing both modes after OOPIF PDF viewer // launches. INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(LensOverlayControllerBrowserPDFTest); +INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE( + LensOverlayControllerBrowserPDFContextualizationTest); // Test with --enable-pixel-output-in-tests enabled, required to actually grab // screenshots for color extraction.
diff --git a/chrome/browser/ui/lens/lens_overlay_controller_interactive_uitest.cc b/chrome/browser/ui/lens/lens_overlay_controller_interactive_uitest.cc index bd7669f..e1bcba88 100644 --- a/chrome/browser/ui/lens/lens_overlay_controller_interactive_uitest.cc +++ b/chrome/browser/ui/lens/lens_overlay_controller_interactive_uitest.cc
@@ -95,6 +95,7 @@ std::optional<GURL> page_url, std::optional<std::string> page_title, std::vector<lens::mojom::CenterRotatedBoxPtr> significant_region_boxes, + base::span<const uint8_t> pdf_bytes, float ui_scale_factor) override { // Send response for full image callback / HandleStartQueryResponse. base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
diff --git a/chrome/browser/ui/lens/lens_overlay_query_controller.cc b/chrome/browser/ui/lens/lens_overlay_query_controller.cc index 3f31ed8..7e5281e 100644 --- a/chrome/browser/ui/lens/lens_overlay_query_controller.cc +++ b/chrome/browser/ui/lens/lens_overlay_query_controller.cc
@@ -75,6 +75,10 @@ constexpr char kStartTimeQueryParameter[] = "qsubts"; constexpr char kGen204IdentifierQueryParameter[] = "plla"; constexpr char kVisualSearchInteractionDataQueryParameterKey[] = "vsint"; +constexpr char kVisualInputTypeQueryParameterKey[] = "vit"; +// TODO(b/362997636): Video is temporary for prototyping. Needs to change once +// the server is ready. +constexpr char kPdfVisualInputTypeQueryParameterValue[] = "video"; constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotationTag = net::DefineNetworkTrafficAnnotation("lens_overlay", R"( @@ -220,11 +224,13 @@ std::optional<GURL> page_url, std::optional<std::string> page_title, std::vector<lens::mojom::CenterRotatedBoxPtr> significant_region_boxes, + base::span<const uint8_t> pdf_bytes, float ui_scale_factor) { original_screenshot_ = screenshot; page_url_ = page_url; page_title_ = page_title; significant_region_boxes_ = std::move(significant_region_boxes); + pdf_bytes_ = pdf_bytes; ui_scale_factor_ = ui_scale_factor; gen204_id_ = base::RandUint64(); @@ -356,6 +362,16 @@ request_context); request.mutable_objects_request()->mutable_image_data()->CopyFrom(image_data); + // The PDF bytes are optional, so if they were included in the StartQueryFlow, + // included them in the request. + if (!pdf_bytes_.empty()) { + lens::Payload payload; + payload.mutable_content_data()->assign(pdf_bytes_.begin(), + pdf_bytes_.end()); + payload.set_content_type("application/pdf"); + request.mutable_objects_request()->mutable_payload()->CopyFrom(payload); + } + int64_t query_start_time_ms = base::Time::Now().InMillisecondsSinceUnixEpoch(); latest_full_image_sequence_id_ = request_id->sequence_id(); @@ -573,8 +589,7 @@ if (base::TrimWhitespaceASCII(query_text, base::TRIM_ALL).empty()) { return; } - SendInteraction(/*region=*/std::move(region), - /*query_text=*/std::make_optional<std::string>(query_text), + SendInteraction(/*region=*/std::move(region), query_text, /*object_id=*/std::nullopt, multimodal_selection_type, additional_search_query_params, region_bytes); } @@ -586,6 +601,21 @@ // Increment the request counter to cancel previously issued fetches. request_counter_++; + // If PDF bytes exist on a text only query, contextualize the query via a Lens + // request, instead of going straight through GWS. + if (!pdf_bytes_.empty()) { + // Include the vit to get contextualized results. + additional_search_query_params.insert( + {kVisualInputTypeQueryParameterKey, + kPdfVisualInputTypeQueryParameterValue}); + + // TODO(b/362816047): Send the correct selection type once it is ready. + SendInteraction(/*region=*/nullptr, query_text, + /*object_id=*/std::nullopt, lens::UNKNOWN_SELECTION_TYPE, + additional_search_query_params, std::nullopt); + return; + } + // Add the start time to the query params now, so that any additional // client processing time is included. additional_search_query_params = @@ -749,6 +779,15 @@ interaction_request_metadata.mutable_selection_metadata() ->mutable_object() ->set_object_id(*object_id); + } else if (query_text.has_value()) { + // If there is only `query_text`, this is a contextual flow. + // TOOD(b/362816047): Send correct LensOverlayInteractionRequestMetadata, + // once the server is ready for it. + interaction_request_metadata.set_type( + lens::LensOverlayInteractionRequestMetadata::UNKNOWN); + interaction_request_metadata.mutable_query_metadata() + ->mutable_text_query() + ->set_query(*query_text); } else { // There should be a region or an object id in the request. NOTREACHED_IN_MIGRATION();
diff --git a/chrome/browser/ui/lens/lens_overlay_query_controller.h b/chrome/browser/ui/lens/lens_overlay_query_controller.h index 79580b37..7b72f0f 100644 --- a/chrome/browser/ui/lens/lens_overlay_query_controller.h +++ b/chrome/browser/ui/lens/lens_overlay_query_controller.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_UI_LENS_LENS_OVERLAY_QUERY_CONTROLLER_H_ #define CHROME_BROWSER_UI_LENS_LENS_OVERLAY_QUERY_CONTROLLER_H_ +#include "base/containers/span.h" #include "base/functional/callback.h" #include "base/task/cancelable_task_tracker.h" #include "chrome/browser/lens/core/mojom/lens.mojom.h" @@ -79,6 +80,7 @@ std::optional<GURL> page_url, std::optional<std::string> page_title, std::vector<lens::mojom::CenterRotatedBoxPtr> significant_region_boxes, + base::span<const uint8_t> pdf_bytes, float ui_scale_factor); // Clears the state and resets stored values. @@ -364,6 +366,10 @@ const raw_ptr<Profile> profile_; + // PDF bytes the user is viewing. Owned by LensOverlayController. Will be + // empty if no PDF bytes to the underlying page exists. + base::span<const uint8_t> pdf_bytes_; + // The request counter, used to make sure requests are not sent out of // order. int request_counter_ = 0;
diff --git a/chrome/browser/ui/lens/lens_overlay_query_controller_unittest.cc b/chrome/browser/ui/lens/lens_overlay_query_controller_unittest.cc index 099cfe4..b611ff0 100644 --- a/chrome/browser/ui/lens/lens_overlay_query_controller_unittest.cc +++ b/chrome/browser/ui/lens/lens_overlay_query_controller_unittest.cc
@@ -63,6 +63,9 @@ // Query parameter for the request id. inline constexpr char kRequestIdParameterKey[] = "vsrid"; +// Query parameter for the visual input type. +inline constexpr char kVisualInputTypeParameterKey[] = "vit"; + // The encoded search context for the test page and title. constexpr char kTestEncodedSearchContext[] = "ChdodHRwczovL3d3dy5nb29nbGUuY29tLxIKUGFnZSBUaXRsZQ"; @@ -266,7 +269,8 @@ query_controller.StartQueryFlow( bitmap, std::make_optional<GURL>(kTestPageUrl), std::make_optional<std::string>(kTestPageTitle), - std::vector<lens::mojom::CenterRotatedBoxPtr>(), 0); + std::vector<lens::mojom::CenterRotatedBoxPtr>(), + /*pdf_bytes=*/{}, 0); task_environment_.RunUntilIdle(); query_controller.EndQuery(); @@ -332,7 +336,8 @@ query_controller.StartQueryFlow( bitmap, std::make_optional<GURL>(kTestPageUrl), std::make_optional<std::string>(kTestPageTitle), - std::vector<lens::mojom::CenterRotatedBoxPtr>(), 0); + std::vector<lens::mojom::CenterRotatedBoxPtr>(), + /*pdf_bytes=*/{}, 0); task_environment_.RunUntilIdle(); auto region = lens::mojom::CenterRotatedBox::New(); @@ -437,7 +442,8 @@ query_controller.StartQueryFlow( viewport_bitmap, std::make_optional<GURL>(kTestPageUrl), std::make_optional<std::string>(kTestPageTitle), - std::vector<lens::mojom::CenterRotatedBoxPtr>(), 0); + std::vector<lens::mojom::CenterRotatedBoxPtr>(), + /*pdf_bytes=*/{}, 0); task_environment_.RunUntilIdle(); SkBitmap region_bitmap = CreateNonEmptyBitmap(100, 100); @@ -558,7 +564,8 @@ query_controller.StartQueryFlow( bitmap, std::make_optional<GURL>(kTestPageUrl), std::make_optional<std::string>(kTestPageTitle), - std::vector<lens::mojom::CenterRotatedBoxPtr>(), 0); + std::vector<lens::mojom::CenterRotatedBoxPtr>(), + /*pdf_bytes=*/{}, 0); task_environment_.RunUntilIdle(); auto region = lens::mojom::CenterRotatedBox::New(); @@ -665,7 +672,8 @@ query_controller.StartQueryFlow( bitmap, std::make_optional<GURL>(kTestPageUrl), std::make_optional<std::string>(kTestPageTitle), - std::vector<lens::mojom::CenterRotatedBoxPtr>(), 0); + std::vector<lens::mojom::CenterRotatedBoxPtr>(), + /*pdf_bytes=*/{}, 0); task_environment_.RunUntilIdle(); query_controller.SendTextOnlyQuery("", TextOnlyQueryType::kLensTextSelection, @@ -694,6 +702,97 @@ } TEST_F(LensOverlayQueryControllerTest, + FetchTextOnlyInteractionWithPdf_ReturnsResponse) { + base::test::TestFuture<std::vector<lens::mojom::OverlayObjectPtr>, + lens::mojom::TextPtr, bool> + full_image_response_future; + base::test::TestFuture<lens::proto::LensOverlayUrlResponse> + url_response_future; + base::test::TestFuture<lens::proto::LensOverlayInteractionResponse> + interaction_data_response_future; + base::test::TestFuture<const std::string&> thumbnail_created_future; + LensOverlayQueryControllerMock query_controller( + full_image_response_future.GetRepeatingCallback(), + url_response_future.GetRepeatingCallback(), + interaction_data_response_future.GetRepeatingCallback(), + thumbnail_created_future.GetRepeatingCallback(), + profile()->GetVariationsClient(), + IdentityManagerFactory::GetForProfile(profile()), profile(), + lens::LensOverlayInvocationSource::kAppMenu, + /*use_dark_mode=*/false); + query_controller.fake_objects_response_.mutable_cluster_info() + ->set_server_session_id(kTestServerSessionId); + query_controller.fake_interaction_response_.set_encoded_response( + kTestSuggestSignals); + SkBitmap bitmap = CreateNonEmptyBitmap(100, 100); + std::map<std::string, std::string> additional_search_query_params; + std::vector<uint8_t> fake_pdf_bytes({1, 2, 3, 4}); + query_controller.StartQueryFlow( + bitmap, std::make_optional<GURL>(kTestPageUrl), + std::make_optional<std::string>(kTestPageTitle), + std::vector<lens::mojom::CenterRotatedBoxPtr>(), fake_pdf_bytes, 0); + task_environment_.RunUntilIdle(); + query_controller.SendTextOnlyQuery(kTestQueryText, + TextOnlyQueryType::kLensTextSelection, + additional_search_query_params); + task_environment_.RunUntilIdle(); + query_controller.EndQuery(); + + // Check initial fetch objects request is correct. + ASSERT_TRUE(full_image_response_future.IsReady()); + ASSERT_EQ(query_controller.sent_objects_request_.image_data() + .image_metadata() + .width(), + 100); + ASSERT_EQ(query_controller.sent_objects_request_.image_data() + .image_metadata() + .height(), + 100); + ASSERT_FALSE( + query_controller.sent_objects_request_.payload().content_data().empty()); + ASSERT_EQ(query_controller.sent_objects_request_.payload().content_type(), + "application/pdf"); + + // Check interaction request is correct. + ASSERT_TRUE(interaction_data_response_future.IsReady()); + ASSERT_EQ(query_controller.sent_interaction_request_.request_context() + .request_id() + .sequence_id(), + 2); + ASSERT_EQ( + query_controller.sent_interaction_request_.interaction_request_metadata() + .type(), + lens::LensOverlayInteractionRequestMetadata::UNKNOWN); + ASSERT_EQ( + query_controller.sent_interaction_request_.interaction_request_metadata() + .query_metadata() + .text_query() + .query(), + kTestQueryText); + ASSERT_FALSE( + query_controller.sent_interaction_request_.interaction_request_metadata() + .has_selection_metadata()); + + // Check search URL is correct. + ASSERT_TRUE(url_response_future.IsReady()); + std::string unused_start_time; + bool has_start_time = + net::GetValueForKeyInQuery(GURL(url_response_future.Get().url()), + kStartTimeQueryParam, &unused_start_time); + std::string visual_input_type; + bool has_visual_input_type = net::GetValueForKeyInQuery( + GURL(url_response_future.Get().url()), kVisualInputTypeParameterKey, + &visual_input_type); + ASSERT_EQ(GetSelectionTypeFromUrl(url_response_future.Get().url()), + lens::UNKNOWN_SELECTION_TYPE); + ASSERT_TRUE(has_start_time); + ASSERT_TRUE(has_visual_input_type); + ASSERT_EQ(visual_input_type, "video"); + ASSERT_EQ(query_controller.num_gen204_pings_sent_, 1); + ASSERT_TRUE(url_response_future.Get().has_url()); +} + +TEST_F(LensOverlayQueryControllerTest, FetchInteraction_StartsNewQueryFlowAfterTimeout) { base::test::TestFuture<std::vector<lens::mojom::OverlayObjectPtr>, lens::mojom::TextPtr, bool> @@ -726,7 +825,8 @@ query_controller.StartQueryFlow( bitmap, std::make_optional<GURL>(kTestPageUrl), std::make_optional<std::string>(kTestPageTitle), - std::vector<lens::mojom::CenterRotatedBoxPtr>(), 0); + std::vector<lens::mojom::CenterRotatedBoxPtr>(), + /*pdf_bytes=*/{}, 0); task_environment_.RunUntilIdle(); ASSERT_TRUE(full_image_response_future.IsReady()); @@ -783,7 +883,8 @@ query_controller.StartQueryFlow( bitmap, std::make_optional<GURL>(kTestPageUrl), std::make_optional<std::string>(kTestPageTitle), - std::vector<lens::mojom::CenterRotatedBoxPtr>(), 0); + std::vector<lens::mojom::CenterRotatedBoxPtr>(), + /*pdf_bytes=*/{}, 0); task_environment_.RunUntilIdle(); ASSERT_TRUE(full_image_response_future.IsReady());
diff --git a/chrome/browser/ui/tabs/public/tab_interface.h b/chrome/browser/ui/tabs/public/tab_interface.h index 40bae34..351d608 100644 --- a/chrome/browser/ui/tabs/public/tab_interface.h +++ b/chrome/browser/ui/tabs/public/tab_interface.h
@@ -123,6 +123,9 @@ // (3) It is not possible to perform dependency injection for legacy code // that is conceptually a TabFeature and needs access to other TabFeatures. virtual tabs::TabFeatures* GetTabFeatures() = 0; + + // An identifier that is guaranteed to be unique. + virtual uint32_t GetTabHandle() = 0; }; } // namespace tabs
diff --git a/chrome/browser/ui/tabs/tab_model.cc b/chrome/browser/ui/tabs/tab_model.cc index 3414b97a..3329b95 100644 --- a/chrome/browser/ui/tabs/tab_model.cc +++ b/chrome/browser/ui/tabs/tab_model.cc
@@ -168,6 +168,10 @@ return tab_features_.get(); } +uint32_t TabModel::GetTabHandle() { + return GetHandle().raw_value(); +} + void TabModel::OnTabStripModelChanged( TabStripModel* tab_strip_model, const TabStripModelChange& change,
diff --git a/chrome/browser/ui/tabs/tab_model.h b/chrome/browser/ui/tabs/tab_model.h index c08f882..b98f6b1 100644 --- a/chrome/browser/ui/tabs/tab_model.h +++ b/chrome/browser/ui/tabs/tab_model.h
@@ -128,6 +128,7 @@ bool IsInNormalWindow() const override; BrowserWindowInterface* GetBrowserWindowInterface() override; tabs::TabFeatures* GetTabFeatures() override; + uint32_t GetTabHandle() override; private: // Overridden from TabStripModelObserver:
diff --git a/chrome/browser/ui/views/data_sharing/data_sharing_utils.h b/chrome/browser/ui/views/data_sharing/data_sharing_utils.h index fca566a9..5a778c80 100644 --- a/chrome/browser/ui/views/data_sharing/data_sharing_utils.h +++ b/chrome/browser/ui/views/data_sharing/data_sharing_utils.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_UI_VIEWS_DATA_SHARING_DATA_SHARING_UTILS_H_ #define CHROME_BROWSER_UI_VIEWS_DATA_SHARING_DATA_SHARING_UTILS_H_ +#include <variant> + #include "base/uuid.h" #include "chrome/browser/profiles/profile.h" #include "components/data_sharing/public/group_data.h"
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 0cca509..eaeb6d3 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -618,7 +618,10 @@ : browser_view_(std::move(browser_view)) {} ~TabContainerOverlayView() override = default; - // views::View override + // + // views::View overrides + // + void OnPaintBackground(gfx::Canvas* canvas) override { SkColor frame_color = browser_view_->frame()->GetFrameView()->GetFrameColor( BrowserFrameActiveState::kUseCurrent); @@ -632,6 +635,45 @@ } } + // + // `BrowserRootView` handles drag and drop for the tab strip. In immersive + // fullscreen, the tab strip is hosted in a separate Widget, in a separate + // view, this view` TabContainerOverlayView`. To support drag and drop for the + // tab strip in immersive fullscreen, forward all drag and drop requests to + // the `BrowserRootView`. + // + + bool GetDropFormats( + int* formats, + std::set<ui::ClipboardFormatType>* format_types) override { + return browser_view_->GetWidget()->GetRootView()->GetDropFormats( + formats, format_types); + } + + bool AreDropTypesRequired() override { + return browser_view_->GetWidget()->GetRootView()->AreDropTypesRequired(); + } + + bool CanDrop(const ui::OSExchangeData& data) override { + return browser_view_->GetWidget()->GetRootView()->CanDrop(data); + } + + void OnDragEntered(const ui::DropTargetEvent& event) override { + return browser_view_->GetWidget()->GetRootView()->OnDragEntered(event); + } + + int OnDragUpdated(const ui::DropTargetEvent& event) override { + return browser_view_->GetWidget()->GetRootView()->OnDragUpdated(event); + } + + void OnDragExited() override { + return browser_view_->GetWidget()->GetRootView()->OnDragExited(); + } + + DropCallback GetDropCallback(const ui::DropTargetEvent& event) override { + return browser_view_->GetWidget()->GetRootView()->GetDropCallback(event); + } + private: // The BrowserView this overlay is created for. WeakPtr is used since // this view is held in a different hierarchy.
diff --git a/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_browsertest.cc b/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_browsertest.cc index eddcb98..3c202a29 100644 --- a/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_browsertest.cc
@@ -178,8 +178,6 @@ IN_PROC_BROWSER_TEST_F(TrackingProtectionBubbleViewBrowserTest, ToggleCreatesTrackingProtectionException) { - browser()->profile()->GetPrefs()->SetBoolean( - prefs::kFingerprintingProtectionEnabled, true); ShowBubble(); EXPECT_EQ(GetTrackingProtectionSetting(), CONTENT_SETTING_BLOCK); SimulateTogglePress(false);
diff --git a/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_interactive_uitest.cc b/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_interactive_uitest.cc index 5afc371..20bf5813 100644 --- a/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_interactive_uitest.cc +++ b/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_interactive_uitest.cc
@@ -757,13 +757,6 @@ browser()->profile()); } - // Enable FPP to display UB UX with ACT features - void EnableFingerprintingProtection() { - browser()->profile()->GetPrefs()->SetBoolean( - prefs::kFingerprintingProtectionEnabled, true); - has_act_features_ = true; - } - protected: std::vector<base::test::FeatureRef> EnabledFeatures() override { return {privacy_sandbox::kFingerprintingProtectionUserBypass}; @@ -775,7 +768,7 @@ IN_PROC_BROWSER_TEST_P(CookieControlsInteractiveUiTrackingProtectionTest, CreateException) { BlockThirdPartyCookies(/*use_3pcd=*/true); - EnableFingerprintingProtection(); + has_act_features_ = true; SetBlockAll3pcToggle(GetParam()); RunTestSequence( InstrumentTab(kWebContentsElementId), @@ -793,8 +786,7 @@ // Open the bubble while 3PC are blocked, but the page already has an // exception. Disable 3PC for the page, and confirm the exception is removed. BlockThirdPartyCookies(/*use_3pcd=*/true); - EnableFingerprintingProtection(); - SetHighSiteEngagement(); + has_act_features_ = true; SetBlockAll3pcToggle(GetParam()); cookie_settings()->SetCookieSettingForUserBypass( third_party_cookie_page_url());
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc index d84ec925..1cb99b4 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc
@@ -1599,9 +1599,6 @@ IN_PROC_BROWSER_TEST_P( PageInfoBubbleViewBrowserTestTrackingProtectionSubpage, ToggleForBlockingThirdPartyCookiesUpdatesTrackingProtectionException) { - // Enable FPP to display UB UX with ACT features - browser()->profile()->GetPrefs()->SetBoolean( - prefs::kFingerprintingProtectionEnabled, true); GURL url_example = GURL("http://example/other/stuff.htm"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url_example));
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc index a5848e4..0ce4c1d 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -181,7 +181,8 @@ if (web_contents) { return base::StringPrintf( - "web.%d", web_contents->GetPrimaryMainFrame()->GetFrameTreeNodeId()); + "web.%d", + web_contents->GetPrimaryMainFrame()->GetFrameTreeNodeId().value()); } LOG(ERROR) << "Unable to generate a RoutingID"; return "";
diff --git a/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc b/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc index 71b567b..9519270 100644 --- a/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc +++ b/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc
@@ -33,6 +33,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/side_panel/side_panel.h" #include "chrome/browser/ui/views/side_panel/side_panel_content_proxy.h" +#include "chrome/browser/ui/views/side_panel/side_panel_entry.h" #include "chrome/browser/ui/views/side_panel/side_panel_entry_id.h" #include "chrome/browser/ui/views/side_panel/side_panel_entry_key.h" #include "chrome/browser/ui/views/side_panel/side_panel_header.h" @@ -395,15 +396,15 @@ } void SidePanelCoordinator::OpenInNewTab() { - if (!browser_view_->unified_side_panel() || !current_entry_) { + if (!browser_view_->unified_side_panel() || !current_key_) { return; } - GURL new_tab_url = current_entry_->GetOpenInNewTabURL(); + GURL new_tab_url = GetEntryForUniqueKey(*current_key_)->GetOpenInNewTabURL(); if (!new_tab_url.is_valid()) return; - SidePanelUtil::RecordNewTabButtonClicked(current_entry_->key().id()); + SidePanelUtil::RecordNewTabButtonClicked(current_key_->key.id()); content::OpenURLParams params(new_tab_url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_AUTO_BOOKMARK, @@ -416,7 +417,7 @@ Profile* const profile = browser_view_->GetProfile(); std::optional<actions::ActionId> action_id = - GetActionItem(current_entry_->key())->GetActionId(); + GetActionItem(current_key_->key)->GetActionId(); CHECK(action_id.has_value()); bool updated_pin_state = false; @@ -424,7 +425,7 @@ // TODO(b/310910098): Clean condition up once/if ToolbarActionModel and // PinnedToolbarActionModel are merged together. if (const std::optional<extensions::ExtensionId> extension_id = - current_entry_->key().extension_id(); + current_key_->key.extension_id(); extension_id.has_value()) { ToolbarActionsModel* const actions_model = ToolbarActionsModel::Get(profile); @@ -439,7 +440,7 @@ actions_model->UpdatePinnedState(action_id.value(), updated_pin_state); } - SidePanelUtil::RecordPinnedButtonClicked(current_entry_->key().id(), + SidePanelUtil::RecordPinnedButtonClicked(current_key_->key.id(), updated_pin_state); header_pin_button_->GetViewAccessibility().AnnounceText( l10n_util::GetStringUTF16(updated_pin_state ? IDS_SIDE_PANEL_PINNED @@ -450,7 +451,8 @@ } void SidePanelCoordinator::OpenMoreInfoMenu() { - more_info_menu_model_ = current_entry_->GetMoreInfoMenuModel(); + more_info_menu_model_ = + GetEntryForUniqueKey(*current_key_)->GetMoreInfoMenuModel(); CHECK(more_info_menu_model_); menu_runner_ = std::make_unique<views::MenuRunner>( more_info_menu_model_.get(), views::MenuRunner::HAS_MNEMONICS); @@ -464,8 +466,8 @@ std::optional<SidePanelEntry::Id> SidePanelCoordinator::GetCurrentEntryId() const { - return current_entry_ - ? std::optional<SidePanelEntry::Id>(current_entry_->key().id()) + return current_key_ + ? std::optional<SidePanelEntry::Id>(current_key_->key.id()) : std::nullopt; } @@ -478,8 +480,7 @@ bool SidePanelCoordinator::IsSidePanelEntryShowing( const SidePanelEntry::Key& entry_key) const { - return IsSidePanelShowing() && current_entry_ && - current_entry_->key() == entry_key; + return IsSidePanelShowing() && current_key_ && current_key_->key == entry_key; } content::WebContents* SidePanelCoordinator::GetWebContentsForTest( @@ -507,8 +508,7 @@ bool SidePanelCoordinator::IsSidePanelEntryShowing( const SidePanelEntry* entry) const { - return IsSidePanelShowing() && current_entry_ && - current_entry_.get() == entry; + return IsSidePanelEntryShowing(entry->key()); } void SidePanelCoordinator::Show( @@ -520,13 +520,7 @@ return; } - SidePanelEntry* entry = nullptr; - if (input.tab_scoped) { - entry = GetActiveContextualEntryForKey(input.key); - } else { - entry = window_registry_->GetEntryForKey(input.key); - } - CHECK(entry); + SidePanelEntry* entry = GetEntryForUniqueKey(input); if (browser_view_->unified_side_panel()->GetViewByID( kSidePanelContentWrapperViewId) == nullptr) { @@ -582,7 +576,7 @@ // yet shown) we want to make sure B will not then be shown when it has // finished loading. Note, this does not cancel the triggered load of B, B // remains cached. - if (current_entry_.get() == entry) { + if (current_key_ && *current_key_ == input) { content_wrapper->SetProperty( kSidePanelContentStateKey, static_cast<std::underlying_type_t<SidePanelContentState>>( @@ -600,8 +594,9 @@ browser_view_->browser(), entry->key().id(), open_trigger); content_wrapper->RequestEntry( - entry, base::BindOnce(&SidePanelCoordinator::PopulateSidePanel, - base::Unretained(this), suppress_animations)); + entry, + base::BindOnce(&SidePanelCoordinator::PopulateSidePanel, + base::Unretained(this), suppress_animations, input)); } void SidePanelCoordinator::Close(bool suppress_animations) { @@ -610,11 +605,14 @@ return; } - if (current_entry_) { + if (current_key_) { if (browser_view_->toolbar()->pinned_toolbar_actions_container()) { - NotifyPinnedContainerOfActiveStateChange(current_entry_->key(), false); + NotifyPinnedContainerOfActiveStateChange(current_key_->key, false); } - current_entry_->OnEntryWillHide(SidePanelEntryHideReason::kSidePanelClosed); + SidePanelEntry* entry = GetEntryForUniqueKey(*current_key_); + if (entry) { + entry->OnEntryWillHide(SidePanelEntryHideReason::kSidePanelClosed); + } } if (views::View* content_wrapper = browser_view_->unified_side_panel()->GetViewByID( @@ -641,12 +639,15 @@ std::optional<SidePanelCoordinator::UniqueKey> SidePanelCoordinator::GetUniqueKeyForKey( const SidePanelEntry::Key& entry_key) const { - if (GetActiveContextualEntryForKey(entry_key)) { - return UniqueKey{/*tab_scoped=*/true, entry_key}; + if (GetActiveContextualRegistry() && + GetActiveContextualRegistry()->GetEntryForKey(entry_key)) { + return UniqueKey{ + browser_view_->browser()->GetActiveTabInterface()->GetTabHandle(), + entry_key}; } if (window_registry_->GetEntryForKey(entry_key)) { - return UniqueKey{/*tab_scoped=*/false, entry_key}; + return UniqueKey{/*tab_handle=*/std::nullopt, entry_key}; } return std::nullopt; } @@ -669,11 +670,12 @@ bool SidePanelCoordinator::IsGlobalEntryShowing( const SidePanelEntry::Key& entry_key) const { - if (!IsSidePanelShowing() || !current_entry_) { + if (!IsSidePanelShowing() || !current_key_) { return false; } - return window_registry_->GetEntryForKey(entry_key) == current_entry_.get(); + return window_registry_->GetEntryForKey(entry_key) == + GetEntryForUniqueKey(*current_key_); } void SidePanelCoordinator::InitializeSidePanel() { @@ -688,6 +690,7 @@ void SidePanelCoordinator::PopulateSidePanel( bool suppress_animations, + const UniqueKey& unique_key, SidePanelEntry* entry, std::optional<std::unique_ptr<views::View>> content_view) { actions::ActionItem* const action_item = GetActionItem(entry->key()); @@ -712,18 +715,20 @@ suppress_animations ? SidePanelContentState::kShowImmediately : SidePanelContentState::kReadyToShow)); - if (current_entry_ && content_wrapper->children().size()) { - current_entry_->OnEntryWillHide(SidePanelEntryHideReason::kReplaced); - auto current_entry_view = + SidePanelEntry* previous_entry = current_entry_.get(); + + if (previous_entry && content_wrapper->children().size()) { + previous_entry->OnEntryWillHide(SidePanelEntryHideReason::kReplaced); + auto previous_entry_view = content_wrapper->RemoveChildViewT(content_wrapper->children().front()); - current_entry_->CacheView(std::move(current_entry_view)); + previous_entry->CacheView(std::move(previous_entry_view)); } auto* content = content_wrapper->AddChildView( content_view.has_value() ? std::move(content_view.value()) : entry->GetContent()); if (auto* contextual_registry = GetActiveContextualRegistry()) contextual_registry->ResetActiveEntry(); - auto* previous_entry = current_entry_.get(); + current_key_ = unique_key; current_entry_ = entry->GetWeakPtr(); if (browser_view_->toolbar()->pinned_toolbar_actions_container()) { NotifyPinnedContainerOfActiveStateChange(entry->key(), true); @@ -743,8 +748,7 @@ } UpdateNewTabButtonState(); UpdateHeaderPinButtonState(); - header_more_info_button_->SetVisible( - current_entry_->SupportsMoreInfoButton()); + header_more_info_button_->SetVisible(entry->SupportsMoreInfoButton()); // Notify the observers when the side panel is opened (made visible). However, // the observers are not renotified when the side panel entry changes. @@ -879,11 +883,11 @@ // null. if (deregistering_registry == GetActiveContextualRegistry() && window_registry_->GetEntryForKey(key)) { - return UniqueKey{/*tab_scoped=*/false, key}; + return UniqueKey{/*tab_handle=*/std::nullopt, key}; } if (window_registry_->active_entry()) { - return UniqueKey{/*tab_scoped=*/false, + return UniqueKey{/*tab_handle=*/std::nullopt, (*window_registry_->active_entry())->key()}; } return std::nullopt; @@ -912,13 +916,13 @@ auto* active_contextual_registry = GetActiveContextualRegistry(); if (active_contextual_registry && active_contextual_registry->active_entry()) { - return UniqueKey{/*tab_scoped=*/true, - (*active_contextual_registry->active_entry())->key()}; + return UniqueKey{ + browser_view_->browser()->GetActiveTabInterface()->GetTabHandle(), + (*active_contextual_registry->active_entry())->key()}; } - if (current_entry_ && - window_registry_->GetEntryForKey(current_entry_->key())) { - return GetUniqueKeyForKey(current_entry_->key()); + if (current_key_ && window_registry_->GetEntryForKey(current_key_->key)) { + return GetUniqueKeyForKey(current_key_->key); } if (window_registry_->active_entry()) { @@ -951,7 +955,7 @@ void SidePanelCoordinator::MaybeQueuePinPromo() { // Which feature is shown depends on the specific side panel that is showing. const base::Feature* const iph_feature = - (current_entry_->key().id() == SidePanelEntryId::kLensOverlayResults) + (current_key_->key.id() == SidePanelEntryId::kLensOverlayResults) ? &feature_engagement::kIPHSidePanelLensOverlayPinnableFeature : &feature_engagement::kIPHSidePanelGenericPinnableFeature; @@ -1023,7 +1027,8 @@ // currently being shown, show the tab-scoped `entry`. if (registry == GetActiveContextualRegistry() && IsGlobalEntryShowing(entry->key())) { - Show({/*tab_scoped=*/true, entry->key()}, + Show({browser_view_->browser()->GetActiveTabInterface()->GetTabHandle(), + entry->key()}, SidePanelUtil::SidePanelOpenTrigger::kExtensionEntryRegistered, /*suppress_animations=*/true); } @@ -1041,12 +1046,11 @@ // removed or close the panel if the entry being deregistered is the only one // that has been visible. if (IsSidePanelShowing() && - !browser_view_->unified_side_panel()->IsClosing() && current_entry_ && - (current_entry_->key() == entry->key())) { - // If a global entry is deregistered but a contextual entry with the same - // key is shown, do nothing. - if (registry == window_registry_.get() && - GetActiveContextualEntryForKey(entry->key())) { + !browser_view_->unified_side_panel()->IsClosing() && current_key_ && + (current_key_->key == entry->key())) { + // If a global entry is deregistered but we are currently showing a + // tab-scoped key, then do nothing. + if (registry == window_registry_.get() && current_key_->tab_handle) { entry->CacheView(std::move(entry_view)); return; } @@ -1064,13 +1068,17 @@ // different entries being shown. } + // If there is going to be any change to UI, it must be done synchronously + // to avoid state referring to a deregistered SidePanelEntry. Both of these + // control flows will result in a synchronous re-entrancy into + // OnViewVisibilityChanged. if (std::optional<UniqueKey> active_entry = GetNewActiveKeyOnDeregister(registry, entry->key())) { Show(active_entry.value(), SidePanelUtil::SidePanelOpenTrigger::kSidePanelEntryDeregistered, - /*suppress_animations=*/false); + /*suppress_animations=*/true); } else { - Close(); + Close(/*suppress_animations=*/true); } } @@ -1143,7 +1151,10 @@ // the view of the old contextual registry (if it was active), and close // the side panel. if (old_contextual_registry && old_contextual_registry->active_entry() && - *old_contextual_registry->active_entry() == current_entry_.get()) { + current_key_ && + (*old_contextual_registry->active_entry())->key() == + current_key_->key && + current_key_->tab_handle) { auto* content_wrapper = browser_view_->unified_side_panel()->GetViewByID( kSidePanelContentWrapperViewId); @@ -1158,7 +1169,7 @@ } } else if (new_contextual_registry && new_contextual_registry->active_entry().has_value()) { - Show({/*tab_scoped=*/true, + Show({browser_view_->browser()->GetActiveTabInterface()->GetTabHandle(), (*new_contextual_registry->active_entry())->key()}, SidePanelUtil::SidePanelOpenTrigger::kTabChanged, /*suppress_animations=*/true); @@ -1166,21 +1177,22 @@ } void SidePanelCoordinator::UpdateNewTabButtonState() { - if (header_open_in_new_tab_button_ && current_entry_) { + if (header_open_in_new_tab_button_ && current_key_) { + SidePanelEntry* current_entry = GetEntryForUniqueKey(*current_key_); bool has_open_in_new_tab_button = - current_entry_->SupportsNewTabButton() && - current_entry_->GetOpenInNewTabURL().is_valid(); + current_entry->SupportsNewTabButton() && + current_entry->GetOpenInNewTabURL().is_valid(); header_open_in_new_tab_button_->SetVisible(has_open_in_new_tab_button); } } void SidePanelCoordinator::UpdateHeaderPinButtonState() { - if (!IsSidePanelShowing() || !current_entry_) { + if (!IsSidePanelShowing() || !current_key_) { return; } Profile* const profile = browser_view_->GetProfile(); - actions::ActionItem* const action_item = GetActionItem(current_entry_->key()); + actions::ActionItem* const action_item = GetActionItem(current_key_->key); std::optional<actions::ActionId> action_id = action_item->GetActionId(); CHECK(action_id.has_value()); @@ -1189,7 +1201,7 @@ // TODO(b/310910098): Clean condition up once/if ToolbarActionModel and // PinnedToolbarActionModel are merged together. if (const std::optional<extensions::ExtensionId> extension_id = - current_entry_->key().extension_id(); + current_key_->key.extension_id(); extension_id.has_value()) { ToolbarActionsModel* const actions_model = ToolbarActionsModel::Get(profile); @@ -1213,6 +1225,10 @@ } } +SidePanelEntry* SidePanelCoordinator::GetCurrentSidePanelEntryForTesting() { + return GetEntryForUniqueKey(*current_key_); +} + void SidePanelCoordinator::SetNoDelaysForTesting(bool no_delays_for_testing) { no_delays_for_testing_ = no_delays_for_testing; if (SidePanel* side_panel = browser_view_->unified_side_panel()) { @@ -1245,18 +1261,18 @@ views::View* starting_from) { if (!observed_view->GetVisible()) { bool closing_global = false; - if (current_entry_) { - // Reset current_entry_ first to prevent current_entry->OnEntryHidden() + if (current_key_) { + // Reset current_key_ first to prevent previous_entry->OnEntryHidden() // from calling multiple times. This could happen in the edge cases when // callback inside current_entry->OnEntryHidden() is calling Close() to // trigger race condition. - auto* current_entry = current_entry_.get(); + closing_global = !current_key_->tab_handle; + SidePanelEntry* previous_entry = current_entry_.get(); + current_key_.reset(); current_entry_.reset(); - if (window_registry_->GetEntryForKey(current_entry->key()) == - current_entry) { - closing_global = true; + if (previous_entry) { + previous_entry->OnEntryHidden(); } - current_entry->OnEntryHidden(); } // Reset active entry values for all observed registries and clear cache for @@ -1293,7 +1309,18 @@ } void SidePanelCoordinator::OnActionsChanged() { - if (current_entry_) { + if (current_key_) { UpdateHeaderPinButtonState(); } } + +SidePanelEntry* SidePanelCoordinator::GetEntryForUniqueKey( + const UniqueKey& unique_key) const { + SidePanelEntry* entry = nullptr; + if (unique_key.tab_handle) { + entry = GetActiveContextualEntryForKey(unique_key.key); + } else { + entry = window_registry_->GetEntryForKey(unique_key.key); + } + return entry; +}
diff --git a/chrome/browser/ui/views/side_panel/side_panel_coordinator.h b/chrome/browser/ui/views/side_panel/side_panel_coordinator.h index ada5e2f..610497b 100644 --- a/chrome/browser/ui/views/side_panel/side_panel_coordinator.h +++ b/chrome/browser/ui/views/side_panel/side_panel_coordinator.h
@@ -15,6 +15,7 @@ #include "base/scoped_observation_traits.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "chrome/browser/ui/tabs/tab_model.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/toolbar/pinned_toolbar/pinned_toolbar_actions_model.h" #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" @@ -102,9 +103,7 @@ void UpdateHeaderPinButtonState(); - SidePanelEntry* GetCurrentSidePanelEntryForTesting() { - return current_entry_.get(); - } + SidePanelEntry* GetCurrentSidePanelEntryForTesting(); actions::ActionItem* GetActionItem(SidePanelEntry::Key entry_key); @@ -132,12 +131,14 @@ PopulateUserNoteSidePanel); // The side panel entry to be shown is uniquely specified via a tuple: - // (tab or window-scoped registry, SidePanelEntry::Key). `tab_scoped` is + // (tab or window-scoped registry, SidePanelEntry::Key). `tab_handle` is // necessary since it's possible for a Key to be present in both the - // tab-scoped and window-scoped registry, and we must distinguish. + // tab-scoped and window-scoped registry, or in multiple different tab-scoped + // registries. struct UniqueKey { - bool tab_scoped; + std::optional<uint32_t> tab_handle; SidePanelEntry::Key key; + friend bool operator==(const UniqueKey&, const UniqueKey&) = default; }; // This method does not show the side panel. Instead, it queues the side panel // to be shown once the contents has been loaded. This process may be either @@ -173,6 +174,7 @@ // provided SidePanelEntry. void PopulateSidePanel( bool suppress_animations, + const UniqueKey& unique_key, SidePanelEntry* entry, std::optional<std::unique_ptr<views::View>> content_view); @@ -248,6 +250,9 @@ void OnToolbarModelInitialized() override {} void OnToolbarPinnedActionsChanged() override; + // Returns the SidePanelEntry uniquely specified by UniqueKey. + SidePanelEntry* GetEntryForUniqueKey(const UniqueKey& unique_key) const; + // When true, prevent loading delays when switching between side panel // entries. bool no_delays_for_testing_ = false; @@ -262,14 +267,16 @@ // This registry is scoped to the browser window and is owned by this class. std::unique_ptr<SidePanelRegistry> window_registry_; - // current_entry_ tracks the entry that currently has its view hosted by the - // side panel. It is necessary as current_entry_ may belong to a contextual - // registry that is swapped out (during a tab switch for e.g.). In such - // situations we may still need a reference to the entry corresponding to the - // hosted view so we can cache and clean up appropriately before switching in - // the new entry. - // Use a weak pointer so that current side panel entry can be reset - // automatically if the entry is destroyed. + // current_key_ uniquely identifies the SidePanelEntry that has its view + // hosted by the side panel. At the time that it is set and for most code + // paths, the SidePanelEntry is guaranteed to exist. It does not exist in the + // following cases: + // * The active tab is switched, and UniqueKey is tab-scoped. + // * The entry is removed from tab or window-scoped registry. + std::optional<UniqueKey> current_key_; + // TODO(https://crbug.com/363743081): Remove this member. + // There are a few cases where the current control flow first modifies the + // active registry, then tries to reference the previous entry. base::WeakPtr<SidePanelEntry> current_entry_; // Used to update icon in the side panel header.
diff --git a/chrome/browser/ui/views/user_education/feature_promo_lifecycle_interactive_uitest.cc b/chrome/browser/ui/views/user_education/feature_promo_lifecycle_interactive_uitest.cc index fcec7a8..53f7d92 100644 --- a/chrome/browser/ui/views/user_education/feature_promo_lifecycle_interactive_uitest.cc +++ b/chrome/browser/ui/views/user_education/feature_promo_lifecycle_interactive_uitest.cc
@@ -612,13 +612,7 @@ CheckDismissed(true, &kFeaturePromoLifecycleTestPromo, app1_id_)); } -// TODO(crbug.com/362182859): flaky on Linux. -#if BUILDFLAG(IS_LINUX) -#define MAYBE_ShowForTwoApps DISABLED_ShowForTwoApps -#else -#define MAYBE_ShowForTwoApps ShowForTwoApps -#endif -IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleAppUiTest, MAYBE_ShowForTwoApps) { +IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleAppUiTest, ShowForTwoApps) { Browser* const app_browser = LaunchWebAppBrowser(app1_id_); Browser* const app_browser2 = LaunchWebAppBrowser(app2_id_); RunTestSequenceInContext(
diff --git a/chrome/browser/ui/webui/commerce/product_specifications_disclosure_dialog.cc b/chrome/browser/ui/webui/commerce/product_specifications_disclosure_dialog.cc index 6ee789f..f1d253d 100644 --- a/chrome/browser/ui/webui/commerce/product_specifications_disclosure_dialog.cc +++ b/chrome/browser/ui/webui/commerce/product_specifications_disclosure_dialog.cc
@@ -28,7 +28,7 @@ namespace { -constexpr gfx::Size kDialogSize{450, 350}; +constexpr gfx::Size kDialogSize{470, 350}; void UpdateDialogPosition(views::Widget* widget, content::WebContents* web_contents) {
diff --git a/chrome/browser/ui/webui/commerce/product_specifications_ui.cc b/chrome/browser/ui/webui/commerce/product_specifications_ui.cc index 97f97be..1d438b6 100644 --- a/chrome/browser/ui/webui/commerce/product_specifications_ui.cc +++ b/chrome/browser/ui/webui/commerce/product_specifications_ui.cc
@@ -90,7 +90,6 @@ {"disclosureDataItem", IDS_COMPARE_DISCLOSURE_DATA_ITEM}, {"disclosureItemsHeader", IDS_COMPARE_DISCLOSURE_ITEMS_HEADER}, {"disclosureTitle", IDS_COMPARE_DISCLOSURE_TITLE}, - {"disclosureLearnMore", IDS_COMPARE_DISCLOSURE_LEARN_MORE}, // Main UI strings: {"buyingOptions", IDS_SHOPPING_INSIGHTS_BUYING_OPTIONS},
diff --git a/chrome/browser/ui/webui/data_sharing/data_sharing_ui.cc b/chrome/browser/ui/webui/data_sharing/data_sharing_ui.cc index 08231d0..74e801c9 100644 --- a/chrome/browser/ui/webui/data_sharing/data_sharing_ui.cc +++ b/chrome/browser/ui/webui/data_sharing/data_sharing_ui.cc
@@ -21,6 +21,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" +#include "ui/webui/color_change_listener/color_change_handler.h" #include "ui/webui/webui_allowlist.h" DataSharingUIConfig::DataSharingUIConfig() @@ -69,6 +70,7 @@ source->OverrideContentSecurityPolicy( network::mojom::CSPDirectiveName::StyleSrc, "style-src " + "chrome-untrusted://theme " "'self';"); // Allow external network connections to be made. @@ -102,6 +104,13 @@ } } +void DataSharingUI::BindInterface( + mojo::PendingReceiver<color_change_listener::mojom::PageHandler> + pending_receiver) { + color_provider_handler_ = std::make_unique<ui::ColorChangeHandler>( + web_ui()->GetWebContents(), std::move(pending_receiver)); +} + void DataSharingUI::CreatePageHandler( mojo::PendingRemote<data_sharing::mojom::Page> page, mojo::PendingReceiver<data_sharing::mojom::PageHandler> receiver) {
diff --git a/chrome/browser/ui/webui/data_sharing/data_sharing_ui.h b/chrome/browser/ui/webui/data_sharing/data_sharing_ui.h index 2a47f8e..911eb86 100644 --- a/chrome/browser/ui/webui/data_sharing/data_sharing_ui.h +++ b/chrome/browser/ui/webui/data_sharing/data_sharing_ui.h
@@ -8,6 +8,11 @@ #include "chrome/browser/ui/webui/data_sharing/data_sharing.mojom.h" #include "chrome/browser/ui/webui/top_chrome/top_chrome_webui_config.h" #include "chrome/browser/ui/webui/top_chrome/untrusted_top_chrome_web_ui_controller.h" +#include "ui/webui/resources/cr_components/color_change_listener/color_change_listener.mojom.h" + +namespace ui { +class ColorChangeHandler; +} class DataSharingPageHandler; class DataSharingUI; @@ -35,6 +40,9 @@ ~DataSharingUI() override; void BindInterface( + mojo::PendingReceiver<color_change_listener::mojom::PageHandler> + pending_receiver); + void BindInterface( mojo::PendingReceiver<data_sharing::mojom::PageHandlerFactory> receiver); void ApiInitComplete(); @@ -51,6 +59,7 @@ mojo::PendingReceiver<data_sharing::mojom::PageHandler> receiver) override; + std::unique_ptr<ui::ColorChangeHandler> color_provider_handler_; std::unique_ptr<DataSharingPageHandler> page_handler_; mojo::Receiver<data_sharing::mojom::PageHandlerFactory>
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc index bb686bc..a6f3bf8c 100644 --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -385,7 +385,7 @@ return std::make_unique<SupervisedUserVerificationPage>( web_contents, "first.last@gmail.com", kRequestUrl, SupervisedUserVerificationPage::VerificationPurpose::REAUTH_REQUIRED_SITE, - /*child_account_service*/ nullptr, + /*child_account_service*/ nullptr, ukm::kInvalidSourceId, std::make_unique<SupervisedUserVerificationControllerClient>( web_contents, Profile::FromBrowserContext(web_contents->GetBrowserContext()) @@ -401,7 +401,7 @@ return std::make_unique<SupervisedUserVerificationPage>( web_contents, "first.last@gmail.com", kRequestUrl, SupervisedUserVerificationPage::VerificationPurpose::BLOCKED_SITE, - /*child_account_service*/ nullptr, + /*child_account_service*/ nullptr, ukm::kInvalidSourceId, std::make_unique<SupervisedUserVerificationControllerClient>( web_contents, Profile::FromBrowserContext(web_contents->GetBrowserContext())
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index 82dd1129..e257291 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -69,6 +69,7 @@ #include "components/autofill/core/common/autofill_constants.h" #include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/autofill_payments_features.h" +#include "components/autofill_prediction_improvements/core/browser/autofill_prediction_improvements_features.h" #include "components/content_settings/core/common/features.h" #include "components/device_reauth/device_authenticator.h" #include "components/dom_distiller/core/dom_distiller_features.h" @@ -1261,7 +1262,8 @@ IDS_SETTINGS_EXPERIMENTAL_ADVANCED_FEATURE3_LABEL}, {"experimentalAdvancedFeature3Sublabel", IDS_SETTINGS_EXPERIMENTAL_ADVANCED_FEATURE3_SUBLABEL}, - }; + {"autofillPredictionImprovementsPageTitle", + IDS_SETTINGS_AUTOFILL_PREDICTION_IMPROVEMENTS_PAGE_TITLE}}; GURL google_password_manager_url = GetGooglePasswordManagerURL( password_manager::ManagePasswordsReferrer::kChromeSettings); @@ -1362,6 +1364,11 @@ "requireValidLocalCards", base::FeatureList::IsEnabled( autofill::features::kAutofillRequireValidLocalCardsInSettings)); + + html_source->AddBoolean( + "autofillPredictionImprovementsEnabled", + base::FeatureList::IsEnabled( + autofill_prediction_improvements::kAutofillPredictionImprovements)); } void AddSignOutDialogStrings(content::WebUIDataSource* html_source,
diff --git a/chrome/browser/updater/browser_updater_client.cc b/chrome/browser/updater/browser_updater_client.cc index 1b3d259..ec308fc8 100644 --- a/chrome/browser/updater/browser_updater_client.cc +++ b/chrome/browser/updater/browser_updater_client.cc
@@ -138,13 +138,9 @@ base::OnceCallback<void(bool)> callback, const std::vector<updater::UpdateService::AppState>& apps) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - const std::string app_id = GetAppId(); - std::move(callback).Run( - std::find_if(apps.begin(), apps.end(), - [&](const updater::UpdateService::AppState& app) { - return base::EqualsCaseInsensitiveASCII(app.app_id, - app_id); - }) != apps.end()); + std::move(callback).Run(std::find_if(apps.begin(), apps.end(), + &BrowserUpdaterClient::AppMatches) != + apps.end()); } // User and System BrowserUpdaterClients must be kept separate - the template
diff --git a/chrome/browser/updater/browser_updater_client.h b/chrome/browser/updater/browser_updater_client.h index 6ca9796..f78ca6fe 100644 --- a/chrome/browser/updater/browser_updater_client.h +++ b/chrome/browser/updater/browser_updater_client.h
@@ -78,8 +78,9 @@ private: SEQUENCE_CHECKER(sequence_checker_); + static std::string GetAppId(); + static bool AppMatches(const updater::UpdateService::AppState& app); updater::RegistrationRequest GetRegistrationRequest(); - std::string GetAppId(); void RegistrationCompleted(base::OnceClosure complete, int result); void GetUpdaterVersionCompleted(
diff --git a/chrome/browser/updater/browser_updater_client_mac.mm b/chrome/browser/updater/browser_updater_client_mac.mm index 39d75c0..515475d9 100644 --- a/chrome/browser/updater/browser_updater_client_mac.mm +++ b/chrome/browser/updater/browser_updater_client_mac.mm
@@ -8,6 +8,7 @@ #include "base/apple/bundle_locations.h" #include "base/apple/foundation_util.h" +#include "base/strings/string_util.h" #include "chrome/browser/google/google_brand.h" #include "chrome/browser/updater/browser_updater_client_util.h" #include "chrome/common/channel_info.h" @@ -29,3 +30,9 @@ req.existence_checker_path = bundle; return req; } + +bool BrowserUpdaterClient::AppMatches( + const updater::UpdateService::AppState& app) { + return base::EqualsCaseInsensitiveASCII(app.app_id, GetAppId()) && + app.ecp == base::apple::OuterBundlePath(); +}
diff --git a/chrome/browser/updater/browser_updater_client_win.cc b/chrome/browser/updater/browser_updater_client_win.cc index c16a957..4a681d02 100644 --- a/chrome/browser/updater/browser_updater_client_win.cc +++ b/chrome/browser/updater/browser_updater_client_win.cc
@@ -7,6 +7,7 @@ #include <string> #include "base/notreached.h" +#include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" #include "base/time/time.h" #include "base/version.h" @@ -28,3 +29,8 @@ base::SysWideToUTF8(install_static::InstallDetails::Get().update_ap()); return req; } + +bool BrowserUpdaterClient::AppMatches( + const updater::UpdateService::AppState& app) { + return base::EqualsCaseInsensitiveASCII(app.app_id, GetAppId()); +}
diff --git a/chrome/browser/vr/test/xr_browser_test.cc b/chrome/browser/vr/test/xr_browser_test.cc index f7b1dd3..1e7990c 100644 --- a/chrome/browser/vr/test/xr_browser_test.cc +++ b/chrome/browser/vr/test/xr_browser_test.cc
@@ -47,7 +47,7 @@ constexpr char XrBrowserTestBase::kSwitchIgnoreRuntimeRequirements[]; const std::vector<std::string> XrBrowserTestBase::kRequiredTestSwitches{ "enable-gpu", "enable-pixel-output-in-tests", - "run-through-xr-wrapper-script"}; + "run-through-xr-wrapper-script", "enable-unsafe-swiftshader"}; const std::vector<std::pair<std::string, std::string>> XrBrowserTestBase::kRequiredTestSwitchesWithValues{ std::pair<std::string, std::string>("test-launcher-jobs", "1")};
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_controller.cc b/chrome/browser/webauthn/authenticator_request_dialog_controller.cc index 81a73f5..dd690bb 100644 --- a/chrome/browser/webauthn/authenticator_request_dialog_controller.cc +++ b/chrome/browser/webauthn/authenticator_request_dialog_controller.cc
@@ -2435,9 +2435,7 @@ } #elif BUILDFLAG(IS_MAC) // If there are multiple platform authenticators, one of them is the default. - if (!type.has_value() && - base::FeatureList::IsEnabled( - device::kWebAuthnPreferVirtualPlatformAuthenticator)) { + if (!type.has_value()) { if (base::ranges::any_of( authenticators, [](const AuthenticatorReference& ref) { return ref.type == AuthenticatorType::kOther &&
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc index c4ed5e16..1f05c844 100644 --- a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc +++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
@@ -217,10 +217,6 @@ if (extension.id() == rp_id) { return true; } - if (!base::FeatureList::IsEnabled( - device::kAllowExtensionsToSetWebAuthnRpIds)) { - return false; - } // Extensions may not claim eTLDs as RP IDs, even if WebAuthn does not // forbid origins from doing so if they are eTLDs themselves.
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 75cc8c6..59e8fdd 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1725371904-6a72aaac82a5988b6e3df6d07c39b5cff405bce8-8bd1ee2b52db8e68fab5daad52dc66fecc234f14.profdata +chrome-mac-arm-main-1725386325-7ccd7a6d3677514ebe19caea03974004ade6f179-b5129dee21dbb804cb1c83fb36a5d53a40618516.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 5954d8335..d4e6e94 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1725364637-bc03be861a17ed1f790b89362d8843d9f8152972-26695bbc5f100cc7e4c982593ef050dc431e5efa.profdata +chrome-win32-main-1725375522-b504c58f193ff3bcc810e12dc37411824b69b197-6b2f4b11472254866735f549155a86162cc61b4b.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index c91d862..d8da5ae 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1725364637-1b5b5cdbe10fa7afe9b38a79400ef12f85edb316-26695bbc5f100cc7e4c982593ef050dc431e5efa.profdata +chrome-win64-main-1725375522-b6cc32742732a68ec9e855c58db3ce51e782f951-6b2f4b11472254866735f549155a86162cc61b4b.profdata
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index dca7b78..617f0c7 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc
@@ -598,9 +598,6 @@ // TLS 1.3 mode for |kSSLVersionMax| and |kSSLVersionMin| switches. const char kSSLVersionTLSv13[] = "tls1.3"; -// Use the thread pool for stack profiler. -const char kStackProfilerUseThreadPool[] = "stack-profiler-thread-pool"; - // Starts the browser maximized, regardless of any previous settings. const char kStartMaximized[] = "start-maximized";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 86195f4..a7f22508 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h
@@ -178,7 +178,6 @@ extern const char kSSLVersionMin[]; extern const char kSSLVersionTLSv12[]; extern const char kSSLVersionTLSv13[]; -extern const char kStackProfilerUseThreadPool[]; extern const char kStartMaximized[]; extern const char kStartStackProfiler[]; extern const char kStartStackProfilerBrowserTest[];
diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index 55fb986..f3518cc 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json
@@ -417,6 +417,9 @@ "enterprise.reportingPrivate.getHotfixes": { "platforms": ["win"] }, + "enterprise.reportingPrivate.reportDataMaskingEvent": { + "feature_flag": "ApiEnterpriseReportingPrivateReportDataMaskingEvent" + }, "experimental.devtools.audits": { "nocompile": true, "dependencies": ["permission:experimental", "manifest:devtools_page"],
diff --git a/chrome/common/extensions/api/enterprise_reporting_private.idl b/chrome/common/extensions/api/enterprise_reporting_private.idl index 40b8965..d20a184 100644 --- a/chrome/common/extensions/api/enterprise_reporting_private.idl +++ b/chrome/common/extensions/api/enterprise_reporting_private.idl
@@ -312,6 +312,34 @@ callback SettingsCallback = void(GetSettingsResponse[] settings); + // Indicates what resulted from an event sent through a `DataMaskingEvent`. + enum EventResult { EVENT_RESULT_DATA_MASKED, EVENT_RESULT_DATA_UNMASKED }; + + // Indicates the type of detector that was used match against data by the data + // masking extension. + enum DetectorType { PREDEFINED_DLP, USER_DEFINED }; + + // Information for a data detector used to apply data masking functionality. + dictionary MatchedDetector { + DOMString detectorId; + DOMString displayName; + DetectorType detectorType; + }; + + // Information for a data leak prevention rule that was used to mask data. + dictionary TriggeredRuleInfo { + DOMString ruleId; + DOMString ruleName; + MatchedDetector[] matchedDetectors; + }; + + // Event representing that something happened in the data masking extension. + dictionary DataMaskingEvent { + DOMString url; + EventResult eventResult; + TriggeredRuleInfo[] triggeredRuleInfo; + }; + interface Functions { // Gets the identity of device that Chrome browser is running on. The ID is // retrieved from the local device and used by the Google admin console. @@ -402,6 +430,12 @@ // results will be returned. [platforms = ("win")] static void getHotfixes(UserContext userContext, HotfixesCallback callback); + + // Sends the passed `event` to the reporting service if the browser or + // profile is managed and the "OnSecurityEventEnterpriseConnector" policy is + // enabled. + static void reportDataMaskingEvent(DataMaskingEvent event, + DoneCallback callback); }; };
diff --git a/chrome/common/profiler/thread_profiler_configuration.cc b/chrome/common/profiler/thread_profiler_configuration.cc index bbbc53e..89ac7d257 100644 --- a/chrome/common/profiler/thread_profiler_configuration.cc +++ b/chrome/common/profiler/thread_profiler_configuration.cc
@@ -9,7 +9,6 @@ #include "base/no_destructor.h" #include "base/notreached.h" #include "base/profiler/process_type.h" -#include "base/profiler/stack_sampler.h" #include "base/rand_util.h" #include "build/branding_buildflags.h" #include "chrome/common/channel_info.h" @@ -114,10 +113,6 @@ *group_name = "Control"; break; - case kProfileEnabledWithThreadPool: - *group_name = "EnabledWithThreadPool"; - break; - case kProfileEnabled: *group_name = "Enabled"; break; @@ -160,15 +155,6 @@ } } -bool ThreadProfilerConfiguration::IsThreadPoolEnabledForCurrentProcess() const { - if (absl::holds_alternative<ChildProcessConfiguration>(configuration_)) { - return base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kStackProfilerUseThreadPool); - } - - const auto& config = absl::get<BrowserProcessConfiguration>(configuration_); - return config.variation_group == kProfileEnabledWithThreadPool; -} ThreadProfilerConfiguration::ThreadProfilerConfiguration() : platform_configuration_(ThreadProfilerPlatformConfiguration::Create( @@ -176,7 +162,6 @@ configuration_(GenerateConfiguration( GetProfilerProcessType(*base::CommandLine::ForCurrentProcess()), *platform_configuration_)) { - base::StackSampler::SetUseThreadPool(IsThreadPoolEnabledForCurrentProcess()); } // static @@ -186,7 +171,6 @@ // that are to be enabled. return variation_group.has_value() && (*variation_group == kProfileEnabled || - *variation_group == kProfileEnabledWithThreadPool || *variation_group == kProfileControl); } @@ -250,14 +234,13 @@ const std::optional<base::ProfilerProcessType> process_type_to_sample = platform_configuration.ChooseEnabledProcess(); - CHECK_EQ(0, relative_populations.experiment % 3); + CHECK_EQ(0, relative_populations.experiment % 2); return { ChooseVariationGroup({ {kProfileDisabledOutsideOfExperiment, relative_populations.disabled}, {kProfileEnabled, relative_populations.enabled}, - {kProfileEnabledWithThreadPool, relative_populations.experiment / 3}, - {kProfileControl, relative_populations.experiment / 3}, - {kProfileDisabled, relative_populations.experiment / 3}, + {kProfileControl, relative_populations.experiment / 2}, + {kProfileDisabled, relative_populations.experiment / 2}, }), process_type_to_sample}; }
diff --git a/chrome/common/profiler/thread_profiler_configuration.h b/chrome/common/profiler/thread_profiler_configuration.h index 739572f..22e6ba1 100644 --- a/chrome/common/profiler/thread_profiler_configuration.h +++ b/chrome/common/profiler/thread_profiler_configuration.h
@@ -60,9 +60,6 @@ void AppendCommandLineSwitchForChildProcess( base::CommandLine* command_line) const; - // True if the thread pool is used for unwinding. - bool IsThreadPoolEnabledForCurrentProcess() const; - private: friend base::NoDestructor<ThreadProfilerConfiguration>; @@ -80,11 +77,6 @@ // kProfileDisabled group). kProfileControl, - // Enabled within the experiment (and paired with equal-sized - // kProfileDisabled and kProfileControl groups). The stack - // unwinder with use a thread pool. - kProfileEnabledWithThreadPool, - // Enabled outside of the experiment. kProfileEnabled,
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration.cc b/chrome/common/profiler/thread_profiler_platform_configuration.cc index fb8bb7b5..69ba9b3b 100644 --- a/chrome/common/profiler/thread_profiler_platform_configuration.cc +++ b/chrome/common/profiler/thread_profiler_platform_configuration.cc
@@ -75,9 +75,9 @@ if (*release_channel == version_info::Channel::BETA) { // TODO(crbug.com/1497983): Ramp up enable rate on Non-Android platforms. - return RelativePopulations{85, 0, 15}; + return RelativePopulations{90, 0, 10}; } - return RelativePopulations{0, 70, 30}; + return RelativePopulations{0, 80, 20}; } double DefaultPlatformConfiguration::GetChildProcessPerExecutionEnableFraction( @@ -202,15 +202,19 @@ *release_channel == version_info::Channel::BETA); if (*release_channel == version_info::Channel::BETA) { - // TODO(crbug.com/40191622): Enable for 100% of the population. - return RelativePopulations{25, 0, 75}; + // For 100% of population + // - 1/2 within the subgroup, i.e. 50% of total population, enable + // profiling. + // - 1/2 within the subgroup, disable profiling. + // This results a total of 50% enable rate. + return RelativePopulations{0, 0, 100}; } + // For 100% of population - // - 1/3 within the subgroup, i.e. 50% of total population, enable profiling. - // - 1/3 within the subgroup, i.e. 50% of total population, enable profiling - // with thread pool unwinding. - // - 1/3 within the subgroup, disable profiling. - return RelativePopulations{0, 1, 99}; + // - 1/2 within the subgroup, i.e. 50% of total population, enable profiling. + // - 1/2 within the subgroup, disable profiling. + // This results a total of 50% enable rate. + return RelativePopulations{0, 0, 100}; } double AndroidPlatformConfiguration::GetChildProcessPerExecutionEnableFraction(
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc b/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc index 174c5e1..4f4bb88 100644 --- a/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc +++ b/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc
@@ -90,21 +90,21 @@ using RelativePopulations = ThreadProfilerPlatformConfiguration::RelativePopulations; #if BUILDFLAG(IS_ANDROID) - EXPECT_EQ((RelativePopulations{0, 1, 99}), + EXPECT_EQ((RelativePopulations{0, 0, 100}), config()->GetEnableRates(version_info::Channel::CANARY)); - EXPECT_EQ((RelativePopulations{0, 1, 99}), + EXPECT_EQ((RelativePopulations{0, 0, 100}), config()->GetEnableRates(version_info::Channel::DEV)); - EXPECT_EQ((RelativePopulations{25, 0, 75}), + EXPECT_EQ((RelativePopulations{0, 0, 100}), config()->GetEnableRates(version_info::Channel::BETA)); // Note: death tests aren't supported on Android. Otherwise this test would // check that the other inputs result in CHECKs. #else EXPECT_CHECK_DEATH(config()->GetEnableRates(version_info::Channel::UNKNOWN)); - EXPECT_EQ((RelativePopulations{0, 70, 30}), + EXPECT_EQ((RelativePopulations{0, 80, 20}), config()->GetEnableRates(version_info::Channel::CANARY)); - EXPECT_EQ((RelativePopulations{0, 70, 30}), + EXPECT_EQ((RelativePopulations{0, 80, 20}), config()->GetEnableRates(version_info::Channel::DEV)); - EXPECT_EQ((RelativePopulations{85, 0, 15}), + EXPECT_EQ((RelativePopulations{90, 0, 10}), config()->GetEnableRates(version_info::Channel::BETA)); EXPECT_CHECK_DEATH(config()->GetEnableRates(version_info::Channel::STABLE));
diff --git a/chrome/renderer/BUILD.gn b/chrome/renderer/BUILD.gn index 430bda9..d869e47d 100644 --- a/chrome/renderer/BUILD.gn +++ b/chrome/renderer/BUILD.gn
@@ -8,6 +8,7 @@ import("//chrome/common/features.gni") import("//components/nacl/features.gni") import("//components/offline_pages/buildflags/features.gni") +import("//components/optimization_guide/features.gni") import("//components/signin/features.gni") import("//components/spellcheck/spellcheck_build_features.gni") import("//extensions/buildflags/buildflags.gni") @@ -411,6 +412,24 @@ "//services/strings", "//third_party/re2:re2", ] + + if (build_with_tflite_lib) { + sources += [ + "accessibility/phrase_segmentation/dependency_parser_model.cc", + "accessibility/phrase_segmentation/dependency_parser_model.h", + "accessibility/phrase_segmentation/dependency_parser_op_resolver.cc", + "accessibility/phrase_segmentation/dependency_parser_op_resolver.h", + ] + + deps += [ + "//third_party/tensorflow_models:tflite_custom_ops", + "//third_party/tflite", + "//third_party/tflite:buildflags", + "//third_party/tflite:tflite_public_headers", + "//third_party/tflite_support", + "//third_party/tflite_support:tflite_support_proto", + ] + } } if (is_chromeos_ash) {
diff --git a/chrome/renderer/accessibility/phrase_segmentation/DEPS b/chrome/renderer/accessibility/phrase_segmentation/DEPS new file mode 100644 index 0000000..2d5ad18 --- /dev/null +++ b/chrome/renderer/accessibility/phrase_segmentation/DEPS
@@ -0,0 +1,6 @@ +include_rules = [ + "+components/optimization_guide", + "+third_party/tflite", + "+third_party/tflite_support", + "+third_party/tensorflow_models/src", +] \ No newline at end of file
diff --git a/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.cc b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.cc new file mode 100644 index 0000000..b82fd4a --- /dev/null +++ b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.cc
@@ -0,0 +1,119 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h" + +#include "base/metrics/histogram_functions.h" +#include "base/metrics/histogram_macros.h" +#include "base/metrics/histogram_macros_local.h" +#include "base/timer/elapsed_timer.h" +#include "chrome/renderer/accessibility/phrase_segmentation/dependency_parser_op_resolver.h" +#include "components/optimization_guide/core/optimization_guide_features.h" +#include "third_party/tflite_support/src/tensorflow_lite_support/cc/task/core/tflite_engine.h" + +namespace { + +// Util class for recording the result of loading the dependency parser model. +// The result is recorded when it goes out of scope and its destructor is +// called. +class ScopedDependencyParserModelStateRecorder { + public: + explicit ScopedDependencyParserModelStateRecorder( + DependencyParserModelState state) + : state_(state) {} + + ScopedDependencyParserModelStateRecorder( + const ScopedDependencyParserModelStateRecorder&) = delete; + ScopedDependencyParserModelStateRecorder& operator=( + const ScopedDependencyParserModelStateRecorder&) = delete; + + ~ScopedDependencyParserModelStateRecorder() { + UMA_HISTOGRAM_ENUMERATION( + "Accessibility.DependencyParserModel.DependencyParserModelState", + state_); + } + + void set_state(DependencyParserModelState state) { state_ = state; } + + private: + DependencyParserModelState state_; +}; + +} // namespace + +DependencyParserModel::DependencyParserModel() + : num_threads_(optimization_guide::features::OverrideNumThreadsForOptTarget( + optimization_guide::proto:: + OPTIMIZATION_TARGET_PHRASE_SEGMENTATION) + .value_or(-1)) {} + +DependencyParserModel::~DependencyParserModel() = default; + +void DependencyParserModel::UpdateWithFile(base::File model_file) { + ScopedDependencyParserModelStateRecorder recorder( + DependencyParserModelState::kModelFileInvalid); + + if (!model_file.IsValid()) { + return; + } + + base::ElapsedTimer timer; + std::string file_content(model_file.GetLength(), '\0'); + if (!model_file.ReadAndCheck(0, base::as_writable_byte_span(file_content))) { + return; + } + + auto tflite_engine = std::make_unique<tflite::task::core::TfLiteEngine>( + std::make_unique<DependencyParserOpResolver>()); + absl::Status model_load_status = tflite_engine->BuildModelFromFlatBuffer( + reinterpret_cast<const char*>(std::data(file_content)), + model_file.GetLength()); + if (!model_load_status.ok()) { + LOCAL_HISTOGRAM_BOOLEAN( + "Accessibility.DependencyParserModel.InvalidModelFile", true); + DLOG(ERROR) << "Failed to load model: " << model_load_status.ToString(); + return; + } + + recorder.set_state(DependencyParserModelState::kModelFileValid); + + auto compute_settings = tflite::proto::ComputeSettings(); + compute_settings.mutable_tflite_settings() + ->mutable_cpu_settings() + ->set_num_threads(num_threads_); + absl::Status interpreter_status = + tflite_engine->InitInterpreter(compute_settings); + if (!interpreter_status.ok()) { + DLOG(ERROR) << "Failed to initialize model interpreter: " + << interpreter_status.ToString(); + return; + } + base::UmaHistogramTimes("Accessibility.DependencyParserModel.Create.Duration", + timer.Elapsed()); + + recorder.set_state(DependencyParserModelState::kModelAvailable); + + dependency_parser_model_ = std::move(tflite_engine); +} + +bool DependencyParserModel::IsAvailable() const { + return dependency_parser_model_ != nullptr; +} + +int64_t DependencyParserModel::GetModelVersion() const { + // TODO(b/339037155): Return the model version provided + // by the model itself. + return 1; +} + +std::vector<unsigned int> GetDependencyHeads(std::vector<std::string> input) { + // TODO(b/339037155): Implement the operations to get the dependency heads for + // each word in a sentence. This method performs the following operations: + // 1. Tokenizes the input string. + // 2. Processes the tokens (N tokens) using the TFLite model to generate a + // dependency probability matrix (NxN). + // 3. Utilizes a Minimum Spanning Tree (MST) algorithm to identify the + // dependency head for each word. + return std::vector<unsigned int>(); +}
diff --git a/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h new file mode 100644 index 0000000..1890abb --- /dev/null +++ b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h
@@ -0,0 +1,68 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_ACCESSIBILITY_PHRASE_SEGMENTATION_DEPENDENCY_PARSER_MODEL_H_ +#define CHROME_RENDERER_ACCESSIBILITY_PHRASE_SEGMENTATION_DEPENDENCY_PARSER_MODEL_H_ + +#include "base/files/file.h" +#include "third_party/tflite/src/tensorflow/lite/core/interpreter.h" + +namespace tflite::task::core { +class TfLiteEngine; +} // namespace tflite::task::core + +// The state of the dependency parser model file. +// LINT.IfChange(DependencyParserModelState) +enum class DependencyParserModelState { + // The dependency parser model state is not known. + kUnknown, + // The provided model file was not valid. + kModelFileInvalid, + // The dependency parser model's `base::File` is valid. + kModelFileValid, + // The dependency parser model is available for use with TFLite. + kModelAvailable, + + // New values above this line. + kMaxValue = kModelAvailable, +}; +// LINT.ThenChange(/tools/metrics/histograms/metadata/accessibility/enums.xml:DependencyParserModelState) + +// This class handles the initialization and execution of a TFLite model for +// dependency parsing. The model is constructed using a model file loaded from +// the memory. The model predicts the dependency head for each word in a given +// sentence. +// Each instance of this should only be used from a single thread. +class DependencyParserModel { + public: + DependencyParserModel(); + ~DependencyParserModel(); + + DependencyParserModel(const DependencyParserModel&) = delete; + DependencyParserModel& operator=(const DependencyParserModel&) = delete; + + // Updates the dependency parser model for use by memory-mapping + // the 'model_file' used for dependency parsing. + void UpdateWithFile(base::File model_file); + + // Returns whether 'this' is initialized and is available to handle requests + // to get the dependency head of each word in a sentence. + bool IsAvailable() const; + + int64_t GetModelVersion() const; + + // Runs the TFLite dependency parser model on a string. This will return + // a vector of dependency head for each word in the string. + std::vector<unsigned int> GetDependencyHeads(std::vector<std::string> input); + + private: + // The tflite model for dependency parsing. + std::unique_ptr<tflite::task::core::TfLiteEngine> dependency_parser_model_; + + // The number of threads to use for model inference. -1 tells TFLite to use + // its internal default logic. + const int num_threads_ = -1; +}; + +#endif // CHROME_RENDERER_ACCESSIBILITY_PHRASE_SEGMENTATION_DEPENDENCY_PARSER_MODEL_H_
diff --git a/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model_unittest.cc b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model_unittest.cc new file mode 100644 index 0000000..dcdfadc --- /dev/null +++ b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model_unittest.cc
@@ -0,0 +1,105 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h" + +#include "base/base_paths.h" +#include "base/files/file_path.h" +#include "base/files/scoped_temp_dir.h" +#include "base/path_service.h" +#include "base/test/metrics/histogram_tester.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +base::File CreateInvalidModelFile() { + base::ScopedTempDir temp_dir; + EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); + base::FilePath file_path = + temp_dir.GetPath().AppendASCII("model_file.tflite"); + base::File file(file_path, (base::File::FLAG_CREATE | base::File::FLAG_READ | + base::File::FLAG_WRITE | + base::File::FLAG_CAN_DELETE_ON_CLOSE)); + EXPECT_TRUE(UNSAFE_TODO(file.WriteAtCurrentPos("12345", 5))); + return file; +} + +base::File GetValidModelFile() { + base::FilePath source_root_dir; + base::PathService::Get(base::DIR_SRC_TEST_DATA_ROOT, &source_root_dir); + base::FilePath model_file_path = source_root_dir.AppendASCII("chrome") + .AppendASCII("test") + .AppendASCII("data") + .AppendASCII("accessibility") + .AppendASCII("phrase_segmentation") + .AppendASCII("model.tflite"); + base::File file(model_file_path, + (base::File::FLAG_OPEN | base::File::FLAG_READ)); + return file; +} + +std::unique_ptr<DependencyParserModel> GetValidDependencyParserModel() { + auto instance = std::make_unique<DependencyParserModel>(); + if (!instance->IsAvailable()) { + base::File file = GetValidModelFile(); + instance->UpdateWithFile(std::move(file)); + } + EXPECT_TRUE(instance->IsAvailable()); + return instance; +} + +class DependencyParserModelTest : public testing::Test { + protected: + base::HistogramTester histogram_tester_; +}; + +TEST_F(DependencyParserModelTest, ModelUnavailable) { + DependencyParserModel dependency_parser_model; + EXPECT_FALSE(dependency_parser_model.IsAvailable()); +} + +TEST_F(DependencyParserModelTest, EmptyFileProvided) { + DependencyParserModel dependency_parser_model; + dependency_parser_model.UpdateWithFile(base::File()); + + EXPECT_FALSE(dependency_parser_model.IsAvailable()); + histogram_tester_.ExpectUniqueSample( + "Accessibility.DependencyParserModel.DependencyParserModelState", + DependencyParserModelState::kModelFileInvalid, 1); +} + +TEST_F(DependencyParserModelTest, UnsupportedModelFileProvided) { + base::File file = CreateInvalidModelFile(); + DependencyParserModel dependency_parser_model; + dependency_parser_model.UpdateWithFile(std::move(file)); + EXPECT_FALSE(dependency_parser_model.IsAvailable()); + histogram_tester_.ExpectUniqueSample( + "Accessibility.DependencyParserModel.DependencyParserModelState", + DependencyParserModelState::kModelFileInvalid, 1); + histogram_tester_.ExpectUniqueSample( + "Accessibility.DependencyParserModel.InvalidModelFile", true, 1); + histogram_tester_.ExpectTotalCount( + "Accessibility.DependencyParserModel.Create.Duration", 0); +} + +class DependencyParserModelValidTest : public DependencyParserModelTest { + public: + DependencyParserModelValidTest() + : dependency_parser_model_(GetValidDependencyParserModel()) {} + + protected: + std::unique_ptr<DependencyParserModel> dependency_parser_model_; +}; + +TEST_F(DependencyParserModelValidTest, ValidModelFileProvided) { + histogram_tester_.ExpectUniqueSample( + "Accessibility.DependencyParserModel.DependencyParserModelState", + DependencyParserModelState::kModelAvailable, 1); + histogram_tester_.ExpectTotalCount( + "Accessibility.DependencyParserModel.InvalidModelFile", 0); + histogram_tester_.ExpectTotalCount( + "Accessibility.DependencyParserModel.Create.Duration", 1); +} + +} // namespace
diff --git a/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_op_resolver.cc b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_op_resolver.cc new file mode 100644 index 0000000..623dd12 --- /dev/null +++ b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_op_resolver.cc
@@ -0,0 +1,54 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/accessibility/phrase_segmentation/dependency_parser_op_resolver.h" + +#include "components/optimization_guide/core/optimization_guide_features.h" +#include "third_party/tensorflow_models/src/research/seq_flow_lite/tflite_ops/sequence_string_projection.h" +#include "third_party/tensorflow_models/src/research/seq_flow_lite/tflite_ops/tflite_qrnn_pooling.h" +#include "third_party/tflite/buildflags.h" +#include "third_party/tflite/src/tensorflow/lite/c/common.h" +#include "third_party/tflite/src/tensorflow/lite/kernels/builtin_op_kernels.h" + +#if BUILDFLAG(BUILD_TFLITE_WITH_XNNPACK) +#include "third_party/tflite/src/tensorflow/lite/tflite_with_xnnpack_optional.h" +#endif + +DependencyParserOpResolver::DependencyParserOpResolver() { + AddBuiltin(tflite::BuiltinOperator_CONCATENATION, + tflite::ops::builtin::Register_CONCATENATION()); + AddBuiltin(tflite::BuiltinOperator_CONV_2D, + tflite::ops::builtin::Register_CONV_2D()); + AddBuiltin(tflite::BuiltinOperator_FULLY_CONNECTED, + tflite::ops::builtin::Register_FULLY_CONNECTED()); + AddBuiltin(tflite::BuiltinOperator_LOG_SOFTMAX, + tflite::ops::builtin::Register_LOG_SOFTMAX()); + AddBuiltin(tflite::BuiltinOperator_LOGISTIC, + tflite::ops::builtin::Register_LOGISTIC()); + AddBuiltin(tflite::BuiltinOperator_MUL, tflite::ops::builtin::Register_MUL()); + AddBuiltin(tflite::BuiltinOperator_PAD, tflite::ops::builtin::Register_PAD()); + AddBuiltin(tflite::BuiltinOperator_RESHAPE, + tflite::ops::builtin::Register_RESHAPE()); + AddBuiltin(tflite::BuiltinOperator_SHAPE, + tflite::ops::builtin::Register_SHAPE()); + AddBuiltin(tflite::BuiltinOperator_STRIDED_SLICE, + tflite::ops::builtin::Register_STRIDED_SLICE()); + AddBuiltin(tflite::BuiltinOperator_SUB, tflite::ops::builtin::Register_SUB()); + AddBuiltin(tflite::BuiltinOperator_TANH, + tflite::ops::builtin::Register_TANH()); + AddCustom("PoolingOp", seq_flow_lite::ops::custom::Register_QRNN_POOLING()); + AddCustom( + "SequenceStringProjectionV2", + seq_flow_lite::ops::custom::Register_SEQUENCE_STRING_PROJECTION_V2()); + +#if BUILDFLAG(BUILD_TFLITE_WITH_XNNPACK) + if (optimization_guide::features::TFLiteXNNPACKDelegateEnabled()) { + delegate_creators_.push_back([](TfLiteContext* context) { + return tflite::MaybeCreateXNNPACKDelegate( + context, tflite::XNNPackQS8Options::default_value); + }); + } +#endif +} +DependencyParserOpResolver::~DependencyParserOpResolver() = default;
diff --git a/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_op_resolver.h b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_op_resolver.h new file mode 100644 index 0000000..291ba7d --- /dev/null +++ b/chrome/renderer/accessibility/phrase_segmentation/dependency_parser_op_resolver.h
@@ -0,0 +1,20 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_ACCESSIBILITY_PHRASE_SEGMENTATION_DEPENDENCY_PARSER_OP_RESOLVER_H_ +#define CHROME_RENDERER_ACCESSIBILITY_PHRASE_SEGMENTATION_DEPENDENCY_PARSER_OP_RESOLVER_H_ + +#include "third_party/tflite/src/tensorflow/lite/mutable_op_resolver.h" + +class DependencyParserOpResolver : public tflite::MutableOpResolver { + public: + DependencyParserOpResolver(); + ~DependencyParserOpResolver() override; + + DependencyParserOpResolver(const DependencyParserOpResolver&) = delete; + DependencyParserOpResolver& operator=(const DependencyParserOpResolver&) = + delete; +}; + +#endif // CHROME_RENDERER_ACCESSIBILITY_PHRASE_SEGMENTATION_DEPENDENCY_PARSER_OP_RESOLVER_H_
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index d41c375..1984b74 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1294,6 +1294,102 @@ } } +source_set("platform_browser_tests") { + testonly = true + + defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] + + sources = [ + "../browser/metrics/metrics_log_browsertest.cc", + "../browser/metrics/sampled_out_client_id_saved_browsertest.cc", + "../browser/metrics/startup_metrics_browsertest.cc", + "../browser/net/cert_verifier_service_browsertest.cc", + "../browser/net/cert_verify_proc_browsertest.cc", + "../browser/policy/policy_prefs_browsertest.cc", + "../browser/share/qr_code_generator_pixeltest.cc", + "../browser/storage/shared_storage_browsertest.cc", + "../browser/tpcd/support/origin_trial_service_browsertest.cc", + "../browser/tpcd/support/tpcd_support_browsertest.cc", + "../browser/tpcd/support/validity_service_browsertest.cc", + ] + + deps = [ + "//base", + "//base/test:test_config", + "//base/test:test_support", + "//build:branding_buildflags", + "//build:chromeos_buildflags", + "//chrome/browser", + "//chrome/browser:browser_process", + "//chrome/browser/policy:test_support", + "//chrome/browser/profiles:profile", + "//chrome/browser/ui", + "//chrome/common:buildflags", + "//chrome/common:constants", + "//chrome/common:non_code_constants", + "//chrome/test:test_support", + "//components/content_settings/core/browser", + "//components/content_settings/core/browser:cookie_settings", + "//components/content_settings/core/common", + "//components/content_settings/core/common:features", + "//components/enterprise:test_support", + "//components/flags_ui:switches", + "//components/metrics", + "//components/metrics:content", + "//components/metrics:metrics_pref_names", + "//components/metrics:test_support", + "//components/metrics_services_manager", + "//components/network_session_configurator/common", + "//components/policy:generated", + "//components/policy:policy_code_generate", + "//components/policy/core/browser", + "//components/policy/core/browser:pref_mapping_test_support", + "//components/policy/core/common", + "//components/policy/core/common:test_support", + "//components/prefs", + "//components/privacy_sandbox:features", + "//components/privacy_sandbox:privacy_sandbox_prefs", + "//components/privacy_sandbox:test_support", + "//components/privacy_sandbox:tracking_protection_prefs", + "//components/privacy_sandbox/privacy_sandbox_attestations", + "//components/privacy_sandbox/privacy_sandbox_attestations:test_support", + "//components/qr_code_generator:bitmap_generator", + "//components/services/storage", + "//components/startup_metric_utils", + "//components/user_prefs", + "//components/variations", + "//components/variations:test_support", + "//content/public/browser", + "//content/public/common", + "//content/test:test_support", + "//net", + "//net:buildflags", + "//net:test_support", + "//services/cert_verifier/public/mojom", + "//services/network/public/cpp", + "//testing/gmock", + "//testing/gtest", + "//third_party/blink/public/common:headers", + "//third_party/metrics_proto", + "//ui/base", + "//url", + ] + + if (is_android) { + deps += [ "//chrome/test:test_support_ui_android" ] + } else { + deps += [ "//chrome/test:test_support_ui" ] + } + + if (enable_extensions) { + deps += [ "//chrome/browser/extensions" ] + } + + if (enable_extensions_core) { + deps += [ "//extensions:test_support" ] + } +} + if (is_android) { test("android_browsertests") { configs += [ "//build/config:precompiled_headers" ] @@ -1316,6 +1412,7 @@ ":android_browsertests_java", ":browser_tests_runner", ":chrome_test_launcher", + ":platform_browser_tests", ":sync_integration_test_support", ":sync_integration_test_support_java", ":test_support", @@ -1437,32 +1534,21 @@ "../browser/enterprise/reporting/cloud_profile_reporting_browsertest.cc", "../browser/fast_checkout/fast_checkout_tab_helper_browsertest.cc", "../browser/feed/rss_links_fetcher_browsertest.cc", - "../browser/metrics/metrics_log_browsertest.cc", "../browser/metrics/metrics_service_user_demographics_browsertest.cc", - "../browser/metrics/sampled_out_client_id_saved_browsertest.cc", - "../browser/metrics/startup_metrics_browsertest.cc", "../browser/metrics/ukm_browsertest.cc", "../browser/net/cert_verifier_policy_browsertest.cc", - "../browser/net/cert_verifier_service_browsertest.cc", - "../browser/net/cert_verify_proc_browsertest.cc", "../browser/page_load_metrics/observers/ad_metrics/ad_density_intervention_android_browsertest.cc", "../browser/password_manager/android/password_manager_android_browsertest.cc", "../browser/password_manager/passwords_navigation_observer.cc", "../browser/password_manager/passwords_navigation_observer.h", - "../browser/policy/policy_prefs_browsertest.cc", "../browser/preloading/prefetch/search_prefetch/search_preload_test_response_utils.cc", "../browser/preloading/prefetch/search_prefetch/search_preload_test_response_utils.h", "../browser/preloading/prefetch/search_prefetch/search_preload_unified_browsertest.cc", "../browser/profiles/profile_browsertest_android.cc", "../browser/safe_browsing/client_side_detection_service_browsertest.cc", "../browser/segmentation_platform/service_browsertest.cc", - "../browser/share/qr_code_generator_pixeltest.cc", "../browser/ssl/chrome_security_state_client_browsertest.cc", "../browser/ssl/crlset_browsertest.cc", - "../browser/storage/shared_storage_browsertest.cc", - "../browser/tpcd/support/origin_trial_service_browsertest.cc", - "../browser/tpcd/support/tpcd_support_browsertest.cc", - "../browser/tpcd/support/validity_service_browsertest.cc", "../browser/trusted_vault/trusted_vault_encryption_keys_tab_helper_browsertest.cc", "../browser/ui/android/autofill/save_update_address_profile_flow_manager_browsertest.cc", "../browser/ui/android/hats/survey_client_android_browsertest.cc", @@ -1754,6 +1840,7 @@ deps = [ ":browser_tests_runner", + ":platform_browser_tests", ":sync_integration_test_support", ":test_support", ":test_support_ui", @@ -2646,13 +2733,10 @@ "../browser/media_galleries/media_galleries_dialog_controller_mock.h", "../browser/metrics/cloned_install_client_id_reset_browsertest.cc", "../browser/metrics/desktop_session_duration/audible_contents_tracker_browsertest.cc", - "../browser/metrics/metrics_log_browsertest.cc", "../browser/metrics/metrics_reporting_state_browsertest.cc", "../browser/metrics/metrics_service_browsertest.cc", "../browser/metrics/metrics_service_user_demographics_browsertest.cc", "../browser/metrics/process_memory_metrics_emitter_browsertest.cc", - "../browser/metrics/sampled_out_client_id_saved_browsertest.cc", - "../browser/metrics/startup_metrics_browsertest.cc", "../browser/metrics/tab_stats/tab_stats_tracker_browsertest.cc", "../browser/metrics/ukm_background_recorder_browsertest.cc", "../browser/metrics/ukm_browsertest.cc", @@ -2669,8 +2753,6 @@ "../browser/navigation_predictor/navigation_predictor_preconnect_client_browsertest.cc", "../browser/navigation_predictor/search_engine_preconnector_browsertest.cc", "../browser/net/cert_verifier_policy_browsertest.cc", - "../browser/net/cert_verifier_service_browsertest.cc", - "../browser/net/cert_verify_proc_browsertest.cc", "../browser/net/chrome_accept_encoding_header_browsertest.cc", "../browser/net/chrome_accept_header_browsertest.cc", "../browser/net/chrome_mojo_proxy_resolver_factory_browsertest.cc", @@ -2771,7 +2853,6 @@ "../browser/picture_in_picture/document_picture_in_picture_window_controller_browsertest.cc", "../browser/picture_in_picture/video_picture_in_picture_window_controller_browsertest.cc", "../browser/policy/policy_initialization_browsertest.cc", - "../browser/policy/policy_prefs_browsertest.cc", "../browser/policy/test/browsing_history_policy_browsertest.cc", "../browser/policy/test/cast_policy_browsertest.cc", "../browser/policy/test/content_settings_policy_browsertest.cc", @@ -2848,7 +2929,6 @@ "../browser/sessions/session_restore_observer_browsertest.cc", "../browser/sessions/session_service_log_browsertest.cc", "../browser/sessions/tab_restore_browsertest.cc", - "../browser/share/qr_code_generator_pixeltest.cc", "../browser/signin/e2e_tests/account_capabilities_observer.cc", "../browser/signin/e2e_tests/account_capabilities_observer.h", "../browser/signin/e2e_tests/accounts_removed_waiter.cc", @@ -2882,7 +2962,6 @@ "../browser/ssl/stateful_ssl_host_state_delegate_test.cc", "../browser/storage/database_access_browsertest.cc", "../browser/storage/durable_storage_browsertest.cc", - "../browser/storage/shared_storage_browsertest.cc", "../browser/storage_access_api/api_browsertest.cc", "../browser/storage_access_api/storage_access_header_service_browsertest.cc", "../browser/subresource_filter/ad_heuristic_tpcd_browsertest.cc", @@ -2931,10 +3010,7 @@ "../browser/tpcd/heuristics/opener_heuristic_browsertest.cc", "../browser/tpcd/metadata/devtools_observer_browsertest.cc", "../browser/tpcd/metadata/manager_browsertest.cc", - "../browser/tpcd/support/origin_trial_service_browsertest.cc", "../browser/tpcd/support/top_level_trial_service_browsertest.cc", - "../browser/tpcd/support/tpcd_support_browsertest.cc", - "../browser/tpcd/support/validity_service_browsertest.cc", "../browser/tracing/chrome_tracing_delegate_browsertest.cc", "../browser/translate/language_detection_service_browsertest.cc", "../browser/translate/translate_frame_binder_browsertest.cc", @@ -8002,6 +8078,7 @@ "../browser/webauthn/enclave_manager_unittest.cc", "../common/importer/mock_importer_bridge.cc", "../common/importer/mock_importer_bridge.h", + "../renderer/accessibility/phrase_segmentation/dependency_parser_model_unittest.cc", "../renderer/accessibility/read_aloud_traversal_utils_unittest.cc", "../renderer/accessibility/read_anything_node_utils_unittest.cc", "../renderer/media/webrtc_logging_agent_impl_unittest.cc", @@ -12708,7 +12785,7 @@ } } -if (!is_android) { +if (!is_android && enable_print_preview) { static_library("print_preview_test_support") { testonly = true
diff --git a/chrome/test/data/accessibility/phrase_segmentation/model.tflite b/chrome/test/data/accessibility/phrase_segmentation/model.tflite new file mode 100644 index 0000000..488451ed --- /dev/null +++ b/chrome/test/data/accessibility/phrase_segmentation/model.tflite Binary files differ
diff --git a/chrome/test/data/webui/commerce/product_specifications/disclosure_app_test.ts b/chrome/test/data/webui/commerce/product_specifications/disclosure_app_test.ts index 967a30d99..a5ad81a 100644 --- a/chrome/test/data/webui/commerce/product_specifications/disclosure_app_test.ts +++ b/chrome/test/data/webui/commerce/product_specifications/disclosure_app_test.ts
@@ -82,11 +82,12 @@ test('disclosure has correct learn more link', async () => { const learnMoreLinkElement = $$<HTMLElement>(app, '#learnMoreLink'); assertTrue(!!learnMoreLinkElement); - const textElement = learnMoreLinkElement.shadowRoot!.querySelector('div'); - assertEquals(app.i18n('disclosureLearnMore'), textElement!.textContent); + assertTrue(!!learnMoreLinkElement!.textContent); + assertEquals( + app.i18n('learnMore'), learnMoreLinkElement!.textContent!.trim()); assertEquals( loadTimeData.getString('compareLearnMoreUrl'), - learnMoreLinkElement!.getAttribute('link-url')); + learnMoreLinkElement!.getAttribute('href')); }); test('click disclosure learn more link', async () => { @@ -104,9 +105,7 @@ const learnMoreLinkElement = $$<HTMLElement>(app, '#learnMoreLink'); assertTrue(!!learnMoreLinkElement); - const link = learnMoreLinkElement.shadowRoot!.querySelector('a'); - assertTrue(!!link); - link!.click(); + learnMoreLinkElement!.click(); assertEquals( 1, metrics.count('Commerce.Compare.FirstRunExperience.LearnMore'));
diff --git a/chrome/test/fuzzing/page_load_in_process_fuzzer.cc b/chrome/test/fuzzing/page_load_in_process_fuzzer.cc index 229e2890..4d25fbe 100644 --- a/chrome/test/fuzzing/page_load_in_process_fuzzer.cc +++ b/chrome/test/fuzzing/page_load_in_process_fuzzer.cc
@@ -133,8 +133,6 @@ const net::test_server::HttpRequest& request) { // Look through all the network resources given in the fuzz case and build // a response if we find one. - LOG(INFO) << "Got request at " << which_server << " path " - << request.relative_url; for (const auto& network_resource : fuzz_case_.network_resource()) { if (network_resource.which_server() == which_server && request.relative_url.substr(1) == network_resource.path()) { @@ -150,8 +148,6 @@ if (network_resource.has_body()) { response->set_content(SubstituteServersInBody(network_resource.body())); } - LOG(INFO) << "Returning valid response for " << which_server << " path " - << request.relative_url; return response; } } @@ -177,7 +173,7 @@ return -1; // invalid fuzz case. } const auto& network_resource = fuzz_case_.network_resource(0); - std::string path = network_resource.path(); + std::string path = "/" + network_resource.path(); switch (network_resource.which_server()) { case WhichServer::HTTP_ORIGIN1: test_url = http_test_server1_.GetURL(path); @@ -196,7 +192,6 @@ } } - LOG(INFO) << "Navigating to " << test_url; base::IgnoreResult(ui_test_utils::NavigateToURL(browser(), test_url)); return 0; }
diff --git a/chrome/test/supervised_user/family_live_test.cc b/chrome/test/supervised_user/family_live_test.cc index 8712a44..2d32a30f 100644 --- a/chrome/test/supervised_user/family_live_test.cc +++ b/chrome/test/supervised_user/family_live_test.cc
@@ -136,10 +136,18 @@ return *child_; } -void FamilyLiveTest::TurnOnSync() { - if (rpc_mode_ == RpcMode::kProd) { - TurnOnSyncFor(*head_of_household_); +FamilyMember& FamilyLiveTest::rpc_issuer() const { + switch (rpc_mode_) { + case RpcMode::kProd: + return head_of_household(); + case RpcMode::kTestImpersonation: + return child(); } + NOTREACHED_NORETURN(); +} + +void FamilyLiveTest::TurnOnSync() { + TurnOnSyncFor(*head_of_household_); TurnOnSyncFor(*child_); } @@ -189,39 +197,23 @@ << "Child credentials are ignored if " << kFamilyIdentifierSwitch << " is set"; - if (rpc_mode_ == RpcMode::kProd) { - SetHeadOfHousehold(GetAccountFromFile(kHeadOfHouseholdAccountIdSuffix)); - } + SetHeadOfHousehold(GetAccountFromFile(kHeadOfHouseholdAccountIdSuffix)); SetChild(GetAccountFromFile(kChildAccountIdSuffix)); return; } - if (rpc_mode_ == RpcMode::kTestImpersonation && - IsSwitchEnabled(kHeadOfHouseholdCredentialsSwitch)) { - // Allow test suite to execute tests that might require head of household - // credentials. - GTEST_SKIP() - << "Requested test is in impersonation mode that doesn't require head " - "of household credentials, but they were provided"; - } else if (rpc_mode_ == RpcMode::kTestImpersonation && - IsSwitchEnabled(kChildCredentialsSwitch)) { - SetChild(CreateTestAccountFromCredentialsSwitch(kChildCredentialsSwitch)); - return; - } else if (rpc_mode_ == RpcMode::kProd && - IsSwitchEnabled(kHeadOfHouseholdCredentialsSwitch) && - IsSwitchEnabled(kChildCredentialsSwitch)) { + if (IsSwitchEnabled(kHeadOfHouseholdCredentialsSwitch) && + IsSwitchEnabled(kChildCredentialsSwitch)) { SetHeadOfHousehold(CreateTestAccountFromCredentialsSwitch( kHeadOfHouseholdCredentialsSwitch)); SetChild(CreateTestAccountFromCredentialsSwitch(kChildCredentialsSwitch)); return; } - NOTREACHED() - << "Either specify " << kFamilyIdentifierSwitch - << " or configure credentials using " << kHeadOfHouseholdCredentialsSwitch - << " and " << kChildCredentialsSwitch - << ". Note that tests using RpcMode::kImpersonation must not have the " - << kHeadOfHouseholdCredentialsSwitch << " switch set."; + NOTREACHED() << "Either specify " << kFamilyIdentifierSwitch + << " or configure credentials using " + << kHeadOfHouseholdCredentialsSwitch << " and " + << kChildCredentialsSwitch << "."; } void FamilyLiveTest::SetHeadOfHousehold( @@ -287,14 +279,13 @@ ui::test::internal::InteractiveTestPrivate::MultiStep InteractiveFamilyLiveTest::WaitForStateSeeding( ui::test::StateIdentifier<BrowserState::Observer> id, - const FamilyMember& rpc_issuer, const FamilyMember& browser_user, const BrowserState& state) { return Steps( Log(base::StrCat({"WaitForState[", state.ToString(), "]: start"})), If([&]() { return !state.Check(browser_user); }, /*then_steps=*/ - Steps(Do([&]() { state.Seed(rpc_issuer, browser_user); }), + Steps(Do([&]() { state.Seed(rpc_issuer(), browser_user); }), PollState( id, [&]() { return state.Check(browser_user); }, /*polling_interval=*/base::Seconds(2)),
diff --git a/chrome/test/supervised_user/family_live_test.h b/chrome/test/supervised_user/family_live_test.h index 15b36b3bc..12fca0f0 100644 --- a/chrome/test/supervised_user/family_live_test.h +++ b/chrome/test/supervised_user/family_live_test.h
@@ -81,6 +81,9 @@ FamilyMember& head_of_household() const; FamilyMember& child() const; + // Family member that will issue rpc. + FamilyMember& rpc_issuer() const; + private: // Creates a FamilyMember entity using credentials from TestAccount. void SetHeadOfHousehold(const signin::test::TestAccount& account); @@ -123,7 +126,6 @@ // After completion, supervised user settings are in `state`. ui::test::internal::InteractiveTestPrivate::MultiStep WaitForStateSeeding( ui::test::StateIdentifier<BrowserState::Observer> id, - const FamilyMember& rpc_issuer, const FamilyMember& browser_user, const BrowserState& state); };
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 16a3c68..e2d1e49 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -16018.0.0 \ No newline at end of file +16020.0.0 \ No newline at end of file
diff --git a/chromeos/ash/components/network/managed_cellular_pref_handler.cc b/chromeos/ash/components/network/managed_cellular_pref_handler.cc index 1f385ba..acad66b 100644 --- a/chromeos/ash/components/network/managed_cellular_pref_handler.cc +++ b/chromeos/ash/components/network/managed_cellular_pref_handler.cc
@@ -16,6 +16,9 @@ #include "components/prefs/scoped_user_pref_update.h" namespace ash { +namespace { +constexpr char kESimMetadataPolicyMissingKey[] = "PolicyMissing"; +} // namespace // static void ManagedCellularPrefHandler::RegisterLocalStatePrefs( @@ -81,7 +84,8 @@ policy_util::SmdxActivationCode::Type::SMDP ? ::onc::cellular::kSMDPAddress : ::onc::cellular::kSMDSAddress, - activation_code.value()); + activation_code.value()) + .Set(kESimMetadataPolicyMissingKey, false); const base::Value::Dict* existing_esim_metadata = GetESimMetadata(iccid); if (existing_esim_metadata && *existing_esim_metadata == esim_metadata) { @@ -103,7 +107,6 @@ const base::Value::Dict* ManagedCellularPrefHandler::GetESimMetadata( const std::string& iccid) { - if (!device_prefs_) { NET_LOG(ERROR) << "Device pref not available yet"; return nullptr; @@ -134,6 +137,42 @@ NotifyManagedCellularPrefChanged(); } +bool ManagedCellularPrefHandler::IsESimManaged(const std::string& iccid) { + const base::Value::Dict* esim_metadata = GetESimMetadata(iccid); + if (!esim_metadata) { + return false; + } + std::optional<bool> policy_missing = + esim_metadata->FindBool(kESimMetadataPolicyMissingKey); + // The eSIM is considered managed if the |kESimMetadataPolicyMissingKey| is + // missing or if the value associated with the key is |false|. This key may be + // missing since it was added after metadata initially was. For more + // information see b/361421631. + if (!policy_missing.has_value()) { + return true; + } + return !policy_missing.value(); +} + +void ManagedCellularPrefHandler::SetPolicyMissing(const std::string& iccid) { + const base::Value::Dict* existing_esim_metadata = GetESimMetadata(iccid); + if (!existing_esim_metadata) { + return; + } + + base::Value::Dict esim_metadata = existing_esim_metadata->Clone(); + esim_metadata.Set(kESimMetadataPolicyMissingKey, true); + + NET_LOG(EVENT) << "Setting the policy missing flag for eSIM metadata in " + << "device prefs with ICCID: " << iccid; + + ScopedDictPrefUpdate update(device_prefs_, + prefs::kManagedCellularESimMetadata); + update->Set(iccid, std::move(esim_metadata)); + network_state_handler_->SyncStubCellularNetworks(); + NotifyManagedCellularPrefChanged(); +} + void ManagedCellularPrefHandler::AddApnMigratedIccid(const std::string& iccid) { if (!device_prefs_) { NET_LOG(ERROR) << "Device pref not available yet.";
diff --git a/chromeos/ash/components/network/managed_cellular_pref_handler.h b/chromeos/ash/components/network/managed_cellular_pref_handler.h index fcb46a2..8d4de687 100644 --- a/chromeos/ash/components/network/managed_cellular_pref_handler.h +++ b/chromeos/ash/components/network/managed_cellular_pref_handler.h
@@ -54,9 +54,23 @@ // it exists, otherwise returns |nullptr|. const base::Value::Dict* GetESimMetadata(const std::string& iccid); - // Removes the persisted eSIM metadata that corresponds to ICCID |iccid|. + // Removes the persisted eSIM metadata that corresponds to ICCID |iccid|. This + // should only be done when the eSIM profile is removed from the device. void RemoveESimMetadata(const std::string& iccid); + // Returns whether there is persisted eSIM metadata that corresponds to ICCID + // |iccid|, and whether this metadata indicates that the eSIM is actively + // managed. If the eSIM was installed by policy, but the policy was + // subsequently removed, the metadata will still exist but will indicate that + // the profile is not actively managed. + bool IsESimManaged(const std::string& iccid); + + // Updates the eSIM metadata that corresponds to ICCID |iccid|, if it exists, + // to reflect that there is no longer an active policy for the relevant eSIM. + // This allows the eSIM metadata for eSIM profiles that were installed by + // policy to be persisted even after the policy is removed. + void SetPolicyMissing(const std::string& iccid); + // Marks cellular network with iccid |iccid| as migrated to the APN revamp // feature. See (b/162365553). virtual void AddApnMigratedIccid(const std::string& iccid);
diff --git a/chromeos/ash/components/network/managed_cellular_pref_handler_unittest.cc b/chromeos/ash/components/network/managed_cellular_pref_handler_unittest.cc index acf44bdb..7a52e96 100644 --- a/chromeos/ash/components/network/managed_cellular_pref_handler_unittest.cc +++ b/chromeos/ash/components/network/managed_cellular_pref_handler_unittest.cc
@@ -171,6 +171,55 @@ EXPECT_EQ(4, NumObserverEvents()); } +TEST_F(ManagedCellularPrefHandlerTest, AddAndRemovePolicyESimMetadata) { + Init(); + SetDevicePrefs(); + + const policy_util::SmdxActivationCode activation_code( + policy_util::SmdxActivationCode::Type::SMDP, + HermesEuiccClient::Get() + ->GetTestInterface() + ->GenerateFakeActivationCode()); + + EXPECT_EQ(0, NumObserverEvents()); + EXPECT_FALSE(managed_cellular_pref_handler()->GetESimMetadata(kIccid0)); + + managed_cellular_pref_handler()->AddESimMetadata(kIccid0, kName0, + activation_code); + EXPECT_EQ(1, NumObserverEvents()); + + ExpectESimMetadata(kIccid0, kName0, activation_code); + EXPECT_TRUE(managed_cellular_pref_handler()->IsESimManaged(kIccid0)); + + // Reach into the prefs and manually erase the field used to communicate that + // an eSIM was installed by policy but is no longer managed. + base::Value::Dict prefs = + device_prefs()->GetDict(prefs::kManagedCellularESimMetadata).Clone(); + ASSERT_TRUE(prefs.contains(kIccid0)); + base::Value::Dict* esim_metadata = prefs.FindDict(kIccid0); + esim_metadata->Remove("PolicyMissing"); + device_prefs()->SetDict(prefs::kManagedCellularESimMetadata, + std::move(prefs)); + + // The eSIM metadata should still be considered managed even if the "policy + // missing" key is not found. + EXPECT_TRUE(managed_cellular_pref_handler()->IsESimManaged(kIccid0)); + + managed_cellular_pref_handler()->SetPolicyMissing(kIccid0); + EXPECT_EQ(2, NumObserverEvents()); + + ExpectESimMetadata(kIccid0, kName0, activation_code); + EXPECT_FALSE(managed_cellular_pref_handler()->IsESimManaged(kIccid0)); + + managed_cellular_pref_handler()->AddESimMetadata(kIccid0, kName0, + activation_code); + EXPECT_EQ(3, NumObserverEvents()); + + // Whenever metadata is added it should always flag the eSIM as being managed. + ExpectESimMetadata(kIccid0, kName0, activation_code); + EXPECT_TRUE(managed_cellular_pref_handler()->IsESimManaged(kIccid0)); +} + TEST_F(ManagedCellularPrefHandlerTest, AddApnMigratedIccid) { Init(); SetDevicePrefs();
diff --git a/chromeos/ash/components/network/policy_applicator.cc b/chromeos/ash/components/network/policy_applicator.cc index 5ee3153..930e54d 100644 --- a/chromeos/ash/components/network/policy_applicator.cc +++ b/chromeos/ash/components/network/policy_applicator.cc
@@ -288,7 +288,7 @@ const std::string* iccid = policy_util::GetIccidFromONC(onc_part); if (managed_cellular_pref_handler_ && iccid) { - managed_cellular_pref_handler_->RemoveESimMetadata(*iccid); + managed_cellular_pref_handler_->SetPolicyMissing(*iccid); } return; }
diff --git a/chromeos/ash/components/network/stub_cellular_networks_provider.cc b/chromeos/ash/components/network/stub_cellular_networks_provider.cc index a7a9eda..84db339 100644 --- a/chromeos/ash/components/network/stub_cellular_networks_provider.cc +++ b/chromeos/ash/components/network/stub_cellular_networks_provider.cc
@@ -71,8 +71,8 @@ // cellular technology is not enabled. if (!cellular_device || !network_state_handler_->IsTechnologyEnabled( NetworkTypePattern::Cellular())) { - return RemoveStubCellularNetworks(/*esim_and_slot_metadata=*/nullptr, - /*shill_iccids=*/nullptr, network_list); + return RemoveCellularNetworks(/*esim_and_slot_metadata=*/nullptr, + /*shill_iccids=*/nullptr, network_list); } base::flat_set<std::string> all_iccids, shill_iccids; @@ -84,8 +84,9 @@ bool network_list_changed = false; network_list_changed |= AddStubNetworks( cellular_device, esim_and_slot_metadata, all_iccids, new_stub_networks); - network_list_changed |= RemoveStubCellularNetworks( - &esim_and_slot_metadata, &shill_iccids, network_list); + network_list_changed |= RemoveCellularNetworks(&esim_and_slot_metadata, + &shill_iccids, network_list); + network_list_changed |= UpdateCellularNetworks(network_list); return network_list_changed; } @@ -172,8 +173,8 @@ bool is_managed = false; if (managed_cellular_pref_handler_) { - is_managed = managed_cellular_pref_handler_->GetESimMetadata( - iccid_eid_pair.first) != nullptr; + is_managed = + managed_cellular_pref_handler_->IsESimManaged(iccid_eid_pair.first); } NET_LOG(EVENT) << "Adding stub cellular network for ICCID=" << iccid_eid_pair.first << " EID=" << iccid_eid_pair.second @@ -188,7 +189,7 @@ return network_added; } -bool StubCellularNetworksProvider::RemoveStubCellularNetworks( +bool StubCellularNetworksProvider::RemoveCellularNetworks( const std::vector<IccidEidPair>* esim_and_slot_metadata, const base::flat_set<std::string>* shill_iccids, NetworkStateHandler::ManagedStateList& network_list) { @@ -226,4 +227,39 @@ return network_removed; } +bool StubCellularNetworksProvider::UpdateCellularNetworks( + NetworkStateHandler::ManagedStateList& network_list) { + bool network_changed = false; + + for (auto it = network_list.begin(); it != network_list.end(); ++it) { + const NetworkState* network = (*it)->AsNetworkState(); + + // Shill backed networks are not stubs and thus should not be modified. + if (!network->IsNonShillCellularNetwork()) { + continue; + } + + const bool is_managed = + managed_cellular_pref_handler_ + ? managed_cellular_pref_handler_->IsESimManaged(network->iccid()) + : false; + + // We only want to update the network if we detect that the managed state + // has changed. + if (is_managed == network->IsManagedByPolicy()) { + continue; + } + + NET_LOG(EVENT) << "Updating managed state of stub cellular network for " + << "ICCID=" << network->iccid() << " EID=" << network->eid() + << ", is managed: " << is_managed; + *it = NetworkState::CreateNonShillCellularNetwork( + network->iccid(), network->eid(), GetGuidForStubIccid(network->iccid()), + is_managed, network->device_path()); + network_changed = true; + } + + return network_changed; +} + } // namespace ash
diff --git a/chromeos/ash/components/network/stub_cellular_networks_provider.h b/chromeos/ash/components/network/stub_cellular_networks_provider.h index 5c4782e5..27d593c6 100644 --- a/chromeos/ash/components/network/stub_cellular_networks_provider.h +++ b/chromeos/ash/components/network/stub_cellular_networks_provider.h
@@ -50,9 +50,9 @@ // slot. std::vector<IccidEidPair> GetESimAndSlotMetadata(const DeviceState* device); - // Adds stub cellular networks to |new_stub_networks| list for the - // metadata in |esim_and_slot_metadata| that does not correspond to networks - // already present in not already in |all_iccids|. + // Adds stub cellular networks to |new_stub_networks| list for the metadata in + // |esim_and_slot_metadata| that does not correspond to networks already + // present in not already in |all_iccids|. bool AddStubNetworks( const DeviceState* device, const std::vector<IccidEidPair>& esim_and_slot_metadata, @@ -62,15 +62,23 @@ // Removes all non-Shill stub cellular networks from |network_list| that are // not required anymore viz. 1) Stub networks for which a corresponding entry // already exists in |shill_iccids| 2) Stub networks that do not have - // corresponding entry in |esim_profiles| or a slot info entry on given - // |device| (e.g. eSIM profile was removed or pSIM was removed from the slot). - // if both |esim_slot_metadata| and |shill_iccids| are nullptr, then all stub - // networks are removed. - bool RemoveStubCellularNetworks( + // corresponding entry in |esim_and_slot_metadata| or a slot info entry on + // given |device| (e.g. eSIM profile was removed or pSIM was removed from the + // slot) 3) Stub networks that do not reflect the correct managed by policy + // state. If both |esim_slot_metadata| and |shill_iccids| are nullptr, then + // all stub networks are removed. + bool RemoveCellularNetworks( const std::vector<IccidEidPair>* esim_and_slot_metadata, const base::flat_set<std::string>* shill_iccids, NetworkStateHandler::ManagedStateList& network_list); + // Iterates through the provided stub networks and updates any network that is + // found to have an outdated managed state. This allows the UI to more quickly + // update when a cellular network transitions to become unmanaged or + // vice-versa. + bool UpdateCellularNetworks( + NetworkStateHandler::ManagedStateList& network_list); + raw_ptr<NetworkStateHandler> network_state_handler_ = nullptr; raw_ptr<CellularESimProfileHandler> cellular_esim_profile_handler_ = nullptr; raw_ptr<ManagedCellularPrefHandler, DanglingUntriaged>
diff --git a/chromeos/ash/components/network/stub_cellular_networks_provider_unittest.cc b/chromeos/ash/components/network/stub_cellular_networks_provider_unittest.cc index dfdd6200..9c5e8db0 100644 --- a/chromeos/ash/components/network/stub_cellular_networks_provider_unittest.cc +++ b/chromeos/ash/components/network/stub_cellular_networks_provider_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "ash/constants/ash_pref_names.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/test/task_environment.h" @@ -136,6 +137,8 @@ base::RunLoop().RunUntilIdle(); } + TestingPrefServiceSimple* device_prefs() { return &device_prefs_; } + ManagedCellularPrefHandler* managed_cellular_pref_handler() { return &managed_cellular_pref_handler_; } @@ -203,19 +206,31 @@ // Verify the stub networks becomes unmanaged once the iccid and smdp address // pair is removed from pref. + network_list = std::move(new_stub_networks); new_stub_networks.clear(); - managed_cellular_pref_handler()->RemoveESimMetadata( - profile3_properties->iccid().value()); + + // Manually reach into the device prefs and mark the eSIM profile as no longer + // being actively managed. We modify the prefs directly so that we can test + // `AddOrRemoveStubCellularNetworks()` directly and not rely on + // `ManagedCellularPrefHandler` notifying pref changes. + const std::string& iccid = profile3_properties->iccid().value(); + base::Value::Dict prefs = + device_prefs()->GetDict(prefs::kManagedCellularESimMetadata).Clone(); + ASSERT_TRUE(prefs.contains(iccid)); + base::Value::Dict* esim_metadata = prefs.FindDict(iccid); + esim_metadata->Set("PolicyMissing", true); + device_prefs()->SetDict(prefs::kManagedCellularESimMetadata, + std::move(prefs)); + AddOrRemoveStubCellularNetworks(network_list, new_stub_networks); - EXPECT_EQ(3u, new_stub_networks.size()); - network2 = new_stub_networks[1]->AsNetworkState(); + EXPECT_EQ(3u, network_list.size()); + EXPECT_EQ(0u, new_stub_networks.size()); + network2 = network_list[1]->AsNetworkState(); EXPECT_EQ(network2->iccid(), profile3_properties->iccid().value()); EXPECT_FALSE(network2->IsManagedByPolicy()); // Verify the stub networks are removed when corresponding slot is no longer // present. e.g. SIM removed. - network_list = std::move(new_stub_networks); - new_stub_networks.clear(); SetPSimSlotInfo(/*iccid=*/std::string()); base::RunLoop().RunUntilIdle(); AddOrRemoveStubCellularNetworks(network_list, new_stub_networks);
diff --git a/chromeos/components/mahi/public/cpp/BUILD.gn b/chromeos/components/mahi/public/cpp/BUILD.gn index f503a72..7172112 100644 --- a/chromeos/components/mahi/public/cpp/BUILD.gn +++ b/chromeos/components/mahi/public/cpp/BUILD.gn
@@ -24,7 +24,6 @@ deps = [ "//base", - "//chromeos/constants", "//chromeos/crosapi/mojom", "//components/account_id", "//components/user_manager",
diff --git a/chromeos/components/mahi/public/cpp/mahi_manager.cc b/chromeos/components/mahi/public/cpp/mahi_manager.cc index 7ce003f..dacaa595 100644 --- a/chromeos/components/mahi/public/cpp/mahi_manager.cc +++ b/chromeos/components/mahi/public/cpp/mahi_manager.cc
@@ -8,7 +8,6 @@ #include "base/notreached.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" -#include "chromeos/constants/chromeos_features.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_switches.h"
diff --git a/chromeos/constants/chromeos_switches.cc b/chromeos/constants/chromeos_switches.cc index 3ec207b..586385e 100644 --- a/chromeos/constants/chromeos_switches.cc +++ b/chromeos/constants/chromeos_switches.cc
@@ -27,6 +27,9 @@ const char kContainerAppPreinstallDebugKey[] = "container-app-preinstall-debug-key"; +// Use in test to override mahi age and country restriction. +const char kMahiRestrictionsOverride[] = "mahi-restrictions-override"; + // Returns the value from the command-line switch for the activation time // threshold for the container app. Returns an absent value if the command-line // switch isn't present or cannot be parsed. Note that this switch will only be
diff --git a/chromeos/constants/chromeos_switches.h b/chromeos/constants/chromeos_switches.h index 9171bc2d..dfc86dc 100644 --- a/chromeos/constants/chromeos_switches.h +++ b/chromeos/constants/chromeos_switches.h
@@ -26,6 +26,9 @@ extern const char kContainerAppPreinstallDebugKey[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) +extern const char kMahiRestrictionsOverride[]; + +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) std::optional<base::Time> GetContainerAppPreinstallActivationTimeThreshold(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
diff --git a/chromeos/recorder_strings.grdp b/chromeos/recorder_strings.grdp index 1bc39a9..1d550c0 100644 --- a/chromeos/recorder_strings.grdp +++ b/chromeos/recorder_strings.grdp
@@ -53,9 +53,15 @@ <message desc="Accessibility label of the landmark for the list of recordings in the main page." name="IDS_RECORDER_MAIN_SEARCH_LANDMARK_ARIA_LABEL"> Search recording files </message> + <message desc="Tooltip of the button to start recording." meaning="Start an audio recording session." name="IDS_RECORDER_MAIN_START_RECORD_BUTTON_TOOLTIP"> + Record + </message> <message desc="Nudge to start recording when there's no existing recording in main page." name="IDS_RECORDER_MAIN_START_RECORD_NUDGE"> Press to record </message> + <message desc="Tooltip of the combobox to choose microphone to use in recording session." meaning="Microphone device to use in recordding session." name="IDS_RECORDER_MIC_SELECTION_MENU_BUTTON_TOOLTIP"> + Mic + </message> <message desc="Label of the option to include system audio in the recording." name="IDS_RECORDER_MIC_SELECTION_MENU_CHROMEBOOK_AUDIO_OPTION"> Chromebook audio </message> @@ -129,6 +135,12 @@ <message desc="Label of the menu item to set playback speed to normal (1.0)." name="IDS_RECORDER_PLAYBACK_SPEED_NORMAL_OPTION"> Normal </message> + <message desc="Tooltip of the button to open more record options." name="IDS_RECORDER_RECORDING_ITEM_OPTIONS_BUTTON_TOOLTIP"> + More options + </message> + <message desc="Tooltip of the button to play the recording." meaning="Play the audio recording." name="IDS_RECORDER_RECORDING_ITEM_PLAY_BUTTON_TOOLTIP"> + Play + </message> <message desc="Header of the recording list." name="IDS_RECORDER_RECORDING_LIST_HEADER"> My Recordings </message> @@ -138,6 +150,12 @@ <message desc="Placeholder text on the search box used to search recordings." name="IDS_RECORDER_RECORDING_LIST_SEARCH_BOX_PLACEHOLDER"> Search recording name </message> + <message desc="Tooltip of the button to open the search box to search recordings by title." name="IDS_RECORDER_RECORDING_LIST_SEARCH_BUTTON_TOOLTIP"> + Search + </message> + <message desc="Tooltip of the button to choose the recordings sort options." name="IDS_RECORDER_RECORDING_LIST_SORT_BUTTON_TOOLTIP"> + Sort options + </message> <message desc="Label of the menu item to sort the recordings by the recorded date." name="IDS_RECORDER_RECORDING_LIST_SORT_BY_DATE_OPTION"> Date modified </message>
diff --git a/chromeos/recorder_strings_grdp/IDS_RECORDER_MAIN_START_RECORD_BUTTON_TOOLTIP.png.sha1 b/chromeos/recorder_strings_grdp/IDS_RECORDER_MAIN_START_RECORD_BUTTON_TOOLTIP.png.sha1 new file mode 100644 index 0000000..3e5fa3b --- /dev/null +++ b/chromeos/recorder_strings_grdp/IDS_RECORDER_MAIN_START_RECORD_BUTTON_TOOLTIP.png.sha1
@@ -0,0 +1 @@ +648f76f1f0eef3092dece05656cb11fa6cff9161 \ No newline at end of file
diff --git a/chromeos/recorder_strings_grdp/IDS_RECORDER_MIC_SELECTION_MENU_BUTTON_TOOLTIP.png.sha1 b/chromeos/recorder_strings_grdp/IDS_RECORDER_MIC_SELECTION_MENU_BUTTON_TOOLTIP.png.sha1 new file mode 100644 index 0000000..81096a4a --- /dev/null +++ b/chromeos/recorder_strings_grdp/IDS_RECORDER_MIC_SELECTION_MENU_BUTTON_TOOLTIP.png.sha1
@@ -0,0 +1 @@ +3b8e4bb1460ce064ac07c3c96e9ec74ddd75ce2f \ No newline at end of file
diff --git a/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_ITEM_OPTIONS_BUTTON_TOOLTIP.png.sha1 b/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_ITEM_OPTIONS_BUTTON_TOOLTIP.png.sha1 new file mode 100644 index 0000000..5f14bc46 --- /dev/null +++ b/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_ITEM_OPTIONS_BUTTON_TOOLTIP.png.sha1
@@ -0,0 +1 @@ +6e6fcf3edc3b1d18a11d372d7ca0405c8e6e225d \ No newline at end of file
diff --git a/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_ITEM_PLAY_BUTTON_TOOLTIP.png.sha1 b/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_ITEM_PLAY_BUTTON_TOOLTIP.png.sha1 new file mode 100644 index 0000000..257845e4 --- /dev/null +++ b/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_ITEM_PLAY_BUTTON_TOOLTIP.png.sha1
@@ -0,0 +1 @@ +c516b3eb2146de958ee9d0396e9701a4350c2986 \ No newline at end of file
diff --git a/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_LIST_SEARCH_BUTTON_TOOLTIP.png.sha1 b/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_LIST_SEARCH_BUTTON_TOOLTIP.png.sha1 new file mode 100644 index 0000000..745fc36 --- /dev/null +++ b/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_LIST_SEARCH_BUTTON_TOOLTIP.png.sha1
@@ -0,0 +1 @@ +a6e71573a114b8d64f8bf4a7a9d4774c8d140a5b \ No newline at end of file
diff --git a/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_LIST_SORT_BUTTON_TOOLTIP.png.sha1 b/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_LIST_SORT_BUTTON_TOOLTIP.png.sha1 new file mode 100644 index 0000000..9f7852ff --- /dev/null +++ b/chromeos/recorder_strings_grdp/IDS_RECORDER_RECORDING_LIST_SORT_BUTTON_TOOLTIP.png.sha1
@@ -0,0 +1 @@ +64c3cb57c552e14f27b7b942e76fb0a228b5f646 \ No newline at end of file
diff --git a/clank b/clank index 39daeb7..13f9fa6 160000 --- a/clank +++ b/clank
@@ -1 +1 @@ -Subproject commit 39daeb7b11d9f4e7fbe38fc90d861ea0ce881389 +Subproject commit 13f9fa6614f55af1da0a158af6c69ea6e4686179
diff --git a/components/autofill/content/browser/risk/fingerprint_browsertest.cc b/components/autofill/content/browser/risk/fingerprint_browsertest.cc index ef0060f1c..760a4cef 100644 --- a/components/autofill/content/browser/risk/fingerprint_browsertest.cc +++ b/components/autofill/content/browser/risk/fingerprint_browsertest.cc
@@ -134,11 +134,11 @@ EXPECT_TRUE(machine.has_browser_build()); EXPECT_TRUE(machine.has_browser_feature()); if (content::GpuDataManager::GetInstance()->GpuAccessAllowed(nullptr)) { - ASSERT_TRUE(machine.has_graphics_card()); + EXPECT_TRUE(machine.has_graphics_card()); + } + if (machine.has_graphics_card()) { EXPECT_TRUE(machine.graphics_card().has_vendor_id()); EXPECT_TRUE(machine.graphics_card().has_device_id()); - } else { - EXPECT_FALSE(machine.has_graphics_card()); } ASSERT_TRUE(fingerprint->has_transient_state());
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc index e3d547c..d7621d7 100644 --- a/components/autofill/core/browser/autofill_external_delegate.cc +++ b/components/autofill/core/browser/autofill_external_delegate.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <functional> +#include <iterator> #include <optional> #include <utility> @@ -420,12 +421,22 @@ return &manager_->driver(); } -void AutofillExternalDelegate::OnSuggestionsShown() { +void AutofillExternalDelegate::OnSuggestionsShown( + base::span<const Suggestion> suggestions) { // Popups are expected to be Autofill or Autocomplete. - DCHECK_NE(GetMainFillingProduct(), FillingProduct::kPassword); + DCHECK(suggestions.empty() || + GetFillingProductFromSuggestionType(suggestions[0].type) != + FillingProduct::kPassword); + + std::vector<SuggestionType> shown_suggestion_types; + // TODO(crbug.com/362630793): Use a `DenseSet` instead of a vector. + shown_suggestion_types.reserve(suggestions.size()); + base::ranges::transform(suggestions, + std::back_insert_iterator(shown_suggestion_types), + &Suggestion::type); const bool has_autofill_suggestions = std::ranges::any_of( - shown_suggestion_types_, IsAutofillAndFirstLayerSuggestionId); + shown_suggestion_types, IsAutofillAndFirstLayerSuggestionId); // If the popup was manually triggered on an unclassified field, the chances // are high that it has no regular suggestions, as it is the main usecase for @@ -445,7 +456,7 @@ } else if (has_autofill_suggestions) { OnAutofillAvailabilityEvent( mojom::AutofillSuggestionAvailability::kAutofillAvailable); - if (base::Contains(shown_suggestion_types_, + if (base::Contains(shown_suggestion_types, SuggestionType::kDevtoolsTestAddresses)) { autofill_metrics::OnDevtoolsTestAddressesShown(); } @@ -456,16 +467,16 @@ // entries. OnAutofillAvailabilityEvent( mojom::AutofillSuggestionAvailability::kAutocompleteAvailable); - if (base::Contains(shown_suggestion_types_, + if (base::Contains(shown_suggestion_types, SuggestionType::kAutocompleteEntry)) { AutofillMetrics::OnAutocompleteSuggestionsShown(); } } - manager_->DidShowSuggestions(shown_suggestion_types_, query_form_, + manager_->DidShowSuggestions(shown_suggestion_types, query_form_, query_field_); - if (base::Contains(shown_suggestion_types_, + if (base::Contains(shown_suggestion_types, SuggestionType::kShowAccountCards)) { autofill_metrics::LogAutofillShowCardsFromGoogleAccountButtonEventMetric( autofill_metrics::ShowCardsFromGoogleAccountButtonEvent:: @@ -477,8 +488,7 @@ } } - if (base::Contains(shown_suggestion_types_, - SuggestionType::kScanCreditCard)) { + if (base::Contains(shown_suggestion_types, SuggestionType::kScanCreditCard)) { AutofillMetrics::LogScanCreditCardPromptMetric( AutofillMetrics::SCAN_CARD_ITEM_SHOWN); }
diff --git a/components/autofill/core/browser/autofill_external_delegate.h b/components/autofill/core/browser/autofill_external_delegate.h index 3c9c84b3..3470923 100644 --- a/components/autofill/core/browser/autofill_external_delegate.h +++ b/components/autofill/core/browser/autofill_external_delegate.h
@@ -10,6 +10,7 @@ #include "base/compiler_specific.h" #include "base/containers/flat_map.h" +#include "base/containers/span.h" #include "base/functional/callback.h" #include "base/gtest_prod_util.h" #include "base/memory/raw_ref.h" @@ -59,7 +60,7 @@ // AutofillSuggestionDelegate implementation. absl::variant<AutofillDriver*, password_manager::PasswordManagerDriver*> GetDriver() override; - void OnSuggestionsShown() override; + void OnSuggestionsShown(base::span<const Suggestion> suggestions) override; void OnSuggestionsHidden() override; void DidSelectSuggestion(const Suggestion& suggestion) override; void DidAcceptSuggestion(const Suggestion& suggestion,
diff --git a/components/autofill/core/browser/autofill_external_delegate_unittest.cc b/components/autofill/core/browser/autofill_external_delegate_unittest.cc index fcd6de04..d1679ed 100644 --- a/components/autofill/core/browser/autofill_external_delegate_unittest.cc +++ b/components/autofill/core/browser/autofill_external_delegate_unittest.cc
@@ -986,7 +986,7 @@ // This would normally get called from ShowAutofillSuggestions, but it is // mocked so we need to call OnSuggestionsShown ourselves. - external_delegate().OnSuggestionsShown(); + external_delegate().OnSuggestionsShown(autofill_item); // Update the current data list and ensure the popup is updated. data_list_items.emplace_back(); @@ -1330,7 +1330,7 @@ queried_field().global_id(), mojom::AutofillSuggestionAvailability::kNoSuggestions)); - external_delegate().OnSuggestionsShown(); + external_delegate().OnSuggestionsShown(suggestions); } // Test that a11y autofill availability is set to `kAutofillAvailable` when @@ -1348,7 +1348,7 @@ queried_field().global_id(), mojom::AutofillSuggestionAvailability::kAutofillAvailable)); - external_delegate().OnSuggestionsShown(); + external_delegate().OnSuggestionsShown(suggestions); } // Test that a11y autofill availability is set to `kAutocompleteAvailable` when @@ -1367,7 +1367,7 @@ queried_field().global_id(), mojom::AutofillSuggestionAvailability::kAutocompleteAvailable)); - external_delegate().OnSuggestionsShown(); + external_delegate().OnSuggestionsShown(suggestions); } // Test parameter data for asserting filling method metrics depending on the @@ -1545,11 +1545,10 @@ base::HistogramTester histogram_tester; client().set_test_addresses({test::GetFullProfile()}); IssueOnQuery(); - OnSuggestionsReturned( - queried_field().global_id(), - {test::CreateAutofillSuggestion(SuggestionType::kDevtoolsTestAddresses, - u"Devtools")}); - external_delegate().OnSuggestionsShown(); + std::vector<Suggestion> suggestions = {test::CreateAutofillSuggestion( + SuggestionType::kDevtoolsTestAddresses, u"Devtools")}; + OnSuggestionsReturned(queried_field().global_id(), suggestions); + external_delegate().OnSuggestionsShown(suggestions); histogram_tester.ExpectUniqueSample( "Autofill.TestAddressesEvent", autofill_metrics::AutofillInDevtoolsTestAddressesEvents:: @@ -2553,9 +2552,10 @@ ScanCreditCardMetrics_SuggestionShown) { base::HistogramTester histogram; IssueOnQuery(); - OnSuggestionsReturned(queried_field().global_id(), - {Suggestion(SuggestionType::kScanCreditCard)}); - external_delegate().OnSuggestionsShown(); + std::vector<Suggestion> suggestions = { + Suggestion(SuggestionType::kScanCreditCard)}; + OnSuggestionsReturned(queried_field().global_id(), suggestions); + external_delegate().OnSuggestionsShown(suggestions); histogram.ExpectUniqueSample("Autofill.ScanCreditCardPrompt", AutofillMetrics::SCAN_CARD_ITEM_SHOWN, 1); @@ -2565,9 +2565,10 @@ ScanCreditCardMetrics_SuggestionAccepted) { base::HistogramTester histogram; IssueOnQuery(); - OnSuggestionsReturned(queried_field().global_id(), - {Suggestion(SuggestionType::kScanCreditCard)}); - external_delegate().OnSuggestionsShown(); + std::vector<Suggestion> suggestions = { + Suggestion(SuggestionType::kScanCreditCard)}; + OnSuggestionsReturned(queried_field().global_id(), suggestions); + external_delegate().OnSuggestionsShown(suggestions); external_delegate().DidAcceptSuggestion( Suggestion(SuggestionType::kScanCreditCard), @@ -2586,9 +2587,10 @@ ScanCreditCardMetrics_DifferentSuggestionAccepted) { base::HistogramTester histogram; IssueOnQuery(); - OnSuggestionsReturned(queried_field().global_id(), - {Suggestion(SuggestionType::kScanCreditCard)}); - external_delegate().OnSuggestionsShown(); + std::vector<Suggestion> suggestions = { + Suggestion(SuggestionType::kScanCreditCard)}; + OnSuggestionsReturned(queried_field().global_id(), suggestions); + external_delegate().OnSuggestionsShown(suggestions); external_delegate().DidAcceptSuggestion( Suggestion(SuggestionType::kCreditCardEntry), @@ -2608,18 +2610,17 @@ base::HistogramTester histogram; IssueOnQuery(); OnSuggestionsReturned(queried_field().global_id(), {}); - external_delegate().OnSuggestionsShown(); + external_delegate().OnSuggestionsShown({}); histogram.ExpectTotalCount("Autofill.ScanCreditCardPrompt", 0); } TEST_F(AutofillExternalDelegateUnitTest, AutocompleteShown_MetricsEmitted) { base::HistogramTester histogram; IssueOnQuery(); - OnSuggestionsReturned( - queried_field().global_id(), - {test::CreateAutofillSuggestion(SuggestionType::kAutocompleteEntry, - u"autocomplete")}); - external_delegate().OnSuggestionsShown(); + std::vector<Suggestion> suggestions = {test::CreateAutofillSuggestion( + SuggestionType::kAutocompleteEntry, u"autocomplete")}; + OnSuggestionsReturned(queried_field().global_id(), suggestions); + external_delegate().OnSuggestionsShown(suggestions); histogram.ExpectBucketCount("Autocomplete.Events2", AutofillMetrics::AUTOCOMPLETE_SUGGESTIONS_SHOWN, 1); @@ -2862,9 +2863,10 @@ base::HistogramTester histogram_tester; auto show_suggestions = [&]() { - OnSuggestionsReturned(queried_field().global_id(), - {Suggestion(SuggestionType::kShowAccountCards)}); - external_delegate().OnSuggestionsShown(); + std::vector<Suggestion> suggestions = { + Suggestion(SuggestionType::kShowAccountCards)}; + OnSuggestionsReturned(queried_field().global_id(), suggestions); + external_delegate().OnSuggestionsShown(suggestions); }; IssueOnQuery();
diff --git a/components/autofill/core/browser/browser_autofill_manager_unittest.cc b/components/autofill/core/browser/browser_autofill_manager_unittest.cc index ecdce20..42d243d 100644 --- a/components/autofill/core/browser/browser_autofill_manager_unittest.cc +++ b/components/autofill/core/browser/browser_autofill_manager_unittest.cc
@@ -1567,7 +1567,7 @@ browser_autofill_manager_->AddSeenForm(form, {NAME_FIRST, NAME_LAST}); GetAutofillSuggestions(form, field); // This ensures that the field has `did_trigger_suggestion_` set. - external_delegate()->OnSuggestionsShown(); + external_delegate()->OnSuggestionsShown(external_delegate()->suggestions()); // Submit the form without calling DidAcceptSuggestions, meaning the user // ignored the suggestions given by Autofill. FormSubmitted(form);
diff --git a/components/autofill/core/browser/test_autofill_external_delegate.cc b/components/autofill/core/browser/test_autofill_external_delegate.cc index d2b0dcf..76c1b71f 100644 --- a/components/autofill/core/browser/test_autofill_external_delegate.cc +++ b/components/autofill/core/browser/test_autofill_external_delegate.cc
@@ -21,10 +21,11 @@ TestAutofillExternalDelegate::~TestAutofillExternalDelegate() = default; -void TestAutofillExternalDelegate::OnSuggestionsShown() { +void TestAutofillExternalDelegate::OnSuggestionsShown( + base::span<const Suggestion> suggestions) { popup_hidden_ = false; - AutofillExternalDelegate::OnSuggestionsShown(); + AutofillExternalDelegate::OnSuggestionsShown(suggestions); } void TestAutofillExternalDelegate::OnSuggestionsHidden() {
diff --git a/components/autofill/core/browser/test_autofill_external_delegate.h b/components/autofill/core/browser/test_autofill_external_delegate.h index 2b52677e..41fb81e 100644 --- a/components/autofill/core/browser/test_autofill_external_delegate.h +++ b/components/autofill/core/browser/test_autofill_external_delegate.h
@@ -30,7 +30,7 @@ ~TestAutofillExternalDelegate() override; // AutofillExternalDelegate overrides. - void OnSuggestionsShown() override; + void OnSuggestionsShown(base::span<const Suggestion> suggestions) override; void OnSuggestionsHidden() override; void OnQuery(const FormData& form, const FormFieldData& field,
diff --git a/components/autofill/core/browser/ui/autofill_suggestion_delegate.h b/components/autofill/core/browser/ui/autofill_suggestion_delegate.h index 8843d6f..1754b4f 100644 --- a/components/autofill/core/browser/ui/autofill_suggestion_delegate.h +++ b/components/autofill/core/browser/ui/autofill_suggestion_delegate.h
@@ -5,6 +5,7 @@ #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_UI_AUTOFILL_SUGGESTION_DELEGATE_H_ #define COMPONENTS_AUTOFILL_CORE_BROWSER_UI_AUTOFILL_SUGGESTION_DELEGATE_H_ +#include "base/containers/span.h" #include "base/functional/callback_forward.h" #include "components/autofill/core/browser/filling_product.h" #include "components/autofill/core/browser/ui/suggestion.h" @@ -42,7 +43,7 @@ // Called when Autofill suggestions are shown. On Desktop, where the // suggestions support sub-popups, only the root popup triggers this call. - virtual void OnSuggestionsShown() = 0; + virtual void OnSuggestionsShown(base::span<const Suggestion> suggestions) = 0; // Called when Autofill suggestions are hidden. This may also get called if // the suggestions were never shown at all, e.g. because of insufficient
diff --git a/components/autofill/core/browser/ui/mock_autofill_suggestion_delegate.h b/components/autofill/core/browser/ui/mock_autofill_suggestion_delegate.h index 883863fd..d53a23f 100644 --- a/components/autofill/core/browser/ui/mock_autofill_suggestion_delegate.h +++ b/components/autofill/core/browser/ui/mock_autofill_suggestion_delegate.h
@@ -24,7 +24,10 @@ GetDriver, (), (override)); - MOCK_METHOD(void, OnSuggestionsShown, (), (override)); + MOCK_METHOD(void, + OnSuggestionsShown, + (base::span<const Suggestion>), + (override)); MOCK_METHOD(void, OnSuggestionsHidden, (), (override)); MOCK_METHOD(void, DidSelectSuggestion,
diff --git a/components/autofill/ios/browser/autofill_agent.mm b/components/autofill/ios/browser/autofill_agent.mm index 1489e36a..0497a33 100644 --- a/components/autofill/ios/browser/autofill_agent.mm +++ b/components/autofill/ios/browser/autofill_agent.mm
@@ -684,8 +684,11 @@ [self onSuggestionsReady:suggestions suggestionDelegate:delegate]; - if (delegate) - delegate->OnSuggestionsShown(); + // TODO(crbug.com/363958046): Pass the actually shown suggestions instead of + // `popup_suggestions`. + if (delegate) { + delegate->OnSuggestionsShown(popup_suggestions); + } } - (void)hideAutofillPopup {
diff --git a/components/autofill/ios/form_util/child_frame_registrar.h b/components/autofill/ios/form_util/child_frame_registrar.h index 9d02a6e..112a669e 100644 --- a/components/autofill/ios/form_util/child_frame_registrar.h +++ b/components/autofill/ios/form_util/child_frame_registrar.h
@@ -9,8 +9,12 @@ #import <optional> #import "base/observer_list.h" +#import "base/scoped_multi_source_observation.h" +#import "base/scoped_observation.h" #import "components/autofill/core/common/unique_ids.h" #import "ios/web/public/js_messaging/java_script_feature.h" +#import "ios/web/public/js_messaging/web_frames_manager.h" +#import "ios/web/public/web_state_observer.h" #import "ios/web/public/web_state_user_data.h" namespace autofill { @@ -28,7 +32,9 @@ // remote frame token) to a child frame, establishing a relationship between // that frame in the DOM (and JS) and the corresponding WebFrame object in C++. // This class maintains those mappings. -class ChildFrameRegistrar : public web::WebStateUserData<ChildFrameRegistrar> { +class ChildFrameRegistrar : public web::WebStateUserData<ChildFrameRegistrar>, + public web::WebFramesManager::Observer, + public web::WebStateObserver { public: ~ChildFrameRegistrar() override; @@ -77,11 +83,22 @@ // Removes |observer| from the list of observers. void RemoveObserver(ChildFrameRegistrarObserver* observer); + // web::WebFramesManager::Observer: + void WebFrameBecameUnavailable(web::WebFramesManager* web_frames_manager, + const std::string& frame_id) override; + + // web::WebStateObserver + void WebStateDestroyed(web::WebState* web_state) override; + private: explicit ChildFrameRegistrar(web::WebState* web_state); friend class web::WebStateUserData<ChildFrameRegistrar>; WEB_STATE_USER_DATA_KEY_DECL(); + // Deletes all entries in `lookup_map_` that contain `frame_id` as local frame + // token. + void RemoveFrameID(const std::string& frame_id); + // Maintains the mapping used by `LookupChildFrame`. The value containing the // local frame token is set to std::nullopt if there was at least one attempt // to register the same remote token, as a security precaution, making the @@ -95,6 +112,16 @@ pending_callbacks_; base::ObserverList<ChildFrameRegistrarObserver> observers_; + + // Observation for listening to WebFrame events. Multiple observations are + // required because there are two WebFramesManager per WebState, one for each + // ContentWorld. + base::ScopedMultiSourceObservation<web::WebFramesManager, + web::WebFramesManager::Observer> + web_frames_managers_observation_{this}; + + base::ScopedObservation<web::WebState, web::WebStateObserver> + web_state_observation_{this}; }; } // namespace autofill
diff --git a/components/autofill/ios/form_util/child_frame_registrar.mm b/components/autofill/ios/form_util/child_frame_registrar.mm index c62f2f1a..7fac8b63 100644 --- a/components/autofill/ios/form_util/child_frame_registrar.mm +++ b/components/autofill/ios/form_util/child_frame_registrar.mm
@@ -7,6 +7,7 @@ #import "base/values.h" #import "components/autofill/core/common/autofill_features.h" #import "components/autofill/ios/browser/autofill_util.h" +#import "ios/web/public/js_messaging/content_world.h" namespace autofill { @@ -136,8 +137,50 @@ } ChildFrameRegistrar::ChildFrameRegistrar(web::WebState* web_state) { - // TODO(crbug.com/40266126): Register self as observer of WebState and remove - // stale frame IDs from `lookup_map_`. + CHECK(web_state); + + // Monitor frame destruction. When frames are gone we clean up entries in + // `lookup_map_` containing their local frame token. + for (auto content_world : {web::ContentWorld::kPageContentWorld, + web::ContentWorld::kIsolatedWorld}) { + web_frames_managers_observation_.AddObservation( + web_state->GetWebFramesManager(content_world)); + } + // On WebState destruction we need to remove the frame managers observation. + // Otherwise the frame managers can be destroyed first which cause a UAF when + // `this` is destroyed and tries to remove itself as an observer of the + // destroyed frame manager. + web_state_observation_.Observe(web_state); +} + +void ChildFrameRegistrar::WebFrameBecameUnavailable( + web::WebFramesManager* web_frames_manager, + const std::string& frame_id) { + // Now that the frame with `frame_id` is gone, remove all stale entries in + // `lookup_map_` containing `frame_id` as local frame token. + RemoveFrameID(frame_id); +} + +void ChildFrameRegistrar::WebStateDestroyed(web::WebState* web_state) { + web_frames_managers_observation_.RemoveAllObservations(); + web_state_observation_.Reset(); +} + +void ChildFrameRegistrar::RemoveFrameID(const std::string& frame_id) { + std::optional<base::UnguessableToken> deserialized_frame_id = + DeserializeJavaScriptFrameId(frame_id); + if (!deserialized_frame_id) { + return; + } + LocalFrameToken local_frame_token = LocalFrameToken(*deserialized_frame_id); + + for (auto it = lookup_map_.begin(); it != lookup_map_.end();) { + if (it->second == local_frame_token) { + lookup_map_.erase(it++); + } else { + ++it; + } + } } WEB_STATE_USER_DATA_KEY_IMPL(ChildFrameRegistrar)
diff --git a/components/autofill/ios/form_util/child_frame_registrar_unittest.mm b/components/autofill/ios/form_util/child_frame_registrar_unittest.mm index 3222901..d5eb67fe 100644 --- a/components/autofill/ios/form_util/child_frame_registrar_unittest.mm +++ b/components/autofill/ios/form_util/child_frame_registrar_unittest.mm
@@ -6,15 +6,30 @@ #import "base/strings/string_util.h" #import "components/autofill/ios/browser/autofill_util.h" +#import "ios/web/public/js_messaging/content_world.h" +#import "ios/web/public/test/fakes/fake_web_frame.h" +#import "ios/web/public/test/fakes/fake_web_frames_manager.h" #import "ios/web/public/test/fakes/fake_web_state.h" #import "testing/gtest/include/gtest/gtest.h" #import "testing/platform_test.h" +#import "url/gurl.h" namespace autofill { class ChildFrameRegistrarTest : public PlatformTest { protected: ChildFrameRegistrarTest() { + auto page_frames_manager = std::make_unique<web::FakeWebFramesManager>(); + page_frames_manager_ = page_frames_manager.get(); + web_state_.SetWebFramesManager(web::ContentWorld::kPageContentWorld, + std::move(page_frames_manager)); + + auto isolated_frames_manager = + std::make_unique<web::FakeWebFramesManager>(); + isolated_frames_manager_ = isolated_frames_manager.get(); + web_state_.SetWebFramesManager(web::ContentWorld::kIsolatedWorld, + std::move(isolated_frames_manager)); + ChildFrameRegistrar::CreateForWebState(&web_state_); } @@ -23,6 +38,8 @@ } web::FakeWebState web_state_; + raw_ptr<web::FakeWebFramesManager> page_frames_manager_ = nullptr; + raw_ptr<web::FakeWebFramesManager> isolated_frames_manager_ = nullptr; }; // Happy path: pass a valid remote/local token pair and confirm that we can get @@ -68,4 +85,67 @@ registrar()->ProcessRegistrationMessage(&junk); } +// Test that stale local tokens are cleaned up when frames are removed. +TEST_F(ChildFrameRegistrarTest, CleanUpStaleLocalFrameTokens) { + // Add a frame to the page content world manager. + const std::string local_frame_id1 = std::string(32, 'a'); + page_frames_manager_->AddWebFrame( + web::FakeWebFrame::Create(local_frame_id1, /*is_main_frame=*/true, + /*security_origin=*/GURL())); + + autofill::LocalFrameToken local_token1( + *DeserializeJavaScriptFrameId(local_frame_id1)); + + // Map two remote tokens to the frame id. + autofill::RemoteFrameToken remote_token1( + *DeserializeJavaScriptFrameId(std::string(32, 'b'))); + registrar()->RegisterMapping(remote_token1, local_token1); + + autofill::RemoteFrameToken remote_token2( + *DeserializeJavaScriptFrameId(std::string(32, 'c'))); + registrar()->RegisterMapping(remote_token2, local_token1); + + ASSERT_TRUE(registrar()->LookupChildFrame(remote_token1)); + ASSERT_TRUE(registrar()->LookupChildFrame(remote_token2)); + + // Add another mapping that should not be affected by the frame deletion. + autofill::LocalFrameToken local_token2( + *DeserializeJavaScriptFrameId(std::string(32, 'd'))); + autofill::RemoteFrameToken remote_token3( + *DeserializeJavaScriptFrameId(std::string(32, 'e'))); + registrar()->RegisterMapping(remote_token3, local_token2); + + // Delete the frame. + page_frames_manager_->RemoveWebFrame(local_frame_id1); + + // Validate that the entries with `local_frame_id1` were cleaned up. + ASSERT_FALSE(registrar()->LookupChildFrame(remote_token1)); + ASSERT_FALSE(registrar()->LookupChildFrame(remote_token2)); + + // Validate that the other entry was not deleted. + ASSERT_TRUE(registrar()->LookupChildFrame(remote_token3)); + + // Test the same in the isolated world. + isolated_frames_manager_->AddWebFrame( + web::FakeWebFrame::Create(local_frame_id1, /*is_main_frame=*/true, + /*security_origin=*/GURL())); + + // Map two remote tokens to the frame id. + registrar()->RegisterMapping(remote_token1, local_token1); + registrar()->RegisterMapping(remote_token2, local_token1); + + ASSERT_TRUE(registrar()->LookupChildFrame(remote_token1)); + ASSERT_TRUE(registrar()->LookupChildFrame(remote_token2)); + + // Delete the frame. + isolated_frames_manager_->RemoveWebFrame(local_frame_id1); + + // Validate that the entries with `local_frame_id` were cleaned up. + ASSERT_FALSE(registrar()->LookupChildFrame(remote_token1)); + ASSERT_FALSE(registrar()->LookupChildFrame(remote_token2)); + + // Validate that the other entry was not deleted. + ASSERT_TRUE(registrar()->LookupChildFrame(remote_token3)); +} + } // namespace autofill
diff --git a/components/commerce_strings.grdp b/components/commerce_strings.grdp index 2b31a23..3ab6f7f 100644 --- a/components/commerce_strings.grdp +++ b/components/commerce_strings.grdp
@@ -635,7 +635,7 @@ </message> <!-- For Compare Disclosure --> <message name="IDS_COMPARE_DISCLOSURE_TITLE" desc="The text for the title of the Compare first-run experience disclosure bubble."> - Chrome can help you compare similar products side-by-side + Compare similar products side-by-side </message> <message name="IDS_COMPARE_DISCLOSURE_ITEMS_HEADER" desc="The text for the Compare disclosure items header."> Things to consider @@ -644,7 +644,7 @@ This feature uses AI and won't always get it right </message> <message name="IDS_COMPARE_DISCLOSURE_TAB_ITEM" desc="The text for the Compare disclosure item that states what tab data is shared with Google."> - Selected tab titles and URLs using are sent to Google + The tab titles and URLs of pages you add to the table are sent to Google </message> <message name="IDS_COMPARE_DISCLOSURE_ACCOUNT_ITEM" desc="The text for the Compare disclosure item that states where the data is stored."> Comparison tables are saved to your account <ph name="EMAIL">$1<ex>test@gmail.com</ex></ph> @@ -652,9 +652,6 @@ <message name="IDS_COMPARE_DISCLOSURE_DATA_ITEM" desc="The text for the Compare disclosure item that states who might see the data."> Data may be seen by trained reviewers to improve this feature </message> - <message name="IDS_COMPARE_DISCLOSURE_LEARN_MORE" desc="The text for the Compare disclosure statement if user wants to learn more about the feature."> - <ph name="BEGIN_LINK"><a href="#"></ph>Learn more<ph name="END_LINK"></a></ph> about comparison tables - </message> <message name="IDS_COMPARE_DISCLOSURE_ACCEPT" desc="The text for the accept button on the Compare first-run experience disclosure."> Let's go </message>
diff --git a/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_LEARN_MORE.png.sha1 b/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_LEARN_MORE.png.sha1 deleted file mode 100644 index fc3e369..0000000 --- a/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_LEARN_MORE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -5426d46ead8e6cfc70ffbb3157f8e448a51ef449 \ No newline at end of file
diff --git a/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_TAB_ITEM.png.sha1 b/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_TAB_ITEM.png.sha1 index fc3e369..6b5dc2a 100644 --- a/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_TAB_ITEM.png.sha1 +++ b/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_TAB_ITEM.png.sha1
@@ -1 +1 @@ -5426d46ead8e6cfc70ffbb3157f8e448a51ef449 \ No newline at end of file +e3def40b8921de87a6eab6aaf77cc4b5168c91b0 \ No newline at end of file
diff --git a/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_TITLE.png.sha1 b/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_TITLE.png.sha1 index fc3e369..6b5dc2a 100644 --- a/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_TITLE.png.sha1 +++ b/components/commerce_strings_grdp/IDS_COMPARE_DISCLOSURE_TITLE.png.sha1
@@ -1 +1 @@ -5426d46ead8e6cfc70ffbb3157f8e448a51ef449 \ No newline at end of file +e3def40b8921de87a6eab6aaf77cc4b5168c91b0 \ No newline at end of file
diff --git a/components/content_settings/core/browser/content_settings_origin_value_map.cc b/components/content_settings/core/browser/content_settings_origin_value_map.cc index 0c01f06..8662d6a 100644 --- a/components/content_settings/core/browser/content_settings_origin_value_map.cc +++ b/components/content_settings/core/browser/content_settings_origin_value_map.cc
@@ -116,7 +116,7 @@ return result; } -OriginValueMap::OriginValueMap(base::Clock* clock) : clock_(clock) { +OriginValueMap::OriginValueMap(const base::Clock* clock) : clock_(clock) { DCHECK(clock); } @@ -184,7 +184,7 @@ return entry_index().clear(); } -void OriginValueMap::SetClockForTesting(base::Clock* clock) { +void OriginValueMap::SetClockForTesting(const base::Clock* clock) { clock_ = clock; base::AutoLock lock(lock_); for (auto& index : entry_index()) {
diff --git a/components/content_settings/core/browser/content_settings_origin_value_map.h b/components/content_settings/core/browser/content_settings_origin_value_map.h index 1b46f2d..dcd9b88b 100644 --- a/components/content_settings/core/browser/content_settings_origin_value_map.h +++ b/components/content_settings/core/browser/content_settings_origin_value_map.h
@@ -71,7 +71,7 @@ EXCLUSIVE_LOCKS_REQUIRED(lock_); OriginValueMap(); - explicit OriginValueMap(base::Clock* clock); + explicit OriginValueMap(const base::Clock* clock); OriginValueMap(const OriginValueMap&) = delete; OriginValueMap& operator=(const OriginValueMap&) = delete; @@ -113,7 +113,7 @@ // Clears all map entries. void clear() EXCLUSIVE_LOCKS_REQUIRED(lock_); - void SetClockForTesting(base::Clock* clock); + void SetClockForTesting(const base::Clock* clock); private: typedef std::map<ContentSettingsType, HostIndexedContentSettings> EntryIndex; @@ -133,7 +133,7 @@ mutable base::Lock lock_; EntryIndex entries_ GUARDED_BY(lock_); - raw_ptr<base::Clock> clock_; + raw_ptr<const base::Clock> clock_; }; } // namespace content_settings
diff --git a/components/content_settings/core/browser/content_settings_partitioned_origin_value_map.cc b/components/content_settings/core/browser/content_settings_partitioned_origin_value_map.cc index f3ad5aa..710c3d7 100644 --- a/components/content_settings/core/browser/content_settings_partitioned_origin_value_map.cc +++ b/components/content_settings/core/browser/content_settings_partitioned_origin_value_map.cc
@@ -161,7 +161,7 @@ partitions_.clear(); } -void PartitionedOriginValueMap::SetClockForTesting(base::Clock* clock) { +void PartitionedOriginValueMap::SetClockForTesting(const base::Clock* clock) { clock_ = clock; base::AutoLock lock(lock_); for (auto& partition : partitions_) {
diff --git a/components/content_settings/core/browser/content_settings_partitioned_origin_value_map.h b/components/content_settings/core/browser/content_settings_partitioned_origin_value_map.h index 0a12b06..53a46b2 100644 --- a/components/content_settings/core/browser/content_settings_partitioned_origin_value_map.h +++ b/components/content_settings/core/browser/content_settings_partitioned_origin_value_map.h
@@ -102,14 +102,14 @@ // Clears all values. void clear() EXCLUSIVE_LOCKS_REQUIRED(lock_); - void SetClockForTesting(base::Clock* clock); + void SetClockForTesting(const base::Clock* clock); private: mutable base::Lock lock_; std::map<PartitionKey, OriginValueMap> partitions_ GUARDED_BY(lock_); - raw_ptr<base::Clock> clock_; + raw_ptr<const base::Clock> clock_; }; } // namespace content_settings
diff --git a/components/content_settings/core/browser/content_settings_pref.cc b/components/content_settings/core/browser/content_settings_pref.cc index e111269..e70e594 100644 --- a/components/content_settings/core/browser/content_settings_pref.cc +++ b/components/content_settings/core/browser/content_settings_pref.cc
@@ -663,7 +663,7 @@ #endif } -void ContentSettingsPref::SetClockForTesting(base::Clock* clock) { +void ContentSettingsPref::SetClockForTesting(const base::Clock* clock) { clock_ = clock; value_map_.SetClockForTesting(clock); // IN-TEST off_the_record_value_map_.SetClockForTesting(clock); // IN-TEST
diff --git a/components/content_settings/core/browser/content_settings_pref.h b/components/content_settings/core/browser/content_settings_pref.h index fe1adf6..20a7d80 100644 --- a/components/content_settings/core/browser/content_settings_pref.h +++ b/components/content_settings/core/browser/content_settings_pref.h
@@ -86,7 +86,7 @@ // Tries to lock |lock_|. If successful, returns true and releases the lock. bool TryLockForTesting() const; - void SetClockForTesting(base::Clock* clock); + void SetClockForTesting(const base::Clock* clock); private: // Reads all content settings exceptions from the preference and loads them @@ -163,7 +163,7 @@ base::ThreadChecker thread_checker_; - raw_ptr<base::Clock> clock_; + raw_ptr<const base::Clock> clock_; }; } // namespace content_settings
diff --git a/components/content_settings/core/browser/content_settings_pref_provider.cc b/components/content_settings/core/browser/content_settings_pref_provider.cc index 153ba73a..3bf0065 100644 --- a/components/content_settings/core/browser/content_settings_pref_provider.cc +++ b/components/content_settings/core/browser/content_settings_pref_provider.cc
@@ -429,7 +429,7 @@ prefs_->ClearPref(kObsoleteFederatedIdentityActiveSesssionExceptionsPref); } -void PrefProvider::SetClockForTesting(base::Clock* clock) { +void PrefProvider::SetClockForTesting(const base::Clock* clock) { clock_ = clock; for (auto& pref : content_settings_prefs_) { pref.second->SetClockForTesting(clock); // IN-TEST
diff --git a/components/content_settings/core/browser/content_settings_pref_provider.h b/components/content_settings/core/browser/content_settings_pref_provider.h index 2b5db4b..1bc77829a 100644 --- a/components/content_settings/core/browser/content_settings_pref_provider.h +++ b/components/content_settings/core/browser/content_settings_pref_provider.h
@@ -87,7 +87,7 @@ ContentSettingsType content_type, std::optional<ContentSetting> setting_to_match, const PartitionKey& partition_key) override; - void SetClockForTesting(base::Clock* clock) override; + void SetClockForTesting(const base::Clock* clock) override; ContentSettingsPref* GetPref(ContentSettingsType type) const; @@ -137,7 +137,7 @@ base::ThreadChecker thread_checker_; - raw_ptr<base::Clock> clock_; + raw_ptr<const base::Clock> clock_; }; } // namespace content_settings
diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc index 61b4350..b676e57 100644 --- a/components/content_settings/core/browser/host_content_settings_map.cc +++ b/components/content_settings/core/browser/host_content_settings_map.cc
@@ -655,7 +655,7 @@ return weak_ptr_factory_.GetWeakPtr(); } -void HostContentSettingsMap::SetClockForTesting(base::Clock* clock) { +void HostContentSettingsMap::SetClockForTesting(const base::Clock* clock) { clock_ = clock; for (content_settings::UserModifiableProvider* provider : user_modifiable_providers_) {
diff --git a/components/content_settings/core/browser/host_content_settings_map.h b/components/content_settings/core/browser/host_content_settings_map.h index 64b9672..42c35f7 100644 --- a/components/content_settings/core/browser/host_content_settings_map.h +++ b/components/content_settings/core/browser/host_content_settings_map.h
@@ -353,7 +353,7 @@ // Injects a clock into the PrefProvider to allow control over the // |last_modified| timestamp. - void SetClockForTesting(base::Clock* clock); + void SetClockForTesting(const base::Clock* clock); // Returns the provider that contains content settings from user // preferences. @@ -541,7 +541,7 @@ // order to ensure the migration logic is sound. bool allow_invalid_secondary_pattern_for_testing_; - raw_ptr<base::Clock> clock_; + raw_ptr<const base::Clock> clock_; // Maps content setting type to OneShotTimers that are used to run // `DeleteNearlyExpiredSettingsAndMaybeScheduleNextRun` which checks for, and
diff --git a/components/content_settings/core/browser/user_modifiable_provider.h b/components/content_settings/core/browser/user_modifiable_provider.h index 7b13fc5b..ac884c91 100644 --- a/components/content_settings/core/browser/user_modifiable_provider.h +++ b/components/content_settings/core/browser/user_modifiable_provider.h
@@ -54,7 +54,7 @@ std::optional<ContentSetting> setting_to_match, const PartitionKey& partition_key) = 0; // Sets the providers internal clock for testing purposes. - virtual void SetClockForTesting(base::Clock* clock) = 0; + virtual void SetClockForTesting(const base::Clock* clock) = 0; // Asks provider to expire the website setting for a particular // |primary_pattern|, |secondary_pattern|, |content_type| tuple.
diff --git a/components/content_settings/core/common/content_settings_metadata.cc b/components/content_settings/core/common/content_settings_metadata.cc index 197940f4..cf09361 100644 --- a/components/content_settings/core/common/content_settings_metadata.cc +++ b/components/content_settings/core/common/content_settings_metadata.cc
@@ -33,7 +33,7 @@ lifetime_ = lifetime; } -bool RuleMetaData::IsExpired(base::Clock* clock) const { +bool RuleMetaData::IsExpired(const base::Clock* clock) const { return !expiration().is_null() && expiration() <= clock->Now(); }
diff --git a/components/content_settings/core/common/content_settings_metadata.h b/components/content_settings/core/common/content_settings_metadata.h index cdcaecc..70a0ef9e7 100644 --- a/components/content_settings/core/common/content_settings_metadata.h +++ b/components/content_settings/core/common/content_settings_metadata.h
@@ -86,7 +86,7 @@ // Returns whether the Rule is expired. Expiration is handled by // HostContentSettingsMap automatically, clients do not have to check this // attribute manually. - bool IsExpired(base::Clock* clock) const; + bool IsExpired(const base::Clock* clock) const; // Computes the setting's lifetime, based on the lifetime and expiration that // were read from persistent storage.
diff --git a/components/content_settings/core/common/host_indexed_content_settings.cc b/components/content_settings/core/common/host_indexed_content_settings.cc index 96c7e59..3fac26b 100644 --- a/components/content_settings/core/common/host_indexed_content_settings.cc +++ b/components/content_settings/core/common/host_indexed_content_settings.cc
@@ -64,7 +64,7 @@ const RuleEntry* FindContentSetting(const GURL& primary_url, const GURL& secondary_url, const Rules& settings, - base::Clock* clock) { + const base::Clock* clock) { const auto it = base::ranges::find_if(settings, [&](const auto& entry) { return entry.first.primary_pattern.Matches(primary_url) && entry.first.secondary_pattern.Matches(secondary_url) && @@ -81,7 +81,7 @@ const HostIndexedContentSettings::HostToContentSettings& indexed_content_setting, std::string_view host, - base::Clock* clock) { + const base::Clock* clock) { if (host.empty() || indexed_content_setting.empty()) { return nullptr; } @@ -236,7 +236,7 @@ HostIndexedContentSettings::HostIndexedContentSettings() : HostIndexedContentSettings(base::DefaultClock::GetInstance()) {} -HostIndexedContentSettings::HostIndexedContentSettings(base::Clock* clock) +HostIndexedContentSettings::HostIndexedContentSettings(const base::Clock* clock) : clock_(clock) { DCHECK(clock); } @@ -363,7 +363,7 @@ wildcard_settings_.empty(); } -void HostIndexedContentSettings::SetClockForTesting(base::Clock* clock) { +void HostIndexedContentSettings::SetClockForTesting(const base::Clock* clock) { clock_ = clock; }
diff --git a/components/content_settings/core/common/host_indexed_content_settings.h b/components/content_settings/core/common/host_indexed_content_settings.h index 05186c6..81f2cf9 100644 --- a/components/content_settings/core/common/host_indexed_content_settings.h +++ b/components/content_settings/core/common/host_indexed_content_settings.h
@@ -37,7 +37,7 @@ HostIndexedContentSettings(); - explicit HostIndexedContentSettings(base::Clock* clock); + explicit HostIndexedContentSettings(const base::Clock* clock); // Creates an index with additional metadata about the content settings // provider that the settings came from. @@ -133,7 +133,7 @@ // Clears the object information. void Clear(); - void SetClockForTesting(base::Clock* clock); + void SetClockForTesting(const base::Clock* clock); private: HostToContentSettings primary_host_indexed_; @@ -141,7 +141,7 @@ Rules wildcard_settings_; ProviderType source_ = ProviderType::kNone; std::optional<bool> off_the_record_; - raw_ptr<base::Clock> clock_; + raw_ptr<const base::Clock> clock_; mutable int iterating_ = 0; };
diff --git a/components/facilitated_payments_strings.grdp b/components/facilitated_payments_strings.grdp index 9969cc3..61f37af 100644 --- a/components/facilitated_payments_strings.grdp +++ b/components/facilitated_payments_strings.grdp
@@ -49,6 +49,9 @@ <message name="IDS_PIX_PAYMENT_ERROR_SCREEN_DESCRIPTION" desc="Description for the PIX payment error screen. It is shown if PIX payment fails after the user has selected an account to pay from." formatter_data="android_java"> Your transaction didn’t go through. No funds were withdrawn from your account. </message> + <message name="IDS_PIX_PAYMENT_PROGRESS_SCREEN_MESSAGE" desc="A message shown in the Pix payment progress screen informing the current status of the transaction. It is shown after a user has selected an account to pay from, and while Chrome is contacting the backend server." formatter_data="android_java"> + Contacting your financial institution... + </message> <message name="IDS_FACILITATED_PAYMENTS_OK" desc="Generic OK string to be used in any Facilitated Payments UI." formatter_data="android_java"> OK </message>
diff --git a/components/facilitated_payments_strings_grdp/IDS_PIX_PAYMENT_PROGRESS_SCREEN_MESSAGE.png.sha1 b/components/facilitated_payments_strings_grdp/IDS_PIX_PAYMENT_PROGRESS_SCREEN_MESSAGE.png.sha1 new file mode 100644 index 0000000..5ef7d34 --- /dev/null +++ b/components/facilitated_payments_strings_grdp/IDS_PIX_PAYMENT_PROGRESS_SCREEN_MESSAGE.png.sha1
@@ -0,0 +1 @@ +fd566ae2df6c9bd7563a1080853a473e5b227440 \ No newline at end of file
diff --git a/components/lens/lens_features.cc b/components/lens/lens_features.cc index 6a9137e6..8d08e57 100644 --- a/components/lens/lens_features.cc +++ b/components/lens/lens_features.cc
@@ -178,6 +178,9 @@ kUseSearchContextForMultimodalLensOverlayRequests{ &kLensOverlay, "use-search-context-for-multimodal-requests", false}; +constexpr base::FeatureParam<bool> kUsePdfsAsContext{ + &kLensOverlay, "use-pdfs-as-context", false}; + constexpr base::FeatureParam<int> kLensOverlayTapRegionHeight{ &kLensOverlay, "tap-region-height", 300}; constexpr base::FeatureParam<int> kLensOverlayTapRegionWidth{ @@ -447,6 +450,10 @@ return kUseSearchContextForMultimodalLensOverlayRequests.Get(); } +bool UsePdfsAsContext() { + return kUsePdfsAsContext.Get(); +} + int GetLensOverlayVerticalTextMargin() { return kLensOverlayVerticalTextMargin.Get(); }
diff --git a/components/lens/lens_features.h b/components/lens/lens_features.h index 08e009bb..ea7859d 100644 --- a/components/lens/lens_features.h +++ b/components/lens/lens_features.h
@@ -333,6 +333,11 @@ COMPONENT_EXPORT(LENS_FEATURES) extern bool UseSearchContextForMultimodalLensOverlayRequests(); +// Returns whether to include PDFs from the underlying page in the request to be +// used as page context. +COMPONENT_EXPORT(LENS_FEATURES) +extern bool UsePdfsAsContext(); + // Returns the margin in pixels to add to the top and bottom of word bounding // boxes. COMPONENT_EXPORT(LENS_FEATURES)
diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc index a07a494f..0acf1d8a 100644 --- a/components/omnibox/browser/autocomplete_controller.cc +++ b/components/omnibox/browser/autocomplete_controller.cc
@@ -1038,12 +1038,14 @@ if (keyword_turl && keyword_turl->starter_pack_id() > 0) { switch (provider->type()) { - // Search provider and keyword provider are still run because we would - // lose the suggestion the keyword chip is attached to otherwise. Search - // provider suggestions are curbed for starter pack scopes in - // `SearchProvider::ShouldCurbDefaultSuggestions()`. + // Keyword provider creates the suggestion attached to the keyword chip + // and search provider creates the SEARCH_OTHER_ENGINE suggestion + // required for keyword mode to work. These still need to be run or + // keyword mode breaks. + // search-what-you-typed suggestions from the DSE are usually provided + // by the search provider, but are skipped within the search provider + // logic when in keyword mode, so do not need to be handled here.. case AutocompleteProvider::TYPE_SEARCH: - return true; case AutocompleteProvider::TYPE_KEYWORD: return true; @@ -1073,32 +1075,23 @@ } // Outside of the starter pack scopes, keyword mode should still restrict - // certain providers (when LimitKeywordModeSuggestions is enabled). - if (omnibox_feature_configs::LimitKeywordModeSuggestions::Get().enabled) { - switch (provider->type()) { - // Don't run history cluster provider. - case AutocompleteProvider::TYPE_HISTORY_CLUSTER_PROVIDER: - return !(omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_history_cluster_suggestions); + // certain providers. + switch (provider->type()) { + // Don't run history cluster provider or on device head provider. + case AutocompleteProvider::TYPE_HISTORY_CLUSTER_PROVIDER: + case AutocompleteProvider::TYPE_ON_DEVICE_HEAD: + return false; - // Don't run document provider, except for Google Drive. - case AutocompleteProvider::TYPE_DOCUMENT: - return !(omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_document_suggestions) || - (keyword_turl && - base::StartsWith(keyword_turl->url(), - "https://drive.google.com", - base::CompareCase::INSENSITIVE_ASCII)); + // Don't run document provider, except for Google Drive. + case AutocompleteProvider::TYPE_DOCUMENT: + return (keyword_turl && + base::StartsWith(keyword_turl->url(), + "https://drive.google.com", + base::CompareCase::INSENSITIVE_ASCII)); - // Don't run on device head provider. - case AutocompleteProvider::TYPE_ON_DEVICE_HEAD: - return !(omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_on_device_head_suggestions); - - // Treat all other providers as usual. - default: - break; - } + // Treat all other providers as usual. + default: + break; } }
diff --git a/components/omnibox/browser/autocomplete_controller_unittest.cc b/components/omnibox/browser/autocomplete_controller_unittest.cc index 3da0c47e..5bc9378 100644 --- a/components/omnibox/browser/autocomplete_controller_unittest.cc +++ b/components/omnibox/browser/autocomplete_controller_unittest.cc
@@ -2104,17 +2104,7 @@ } } -TEST_F(AutocompleteControllerTest, ShouldRunProvider) { - // Disable LimitKeywordModeSuggestions flag. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatureState( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions, - false); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; - +TEST_F(AutocompleteControllerTest, ShouldRunProvider_StarterPack) { std::set<AutocompleteProvider::Type> expected_provider_types; AutocompleteInput input(u"a", 1u, metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); @@ -2136,16 +2126,9 @@ << AutocompleteProvider::TypeToString(provider->type()); } - // In keyword mode but not starter pack, LimitkeywordModeSuggestions disabled, - // run all providers except open tab provider. + // Enter keyword mode. controller_.input_.set_keyword_mode_entry_method( metrics::OmniboxEventProto_KeywordModeEntryMethod_TAB); - for (auto& provider : controller_.providers()) { - EXPECT_EQ(controller_.ShouldRunProvider(provider.get()), - provider->type() != AutocompleteProvider::TYPE_OPEN_TAB) - << "Provider Type: " - << AutocompleteProvider::TypeToString(provider->type()); - } // In @tabs, run search, keyword, and open tab provider only. controller_.input_.UpdateText(u"@tabs", 0, {}); @@ -2187,16 +2170,6 @@ TEST_F(AutocompleteControllerTest, ShouldRunProvider_LimitKeywordModeSuggestions) { - // Enable LimitKeywordModeSuggestions flag. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatureState( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions, - true); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; - std::set<AutocompleteProvider::Type> excluded_provider_types; AutocompleteInput input(u"a", 1u, metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); @@ -2255,24 +2228,6 @@ << "Provider Type: " << AutocompleteProvider::TypeToString(provider->type()); } - - // Turn off param to limit history cluster and document suggestions, ensure - // they're run. - scoped_feature_list.Reset(); - scoped_feature_list.InitAndEnableFeatureWithParameters( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions, - {{"LimitHistoryClusterSuggestions", "false"}}); - scoped_config.Reset(); - controller_.input_.UpdateText(u"keyword", 0, {}); - excluded_provider_types = {AutocompleteProvider::TYPE_OPEN_TAB, - AutocompleteProvider::TYPE_DOCUMENT}; - for (auto& provider : controller_.providers()) { - EXPECT_NE(controller_.ShouldRunProvider(provider.get()), - excluded_provider_types.contains(provider->type())) - << "Provider Type: " - << AutocompleteProvider::TypeToString(provider->type()); - } } TEST_F(AutocompleteControllerTest, ShouldRunProvider_LensSearchbox) {
diff --git a/components/omnibox/browser/autocomplete_provider_unittest.cc b/components/omnibox/browser/autocomplete_provider_unittest.cc index b74d0d34..482059a 100644 --- a/components/omnibox/browser/autocomplete_provider_unittest.cc +++ b/components/omnibox/browser/autocomplete_provider_unittest.cc
@@ -826,36 +826,20 @@ RunExactKeymatchTest(true); CopyResults(); - // When LimitKeywordModeSuggestions is enabled, DSE suggestions are curbed in - // keyword mode, so this test is only relevant when disabled. - if (!omnibox_feature_configs::LimitKeywordModeSuggestions::Get().enabled) { - ASSERT_EQ(2U, result_.size()); - EXPECT_EQ("http://keyword/test", - result_.match_at(0)->destination_url.possibly_invalid_spec()); - EXPECT_EQ("http://defaultturl/k%20test?a=b", - result_.match_at(1)->destination_url.possibly_invalid_spec()); - } + ASSERT_EQ(1U, result_.size()); + EXPECT_EQ("http://keyword/test", + result_.match_at(0)->destination_url.possibly_invalid_spec()); } // Ensures matches from (only) the default search provider are curbed when in -// keyword mode and LimitKeywordModeSuggestions is enabled. +// keyword mode. TEST_F(AutocompleteProviderTest, CurbDefaultSuggestions) { - // Enable LimitKeywordModeSuggestions flag. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatureState( - omnibox_feature_configs::LimitKeywordModeSuggestions:: - kLimitKeywordModeSuggestions, - true); - omnibox_feature_configs::ScopedConfigForTesting< - omnibox_feature_configs::LimitKeywordModeSuggestions> - scoped_config; - ResetControllerWithKeywordAndSearchProviders(); RunExactKeymatchTest(true); CopyResults(); - // When LimitKeywordModeSuggestions is enabled, DSE suggestions are curbed, so - // the default turl suggestion should not be present in the results. + // DSE suggestions are curbed in keyword mode, so the default turl suggestion + // should not be present in the res=ults. ASSERT_EQ(1U, result_.size()); EXPECT_EQ("http://keyword/test", result_.match_at(0)->destination_url.possibly_invalid_spec());
diff --git a/components/omnibox/browser/omnibox_feature_configs.cc b/components/omnibox/browser/omnibox_feature_configs.cc index 4758b861..1a275a6 100644 --- a/components/omnibox/browser/omnibox_feature_configs.cc +++ b/components/omnibox/browser/omnibox_feature_configs.cc
@@ -62,31 +62,6 @@ } // static -BASE_FEATURE(LimitKeywordModeSuggestions::kLimitKeywordModeSuggestions, - "OmniboxLimitKeywordModeSuggestions", - base::FEATURE_ENABLED_BY_DEFAULT); -LimitKeywordModeSuggestions::LimitKeywordModeSuggestions() { - enabled = base::FeatureList::IsEnabled(kLimitKeywordModeSuggestions); - - limit_document_suggestions = - base::FeatureParam<bool>(&kLimitKeywordModeSuggestions, - "LimitDocumentSuggestions", true) - .Get(); - limit_history_cluster_suggestions = - base::FeatureParam<bool>(&kLimitKeywordModeSuggestions, - "LimitHistoryClusterSuggestions", true) - .Get(); - limit_dse_suggestions = - base::FeatureParam<bool>(&kLimitKeywordModeSuggestions, - "LimitDSESuggestions", true) - .Get(); - limit_on_device_head_suggestions = - base::FeatureParam<bool>(&kLimitKeywordModeSuggestions, - "LimitOnDeviceHeadSuggestions", true) - .Get(); -} - -// static BASE_FEATURE(RealboxContextualAndTrendingSuggestions:: kRealboxContextualAndTrendingSuggestions, "NTPRealboxContextualAndTrendingSuggestions",
diff --git a/components/omnibox/browser/omnibox_feature_configs.h b/components/omnibox/browser/omnibox_feature_configs.h index a6a79cb8..634441e7 100644 --- a/components/omnibox/browser/omnibox_feature_configs.h +++ b/components/omnibox/browser/omnibox_feature_configs.h
@@ -135,24 +135,6 @@ bool enabled; }; -// If enabled, only suggestions from the keyword mode provider and historical -// keyword mode suggestions will be shown in keyword mode. -struct LimitKeywordModeSuggestions : Config<LimitKeywordModeSuggestions> { - DECLARE_FEATURE(kLimitKeywordModeSuggestions); - LimitKeywordModeSuggestions(); - bool enabled; - - // If enabled, limits document provider suggestions except for the Google - // Drive keyword engine. - bool limit_document_suggestions; - // If enabled, limits history cluster suggestions in keyword mode. - bool limit_history_cluster_suggestions; - // If enabled, limits default search engine suggestions in keyword mode. - bool limit_dse_suggestions; - // If enabled, limits on device head uggestions in keyword mode. - bool limit_on_device_head_suggestions; -}; - // If enabled, NTP Realbox second column will allow displaying contextual and // trending suggestions. struct RealboxContextualAndTrendingSuggestions
diff --git a/components/omnibox/browser/search_provider.cc b/components/omnibox/browser/search_provider.cc index fca40c0..e9f2c8e 100644 --- a/components/omnibox/browser/search_provider.cc +++ b/components/omnibox/browser/search_provider.cc
@@ -965,7 +965,8 @@ ? TemplateURLRef::NO_SUGGESTIONS_AVAILABLE : TemplateURLRef::NO_SUGGESTION_CHOSEN; const TemplateURL* keyword_url = providers_.GetKeywordProviderURL(); - const bool should_curb_default_suggestions = ShouldCurbDefaultSuggestions(); + const bool should_curb_default_suggestions = + providers_.has_keyword_provider(); // Don't add what-you-typed suggestion from the default provider when the // user requested keyword search. if (!should_curb_default_suggestions && verbatim_relevance > 0) { @@ -1380,22 +1381,6 @@ : CalculateRelevanceForVerbatim(); } -bool SearchProvider::ShouldCurbDefaultSuggestions() const { - // Only curb if we're in keyword mode for stater pack, or - // LimitKeywordModeSuggestions flag is enabled. - if (providers_.has_keyword_provider()) { - const TemplateURL* turl = providers_.GetKeywordProviderURL(); - DCHECK(turl); - return (omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .enabled && - omnibox_feature_configs::LimitKeywordModeSuggestions::Get() - .limit_dse_suggestions) || - turl->starter_pack_id() > 0; - } else { - return false; - } -} - int SearchProvider::CalculateRelevanceForVerbatim() const { if (!providers_.keyword_provider().empty()) return 250;
diff --git a/components/omnibox/browser/search_provider.h b/components/omnibox/browser/search_provider.h index 5f4bfa1c..afbd725 100644 --- a/components/omnibox/browser/search_provider.h +++ b/components/omnibox/browser/search_provider.h
@@ -351,11 +351,6 @@ // those is true. int GetVerbatimRelevance(bool* relevance_from_server) const; - // Whether we should limit suggestions from SearchProvider while in - // keyword mode to only keyword suggestions. Used when we suspect that the - // user intentionally entered keyword mode and doesn't want the others. - bool ShouldCurbDefaultSuggestions() const; - // Calculates the relevance score for the verbatim result from the // default search engine. This version takes into account context: // i.e., whether the user has entered a keyword-based search or not.
diff --git a/components/optimization_guide/internal b/components/optimization_guide/internal index 1b3d4a8..bae07ac 160000 --- a/components/optimization_guide/internal +++ b/components/optimization_guide/internal
@@ -1 +1 @@ -Subproject commit 1b3d4a8fafe6ebba72ef42555c0429db029b6d71 +Subproject commit bae07ac124624f1389990348b3d2df951083f28d
diff --git a/components/password_manager/core/browser/password_autofill_manager.cc b/components/password_manager/core/browser/password_autofill_manager.cc index 558875a6..baf53704 100644 --- a/components/password_manager/core/browser/password_autofill_manager.cc +++ b/components/password_manager/core/browser/password_autofill_manager.cc
@@ -187,7 +187,8 @@ return password_manager_driver_.get(); } -void PasswordAutofillManager::OnSuggestionsShown() {} +void PasswordAutofillManager::OnSuggestionsShown( + base::span<const Suggestion> suggestions) {} void PasswordAutofillManager::OnSuggestionsHidden() {}
diff --git a/components/password_manager/core/browser/password_autofill_manager.h b/components/password_manager/core/browser/password_autofill_manager.h index e07c146..78abd97 100644 --- a/components/password_manager/core/browser/password_autofill_manager.h +++ b/components/password_manager/core/browser/password_autofill_manager.h
@@ -58,7 +58,8 @@ // AutofillSuggestionDelegate implementation. absl::variant<autofill::AutofillDriver*, PasswordManagerDriver*> GetDriver() override; - void OnSuggestionsShown() override; + void OnSuggestionsShown( + base::span<const autofill::Suggestion> suggestions) override; void OnSuggestionsHidden() override; void DidSelectSuggestion(const autofill::Suggestion& suggestion) override; void DidAcceptSuggestion(const autofill::Suggestion& suggestion,
diff --git a/components/password_manager/core/browser/password_manual_fallback_flow.cc b/components/password_manager/core/browser/password_manual_fallback_flow.cc index c37188c..3f75fdb 100644 --- a/components/password_manager/core/browser/password_manual_fallback_flow.cc +++ b/components/password_manager/core/browser/password_manual_fallback_flow.cc
@@ -181,7 +181,8 @@ return password_manager_driver_.get(); } -void PasswordManualFallbackFlow::OnSuggestionsShown() { +void PasswordManualFallbackFlow::OnSuggestionsShown( + base::span<const Suggestion> suggestions) { manual_fallback_metrics_recorder_->OnDidShowSuggestions( password_form_cache_->HasPasswordForm(password_manager_driver_, field_id_));
diff --git a/components/password_manager/core/browser/password_manual_fallback_flow.h b/components/password_manager/core/browser/password_manual_fallback_flow.h index 325a3cb..193e8de 100644 --- a/components/password_manager/core/browser/password_manual_fallback_flow.h +++ b/components/password_manager/core/browser/password_manual_fallback_flow.h
@@ -69,7 +69,8 @@ // AutofillSuggestionDelegate: absl::variant<autofill::AutofillDriver*, PasswordManagerDriver*> GetDriver() override; - void OnSuggestionsShown() override; + void OnSuggestionsShown( + base::span<const autofill::Suggestion> suggestions) override; void OnSuggestionsHidden() override; void DidSelectSuggestion(const autofill::Suggestion& suggestion) override; void DidAcceptSuggestion(const autofill::Suggestion& suggestion,
diff --git a/components/password_manager/core/browser/password_manual_fallback_flow_unittest.cc b/components/password_manager/core/browser/password_manual_fallback_flow_unittest.cc index 74a5231..768a528 100644 --- a/components/password_manager/core/browser/password_manual_fallback_flow_unittest.cc +++ b/components/password_manager/core/browser/password_manual_fallback_flow_unittest.cc
@@ -245,7 +245,7 @@ // In production, suggestions cannot be accepted if not shown first. // Simulating showing them in tests is mandatory, otherwise a `CHECK` error // would occur while logging metrics. - flow().OnSuggestionsShown(); + flow().OnSuggestionsShown(base::span_from_ref(suggestion)); flow().DidAcceptSuggestion(suggestion, position); } @@ -1164,14 +1164,14 @@ flow().RunFlow(field_id, gfx::RectF{}, TextDirection::LEFT_TO_RIGHT); base::HistogramTester histograms; + autofill::Suggestion suggestion = autofill::test::CreateAutofillSuggestion( + SuggestionType::kPasswordFieldByFieldFilling, u"password"); if (SuggestionAccepted()) { - ShowAndAcceptSuggestion( - autofill::test::CreateAutofillSuggestion( - SuggestionType::kPasswordFieldByFieldFilling, u"password"), - AutofillSuggestionDelegate::SuggestionPosition{.row = 0, - .sub_popup_level = 0}); + ShowAndAcceptSuggestion(suggestion, + AutofillSuggestionDelegate::SuggestionPosition{ + .row = 0, .sub_popup_level = 0}); } else { - flow().OnSuggestionsShown(); + flow().OnSuggestionsShown(base::span_from_ref(suggestion)); } // The metric is recorded only in the destructor of the metrics recorder. histograms.ExpectTotalCount(MetricName(), 0);
diff --git a/components/password_manager/ios/shared_password_controller_unittest.mm b/components/password_manager/ios/shared_password_controller_unittest.mm index 22098b5e..c4007f3 100644 --- a/components/password_manager/ios/shared_password_controller_unittest.mm +++ b/components/password_manager/ios/shared_password_controller_unittest.mm
@@ -143,6 +143,15 @@ OCMExpect([form_helper_ setDelegate:[OCMArg any]]); OCMExpect([suggestion_helper_ setDelegate:[OCMArg any]]); + // Some tests observe both frame managers. Making sure that both content + // world have managers set. + web_state_.SetWebFramesManager( + web::ContentWorld::kPageContentWorld, + std::make_unique<web::FakeWebFramesManager>()); + web_state_.SetWebFramesManager( + web::ContentWorld::kIsolatedWorld, + std::make_unique<web::FakeWebFramesManager>()); + auto web_frames_manager = std::make_unique<web::FakeWebFramesManager>(); web_frames_manager_ = web_frames_manager.get(); web::ContentWorld content_world =
diff --git a/components/pdf/browser/pdf_document_helper.cc b/components/pdf/browser/pdf_document_helper.cc index 7dbfec5..f52729bc 100644 --- a/components/pdf/browser/pdf_document_helper.cc +++ b/components/pdf/browser/pdf_document_helper.cc
@@ -15,6 +15,7 @@ #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" #include "content/public/common/referrer_type_converters.h" +#include "pdf/mojom/pdf.mojom.h" #include "pdf/pdf_features.h" #include "ui/base/pointer/touch_editing_controller.h" #include "ui/base/ui_base_types.h" @@ -201,6 +202,15 @@ ConvertFromRoot(extent)); } +void PDFDocumentHelper::GetPdfBytes( + pdf::mojom::PdfListener::GetPdfBytesCallback callback) { + if (!remote_pdf_client_) { + std::move(callback).Run(std::vector<uint8_t>()); + return; + } + remote_pdf_client_->GetPdfBytes(std::move(callback)); +} + void PDFDocumentHelper::OnSelectionEvent(ui::SelectionEventType event) { // Should be handled by `TouchSelectionControllerClientAura`. NOTREACHED_IN_MIGRATION();
diff --git a/components/pdf/browser/pdf_document_helper.h b/components/pdf/browser/pdf_document_helper.h index fe7529b..544f3e5 100644 --- a/components/pdf/browser/pdf_document_helper.h +++ b/components/pdf/browser/pdf_document_helper.h
@@ -87,6 +87,8 @@ int32_t right_height) override; void SetPluginCanSave(bool can_save) override; + void GetPdfBytes(pdf::mojom::PdfListener::GetPdfBytesCallback callback); + private: friend class content::DocumentUserData<PDFDocumentHelper>;
diff --git a/components/pdf/browser/pdf_document_helper_browsertest.cc b/components/pdf/browser/pdf_document_helper_browsertest.cc index 31e4cb0a..f595f39 100644 --- a/components/pdf/browser/pdf_document_helper_browsertest.cc +++ b/components/pdf/browser/pdf_document_helper_browsertest.cc
@@ -41,6 +41,7 @@ SetSelectionBounds, (const gfx::PointF&, const gfx::PointF&), (override)); + MOCK_METHOD(void, GetPdfBytes, (GetPdfBytesCallback callback), (override)); }; class TestPDFDocumentHelperClient : public PDFDocumentHelperClient {
diff --git a/components/performance_manager/features.cc b/components/performance_manager/features.cc index 34d20d5..19bd42ec 100644 --- a/components/performance_manager/features.cc +++ b/components/performance_manager/features.cc
@@ -140,17 +140,6 @@ "UrgentPageDiscarding", base::FEATURE_ENABLED_BY_DEFAULT); -BASE_FEATURE(kCPUInterventionEvaluationLogging, - "CPUInterventionEvaluationLogging", - base::FEATURE_DISABLED_BY_DEFAULT); - -const base::FeatureParam<base::TimeDelta> kDelayBeforeLogging{ - &kCPUInterventionEvaluationLogging, "delay_before_logging", - base::Seconds(60)}; - -const base::FeatureParam<int> kThresholdChromeCPUPercent{ - &kCPUInterventionEvaluationLogging, "threshold_chrome_cpu_percent", 25}; - BASE_FEATURE(kCPUMeasurementInFreezingPolicy, "CPUMeasurementInFreezingPolicy", base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/components/performance_manager/public/features.h b/components/performance_manager/public/features.h index b369f45d..2f357bf 100644 --- a/components/performance_manager/public/features.h +++ b/components/performance_manager/public/features.h
@@ -132,9 +132,6 @@ // Whether tabs are discarded under high memory pressure. BASE_DECLARE_FEATURE(kUrgentPageDiscarding); -// This enables logging to evaluate the efficacy of potential CPU interventions. -BASE_DECLARE_FEATURE(kCPUInterventionEvaluationLogging); - // This represents the duration that CPU must be over the threshold before // logging the delayed metrics. extern const base::FeatureParam<base::TimeDelta> kDelayBeforeLogging;
diff --git a/components/permissions/permission_request_manager.cc b/components/permissions/permission_request_manager.cc index 7cfda56..4e98863 100644 --- a/components/permissions/permission_request_manager.cc +++ b/components/permissions/permission_request_manager.cc
@@ -302,7 +302,8 @@ bool PermissionRequestManager::ReprioritizeCurrentRequestIfNeeded() { if (!IsRequestInProgress() || - IsCurrentRequestEmbeddedPermissionElementInitiated()) { + IsCurrentRequestEmbeddedPermissionElementInitiated() || + !can_preempt_current_request_) { return true; } @@ -610,6 +611,7 @@ if (ignore_callbacks_from_prompt_) return; DCHECK(view_); + base::AutoReset<bool> block_preempt(&can_preempt_current_request_, false); std::vector<raw_ptr<PermissionRequest, VectorExperimental>>::iterator requests_iter; for (requests_iter = requests_.begin(); requests_iter != requests_.end(); @@ -640,6 +642,7 @@ if (ignore_callbacks_from_prompt_) return; DCHECK(view_); + base::AutoReset<bool> block_preempt(&can_preempt_current_request_, false); std::vector<raw_ptr<PermissionRequest, VectorExperimental>>::iterator requests_iter; for (requests_iter = requests_.begin(); requests_iter != requests_.end(); @@ -659,6 +662,7 @@ if (ignore_callbacks_from_prompt_) return; DCHECK(view_); + base::AutoReset<bool> block_preempt(&can_preempt_current_request_, false); // Suppress any further prompts in this WebContents, from any origin, until // there is a user-initiated navigation. This stops users from getting @@ -690,6 +694,7 @@ if (ignore_callbacks_from_prompt_) return; DCHECK(view_); + base::AutoReset<bool> block_preempt(&can_preempt_current_request_, false); std::vector<raw_ptr<PermissionRequest, VectorExperimental>>::iterator requests_iter; for (requests_iter = requests_.begin(); requests_iter != requests_.end(); @@ -708,6 +713,7 @@ if (ignore_callbacks_from_prompt_) return; DCHECK(view_); + base::AutoReset<bool> block_preempt(&can_preempt_current_request_, false); std::vector<raw_ptr<PermissionRequest, VectorExperimental>>::iterator requests_iter; for (requests_iter = requests_.begin(); requests_iter != requests_.end(); @@ -725,6 +731,7 @@ void PermissionRequestManager::FinalizeCurrentRequests() { CHECK(IsRequestInProgress()); ResetViewStateForCurrentRequest(); + base::AutoReset<bool> block_preempt(&can_preempt_current_request_, false); std::vector<raw_ptr<PermissionRequest, VectorExperimental>>::iterator requests_iter; for (requests_iter = requests_.begin(); requests_iter != requests_.end(); @@ -741,6 +748,8 @@ preignore_timer_.AbandonAndStop(); requests_.clear(); + // We have no need to block preemption anymore. + std::ignore = std::move(block_preempt); for (Observer& observer : observer_list_) { observer.OnRequestsFinalized();
diff --git a/components/permissions/permission_request_manager.h b/components/permissions/permission_request_manager.h index 607ce5e..66afbce 100644 --- a/components/permissions/permission_request_manager.h +++ b/components/permissions/permission_request_manager.h
@@ -539,6 +539,12 @@ bool did_click_learn_more_ = false; + // Whether the current request can be preempted or not. This is set when + // callbacks are being issued to prevent potential re-entrant behavior of + // those callbacks requesting a permission that would preempt the current one + // and thus invalidate the iterator being used to issue the callback. + bool can_preempt_current_request_ = true; + std::optional<base::TimeDelta> time_to_decision_for_test_; std::optional<bool> enabled_app_level_notification_permission_for_testing_;
diff --git a/components/permissions/permission_request_manager_unittest.cc b/components/permissions/permission_request_manager_unittest.cc index b704be5..d2c91e3e 100644 --- a/components/permissions/permission_request_manager_unittest.cc +++ b/components/permissions/permission_request_manager_unittest.cc
@@ -87,6 +87,11 @@ task_environment()->RunUntilIdle(); } + void AcceptThisTime() { + manager_->AcceptThisTime(); + task_environment()->RunUntilIdle(); + } + void Deny() { manager_->Deny(); task_environment()->RunUntilIdle(); @@ -1621,6 +1626,124 @@ EXPECT_EQ(prompt_factory_->show_count(), 5); } +// Verifies that a high-priority request cannot preempt a low-priority request +// if the high-priority request comes in as the result of a permission prompt +// being accepted. +// Permissions requested in order: +// 1. Gelocation (low) +// 2. Mic (high) +TEST_F(PermissionRequestManagerTest, ReentrantPermissionRequestAccept) { + request1_.RegisterOnPermissionDecidedCallback( + base::BindLambdaForTesting([&]() { + manager_->AddRequest(web_contents()->GetPrimaryMainFrame(), + &request_mic_); + })); + + manager_->AddRequest(web_contents()->GetPrimaryMainFrame(), &request1_); + WaitForBubbleToBeShown(); + + EXPECT_TRUE(prompt_factory_->is_visible()); + EXPECT_EQ(prompt_factory_->request_count(), 1); + Accept(); + EXPECT_TRUE(request1_.granted()); + EXPECT_FALSE(request_mic_.granted()); + WaitForBubbleToBeShown(); + + EXPECT_TRUE(prompt_factory_->is_visible()); + EXPECT_EQ(prompt_factory_->request_count(), 1); + Accept(); + EXPECT_TRUE(request_mic_.granted()); +} + +// Verifies that a high-priority request cannot preempt a low-priority request +// if the high-priority request comes in as the result of a permission prompt +// being accepted once. +// Permissions requested in order: +// 1. Gelocation (low) +// 2. Mic (high) +TEST_F(PermissionRequestManagerTest, ReentrantPermissionRequestAcceptOnce) { + request1_.RegisterOnPermissionDecidedCallback( + base::BindLambdaForTesting([&]() { + manager_->AddRequest(web_contents()->GetPrimaryMainFrame(), + &request_mic_); + })); + + manager_->AddRequest(web_contents()->GetPrimaryMainFrame(), &request1_); + WaitForBubbleToBeShown(); + + EXPECT_TRUE(prompt_factory_->is_visible()); + EXPECT_EQ(prompt_factory_->request_count(), 1); + AcceptThisTime(); + EXPECT_TRUE(request1_.granted()); + EXPECT_FALSE(request_mic_.granted()); + WaitForBubbleToBeShown(); + + EXPECT_TRUE(prompt_factory_->is_visible()); + EXPECT_EQ(prompt_factory_->request_count(), 1); + Accept(); + EXPECT_TRUE(request_mic_.granted()); +} + +// Verifies that a high-priority request cannot preempt a low-priority request +// if the high-priority request comes in as the result of a permission prompt +// being denied. +// Permissions requested in order: +// 1. Gelocation (low) +// 2. Mic (high) +TEST_F(PermissionRequestManagerTest, ReentrantPermissionRequestDeny) { + request1_.RegisterOnPermissionDecidedCallback( + base::BindLambdaForTesting([&]() { + manager_->AddRequest(web_contents()->GetPrimaryMainFrame(), + &request_mic_); + })); + + manager_->AddRequest(web_contents()->GetPrimaryMainFrame(), &request1_); + WaitForBubbleToBeShown(); + + EXPECT_TRUE(prompt_factory_->is_visible()); + EXPECT_EQ(prompt_factory_->request_count(), 1); + Deny(); + EXPECT_FALSE(request1_.granted()); + EXPECT_FALSE(request_mic_.granted()); + WaitForBubbleToBeShown(); + + EXPECT_TRUE(prompt_factory_->is_visible()); + EXPECT_EQ(prompt_factory_->request_count(), 1); + Accept(); + EXPECT_FALSE(request1_.granted()); + EXPECT_TRUE(request_mic_.granted()); +} + +// Verifies that a high-priority request cannot preempt a low-priority request +// if the high-priority request comes in as the result of a permission prompt +// being dismissed. +// Permissions requested in order: +// 1. Gelocation (low) +// 2. Mic (high) +TEST_F(PermissionRequestManagerTest, ReentrantPermissionRequestCancelled) { + request1_.RegisterOnPermissionDecidedCallback( + base::BindLambdaForTesting([&]() { + manager_->AddRequest(web_contents()->GetPrimaryMainFrame(), + &request_mic_); + })); + + manager_->AddRequest(web_contents()->GetPrimaryMainFrame(), &request1_); + WaitForBubbleToBeShown(); + + EXPECT_TRUE(prompt_factory_->is_visible()); + EXPECT_EQ(prompt_factory_->request_count(), 1); + Closing(); + EXPECT_TRUE(request1_.cancelled()); + EXPECT_FALSE(request_mic_.cancelled()); + WaitForBubbleToBeShown(); + + EXPECT_TRUE(prompt_factory_->is_visible()); + EXPECT_EQ(prompt_factory_->request_count(), 1); + Accept(); + EXPECT_FALSE(request1_.granted()); + EXPECT_TRUE(request_mic_.granted()); +} + // Verifies order of requests with mixed low-high priority requests input, with // both chip and quiet chip enabled. New permissions are added and accepted one // by one.
diff --git a/components/permissions/test/mock_permission_request.cc b/components/permissions/test/mock_permission_request.cc index 1b256964..3101868f 100644 --- a/components/permissions/test/mock_permission_request.cc +++ b/components/permissions/test/mock_permission_request.cc
@@ -70,12 +70,22 @@ RequestFinished(); } +void MockPermissionRequest::RegisterOnPermissionDecidedCallback( + base::OnceClosure callback) { + on_permission_decided_ = std::move(callback); +} + void MockPermissionRequest::PermissionDecided(ContentSetting result, bool is_one_time, bool is_final_decision) { granted_ = result == CONTENT_SETTING_ALLOW; - if (result == CONTENT_SETTING_DEFAULT) + if (result == CONTENT_SETTING_DEFAULT) { cancelled_ = true; + } + + if (on_permission_decided_) { + std::move(on_permission_decided_).Run(); + } } void MockPermissionRequest::MarkFinished() {
diff --git a/components/permissions/test/mock_permission_request.h b/components/permissions/test/mock_permission_request.h index fbbbdd6f..59289f2 100644 --- a/components/permissions/test/mock_permission_request.h +++ b/components/permissions/test/mock_permission_request.h
@@ -33,6 +33,8 @@ ~MockPermissionRequest() override; + void RegisterOnPermissionDecidedCallback(base::OnceClosure callback); + void PermissionDecided(ContentSetting result, bool is_one_time, bool is_final_decision); @@ -54,6 +56,7 @@ bool cancelled_; bool finished_; + base::OnceClosure on_permission_decided_; std::vector<std::string> requested_audio_capture_device_ids_; std::vector<std::string> requested_video_capture_device_ids_; };
diff --git a/components/policy/core/common/cloud/enterprise_metrics.h b/components/policy/core/common/cloud/enterprise_metrics.h index 98d0b4e..5c6597c 100644 --- a/components/policy/core/common/cloud/enterprise_metrics.h +++ b/components/policy/core/common/cloud/enterprise_metrics.h
@@ -416,8 +416,6 @@ "Enterprise.StateDetermination.DeviceIdentifierStatus"; inline constexpr char kUMAStateDeterminationEnabled[] = "Enterprise.StateDetermination.Enabled"; -inline constexpr char kUMAStateDeterminationEmbargoDatePassed[] = - "Enterprise.StateDetermination.EmbargoDatePassed"; inline constexpr char kUMAStateDeterminationKillSwitchFetchNetworkErrorCode[] = "Enterprise.StateDetermination.KillSwitchFetch.NetworkErrorCode"; inline constexpr char kUMAStateDeterminationKillSwitchFetchNumTries[] = @@ -448,8 +446,6 @@ "Enterprise.StateDetermination.StateReturned"; inline constexpr char kUMAStateDeterminationStepDuration[] = "Enterprise.StateDetermination.StepDuration"; -inline constexpr char kUMAStateDeterminationSystemClockSynchronized[] = - "Enterprise.StateDetermination.SystemClockSynchronized"; inline constexpr char kUMAStateDeterminationTotalDurationByState[] = "Enterprise.StateDetermination.TotalDurationByState"; inline constexpr char kUMAStateDeterminationTotalDuration[] = @@ -477,7 +473,6 @@ inline constexpr char kUMASuffixQueryRequest[] = ".QueryRequest"; inline constexpr char kUMASuffixStateKeysRetrieval[] = ".StateKeysRetrieval"; inline constexpr char kUMASuffixStateRequest[] = ".StateRequest"; -inline constexpr char kUMASuffixSystemClockSync[] = ".SystemClockSync"; } // namespace policy
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/DevicePostQuantumKeyAgreementEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/DevicePostQuantumKeyAgreementEnabled.yaml index aae63b9..1f5d6515 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/DevicePostQuantumKeyAgreementEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/DevicePostQuantumKeyAgreementEnabled.yaml
@@ -1,19 +1,19 @@ caption: Enable post-quantum key agreement for TLS for device default: true desc: |- - This device-level policy configures whether <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> will offer Kyber, a post-quantum key agreement algorithm, in TLS. This allows supporting servers to protect user traffic from being later decrypted by quantum computers. + This device-level policy configures whether <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> will offer a post-quantum key agreement algorithm in TLS. In future versions, the algorithm will be ML-KEM, a NIST post-quantum standard. Initially, the algorithm was Kyber, an earlier draft iteration of the standard. This allows supporting servers to protect user traffic from being later decrypted by quantum computers. - If this policy is Enabled, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> will offer Kyber in TLS connections. TLS connections will be protected with Kyber key agreement when communicating with compatible servers that select Kyber during the TLS handshake. + If this policy is Enabled, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> will offer a post-quantum key agreement in TLS connections. User traffic will then be protected from quantum computers when communicating with compatible servers. - If this policy is Disabled, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> will not offer Kyber in TLS connections. User traffic will then be unprotected from quantum computers. + If this policy is Disabled, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> will not offer a post-quantum key agreement in TLS connections. User traffic will then be unprotected from quantum computers. - If this policy is not set, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> will follow the default rollout process for offering Kyber. + If this policy is not set, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> will follow the default rollout process for offering a post-quantum key agreement. Offering Kyber is backwards-compatible. Existing TLS servers and networking middleware are expected to ignore the new option and continue selecting previous options. However, devices that do not correctly implement TLS may malfunction when offered the new option. For example, they may disconnect in response to unrecognized options or the resulting larger messages. Such devices are not post-quantum-ready and will interfere with an enterprise's post-quantum transition. If encountered, administrators should contact the vendor for a fix. - This policy is a temporary measure and will be removed in future versions of <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph>. It may be Enabled to allow you to test for issues, and may be Disabled while issues are being resolved. + This policy is a temporary measure and will be removed sometime after <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> version 141. It may be Enabled to allow you to test for issues, and may be Disabled while issues are being resolved. If both this policy and the PostQuantumKeyAgreementEnabled policy are set, this policy will take precedence. @@ -23,9 +23,9 @@ dynamic_refresh: true per_profile: false items: -- caption: Enable Kyber post-quantum key agreement for TLS +- caption: Enable post-quantum key agreement for TLS value: true -- caption: Disable Kyber post-quantum key agreement for TLS +- caption: Disable post-quantum key agreement for TLS value: false owners: - file://crypto/OWNERS
diff --git a/components/policy/resources/templates/policy_definitions/Miscellaneous/PostQuantumKeyAgreementEnabled.yaml b/components/policy/resources/templates/policy_definitions/Miscellaneous/PostQuantumKeyAgreementEnabled.yaml index a6033cd7..1b0b6101 100644 --- a/components/policy/resources/templates/policy_definitions/Miscellaneous/PostQuantumKeyAgreementEnabled.yaml +++ b/components/policy/resources/templates/policy_definitions/Miscellaneous/PostQuantumKeyAgreementEnabled.yaml
@@ -1,19 +1,19 @@ caption: Enable post-quantum key agreement for TLS default: null desc: |- - This policy configures whether <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will offer Kyber, a post-quantum key agreement algorithm, in TLS. This allows supporting servers to protect user traffic from being later decrypted by quantum computers. + This policy configures whether <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will offer a post-quantum key agreement algorithm in TLS. In future versions, the algorithm will be ML-KEM, a NIST post-quantum standard. Initially, the algorithm was Kyber, an earlier draft iteration of the standard. This allows supporting servers to protect user traffic from being later decrypted by quantum computers. - If this policy is Enabled, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will offer Kyber in TLS connections. TLS connections will be protected with Kyber key agreement when communicating with compatible servers that select Kyber during the TLS handshake. + If this policy is Enabled, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will offer a post-quantum key agreement in TLS connections. User traffic will then be protected from quantum computers when communicating with compatible servers. - If this policy is Disabled, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will not offer Kyber in TLS connections. User traffic will then be unprotected from quantum computers. + If this policy is Disabled, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will not offer a post-quantum key agreement in TLS connections. User traffic will then be unprotected from quantum computers. - If this policy is not set, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will follow the default rollout process for offering Kyber. + If this policy is not set, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will follow the default rollout process for offering a post-quantum key agreement. - Offering Kyber is backwards-compatible. Existing TLS servers and networking middleware are expected to ignore the new option and continue selecting previous options. + Offering a post-quantum key agreement is backwards-compatible. Existing TLS servers and networking middleware are expected to ignore the new option and continue selecting previous options. However, devices that do not correctly implement TLS may malfunction when offered the new option. For example, they may disconnect in response to unrecognized options or the resulting larger messages. Such devices are not post-quantum-ready and will interfere with an enterprise's post-quantum transition. If encountered, administrators should contact the vendor for a fix. - This policy is a temporary measure and will be removed in future versions of <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. It may be Enabled to allow you to test for issues, and may be Disabled while issues are being resolved. + This policy is a temporary measure and will be removed sometime after <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> version 141. It may be Enabled to allow you to test for issues, and may be Disabled while issues are being resolved. example_value: true features: @@ -22,11 +22,11 @@ future_on: - fuchsia items: -- caption: Use Default Value for Kyber post-quantum key agreement for TLS +- caption: Use Default Value for post-quantum key agreement for TLS value: null -- caption: Enable Kyber post-quantum key agreement for TLS +- caption: Enable post-quantum key agreement for TLS value: true -- caption: Disable Kyber post-quantum key agreement for TLS +- caption: Disable post-quantum key agreement for TLS value: false owners: - file://crypto/OWNERS
diff --git a/components/privacy_sandbox/privacy_sandbox_features.cc b/components/privacy_sandbox/privacy_sandbox_features.cc index 28b8bca..b26bae84 100644 --- a/components/privacy_sandbox/privacy_sandbox_features.cc +++ b/components/privacy_sandbox/privacy_sandbox_features.cc
@@ -108,7 +108,7 @@ BASE_FEATURE(kPrivacySandboxAttestationsLoadPreInstalledComponent, "PrivacySandboxAttestationsLoadPreInstalledComponent", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kPrivacySandboxProactiveTopicsBlocking, "PrivacySandboxProactiveTopicsBlocking",
diff --git a/components/privacy_sandbox_chrome_strings.grdp b/components/privacy_sandbox_chrome_strings.grdp index 65b9f0fa..77c07e95 100644 --- a/components/privacy_sandbox_chrome_strings.grdp +++ b/components/privacy_sandbox_chrome_strings.grdp
@@ -183,7 +183,7 @@ <message name="IDS_SETTINGS_TOPICS_PAGE_TOGGLE_LABEL" desc="The label for a new setting." formatter_data="android_java"> Ad topics </message> - <message name="IDS_SETTINGS_TOPICS_PAGE_TOGGLE_SUB_LABEL" desc="A description of the new Ad topics setting. This text appears beneath the name of the new setting, 'Ad topics', and is associated with the control that a user can turn on or off. * 'browsing history': This help-center article explains 'browsing history' to users: https://support.google.com/chrome/answer/95589. * Ad topics are published at https://github.com/patcg-individual-drafts/topics/blob/main/taxonomy_v1.md * 'used by sites': Chrome estimates a user's topics of interest. As the user continues browsing, a site can ask Chrome for up to 3 of the user's topics to personalize ads for that user. **** CONTEXT PRIVACY SANDBOX **** Chrome’s Privacy Sandbox initiative 1) deprecates third-party cookies in Chrome, 2) supports free and open content on the web (by finding better ways to support ads online), 3) while providing stronger privacy protections for users. You can see a high-level description of this public project at www.privacysanbox.com. **** NEW SETTINGS SECTION IN CHROME **** 3 new ad-specific settings appear on an “Ad privacy” page in Chrome settings. For an equivalent structure, see “Security” on chrome://settings/privacy that opens chrome://settings/security. Likewise, “Ad privacy” on chrome://settings/privacy will open chrome://settings/AdPrivacy." formatter_data="android_java"> + <message name="IDS_SETTINGS_TOPICS_PAGE_TOGGLE_SUB_LABEL" desc="A description of the new Ad topics setting. This text appears beneath the name of the new setting, 'Ad topics', and is associated with the control that a user can turn on or off. * 'browsing history': This help-center article explains 'browsing history' to users: https://support.google.com/chrome/answer/95589. * Ad topics are published at https://github.com/patcg-individual-drafts/topics/blob/main/taxonomy_v1.md * 'used by sites': Chrome estimates a user's topics of interest. As the user continues browsing, a site can ask Chrome for up to 3 of the user's topics to personalize ads for that user. **** CONTEXT PRIVACY SANDBOX **** Chrome’s Privacy Sandbox initiative 1) deprecates third-party cookies in Chrome, 2) supports free and open content on the web (by finding better ways to support ads online), 3) while providing stronger privacy protections for users. You can see a high-level description of this public project at www.privacysanbox.com. **** NEW SETTINGS SECTION IN CHROME **** 3 new ad-specific settings appear on an “Ad privacy” page in Chrome settings. For an equivalent structure, see “Security” on chrome://settings/privacy that opens chrome://settings/security. Likewise, “Ad privacy” on chrome://settings/privacy will open chrome://settings/AdPrivacy."> Topics of interest are based on your recent browsing history and are used by sites to show you personalized ads </message> <message name="IDS_SETTINGS_TOPICS_PAGE_TOGGLE_SUB_LABEL_V2" desc="A description of the new Ad topics setting page. This sits under the toggle to turn on the topics API." formatter_data="android_java"> @@ -192,7 +192,7 @@ <message name="IDS_SETTINGS_TOPICS_PAGE_DISCLAIMER_DESKTOP" desc="Desktop - Disclaimer of the new Ad topics setting. This text appears beneath the sublabel."> Ad topics are just one of many things a site can use to personalize ads. Even without ad topics, sites can still show you ads but they may be less personalized. Learn more about <ph name="BEGIN_LINK"><a href="$1" aria-description="$2" target="_blank"></ph>managing your ad privacy<ph name="LINK_END"></a></ph>. </message> - <message name="IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_HEADING" desc="A label above a list of the user's topics of interest. Ad topics are published at https://github.com/patcg-individual-drafts/topics/blob/main/taxonomy_v1.md" formatter_data="android_java"> + <message name="IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_HEADING" desc="A label above a list of the user's topics of interest. Ad topics are published at https://github.com/patcg-individual-drafts/topics/blob/main/taxonomy_v1.md"> Your topics </message> <message name="IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION_CANONICAL" desc="A description that appear beneath the 'Your topics' label. * 'You can block': There is a 'Block' button (or an X on mobile) that appears next to each topic in the list. * 'auto-deletes': this could also read 'Chrome deletes...' We included the 'auto' to reinforce that this is part of a system and the deletion is done regularly. The link opens a dialog box that provides more information about Ad topics."> @@ -201,7 +201,7 @@ <message name="IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION_DISABLED" desc="A description that appear beneath the 'Your topics' title. If this setting is off, no interests appear." formatter_data="android_java"> When on, a list of topics appears here based on your recent browsing history </message> - <message name="IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION_EMPTY" desc="A description that appear beneath the 'Your topics' title. This setting could be on but no topics appear in the list. This text explains why." formatter_data="android_java"> + <message name="IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION_EMPTY" desc="A description that appear beneath the 'Your topics' title. This setting could be on but no topics appear in the list. This text explains why."> No topics to show right now </message> <message name="IDS_SETTINGS_TOPICS_PAGE_CURRENT_TOPICS_DESCRIPTION_EMPTY_TEXT_V2" desc="A description that appear beneath the 'Active topics' title. The ad topics setting could be on but no topics appears in the list. This is part of the text that explains why." formatter_data="android_java"> @@ -222,13 +222,13 @@ <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCK_TOPIC_A11Y_LABEL" desc="A button label read by screen readers that indicates which topic will get blocked. The full 'pool of topics' is published at https://github.com/patcg-individual-drafts/topics/blob/main/taxonomy_v1.md"> Block <ph name="TOPIC">$1<ex>Movies</ex></ph> </message> - <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_HEADING" desc="A label that serves as a button to open the 'Topics you blocked' page." formatter_data="android_java"> + <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_HEADING" desc="A label that serves as a button to open the 'Topics you blocked' page."> Topics you blocked </message> - <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_DESCRIPTION" desc="A description that appear beneath the 'Topics you blocked' title. * 'Add' is also the name used on the button that allows users to remove a topic from the blocked list. * 'an item' could be replaced by 'a topic'. We didn't so as not to repeat 'topic' in the same sentence. * 'pool of topics': We want to express that by clicking 'Add', the user is making a topic eligible again for consideration. The full 'pool of topics' is published at https://github.com/patcg-individual-drafts/topics/blob/main/taxonomy_v1.md" formatter_data="android_java"> + <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_DESCRIPTION" desc="A description that appear beneath the 'Topics you blocked' title. * 'Add' is also the name used on the button that allows users to remove a topic from the blocked list. * 'an item' could be replaced by 'a topic'. We didn't so as not to repeat 'topic' in the same sentence. * 'pool of topics': We want to express that by clicking 'Add', the user is making a topic eligible again for consideration. The full 'pool of topics' is published at https://github.com/patcg-individual-drafts/topics/blob/main/taxonomy_v1.md"> Add an item back if you want it in the pool of topics that Chrome can choose from when estimating your interests </message> - <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_DESCRIPTION_EMPTY" desc="A description that appear beneath the 'Topics you blocked' title. This string is used if the user doesn't have any topics on the 'Topics you blocked' list." formatter_data="android_java"> + <message name="IDS_SETTINGS_TOPICS_PAGE_BLOCKED_TOPICS_DESCRIPTION_EMPTY" desc="A description that appear beneath the 'Topics you blocked' title. This string is used if the user doesn't have any topics on the 'Topics you blocked' list."> Blocked topics appear here </message> <message name="IDS_SETTINGS_TOPICS_PAGE_ALLOW_TOPIC" desc="A button associated with each of the user's topics. When the user clicks 'Add', it makes that topic eligible in the 'pool of topics' that Chrome can use to estimate the user's topics of interest. Clicking 'Add' doesn't automatically put the added topic back onto the list of 'Your topics'. For that to happen, a user would have to browse sites associated with the 'Add'ed topic and Chrome would have to estimate the topic as relevant to that user.">
diff --git a/components/sensitive_content/sensitive_content_client.h b/components/sensitive_content/sensitive_content_client.h index 6b4474b..ac84d1e1 100644 --- a/components/sensitive_content/sensitive_content_client.h +++ b/components/sensitive_content/sensitive_content_client.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_SENSITIVE_CONTENT_SENSITIVE_CONTENT_CLIENT_H_ #define COMPONENTS_SENSITIVE_CONTENT_SENSITIVE_CONTENT_CLIENT_H_ +#include <string> + namespace sensitive_content { // Used for dependency injection from the embedder (Chrome on Android or @@ -14,6 +16,11 @@ virtual ~SensitiveContentClient() = default; virtual void SetContentSensitivity(bool content_is_sensitive) = 0; + + // Returns the prefix of the histograms that will be recorded. The prefix is + // embedder specific, as the metrics are recorded individually for each + // embedder. + virtual std::string_view GetHistogramPrefix() = 0; }; } // namespace sensitive_content
diff --git a/components/sensitive_content/sensitive_content_manager.cc b/components/sensitive_content/sensitive_content_manager.cc index 1f7f591..5b43cc8 100644 --- a/components/sensitive_content/sensitive_content_manager.cc +++ b/components/sensitive_content/sensitive_content_manager.cc
@@ -5,6 +5,8 @@ #include "components/sensitive_content/sensitive_content_manager.h" #include "base/check_deref.h" +#include "base/metrics/histogram_functions.h" +#include "base/strings/strcat.h" #include "components/autofill/core/browser/autofill_field.h" #include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/form_structure.h" @@ -53,6 +55,9 @@ if (last_content_was_sensitive_ != content_is_sensitive) { client_->SetContentSensitivity(!sensitive_fields_.empty()); last_content_was_sensitive_ = content_is_sensitive; + base::UmaHistogramBoolean( + base::StrCat({client_->GetHistogramPrefix(), "SensitivityChanged"}), + content_is_sensitive); } }
diff --git a/components/sensitive_content/sensitive_content_manager_unittest.cc b/components/sensitive_content/sensitive_content_manager_unittest.cc index 83ceb4fd..4fc0d08 100644 --- a/components/sensitive_content/sensitive_content_manager_unittest.cc +++ b/components/sensitive_content/sensitive_content_manager_unittest.cc
@@ -4,6 +4,7 @@ #include "components/sensitive_content/sensitive_content_manager.h" +#include "base/test/metrics/histogram_tester.h" #include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/content/browser/content_autofill_driver_test_api.h" #include "components/autofill/content/browser/test_autofill_client_injector.h" @@ -29,9 +30,16 @@ using ::testing::MockFunction; using LifecycleState = autofill::AutofillDriver::LifecycleState; +constexpr std::string_view histogram_sensitivity_changed = + "SensitiveContent.Chrome.SensitivityChanged"; + class MockSensitiveContentClient : public SensitiveContentClient { public: MOCK_METHOD(void, SetContentSensitivity, (bool), (override)); + + std::string_view GetHistogramPrefix() override { + return "SensitiveContent.Chrome."; + } }; class SensitiveContentManagerTest : public content::RenderViewHostTestHarness { @@ -92,6 +100,7 @@ NavigateAndCommit(GURL("https://test.com")); FormData not_sensitive_form = CreateNotSensitiveFormData(); FormData sensitive_form = CreateSensitiveFormData(); + base::HistogramTester histogram_tester; MockFunction<void(std::string_view)> check; { @@ -113,12 +122,15 @@ /*removed_forms=*/{}); ASSERT_TRUE(waiter.Wait()); check.Call("no sensitive content present"); + histogram_tester.ExpectTotalCount(histogram_sensitivity_changed, 0); waiter.Reset(); autofill_manager().OnFormsSeen(/*updated_forms=*/{sensitive_form}, /*removed_forms=*/{}); ASSERT_TRUE(waiter.Wait()); check.Call("sensitive content present"); + histogram_tester.ExpectUniqueSample(histogram_sensitivity_changed, + /*content_is_sensitive=*/true, 1); waiter.Reset(); autofill_manager().OnFormsSeen( @@ -126,6 +138,10 @@ /*removed_forms=*/{sensitive_form.global_id()}); ASSERT_TRUE(waiter.Wait()); check.Call("no sensitive content present anymore"); + histogram_tester.ExpectBucketCount(histogram_sensitivity_changed, + /*content_is_sensitive=*/true, 1); + histogram_tester.ExpectBucketCount(histogram_sensitivity_changed, + /*content_is_sensitive=*/false, 1); waiter.Reset(); autofill_manager().OnFormsSeen( @@ -138,6 +154,7 @@ NavigateAndCommit(GURL("https://test.com")); FormData not_sensitive_form = CreateNotSensitiveFormData(); FormData sensitive_form = CreateSensitiveFormData(); + base::HistogramTester histogram_tester; MockFunction<void(std::string_view)> check; { @@ -169,19 +186,31 @@ test_api(*autofill_driver()) .SetLifecycleStateAndNotifyObservers(LifecycleState::kActive); check.Call("no sensitive content present so far"); + histogram_tester.ExpectTotalCount(histogram_sensitivity_changed, 0); waiter.Reset(); autofill_manager().OnFormsSeen(/*updated_forms=*/{sensitive_form}, /*removed_forms=*/{}); ASSERT_TRUE(waiter.Wait()); check.Call("sensitive content present now"); + histogram_tester.ExpectUniqueSample(histogram_sensitivity_changed, + /*content_is_sensitive=*/true, 1); test_api(*autofill_driver()) .SetLifecycleStateAndNotifyObservers(LifecycleState::kInactive); check.Call("frame became inactive"); + histogram_tester.ExpectBucketCount(histogram_sensitivity_changed, + /*content_is_sensitive=*/true, 1); + histogram_tester.ExpectBucketCount(histogram_sensitivity_changed, + /*content_is_sensitive=*/false, 1); + test_api(*autofill_driver()) .SetLifecycleStateAndNotifyObservers(LifecycleState::kActive); check.Call("frame became active"); + histogram_tester.ExpectBucketCount(histogram_sensitivity_changed, + /*content_is_sensitive=*/true, 2); + histogram_tester.ExpectBucketCount(histogram_sensitivity_changed, + /*content_is_sensitive=*/false, 1); } } // namespace
diff --git a/components/site_engagement/content/site_engagement_observer.h b/components/site_engagement/content/site_engagement_observer.h index 5de0500..1ba01e85 100644 --- a/components/site_engagement/content/site_engagement_observer.h +++ b/components/site_engagement/content/site_engagement_observer.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_SITE_ENGAGEMENT_CONTENT_SITE_ENGAGEMENT_OBSERVER_H_ #define COMPONENTS_SITE_ENGAGEMENT_CONTENT_SITE_ENGAGEMENT_OBSERVER_H_ +#include <optional> + #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" #include "components/webapps/common/web_app_id.h"
diff --git a/components/viz/service/display_embedder/image_context_impl.cc b/components/viz/service/display_embedder/image_context_impl.cc index fd93d58..750745b 100644 --- a/components/viz/service/display_embedder/image_context_impl.cc +++ b/components/viz/service/display_embedder/image_context_impl.cc
@@ -15,6 +15,7 @@ #include "gpu/command_buffer/service/shared_image/shared_image_format_service_utils.h" #include "gpu/command_buffer/service/skia_utils.h" #include "gpu/command_buffer/service/texture_manager.h" +#include "skia/buildflags.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColorSpace.h" #include "third_party/skia/include/core/SkImageInfo.h" @@ -22,6 +23,7 @@ #include "third_party/skia/include/gpu/GrContextThreadSafeProxy.h" #include "third_party/skia/include/gpu/graphite/Recorder.h" #include "third_party/skia/include/gpu/graphite/Surface.h" +#include "third_party/skia/include/gpu/graphite/dawn/DawnTypes.h" #include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h" namespace { @@ -129,6 +131,12 @@ gpu::SharedContextState* context_state) { const int num_planes = format().NumberOfPlanes(); + if (format().PrefersExternalSampler()) { + // Skia can't allocate a fallback texture since the original texture was + // externally allocated. + return; + } + if (context_state->graphite_context()) { const auto& tex_infos = texture_infos(); if (tex_infos.size() != static_cast<size_t>(num_planes) || @@ -139,6 +147,18 @@ << format().ToString(); return; } + +#if BUILDFLAG(SKIA_USE_DAWN) + skgpu::graphite::DawnTextureInfo dawn_info; + bool success = skgpu::graphite::TextureInfos::GetDawnTextureInfo( + tex_infos[0], &dawn_info); + if (success && dawn_info.fFormat == wgpu::TextureFormat::External) { + // Skia can't allocate a fallback texture since the original texture was + // externally allocated. + return; + } +#endif + for (int plane_index = 0; plane_index < num_planes; plane_index++) { SkISize sk_size = gfx::SizeToSkISize(format().GetPlaneSize(plane_index, size())); @@ -171,9 +191,7 @@ // allocated. Skia will skip drawing a null GrPromiseImageTexture, do nothing // and leave it null. const auto& formats = backend_formats(); - // Return early if SIFormat prefers external sampler. - if (formats.empty() || formats[0].textureType() == GrTextureType::kExternal || - format().PrefersExternalSampler()) { + if (formats.empty() || formats[0].textureType() == GrTextureType::kExternal) { return; }
diff --git a/components/viz/service/display_embedder/image_context_impl.h b/components/viz/service/display_embedder/image_context_impl.h index 2be12658..fa6e15a 100644 --- a/components/viz/service/display_embedder/image_context_impl.h +++ b/components/viz/service/display_embedder/image_context_impl.h
@@ -98,6 +98,12 @@ private: void DeleteFallbackTextures(); + + // Creates a solid color fallback image that can be substituted for the + // original image. Note that this may fail if it's not possible to allocate a + // fallback image, for example if the original image was externally allocated. + // In this case the promise image fulfillment will fail and skia will abort + // drawing the entire render pass, so we rely on this being a transient state. void CreateFallbackImage(gpu::SharedContextState* context_state); bool BeginAccessIfNecessaryInternal( gpu::SharedContextState* context_state,
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 4502ba5..dac8fa68 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1603,6 +1603,7 @@ "private_aggregation/private_aggregation_budget_storage.h", "private_aggregation/private_aggregation_budgeter.cc", "private_aggregation/private_aggregation_budgeter.h", + "private_aggregation/private_aggregation_caller_api.h", "private_aggregation/private_aggregation_features.cc", "private_aggregation/private_aggregation_features.h", "private_aggregation/private_aggregation_host.cc",
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index 6ea01df..18afbeb 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc
@@ -194,8 +194,9 @@ } mojo::PendingRemote<network::mojom::URLLoaderFactory> - CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme, - int frame_tree_node_id) override { + CreateNonNetworkNavigationURLLoaderFactory( + const std::string& scheme, + FrameTreeNodeId frame_tree_node_id) override { if (!enable_register_non_network_url_loader_) { return {}; }
diff --git a/content/browser/fenced_frame/fenced_frame.cc b/content/browser/fenced_frame/fenced_frame.cc index 0548d4d..a27b3c8 100644 --- a/content/browser/fenced_frame/fenced_frame.cc +++ b/content/browser/fenced_frame/fenced_frame.cc
@@ -191,7 +191,7 @@ return web_contents_->IsHidden(); } -int FencedFrame::GetOuterDelegateFrameTreeNodeId() { +FrameTreeNodeId FencedFrame::GetOuterDelegateFrameTreeNodeId() { DCHECK(outer_delegate_frame_tree_node_); return outer_delegate_frame_tree_node_->frame_tree_node_id(); }
diff --git a/content/browser/fenced_frame/fenced_frame.h b/content/browser/fenced_frame/fenced_frame.h index 6d8eb3f..66cfce7 100644 --- a/content/browser/fenced_frame/fenced_frame.h +++ b/content/browser/fenced_frame/fenced_frame.h
@@ -64,7 +64,7 @@ void DidStartLoading(FrameTreeNode* frame_tree_node) override {} void DidStopLoading() override {} bool IsHidden() override; - int GetOuterDelegateFrameTreeNodeId() override; + FrameTreeNodeId GetOuterDelegateFrameTreeNodeId() override; RenderFrameHostImpl* GetProspectiveOuterDocument() override; FrameTree* LoadingTree() override; void SetFocusedFrame(FrameTreeNode* node, SiteInstanceGroup* source) override;
diff --git a/content/browser/file_system_access/file_system_access_observer_browsertest.cc b/content/browser/file_system_access/file_system_access_observer_browsertest.cc index bbfe8ee9..d58999af 100644 --- a/content/browser/file_system_access/file_system_access_observer_browsertest.cc +++ b/content/browser/file_system_access/file_system_access_observer_browsertest.cc
@@ -4,10 +4,13 @@ #include <memory> +#include "base/base_paths.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/json/values_util.h" +#include "base/test/metrics/histogram_tester.h" #include "base/test/test_timeouts.h" +#include "base/win/windows_version.h" #include "build/buildflag.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/render_frame_host.h" @@ -31,12 +34,26 @@ constexpr int kBFCacheTestTimeoutMs = 3000; #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) && // !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_MAC) +constexpr char kAttemptToObserveSymlinkHistogram[] = + "Storage.FileSystemAccess.AttemptToObserveSymlinkOrJunction"; enum class TestFileSystemType { kBucket, kLocal, }; +enum class CreateSymbolicLinkResult { + // The symbolic link creation failed because the platform does not support it. + // On Windows, that may be due to the lack of the required privilege. + kUnsupported = -1, + + // The symbolic link creation failed. + kFailed, + + // The symbolic link was created successfully. + kSucceeded, +}; + } // namespace // Helpful macros to reduce the boilerplate script in the tests below. @@ -158,6 +175,88 @@ ui::SelectFileDialog::SetFactory(nullptr); } +#if BUILDFLAG(IS_WIN) + CreateSymbolicLinkResult CreateWinSymbolicLink(const base::FilePath& target, + const base::FilePath& symlink, + bool is_directory = false) { + // Creating symbolic links on Windows requires Administrator privileges. + // However, recent versions of Windows introduced the + // SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE flag, which allows the + // creation of symbolic links by processes with lower privileges, provided + // that Developer Mode is enabled. + // + // On older versions of Windows where the + // SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE flag does not exist, the OS + // will return the error code ERROR_INVALID_PARAMETER when attempting to + // create a symbolic link without sufficient privileges. + if (base::win::GetVersion() < base::win::Version::WIN10_RS3) { + return CreateSymbolicLinkResult::kUnsupported; + } + + DWORD flags = is_directory ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0; + + if (!::CreateSymbolicLink( + symlink.value().c_str(), target.value().c_str(), + flags | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE)) { + // SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE works only if Developer + // Mode is enabled. + if (::GetLastError() == ERROR_PRIVILEGE_NOT_HELD) { + return CreateSymbolicLinkResult::kUnsupported; + } + return CreateSymbolicLinkResult::kFailed; + } + + return CreateSymbolicLinkResult::kSucceeded; + } +#endif // BUILDFLAG(IS_WIN) + + CreateSymbolicLinkResult CreateSymbolicLinkForTesting( + const base::FilePath& target, + const base::FilePath& symlink) { + // base::ScopedAllowBlockingForTesting allow_blocking; +#if BUILDFLAG(IS_WIN) + return CreateWinSymbolicLink(target, symlink); +#elif BUILDFLAG(IS_POSIX) + if (!base::CreateSymbolicLink(target, symlink)) { + return CreateSymbolicLinkResult::kFailed; + } + return CreateSymbolicLinkResult::kSucceeded; +#else + return CreateSymbolicLinkResult::kUnsupported; +#endif // BUILDFLAG(IS_WIN) + } + + std::optional<base::FilePath> CreateSymlinkToBePicked() { + base::FilePath file_path; + base::FilePath symlink_path = temp_dir_.GetPath().AppendASCII("symlink1"); + + { + base::ScopedAllowBlockingForTesting allow_blocking; + // Create the temporary file in the temp_dir_ + EXPECT_TRUE( + base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &file_path)); + EXPECT_TRUE(base::WriteFile(file_path, "observe me")); + + // Create a symbolic link to the temporary file + CreateSymbolicLinkResult result = + CreateSymbolicLinkForTesting(file_path, symlink_path); + if (result == CreateSymbolicLinkResult::kUnsupported) { + return std::nullopt; + } + EXPECT_EQ(result, CreateSymbolicLinkResult::kSucceeded); + } + + // Set up the file dialog factory with the symlink path + ui::SelectFileDialog::SetFactory( + std::make_unique<FakeSelectFileDialogFactory>( + std::vector<base::FilePath>{symlink_path})); + + // Navigate to the test URL + EXPECT_TRUE(NavigateToURL(shell(), test_url_)); + + return symlink_path; + } + base::FilePath CreateFileToBePicked() { base::FilePath file_path; { @@ -380,6 +479,36 @@ EXPECT_THAT(records.GetList(), testing::IsEmpty()); } +// Local file system access - including the open*Picker() methods used here +// - is not supported on Android or iOS. Fuchsia does not support symlinks. +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_FUCHSIA) +IN_PROC_BROWSER_TEST_F(FileSystemAccessObserveWithFlagBrowserTest, + SymlinkCannotBeObserved) { + base::HistogramTester histogram_tester; + std::optional<base::FilePath> symlink_path = CreateSymlinkToBePicked(); + if (!symlink_path.has_value()) { + GTEST_SKIP() << "Platform does not support symlinks."; + } + const std::string script = + // clang-format off + "(async () => {" + CREATE_PROMISE_AND_RESOLVERS + START_OBSERVING_FILE(TestFileSystemType::kLocal) + SET_CHANGE_TIMEOUT + "})()"; + // clang-format on + auto result = EvalJs(shell(), script); + + // Check if a JavaScript error occurred. + EXPECT_TRUE(result.error.find("InvalidModificationError") != + std::string::npos) + << "Unexpected result: " << result.error; + histogram_tester.ExpectUniqueSample(kAttemptToObserveSymlinkHistogram, + /*sample=*/true, 1); +} +#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) && + // !BUILDFLAG(IS_FUCHSIA) + class FileSystemAccessObserveWithUnobserveFlagBrowserTest : public FileSystemAccessObserveWithFlagBrowserTest { public: @@ -482,6 +611,7 @@ // TODO(b/360153904): Disabled on Mac due to flakiness. #if !BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(FileSystemAccessObserverBrowserTest, ObserveFile) { + base::HistogramTester histogram_tester; base::FilePath file_path = CreateFileToBePicked(); const std::string script = @@ -495,6 +625,8 @@ // clang-format on auto records = EvalJs(shell(), script).ExtractList(); EXPECT_THAT(records.GetList(), testing::Not(testing::IsEmpty())); + histogram_tester.ExpectUniqueSample(kAttemptToObserveSymlinkHistogram, + /*sample=*/false, 1); } #endif // !BUILDFLAG(IS_MAC) @@ -557,7 +689,7 @@ // clang-format on auto result = EvalJs(shell(), script); - // Check if a JavaScript error occurred and contains "NotFoundError" + // Check if a JavaScript error occurred and contains "NotFoundError". EXPECT_TRUE(result.error.find("NotFoundError") != std::string::npos) << "Unexpected result: " << result.error; } @@ -580,7 +712,7 @@ // clang-format on auto result = EvalJs(shell(), script); - // Check if a JavaScript error occurred and contains "NotFoundError" + // Check if a JavaScript error occurred and contains "NotFoundError". EXPECT_TRUE(result.error.find("NotFoundError") != std::string::npos) << "Unexpected result: " << result.error; }
diff --git a/content/browser/file_system_access/file_system_access_observer_host.cc b/content/browser/file_system_access/file_system_access_observer_host.cc index a03a2d18..c142176 100644 --- a/content/browser/file_system_access/file_system_access_observer_host.cc +++ b/content/browser/file_system_access/file_system_access_observer_host.cc
@@ -6,6 +6,8 @@ #include <memory> +#include "base/files/file_util.h" +#include "base/metrics/histogram_functions.h" #include "base/ranges/algorithm.h" #include "content/browser/file_system_access/file_system_access_directory_handle_impl.h" #include "content/browser/file_system_access/file_system_access_error.h" @@ -100,6 +102,53 @@ break; } + // Observing symlink and junction is not supported for Origin Trial. + // TODO(crbug.com/363195541): Add support for symlinks and junctions for + // feature launch. + base::FilePath path = resolved_token->url().path(); + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::MayBlock()}, + base::BindOnce( + [](base::FilePath path) -> bool { + base::FilePath check_path; + // `base::NormalizeFilePath()` resolves any file path elements like + // symbolic links or junctions by returning the target file path. + if (!base::NormalizeFilePath(path, &check_path)) { + check_path = path; + } + DCHECK(path.empty() == check_path.empty()); + return check_path != path; + }, + std::move(path)), + base::BindOnce(&FileSystemAccessObserverHost::DidCheckIfSymlinkOrJunction, + weak_factory_.GetWeakPtr(), std::move(handle), + std::move(callback), resolved_token->url(), is_recursive, + handle_type)); +} + +void FileSystemAccessObserverHost::DidCheckIfSymlinkOrJunction( + absl::variant<std::unique_ptr<FileSystemAccessDirectoryHandleImpl>, + std::unique_ptr<FileSystemAccessFileHandleImpl>> handle, + ObserveCallback callback, + storage::FileSystemURL url, + bool is_recursive, + FileSystemAccessPermissionContext::HandleType handle_type, + bool is_symlink_or_junction) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + base::UmaHistogramBoolean( + "Storage.FileSystemAccess.AttemptToObserveSymlinkOrJunction", + is_symlink_or_junction); + if (is_symlink_or_junction) { + std::move(callback).Run( + blink::mojom::FileSystemAccessError::New( + blink::mojom::FileSystemAccessStatus::kFileError, + base::File::FILE_ERROR_INVALID_OPERATION, + "Symlinks or junctions cannot be observed"), + mojo::NullReceiver()); + return; + } + manager_->DoFileSystemOperation( FROM_HERE, handle_type == FileSystemAccessPermissionContext::HandleType::kDirectory @@ -107,8 +156,8 @@ : &storage::FileSystemOperationRunner::FileExists, base::BindOnce(&FileSystemAccessObserverHost::DidCheckItemExists, weak_factory_.GetWeakPtr(), std::move(handle), - std::move(callback), resolved_token->url(), is_recursive), - resolved_token->url()); + std::move(callback), url, is_recursive), + url); } void FileSystemAccessObserverHost::DidCheckItemExists(
diff --git a/content/browser/file_system_access/file_system_access_observer_host.h b/content/browser/file_system_access/file_system_access_observer_host.h index 3490f3d..ff90992 100644 --- a/content/browser/file_system_access/file_system_access_observer_host.h +++ b/content/browser/file_system_access/file_system_access_observer_host.h
@@ -65,6 +65,15 @@ ObserveCallback callback, FileSystemAccessTransferTokenImpl* resolved_token); + void DidCheckIfSymlinkOrJunction( + absl::variant<std::unique_ptr<FileSystemAccessDirectoryHandleImpl>, + std::unique_ptr<FileSystemAccessFileHandleImpl>> handle, + ObserveCallback callback, + storage::FileSystemURL url, + bool is_recursive, + FileSystemAccessPermissionContext::HandleType handle_type, + bool is_symlink_or_junction); + void DidCheckItemExists( absl::variant<std::unique_ptr<FileSystemAccessDirectoryHandleImpl>, std::unique_ptr<FileSystemAccessFileHandleImpl>> handle,
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index 6f89c1c7..04a7cbc 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -79,6 +79,7 @@ #include "ui/display/screen.h" #include "ui/gfx/switches.h" #include "ui/gl/buildflags.h" +#include "ui/gl/gl_features.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_switches.h" #include "ui/gl/gpu_preference.h" @@ -412,12 +413,10 @@ // Determines if SwiftShader is available as a fallback for WebGL. bool SwiftShaderAllowed() { -#if BUILDFLAG(ENABLE_SWIFTSHADER) - return !base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableSoftwareRasterizer); -#else - return false; -#endif + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + return !command_line->HasSwitch(switches::kDisableSoftwareRasterizer) && + features::IsSwiftShaderAllowed(command_line); } // These values are logged to UMA. Entries should not be renumbered and numeric
diff --git a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc index d91534c4..c706288 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
@@ -7,6 +7,8 @@ #pragma allow_unsafe_buffers #endif +#include "content/browser/gpu/gpu_data_manager_impl_private.h" + #include <stddef.h> #include "base/command_line.h" @@ -17,7 +19,6 @@ #include "build/build_config.h" #include "build/chromecast_buildflags.h" #include "build/chromeos_buildflags.h" -#include "content/browser/gpu/gpu_data_manager_impl_private.h" #include "content/browser/gpu/gpu_data_manager_testing_autogen.h" #include "content/browser/gpu/gpu_data_manager_testing_entry_enums_autogen.h" #include "content/public/browser/gpu_data_manager_observer.h" @@ -30,6 +31,8 @@ #include "gpu/config/gpu_switches.h" #include "gpu/ipc/common/memory_stats.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gl/gl_features.h" +#include "ui/gl/gl_switches.h" #include "url/gurl.h" // TODO(crbug.com/1293538): The IS_CAST_AUDIO_ONLY check should not need to be @@ -488,7 +491,21 @@ // not support falling back to software from Vulkan. #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_IOS) #if !BUILDFLAG(IS_FUCHSIA) -TEST_F(GpuDataManagerImplPrivateTest, FallbackToSwiftShader) { +TEST_F(GpuDataManagerImplPrivateTest, NoDefaultFallbackToSwiftShader) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(features::kAllowSwiftShaderFallback); + + ScopedGpuDataManagerImplPrivate manager; + EXPECT_EQ(gpu::GpuMode::HARDWARE_GL, manager->GetGpuMode()); + + manager->FallBackToNextGpuMode(); + EXPECT_EQ(gpu::GpuMode::DISPLAY_COMPOSITOR, manager->GetGpuMode()); +} + +TEST_F(GpuDataManagerImplPrivateTest, ExplicitFallbackToSwiftShader) { + base::CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnableUnsafeSwiftShader); + ScopedGpuDataManagerImplPrivate manager; EXPECT_EQ(gpu::GpuMode::HARDWARE_GL, manager->GetGpuMode()); @@ -496,9 +513,32 @@ EXPECT_EQ(gpu::GpuMode::SWIFTSHADER, manager->GetGpuMode()); } -TEST_F(GpuDataManagerImplPrivateTest, FallbackWithSwiftShaderDisabled) { +TEST_F(GpuDataManagerImplPrivateTest, FallbackWithSwiftShaderDisabledByFlags) { + // Make sure that we don't fall back to SwiftShader when it's disabled with + // --disable-software-rasterizer even if --allow-unsafe-swiftshader is used base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kDisableSoftwareRasterizer); + base::CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnableUnsafeSwiftShader); + ScopedGpuDataManagerImplPrivate manager; + EXPECT_EQ(gpu::GpuMode::HARDWARE_GL, manager->GetGpuMode()); + + manager->FallBackToNextGpuMode(); + gpu::GpuMode expected_mode = gpu::GpuMode::DISPLAY_COMPOSITOR; + EXPECT_EQ(expected_mode, manager->GetGpuMode()); +} + +TEST_F(GpuDataManagerImplPrivateTest, + FallbackWithSwiftShaderDisabledByFeatures) { + // Make sure that we don't fall back to SwiftShader when it's disabled with + // --disable-software-rasterizer even the AllowSwiftShaderFallback feature is + // present. + base::CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kDisableSoftwareRasterizer); + + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(features::kAllowSwiftShaderFallback); + ScopedGpuDataManagerImplPrivate manager; EXPECT_EQ(gpu::GpuMode::HARDWARE_GL, manager->GetGpuMode()); @@ -527,9 +567,12 @@ #if !defined(CAST_AUDIO_ONLY) TEST_F(GpuDataManagerImplPrivateTest, GpuStartsWithGpuDisabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(features::kAllowSwiftShaderFallback); + base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableGpu); ScopedGpuDataManagerImplPrivate manager; - EXPECT_EQ(gpu::GpuMode::SWIFTSHADER, manager->GetGpuMode()); + EXPECT_EQ(gpu::GpuMode::DISPLAY_COMPOSITOR, manager->GetGpuMode()); } #endif // !defined(CAST_AUDIO_ONLY) #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && @@ -569,7 +612,13 @@ TEST_F(GpuDataManagerImplPrivateTest, VulkanInitializationFails) { base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(features::kVulkan); + feature_list.InitWithFeatures({features::kVulkan}, +#if BUILDFLAG(ENABLE_SWIFTSHADER) + {features::kAllowSwiftShaderFallback}); +#else + {}); +#endif // BUILDFLAG(ENABLE_SWIFTSHADER) + ScopedGpuDataManagerImplPrivate manager; EXPECT_EQ(gpu::GpuMode::HARDWARE_VULKAN, manager->GetGpuMode()); @@ -581,11 +630,11 @@ // GpuDataManager should update its mode to be GL. EXPECT_EQ(gpu::GpuMode::HARDWARE_GL, manager->GetGpuMode()); - // The first fallback should go to SwiftShader on platforms where fallback to - // software is allowed. + // The first fallback should go to the display compositor on platforms where + // fallback to software is allowed. #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_IOS) manager->FallBackToNextGpuMode(); - EXPECT_EQ(gpu::GpuMode::SWIFTSHADER, manager->GetGpuMode()); + EXPECT_EQ(gpu::GpuMode::DISPLAY_COMPOSITOR, manager->GetGpuMode()); #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && // !BUILDFLAG(IS_IOS) } @@ -593,7 +642,8 @@ #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_IOS) TEST_F(GpuDataManagerImplPrivateTest, FallbackFromVulkanWithGLDisabled) { base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(features::kVulkan); + feature_list.InitWithFeatures({features::kVulkan}, + {features::kAllowSwiftShaderFallback}); ScopedGpuDataManagerImplPrivate manager; EXPECT_EQ(gpu::GpuMode::HARDWARE_VULKAN, manager->GetGpuMode()); @@ -603,7 +653,7 @@ manager->UpdateGpuFeatureInfo(gpu_feature_info, std::nullopt); manager->FallBackToNextGpuMode(); - EXPECT_EQ(gpu::GpuMode::SWIFTSHADER, manager->GetGpuMode()); + EXPECT_EQ(gpu::GpuMode::DISPLAY_COMPOSITOR, manager->GetGpuMode()); } #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && // !BUILDFLAG(IS_IOS)
diff --git a/content/browser/interest_group/ad_auction_service_impl.cc b/content/browser/interest_group/ad_auction_service_impl.cc index 646fd17..0f6a13ec 100644 --- a/content/browser/interest_group/ad_auction_service_impl.cc +++ b/content/browser/interest_group/ad_auction_service_impl.cc
@@ -448,23 +448,12 @@ // Try to preconnect to owner and bidding signals origins if this is an // on-device auction. if (base::FeatureList::IsEnabled(features::kFledgeUsePreconnectCache) && - !config.server_response.has_value() && - config.non_shared_params.interest_group_buyers.has_value()) { - for (const auto& buyer : *config.non_shared_params.interest_group_buyers) { - std::optional<url::Origin> signals_origin; - if (GetInterestGroupManager().GetCachedOwnerAndSignalsOrigins( - buyer, signals_origin)) { - net::NetworkAnonymizationKey network_anonymization_key = - net::NetworkAnonymizationKey::CreateSameSite( - net::SchemefulSite(buyer)); - PreconnectSocket(buyer.GetURL(), network_anonymization_key); - if (signals_origin) { - // We preconnect to the signals origin and not the full signals URL so - // that we do not need to store the full URL in memory. Preconnecting - // to the origin will be roughly equivalent to preconnecting to the - // full URL. - PreconnectSocket(signals_origin->GetURL(), network_anonymization_key); - } + !config.server_response.has_value()) { + PreconnectToBuyerOrigins(config); + for (const blink::AuctionConfig& component_config : + config.non_shared_params.component_auctions) { + if (!component_config.server_response.has_value()) { + PreconnectToBuyerOrigins(component_config); } } } @@ -1260,4 +1249,28 @@ render_frame_host().GetPage()); } +void AdAuctionServiceImpl::PreconnectToBuyerOrigins( + const blink::AuctionConfig& config) { + if (!config.non_shared_params.interest_group_buyers) { + return; + } + for (const auto& buyer : *config.non_shared_params.interest_group_buyers) { + std::optional<url::Origin> signals_origin; + if (GetInterestGroupManager().GetCachedOwnerAndSignalsOrigins( + buyer, signals_origin)) { + net::NetworkAnonymizationKey network_anonymization_key = + net::NetworkAnonymizationKey::CreateSameSite( + net::SchemefulSite(buyer)); + PreconnectSocket(buyer.GetURL(), network_anonymization_key); + if (signals_origin) { + // We preconnect to the signals origin and not the full signals URL so + // that we do not need to store the full URL in memory. Preconnecting + // to the origin will be roughly equivalent to preconnecting to the + // full URL. + PreconnectSocket(signals_origin->GetURL(), network_anonymization_key); + } + } + } +} + } // namespace content
diff --git a/content/browser/interest_group/ad_auction_service_impl.h b/content/browser/interest_group/ad_auction_service_impl.h index be50273..688db75 100644 --- a/content/browser/interest_group/ad_auction_service_impl.h +++ b/content/browser/interest_group/ad_auction_service_impl.h
@@ -207,6 +207,12 @@ AdAuctionPageData* GetAdAuctionPageData(); + // For each buyer in `config`, preconnect to its origin and bidding signals + // origin if the origins have been cached from previous interest group joins + // or auctions. This function needs to be called separately to preconnect to + // origins for `config`'s component auctions. + void PreconnectToBuyerOrigins(const blink::AuctionConfig& config); + // To avoid race conditions associated with top frame navigations (mentioned // in document_service.h), we need to save the values of the main frame // URL and origin in the constructor.
diff --git a/content/browser/interest_group/ad_auction_service_impl_unittest.cc b/content/browser/interest_group/ad_auction_service_impl_unittest.cc index b161eb8a..140bf09 100644 --- a/content/browser/interest_group/ad_auction_service_impl_unittest.cc +++ b/content/browser/interest_group/ad_auction_service_impl_unittest.cc
@@ -53,6 +53,7 @@ #include "content/browser/interest_group/interest_group_storage.h" #include "content/browser/interest_group/storage_interest_group.h" #include "content/browser/private_aggregation/private_aggregation_budgeter.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_manager_impl.h" #include "content/browser/private_aggregation/private_aggregation_test_utils.h" #include "content/browser/renderer_host/render_frame_host_impl.h" @@ -821,7 +822,7 @@ ON_CALL(*this, BindNewReceiver) .WillByDefault( [this](url::Origin worklet_origin, url::Origin top_frame_origin, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, std::optional<std::string> context_id, std::optional<base::TimeDelta> timeout, std::optional<url::Origin> aggregation_coordinator_origin, @@ -844,7 +845,7 @@ BindNewReceiver, (url::Origin, url::Origin, - PrivateAggregationBudgetKey::Api, + PrivateAggregationCallerApi, std::optional<std::string>, std::optional<base::TimeDelta>, std::optional<url::Origin>, @@ -9933,7 +9934,7 @@ /*filtering_id=*/std::nullopt))); EXPECT_EQ(request.shared_info().reporting_origin, kOriginA); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); EXPECT_EQ(budget_key.origin(), kOriginA); EXPECT_EQ(budget_denied_behavior, PrivateAggregationBudgeter::BudgetDeniedBehavior::
diff --git a/content/browser/interest_group/interest_group_browsertest.cc b/content/browser/interest_group/interest_group_browsertest.cc index f8836d6..48b1e8e 100644 --- a/content/browser/interest_group/interest_group_browsertest.cc +++ b/content/browser/interest_group/interest_group_browsertest.cc
@@ -66,6 +66,7 @@ #include "content/browser/interest_group/interest_group_features.h" #include "content/browser/interest_group/interest_group_manager_impl.h" #include "content/browser/interest_group/test_interest_group_observer.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_manager_impl.h" #include "content/browser/private_aggregation/private_aggregation_test_utils.h" #include "content/browser/renderer_host/page_impl.h" @@ -8080,7 +8081,7 @@ EXPECT_EQ(request.debug_key(), debug_key); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); EXPECT_EQ(budget_key.origin(), test_origin_); EXPECT_EQ(budget_denied_behavior, PrivateAggregationBudgeter::BudgetDeniedBehavior:: @@ -8386,7 +8387,7 @@ request_returned = std::move(generator).Run(contributions); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); EXPECT_EQ(budget_key.origin(), test_origin_); EXPECT_EQ(budget_denied_behavior, PrivateAggregationBudgeter::BudgetDeniedBehavior:: @@ -14115,6 +14116,21 @@ base::test::ScopedFeatureList scoped_feature_list_; }; +IN_PROC_BROWSER_TEST_F(InterestGroupAuctionFledgeDealSupportDisabledTest, + FeatureDetection) { + GURL test_url = + embedded_https_test_server().GetURL("a.test", "/simple_page.html"); + + ASSERT_TRUE(NavigateToURL(shell(), test_url)); + ASSERT_EQ(true, EvalJs(shell(), "'protectedAudience' in navigator")); + + const char kQuerySelectableReportingIds[] = R"( + navigator.protectedAudience.queryFeatureSupport( + 'selectableReportingIds'); + )"; + EXPECT_EQ(false, EvalJs(shell(), kQuerySelectableReportingIds)); +} + // When an interest group contains selectableBuyerAndSellerReportingIds, // and the feature is disabled, we expect the selectable to never be set, // and therefore should be treated as a regular bid as if it was never there. @@ -19829,7 +19845,7 @@ EXPECT_EQ(request.payload_contents().contributions[0].value, 5); EXPECT_EQ(request.shared_info().reporting_origin, test_origin); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); EXPECT_EQ(budget_key.origin(), test_origin); EXPECT_EQ(budget_denied_behavior, PrivateAggregationBudgeter::BudgetDeniedBehavior:: @@ -23905,6 +23921,11 @@ 'realTimeReporting'); )"; + const char kQuerySelectableReportingIds[] = R"( + navigator.protectedAudience.queryFeatureSupport( + 'selectableReportingIds'); + )"; + const char kQueryAll[] = R"( navigator.protectedAudience.queryFeatureSupport('*'); )"; @@ -23912,10 +23933,18 @@ EXPECT_EQ(40, EvalJs(shell(), kQueryComponentLimit)); EXPECT_EQ(true, EvalJs(shell(), kQueryUrlReplacements)); EXPECT_EQ(true, EvalJs(shell(), kQueryReportingTimeout)); + EXPECT_EQ(true, EvalJs(shell(), kQuerySelectableReportingIds)); EXPECT_EQ(false, EvalJs(shell(), kQueryCrossOriginTrustedSignals)); EXPECT_EQ(false, EvalJs(shell(), kQueryRealTimeReporting)); - // Since only older features are on in this feature, * isn't available yet. - EXPECT_EQ(nullptr, EvalJs(shell(), kQueryAll)); + auto all_result = EvalJs(shell(), kQueryAll); + EXPECT_THAT(all_result.value, base::test::IsJson(R"({ + "adComponentsLimit": 40, + "deprecatedRenderURLReplacements": true, + "permitCrossOriginTrustedSignals": false, + "realTimeReporting": false, + "reportingTimeout": true, + "selectableReportingIds": true +})")) << all_result.error; } // Worklet handling of zero seller timeout. @@ -25015,6 +25044,7 @@ "permitCrossOriginTrustedSignals": true, "realTimeReporting": false, "reportingTimeout": true, + "selectableReportingIds": true, })")) << all_result.error; } @@ -25442,6 +25472,7 @@ "permitCrossOriginTrustedSignals": false, "realTimeReporting": true, "reportingTimeout": true, + "selectableReportingIds": true, })")) << all_result.error; } @@ -25580,7 +25611,8 @@ } class InterestGroupPreconnectOwnerAndSignalsOriginsTest - : public InterestGroupBrowserTest { + : public InterestGroupBrowserTest, + public testing::WithParamInterface<bool> { public: InterestGroupPreconnectOwnerAndSignalsOriginsTest() { feature_list_.InitWithFeatures(/*enabled_features=*/ @@ -25692,13 +25724,15 @@ return num_signals_requests_; } + bool UseConfigWithComponentAuction() const { return GetParam(); } + protected: base::test::ScopedFeatureList feature_list_; size_t num_owner_requests_ GUARDED_BY(requests_lock_) = 0; size_t num_signals_requests_ GUARDED_BY(requests_lock_) = 0; }; -IN_PROC_BROWSER_TEST_F(InterestGroupPreconnectOwnerAndSignalsOriginsTest, +IN_PROC_BROWSER_TEST_P(InterestGroupPreconnectOwnerAndSignalsOriginsTest, PreconnectsToOwnerAndSignalsOrigins) { GURL joining_url = embedded_https_test_server().GetURL("c.test", "/echo"); url::Origin joining_origin = url::Origin::Create(joining_url); @@ -25760,15 +25794,33 @@ interest_group_without_ads.owner, cached_signals_origin)); EXPECT_EQ(cached_signals_origin, signals_origin); - const char kConfigTemplate[] = R"({ + std::string config_template; + if (UseConfigWithComponentAuction()) { + config_template = R"({ + seller: $1, + decisionLogicURL: $2, + auctionSignals: "bidderAllowsComponentAuction,"+ + "sellerAllowsComponentAuction", + componentAuctions: + [{ + seller: $1, + decisionLogicURL: $2, + interestGroupBuyers: [$3], + auctionSignals: "bidderAllowsComponentAuction,"+ + "sellerAllowsComponentAuction" + }] + })"; + } else { + config_template = R"({ seller: $1, decisionLogicURL: $2, interestGroupBuyers: [$3], sellerTimeout: 3000, })"; + } std::string auction_config = - JsReplace(kConfigTemplate, joining_origin, + JsReplace(config_template, joining_origin, embedded_https_test_server().GetURL( "c.test", "/interest_group/decision_logic.js"), owner_origin); @@ -25805,6 +25857,10 @@ EXPECT_EQ(GetNumSignalsRequests(), 1u); } +INSTANTIATE_TEST_SUITE_P(All, + InterestGroupPreconnectOwnerAndSignalsOriginsTest, + testing::Bool()); + } // namespace } // namespace content
diff --git a/content/browser/interest_group/interest_group_pa_report_util.cc b/content/browser/interest_group/interest_group_pa_report_util.cc index 6a6f731..322147b 100644 --- a/content/browser/interest_group/interest_group_pa_report_util.cc +++ b/content/browser/interest_group/interest_group_pa_report_util.cc
@@ -20,6 +20,7 @@ #include "base/notreached.h" #include "base/numerics/clamped_math.h" #include "components/aggregation_service/aggregation_coordinator_utils.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_host.h" #include "content/browser/private_aggregation/private_aggregation_manager.h" #include "content/common/content_export.h" @@ -418,7 +419,7 @@ bool bound = pa_manager.BindNewReceiver( /*worklet_origin=*/reporting_origin, /*top_frame_origin=*/main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, aggregation_coordinator_origin, PrivateAggregationHost::kDefaultFilteringIdMaxBytes,
diff --git a/content/browser/interest_group/test_interest_group_private_aggregation_manager.cc b/content/browser/interest_group/test_interest_group_private_aggregation_manager.cc index ba0d27d4..402d753 100644 --- a/content/browser/interest_group/test_interest_group_private_aggregation_manager.cc +++ b/content/browser/interest_group/test_interest_group_private_aggregation_manager.cc
@@ -20,7 +20,7 @@ #include "base/run_loop.h" #include "base/time/time.h" #include "content/browser/interest_group/interest_group_auction_reporter.h" -#include "content/browser/private_aggregation/private_aggregation_budget_key.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_manager.h" #include "content/public/browser/storage_partition.h" #include "content/services/auction_worklet/public/mojom/private_aggregation_request.mojom.h" @@ -44,7 +44,7 @@ bool TestInterestGroupPrivateAggregationManager::BindNewReceiver( url::Origin worklet_origin, url::Origin top_frame_origin, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, std::optional<std::string> context_id, std::optional<base::TimeDelta> timeout, std::optional<url::Origin> aggregation_coordinator_origin, @@ -52,8 +52,7 @@ mojo::PendingReceiver<blink::mojom::PrivateAggregationHost> pending_receiver) { EXPECT_EQ(expected_top_frame_origin_, top_frame_origin); - EXPECT_EQ(PrivateAggregationBudgetKey::Api::kProtectedAudience, - api_for_budgeting); + EXPECT_EQ(PrivateAggregationCallerApi::kProtectedAudience, api_for_budgeting); EXPECT_FALSE(context_id.has_value()); EXPECT_FALSE(timeout.has_value()); EXPECT_EQ(filtering_id_max_bytes, 1u);
diff --git a/content/browser/interest_group/test_interest_group_private_aggregation_manager.h b/content/browser/interest_group/test_interest_group_private_aggregation_manager.h index e88f813..41933d7 100644 --- a/content/browser/interest_group/test_interest_group_private_aggregation_manager.h +++ b/content/browser/interest_group/test_interest_group_private_aggregation_manager.h
@@ -15,7 +15,7 @@ #include "base/functional/callback_forward.h" #include "base/time/time.h" #include "content/browser/interest_group/interest_group_auction_reporter.h" -#include "content/browser/private_aggregation/private_aggregation_budget_key.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_manager.h" #include "content/public/browser/storage_partition.h" #include "content/services/auction_worklet/public/mojom/private_aggregation_request.mojom-forward.h" @@ -28,7 +28,7 @@ namespace content { // An implementation of PrivateAggregationManager used for interest group tests -// that tracks PrivateAggregationBudgetKey::Api::kProtectedAudience reports. +// that tracks PrivateAggregationCallerApi::kProtectedAudience reports. class TestInterestGroupPrivateAggregationManager : public PrivateAggregationManager, public blink::mojom::PrivateAggregationHost { @@ -43,7 +43,7 @@ bool BindNewReceiver( url::Origin worklet_origin, url::Origin top_frame_origin, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, std::optional<std::string> context_id, std::optional<base::TimeDelta> timeout, std::optional<url::Origin> aggregation_coordinator_origin,
diff --git a/content/browser/launch_as_mojo_client_browsertest.cc b/content/browser/launch_as_mojo_client_browsertest.cc index 8027378..97e1fd19 100644 --- a/content/browser/launch_as_mojo_client_browsertest.cc +++ b/content/browser/launch_as_mojo_client_browsertest.cc
@@ -81,6 +81,7 @@ gl::kGLImplementationANGLEName); command_line.AppendSwitchASCII(switches::kUseANGLE, gl::kANGLEImplementationSwiftShaderName); + command_line.AppendSwitch(switches::kEnableUnsafeSwiftShader); #endif #if defined(MEMORY_SANITIZER)
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc index 9819389e..4f42ebe 100644 --- a/content/browser/navigation_browsertest.cc +++ b/content/browser/navigation_browsertest.cc
@@ -3274,7 +3274,7 @@ mojo::PendingRemote<network::mojom::URLLoaderFactory> CreateNonNetworkNavigationURLLoaderFactory( const std::string& scheme, - int frame_tree_node_id) override { + FrameTreeNodeId frame_tree_node_id) override { if (scheme == kNoAccessScheme) { mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_remote; fake_url_loader_factory_->Clone(
diff --git a/content/browser/navigation_transitions/back_forward_transition_animation_manager_android.cc b/content/browser/navigation_transitions/back_forward_transition_animation_manager_android.cc index 0741657..8731689 100644 --- a/content/browser/navigation_transitions/back_forward_transition_animation_manager_android.cc +++ b/content/browser/navigation_transitions/back_forward_transition_animation_manager_android.cc
@@ -252,9 +252,12 @@ ->MaybeCopyContentAreaAsBitmapSync(); } -// TODO(baranerf): Implement this. void BackForwardTransitionAnimationManagerAndroid::MaybeRecordIgnoredInput( - const blink::WebInputEvent& event) {} + const blink::WebInputEvent& event) { + if (animator_) { + animator_->MaybeRecordIgnoredInput(event); + } +} void BackForwardTransitionAnimationManagerAndroid::MaybeDestroyAnimator() { CHECK(animator_);
diff --git a/content/browser/navigation_transitions/back_forward_transition_animator.cc b/content/browser/navigation_transitions/back_forward_transition_animator.cc index bd25fe37..62ec993 100644 --- a/content/browser/navigation_transitions/back_forward_transition_animator.cc +++ b/content/browser/navigation_transitions/back_forward_transition_animator.cc
@@ -264,6 +264,33 @@ BackForwardTransitionAnimator::~BackForwardTransitionAnimator() { CHECK(IsTerminalState()) << ToString(state_); + switch (ignoring_input_reason_) { + case IgnoringInputReason::kAnimationInvokedOccurred: { + base::UmaHistogramCounts100( + "Navigation.GestureTransition.IgnoredInputCount.AnimationInvoked." + "OnDestination", + ignored_inputs_count_.animation_invoked_on_destination); + base::UmaHistogramCounts100( + "Navigation.GestureTransition.IgnoredInputCount.AnimationInvoked." + "OnSource", + ignored_inputs_count_.animation_invoked_on_source); + break; + } + case IgnoringInputReason::kAnimationCanceledOccurred: { + base::UmaHistogramCounts100( + "Navigation.GestureTransition.IgnoredInputCount.AnimationCanceled." + "OnDestination", + ignored_inputs_count_.animation_canceled_on_destination); + base::UmaHistogramCounts100( + "Navigation.GestureTransition.IgnoredInputCount.AnimationCanceled." + "OnSource", + ignored_inputs_count_.animation_canceled_on_source); + break; + } + case IgnoringInputReason::kNoOccurrence: + break; + } + ResetTransformForLayer(animation_manager_->web_contents_view_android() ->parent_for_web_page_widgets()); @@ -367,14 +394,14 @@ void BackForwardTransitionAnimator::OnGestureCancelled() { CHECK_EQ(state_, State::kStarted); - StartInputSuppression(); + StartInputSuppression(IgnoringInputReason::kAnimationCanceledOccurred); AdvanceAndProcessState(State::kDisplayingCancelAnimation); } void BackForwardTransitionAnimator::OnGestureInvoked() { CHECK_EQ(state_, State::kStarted); - StartInputSuppression(); + StartInputSuppression(IgnoringInputReason::kAnimationInvokedOccurred); if (!StartNavigationAndTrackRequest()) { // `BackForwardTransitionAnimationManagerAndroid` will destroy `this` upon @@ -887,6 +914,69 @@ } } +void BackForwardTransitionAnimator::MaybeRecordIgnoredInput( + const blink::WebInputEvent& event) { + if (event.GetType() != blink::WebInputEvent::Type::kTouchStart) { + return; + } + + CHECK(blink::WebInputEvent::IsTouchEventType(event.GetType())); + const auto& touch_event = static_cast<const blink::WebTouchEvent&>(event); + + for (auto& touch : touch_event.touches) { + // Only counting initial press touch instances. + if (touch.state != blink::mojom::TouchState::kStatePressed) { + continue; + } + const auto touch_position_x = + touch.PositionInScreen().x() * device_scale_factor_; + const auto touch_position_y = + touch.PositionInScreen().y() * device_scale_factor_; + bool on_destination = false; + gfx::Rect viewport_rect = + gfx::Rect(animation_manager_->web_contents_view_android() + ->GetNativeView() + ->GetPhysicalBackingSize()); + + if (nav_direction_ == NavigationDirection::kForward) { + // In forward navigations, the screenshot is on top so, count the touch + // event if it hits the screenshot. + on_destination = screenshot_layer_->transform() + .MapRect(viewport_rect) + .Contains(touch_position_x, touch_position_y); + } else { + // In back navigations, the live page is on top so, count the touch event + // if it hits the live page. + on_destination = !animation_manager_->web_contents_view_android() + ->parent_for_web_page_widgets() + ->transform() + .MapRect(viewport_rect) + .Contains(touch_position_x, touch_position_y); + } + + switch (ignoring_input_reason_) { + case IgnoringInputReason::kAnimationInvokedOccurred: { + if (on_destination) { + ++ignored_inputs_count_.animation_invoked_on_destination; + } else { + ++ignored_inputs_count_.animation_invoked_on_source; + } + break; + } + case IgnoringInputReason::kAnimationCanceledOccurred: { + if (on_destination) { + ++ignored_inputs_count_.animation_canceled_on_destination; + } else { + ++ignored_inputs_count_.animation_canceled_on_source; + } + break; + } + case IgnoringInputReason::kNoOccurrence: + break; + } + } +} + void BackForwardTransitionAnimator::AbortAnimation() { AdvanceAndProcessState(State::kAnimationAborted); } @@ -1626,8 +1716,10 @@ .height(); } -void BackForwardTransitionAnimator::StartInputSuppression() { +void BackForwardTransitionAnimator::StartInputSuppression( + IgnoringInputReason ignoring_input_reason) { CHECK(!ignore_input_scope_); + ignoring_input_reason_ = ignoring_input_reason; ignore_input_scope_.emplace(animation_manager_->web_contents_view_android() ->web_contents()
diff --git a/content/browser/navigation_transitions/back_forward_transition_animator.h b/content/browser/navigation_transitions/back_forward_transition_animator.h index 71770229..9cd1f87 100644 --- a/content/browser/navigation_transitions/back_forward_transition_animator.h +++ b/content/browser/navigation_transitions/back_forward_transition_animator.h
@@ -176,6 +176,7 @@ RenderFrameHostImpl* old_host, RenderFrameHostImpl* new_host); void OnNavigationCancelledBeforeStart(NavigationHandle* navigation_handle); + void MaybeRecordIgnoredInput(const blink::WebInputEvent& event); // Notifies when the transition needs to be aborted. void AbortAnimation(); @@ -276,6 +277,13 @@ cc::RenderFrameMetadata::kInvalidItemSequenceNumber; private: + // Indicates what animation state caused input event suppression. + enum class IgnoringInputReason { + kAnimationInvokedOccurred = 0, + kAnimationCanceledOccurred = 1, + kNoOccurrence = 2 + }; + // Initializes `effect_` for the scrim and cross-fade animation. void InitializeEffectForGestureProgressAnimation(); void InitializeEffectForCrossfadeAnimation(); @@ -337,7 +345,7 @@ int GetViewportWidthPx() const; int GetViewportHeightPx() const; - void StartInputSuppression(); + void StartInputSuppression(IgnoringInputReason ignoring_input_reason); void InsertLayersInOrder(); @@ -489,6 +497,19 @@ // fully centered (at the end of the invoke animation). base::OneShotTimer dismiss_screenshot_timer_; + // Counter for different combinations of reason and position of ignored + // inputs. + struct IgnoredReasonCategoryAndCount { + int animation_invoked_on_source = 0; + int animation_invoked_on_destination = 0; + int animation_canceled_on_source = 0; + int animation_canceled_on_destination = 0; + }; + IgnoredReasonCategoryAndCount ignored_inputs_count_; + + IgnoringInputReason ignoring_input_reason_ = + IgnoringInputReason::kNoOccurrence; + base::WeakPtrFactory<BackForwardTransitionAnimator> weak_ptr_factory_{this}; };
diff --git a/content/browser/preloading/prerender/prerender_host.cc b/content/browser/preloading/prerender/prerender_host.cc index e518fbbc0..a6b3a4d 100644 --- a/content/browser/preloading/prerender/prerender_host.cc +++ b/content/browser/preloading/prerender/prerender_host.cc
@@ -339,13 +339,13 @@ return nullptr; } -int PrerenderHost::GetOuterDelegateFrameTreeNodeId() { +FrameTreeNodeId PrerenderHost::GetOuterDelegateFrameTreeNodeId() { // A prerendered FrameTree is not "inner to" or "nested inside" another // FrameTree; it exists in parallel to the primary FrameTree of the current // WebContents. Therefore, it must not attempt to access the primary // FrameTree in the sense of an "outer delegate" relationship, so we return // the invalid ID here. - return FrameTreeNode::kFrameTreeNodeInvalidId; + return FrameTreeNodeId(); } RenderFrameHostImpl* PrerenderHost::GetProspectiveOuterDocument() {
diff --git a/content/browser/preloading/prerender/prerender_host.h b/content/browser/preloading/prerender/prerender_host.h index 55f41e64..527ef1e 100644 --- a/content/browser/preloading/prerender/prerender_host.h +++ b/content/browser/preloading/prerender/prerender_host.h
@@ -200,7 +200,7 @@ void DidStopLoading() override; bool IsHidden() override; FrameTree* LoadingTree() override; - int GetOuterDelegateFrameTreeNodeId() override; + FrameTreeNodeId GetOuterDelegateFrameTreeNodeId() override; RenderFrameHostImpl* GetProspectiveOuterDocument() override; void SetFocusedFrame(FrameTreeNode* node, SiteInstanceGroup* source) override; FrameTree* GetOwnedPictureInPictureFrameTree() override;
diff --git a/content/browser/private_aggregation/private_aggregation_budget_key.cc b/content/browser/private_aggregation/private_aggregation_budget_key.cc index 8d04fdc..2c7fa43 100644 --- a/content/browser/private_aggregation/private_aggregation_budget_key.cc +++ b/content/browser/private_aggregation/private_aggregation_budget_key.cc
@@ -8,6 +8,7 @@ #include "base/check.h" #include "base/time/time.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "services/network/public/cpp/is_potentially_trustworthy.h" #include "url/origin.h" @@ -29,7 +30,7 @@ PrivateAggregationBudgetKey::PrivateAggregationBudgetKey( url::Origin origin, base::Time api_invocation_time, - Api api) + PrivateAggregationCallerApi api) : origin_(std::move(origin)), time_window_(api_invocation_time), api_(api) { CHECK(network::IsOriginPotentiallyTrustworthy(origin_)); } @@ -37,7 +38,7 @@ std::optional<PrivateAggregationBudgetKey> PrivateAggregationBudgetKey::Create( url::Origin origin, base::Time api_invocation_time, - Api api) { + PrivateAggregationCallerApi api) { if (!network::IsOriginPotentiallyTrustworthy(origin)) { return std::nullopt; } @@ -49,7 +50,7 @@ PrivateAggregationBudgetKey PrivateAggregationBudgetKey::CreateForTesting( url::Origin origin, base::Time api_invocation_time, - Api api) { + PrivateAggregationCallerApi api) { return PrivateAggregationBudgetKey(std::move(origin), api_invocation_time, api); }
diff --git a/content/browser/private_aggregation/private_aggregation_budget_key.h b/content/browser/private_aggregation/private_aggregation_budget_key.h index ab99a76..23b9965 100644 --- a/content/browser/private_aggregation/private_aggregation_budget_key.h +++ b/content/browser/private_aggregation/private_aggregation_budget_key.h
@@ -8,6 +8,7 @@ #include <optional> #include "base/time/time.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/common/content_export.h" #include "url/origin.h" @@ -23,12 +24,6 @@ // `PrivateAggregationBudgeter::kLargerScopeValues.budget_scope_duration`. class CONTENT_EXPORT PrivateAggregationBudgetKey { public: - // TODO(crbug.com/362431899): Lift `Api` out of `PrivateAggregationBudgetKey`. - enum class Api { kProtectedAudience, kSharedStorage }; - - static constexpr Api kAllApis[] = {Api::kProtectedAudience, - Api::kSharedStorage}; - // Represents the smallest period of time for which budget usage is recorded. // This interval includes the `start_time()` instant, but excludes the end // time (`start_time() + kDuration`) instant. (But note the @@ -66,27 +61,31 @@ default; // Returns `std::nullopt` if `origin` is not potentially trustworthy. - static std::optional<PrivateAggregationBudgetKey> - Create(url::Origin origin, base::Time api_invocation_time, Api api); + static std::optional<PrivateAggregationBudgetKey> Create( + url::Origin origin, + base::Time api_invocation_time, + PrivateAggregationCallerApi api); // Skips validity checks - static PrivateAggregationBudgetKey - CreateForTesting(url::Origin origin, base::Time api_invocation_time, Api api); + static PrivateAggregationBudgetKey CreateForTesting( + url::Origin origin, + base::Time api_invocation_time, + PrivateAggregationCallerApi api); const url::Origin& origin() const { return origin_; } TimeWindow time_window() const { return time_window_; } - Api api() const { return api_; } + PrivateAggregationCallerApi api() const { return api_; } private: PrivateAggregationBudgetKey(url::Origin origin, base::Time api_invocation_time, - Api api); + PrivateAggregationCallerApi api); // `origin_` must be potentially trustworthy. Even though the budget is scoped // per-site, we store the origin to support deleting the data by origin later. url::Origin origin_; TimeWindow time_window_; - Api api_; + PrivateAggregationCallerApi api_; // When adding new members, the corresponding `operator==()` definition in // `private_aggregation_test_utils.h` should also be updated.
diff --git a/content/browser/private_aggregation/private_aggregation_budget_key_unittest.cc b/content/browser/private_aggregation/private_aggregation_budget_key_unittest.cc index 89d9cd5..9f0612d 100644 --- a/content/browser/private_aggregation/private_aggregation_budget_key_unittest.cc +++ b/content/browser/private_aggregation/private_aggregation_budget_key_unittest.cc
@@ -7,6 +7,7 @@ #include <optional> #include "base/time/time.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" #include "url/origin.h" @@ -33,24 +34,24 @@ std::optional<PrivateAggregationBudgetKey> protected_audience_key = PrivateAggregationBudgetKey::Create( example_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); ASSERT_TRUE(protected_audience_key.has_value()); EXPECT_EQ(protected_audience_key->origin(), example_origin); EXPECT_EQ(protected_audience_key->time_window().start_time(), kExampleMinuteBoundary); EXPECT_EQ(protected_audience_key->api(), - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); std::optional<PrivateAggregationBudgetKey> shared_storage_key = PrivateAggregationBudgetKey::Create( example_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); ASSERT_TRUE(shared_storage_key.has_value()); EXPECT_EQ(shared_storage_key->origin(), example_origin); EXPECT_EQ(shared_storage_key->time_window().start_time(), kExampleMinuteBoundary); EXPECT_EQ(shared_storage_key->api(), - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); } TEST(PrivateAggregationBudgetKeyTest, StartTimes_FlooredToTheMinute) { @@ -60,14 +61,14 @@ std::optional<PrivateAggregationBudgetKey> example_key = PrivateAggregationBudgetKey::Create( example_origin, /*api_invocation_time=*/kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); ASSERT_TRUE(example_key.has_value()); EXPECT_EQ(example_key->time_window().start_time(), kExampleMinuteBoundary); std::optional<PrivateAggregationBudgetKey> on_the_minute = PrivateAggregationBudgetKey::Create( example_origin, /*api_invocation_time=*/kExampleMinuteBoundary, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); ASSERT_TRUE(on_the_minute.has_value()); EXPECT_EQ(on_the_minute->time_window().start_time(), kExampleMinuteBoundary); @@ -76,7 +77,7 @@ example_origin, /*api_invocation_time=*/kExampleMinuteBoundary + base::Microseconds(1), - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); ASSERT_TRUE(just_after_the_minute.has_value()); EXPECT_EQ(just_after_the_minute->time_window().start_time(), kExampleMinuteBoundary); @@ -86,7 +87,7 @@ example_origin, /*api_invocation_time=*/kExampleMinuteBoundary - base::Microseconds(1), - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); ASSERT_TRUE(just_before_the_minute.has_value()); EXPECT_EQ(just_before_the_minute->time_window().start_time(), kExampleMinuteBoundary - base::Minutes(1)); @@ -132,13 +133,13 @@ std::optional<PrivateAggregationBudgetKey> opaque_origin_budget_key = PrivateAggregationBudgetKey::Create( url::Origin(), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); EXPECT_FALSE(opaque_origin_budget_key.has_value()); std::optional<PrivateAggregationBudgetKey> insecure_origin_budget_key = PrivateAggregationBudgetKey::Create( url::Origin::Create(GURL("http://origin.example")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); EXPECT_FALSE(insecure_origin_budget_key.has_value()); }
diff --git a/content/browser/private_aggregation/private_aggregation_budgeter.cc b/content/browser/private_aggregation/private_aggregation_budgeter.cc index 08ae786..e1666eea 100644 --- a/content/browser/private_aggregation/private_aggregation_budgeter.cc +++ b/content/browser/private_aggregation/private_aggregation_budgeter.cc
@@ -28,6 +28,7 @@ #include "base/time/time.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budget_storage.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/proto/private_aggregation_budgets.pb.h" #include "content/public/browser/private_aggregation_data_model.h" #include "net/base/schemeful_site.h" @@ -43,6 +44,10 @@ using ValidityStatus = PrivateAggregationBudgeter::BudgetValidityStatus; +static constexpr PrivateAggregationCallerApi kAllApis[] = { + PrivateAggregationCallerApi::kProtectedAudience, + PrivateAggregationCallerApi::kSharedStorage}; + int64_t SerializeTimeForStorage(base::Time time) { return time.ToDeltaSinceWindowsEpoch().InMicroseconds(); } @@ -127,12 +132,12 @@ } google::protobuf::RepeatedPtrField<proto::PrivateAggregationBudgetEntry>* -GetBudgetEntries(PrivateAggregationBudgetKey::Api api, +GetBudgetEntries(PrivateAggregationCallerApi api, proto::PrivateAggregationBudgets& budgets) { switch (api) { - case PrivateAggregationBudgetKey::Api::kProtectedAudience: + case PrivateAggregationCallerApi::kProtectedAudience: return budgets.mutable_protected_audience_budgets(); - case PrivateAggregationBudgetKey::Api::kSharedStorage: + case PrivateAggregationCallerApi::kSharedStorage: return budgets.mutable_shared_storage_budgets(); } } @@ -621,8 +626,7 @@ proto::PrivateAggregationBudgets budgets; storage_->budgets_data()->TryGetData(site_key, &budgets); - for (PrivateAggregationBudgetKey::Api api : - PrivateAggregationBudgetKey::kAllApis) { + for (PrivateAggregationCallerApi api : kAllApis) { google::protobuf::RepeatedPtrField<proto::PrivateAggregationBudgetEntry>* budget_entries = GetBudgetEntries(api, budgets); CHECK(budget_entries); @@ -715,8 +719,7 @@ bool was_modified = false; - for (PrivateAggregationBudgetKey::Api api : - PrivateAggregationBudgetKey::kAllApis) { + for (PrivateAggregationCallerApi api : kAllApis) { google::protobuf::RepeatedPtrField<proto::PrivateAggregationBudgetEntry>* budget_entries = GetBudgetEntries(api, budgets); CHECK(budget_entries);
diff --git a/content/browser/private_aggregation/private_aggregation_budgeter_unittest.cc b/content/browser/private_aggregation/private_aggregation_budgeter_unittest.cc index 2165ed5..b3a32643 100644 --- a/content/browser/private_aggregation/private_aggregation_budgeter_unittest.cc +++ b/content/browser/private_aggregation/private_aggregation_budgeter_unittest.cc
@@ -32,6 +32,7 @@ #include "base/time/time.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budget_storage.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/proto/private_aggregation_budgets.pb.h" #include "content/browser/storage_partition_impl.h" #include "content/public/browser/private_aggregation_data_model.h" @@ -89,8 +90,7 @@ google::protobuf::RepeatedPtrField<proto::PrivateAggregationBudgetEntry>* budget_entries = - budget_key.api() == - PrivateAggregationBudgetKey::Api::kProtectedAudience + budget_key.api() == PrivateAggregationCallerApi::kProtectedAudience ? budgets.mutable_protected_audience_budgets() : budgets.mutable_shared_storage_budgets(); @@ -208,7 +208,7 @@ return PrivateAggregationBudgetKey::CreateForTesting( /*origin=*/url::Origin::Create(GURL("https://a.example/")), /*api_invocation_time=*/kExampleTime, - /*api=*/PrivateAggregationBudgetKey::Api::kProtectedAudience); + /*api=*/PrivateAggregationCallerApi::kProtectedAudience); } base::FilePath db_path() const { @@ -277,7 +277,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( PrivateAggregationBudgeter::kSmallerScopeValues.max_budget_per_scope, example_key, @@ -314,7 +314,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( PrivateAggregationBudgeter::kSmallerScopeValues.max_budget_per_scope, example_key, @@ -350,7 +350,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); // Budget can be increased to below max budgeter()->ConsumeBudget( @@ -402,7 +402,7 @@ example_keys.push_back(PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example")), reference_time + i * base::Minutes(1), - PrivateAggregationBudgetKey::Api::kProtectedAudience)); + PrivateAggregationCallerApi::kProtectedAudience)); } // Consuming this budget 10 times in 10 min would not exceed the daily budget, @@ -465,7 +465,7 @@ example_keys.push_back(PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example")), reference_time + i * base::Minutes(1), - PrivateAggregationBudgetKey::Api::kProtectedAudience)); + PrivateAggregationCallerApi::kProtectedAudience)); } // Consuming this budget 1440 times in a day would not exceed the daily @@ -527,12 +527,12 @@ PrivateAggregationBudgetKey protected_audience_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey shared_storage_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); budgeter()->ConsumeBudget( PrivateAggregationBudgeter::kSmallerScopeValues.max_budget_per_scope, @@ -566,12 +566,12 @@ PrivateAggregationBudgetKey key_a = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey key_b = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://b.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( PrivateAggregationBudgeter::kSmallerScopeValues.max_budget_per_scope, @@ -603,12 +603,12 @@ PrivateAggregationBudgetKey key_a = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.domain.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey key_b = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://b.domain.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( PrivateAggregationBudgeter::kSmallerScopeValues.max_budget_per_scope, @@ -638,7 +638,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); base::RunLoop run_loop; @@ -882,7 +882,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); // Queries should be processed in the order they are received. int num_queries_processed = 0; @@ -959,7 +959,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); // Queries should be processed in the order they are received. int num_queries_processed = 0; @@ -1008,7 +1008,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); int num_queries_succeeded = 0; @@ -1057,7 +1057,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); int num_consume_queries_succeeded = 0; @@ -1131,7 +1131,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( /*budget=*/PrivateAggregationBudgeter::kSmallerScopeValues @@ -1182,13 +1182,13 @@ PrivateAggregationBudgetKey example_key_1 = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey example_key_2 = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime + PrivateAggregationBudgetKey::TimeWindow::kDuration, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); EXPECT_NE(example_key_1.time_window().start_time(), example_key_2.time_window().start_time()); @@ -1255,19 +1255,19 @@ PrivateAggregationBudgetKey key_to_clear = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey key_after = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime + PrivateAggregationBudgetKey::TimeWindow::kDuration, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey key_before = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime - PrivateAggregationBudgetKey::TimeWindow::kDuration, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); EXPECT_LT(key_to_clear.time_window().start_time(), key_after.time_window().start_time()); @@ -1342,12 +1342,12 @@ PrivateAggregationBudgetKey protected_audience_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey shared_storage_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); base::RepeatingCallback<void(RequestResult)> expect_approved = base::BindLambdaForTesting( @@ -1415,7 +1415,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( /*budget=*/PrivateAggregationBudgeter::kSmallerScopeValues @@ -1466,7 +1466,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( /*budget=*/PrivateAggregationBudgeter::kSmallerScopeValues @@ -1517,7 +1517,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( /*budget=*/PrivateAggregationBudgeter::kSmallerScopeValues @@ -1571,12 +1571,12 @@ PrivateAggregationBudgetKey example_key_a = PrivateAggregationBudgetKey::CreateForTesting( kOriginA, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey example_key_b = PrivateAggregationBudgetKey::CreateForTesting( kOriginB, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); base::RepeatingCallback<void(RequestResult)> expect_approved = base::BindLambdaForTesting( @@ -1646,12 +1646,12 @@ PrivateAggregationBudgetKey example_key_a = PrivateAggregationBudgetKey::CreateForTesting( kOriginA, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey example_key_b = PrivateAggregationBudgetKey::CreateForTesting( kOriginB, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); base::RepeatingCallback<void(RequestResult)> expect_approved = base::BindLambdaForTesting( @@ -1725,12 +1725,12 @@ PrivateAggregationBudgetKey example_key_a = PrivateAggregationBudgetKey::CreateForTesting( kOriginA, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey example_key_b = PrivateAggregationBudgetKey::CreateForTesting( kOriginB, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); base::RepeatingCallback<void(RequestResult)> expect_approved = base::BindLambdaForTesting( @@ -1797,12 +1797,12 @@ PrivateAggregationBudgetKey example_key_a = PrivateAggregationBudgetKey::CreateForTesting( kOriginA, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey example_key_b = PrivateAggregationBudgetKey::CreateForTesting( kOriginB, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); base::RepeatingCallback<void(RequestResult)> expect_approved = base::BindLambdaForTesting( @@ -1876,12 +1876,12 @@ PrivateAggregationBudgetKey example_key_a = PrivateAggregationBudgetKey::CreateForTesting( kOriginA, kExampleTime - base::Minutes(5), - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey example_key_b = PrivateAggregationBudgetKey::CreateForTesting( kOriginB, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); base::RepeatingCallback<void(RequestResult)> expect_approved = base::BindLambdaForTesting( @@ -1940,7 +1940,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::CreateForTesting( url::Origin::Create(GURL("https://a.example/")), kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); budgeter()->ConsumeBudget( /*budget=*/PrivateAggregationBudgeter::kSmallerScopeValues @@ -1977,12 +1977,12 @@ PrivateAggregationBudgetKey example_key_a = PrivateAggregationBudgetKey::CreateForTesting( kOriginA, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); PrivateAggregationBudgetKey example_key_b = PrivateAggregationBudgetKey::CreateForTesting( kOriginB, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience); + PrivateAggregationCallerApi::kProtectedAudience); base::RepeatingCallback<void(RequestResult)> expect_approved = base::BindLambdaForTesting( @@ -2091,7 +2091,7 @@ PrivateAggregationBudgetKey::CreateForTesting( /*origin=*/url::Origin::Create(GURL("https://b.example/")), /*api_invocation_time=*/kExampleTime, - /*api=*/PrivateAggregationBudgetKey::Api::kProtectedAudience); + /*api=*/PrivateAggregationCallerApi::kProtectedAudience); base::RunLoop run_loop; budgeter()->ConsumeBudget( /*budget=*/1, non_stale_key,
diff --git a/content/browser/private_aggregation/private_aggregation_caller_api.h b/content/browser/private_aggregation/private_aggregation_caller_api.h new file mode 100644 index 0000000..ca5b553 --- /dev/null +++ b/content/browser/private_aggregation/private_aggregation_caller_api.h
@@ -0,0 +1,14 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_PRIVATE_AGGREGATION_PRIVATE_AGGREGATION_CALLER_API_H_ +#define CONTENT_BROWSER_PRIVATE_AGGREGATION_PRIVATE_AGGREGATION_CALLER_API_H_ + +namespace content { + +enum class PrivateAggregationCallerApi { kProtectedAudience, kSharedStorage }; + +} + +#endif // CONTENT_BROWSER_PRIVATE_AGGREGATION_PRIVATE_AGGREGATION_CALLER_API_H_
diff --git a/content/browser/private_aggregation/private_aggregation_host.cc b/content/browser/private_aggregation/private_aggregation_host.cc index 02eb443f..70ea4e1 100644 --- a/content/browser/private_aggregation/private_aggregation_host.cc +++ b/content/browser/private_aggregation/private_aggregation_host.cc
@@ -41,6 +41,7 @@ #include "content/browser/aggregation_service/aggregation_service_features.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budgeter.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_features.h" #include "content/browser/private_aggregation/private_aggregation_utils.h" #include "content/public/browser/content_browser_client.h" @@ -100,7 +101,7 @@ // unique bucket and filtering ID pairs) that passed through the mojo pipe. void RecordNumberOfContributionMergeKeysHistogram( size_t num_merge_keys_sent_or_truncated, - PrivateAggregationBudgetKey::Api api, + PrivateAggregationCallerApi api, bool has_timeout) { CHECK( base::FeatureList::IsEnabled(kPrivateAggregationApiContributionMerging)); @@ -110,12 +111,12 @@ base::UmaHistogramCounts10000(kMergeKeysHistogramBase, num_merge_keys_sent_or_truncated); switch (api) { - case PrivateAggregationBudgetKey::Api::kProtectedAudience: + case PrivateAggregationCallerApi::kProtectedAudience: base::UmaHistogramCounts10000( base::StrCat({kMergeKeysHistogramBase, ".ProtectedAudience"}), num_merge_keys_sent_or_truncated); break; - case PrivateAggregationBudgetKey::Api::kSharedStorage: + case PrivateAggregationCallerApi::kSharedStorage: base::UmaHistogramCounts10000( base::StrCat({kMergeKeysHistogramBase, ".SharedStorage"}), num_merge_keys_sent_or_truncated); @@ -148,7 +149,7 @@ struct PrivateAggregationHost::ReceiverContext { url::Origin worklet_origin; url::Origin top_frame_origin; - PrivateAggregationBudgetKey::Api api_for_budgeting; + PrivateAggregationCallerApi api_for_budgeting; std::optional<std::string> context_id; std::optional<url::Origin> aggregation_coordinator_origin; size_t filtering_id_max_bytes; @@ -227,7 +228,7 @@ // static size_t PrivateAggregationHost::GetMaxNumContributions( - PrivateAggregationBudgetKey::Api api) { + PrivateAggregationCallerApi api) { // These constants define the maximum number of contributions that can go in // an `AggregatableReport` after merging. static constexpr size_t kMaxNumContributionsSharedStorage = 20; @@ -235,9 +236,9 @@ static constexpr size_t kMaxNumContributionsProtectedAudienceIncreased = 100; switch (api) { - case PrivateAggregationBudgetKey::Api::kSharedStorage: + case PrivateAggregationCallerApi::kSharedStorage: return kMaxNumContributionsSharedStorage; - case PrivateAggregationBudgetKey::Api::kProtectedAudience: + case PrivateAggregationCallerApi::kProtectedAudience: return base::FeatureList::IsEnabled( kPrivateAggregationApi100ContributionsForProtectedAudience) ? kMaxNumContributionsProtectedAudienceIncreased @@ -249,7 +250,7 @@ bool PrivateAggregationHost::BindNewReceiver( url::Origin worklet_origin, url::Origin top_frame_origin, - PrivateAggregationBudgetKey::Api api, + PrivateAggregationCallerApi api, std::optional<std::string> context_id, std::optional<base::TimeDelta> timeout, std::optional<url::Origin> aggregation_coordinator_origin, @@ -470,7 +471,7 @@ AggregatableReportRequest::DelayType delay_type, base::Uuid report_id, const url::Origin& reporting_origin, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, std::optional<std::string> context_id, std::optional<url::Origin> aggregation_coordinator_origin, size_t specified_filtering_id_max_bytes,
diff --git a/content/browser/private_aggregation/private_aggregation_host.h b/content/browser/private_aggregation/private_aggregation_host.h index 57236d52..220d884 100644 --- a/content/browser/private_aggregation/private_aggregation_host.h +++ b/content/browser/private_aggregation/private_aggregation_host.h
@@ -18,6 +18,7 @@ #include "content/browser/aggregation_service/aggregatable_report.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budgeter.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h" @@ -105,7 +106,7 @@ // Returns the maximum number of contributions that can go in an // `AggregatableReport` after merging. Marked public for testing; this enables // golden report unittests to match the browser's actual behavior. - static size_t GetMaxNumContributions(PrivateAggregationBudgetKey::Api api); + static size_t GetMaxNumContributions(PrivateAggregationCallerApi api); // `on_report_request_details_received` and `browser_context` must be // non-null. @@ -135,7 +136,7 @@ [[nodiscard]] virtual bool BindNewReceiver( url::Origin worklet_origin, url::Origin top_frame_origin, - PrivateAggregationBudgetKey::Api api, + PrivateAggregationCallerApi api, std::optional<std::string> context_id, std::optional<base::TimeDelta> timeout, std::optional<url::Origin> aggregation_coordinator_origin, @@ -166,7 +167,7 @@ AggregatableReportRequest::DelayType delay_type, base::Uuid report_id, const url::Origin& reporting_origin, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, std::optional<std::string> context_id, std::optional<url::Origin> aggregation_coordinator_origin, size_t specified_filtering_id_max_bytes,
diff --git a/content/browser/private_aggregation/private_aggregation_host_unittest.cc b/content/browser/private_aggregation/private_aggregation_host_unittest.cc index 9fa0793..87d01c6c 100644 --- a/content/browser/private_aggregation/private_aggregation_host_unittest.cc +++ b/content/browser/private_aggregation/private_aggregation_host_unittest.cc
@@ -34,6 +34,7 @@ #include "content/browser/aggregation_service/aggregation_service_test_utils.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budgeter.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_features.h" #include "content/browser/private_aggregation/private_aggregation_test_utils.h" #include "content/public/common/content_switches.h" @@ -87,7 +88,7 @@ void ExpectNumberOfContributionMergeKeysHistogram( const base::HistogramTester& tester, size_t value, - PrivateAggregationBudgetKey::Api api, + PrivateAggregationCallerApi api, bool is_reduced_delay) { constexpr std::string_view kBaseHistogram = "PrivacySandbox.PrivateAggregation.Host.NumContributionMergeKeysInPipe"; @@ -97,14 +98,14 @@ tester.ExpectUniqueSample( base::StrCat({kBaseHistogram, ".ProtectedAudience"}), value, /*expected_bucket_count=*/ - (api == PrivateAggregationBudgetKey::Api::kProtectedAudience) ? 1 : 0); + (api == PrivateAggregationCallerApi::kProtectedAudience) ? 1 : 0); tester.ExpectUniqueSample( base::StrCat({kBaseHistogram, ".SharedStorage"}), value, /*expected_bucket_count=*/ - (api == PrivateAggregationBudgetKey::Api::kSharedStorage) ? 1 : 0); + (api == PrivateAggregationCallerApi::kSharedStorage) ? 1 : 0); if (is_reduced_delay) { - CHECK_EQ(api, PrivateAggregationBudgetKey::Api::kSharedStorage); + CHECK_EQ(api, PrivateAggregationCallerApi::kSharedStorage); } tester.ExpectUniqueSample( @@ -113,8 +114,7 @@ tester.ExpectUniqueSample( base::StrCat({kBaseHistogram, ".SharedStorage.FullDelay"}), value, /*expected_bucket_count=*/ - (api == PrivateAggregationBudgetKey::Api::kSharedStorage && - !is_reduced_delay) + (api == PrivateAggregationCallerApi::kSharedStorage && !is_reduced_delay) ? 1 : 0); } @@ -161,19 +161,18 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remote.BindNewPipeAndPassReceiver())); std::optional<AggregatableReportRequest> validated_request; - EXPECT_CALL( - mock_callback_, - Run(_, _, - Property(&PrivateAggregationBudgetKey::api, - PrivateAggregationBudgetKey::Api::kProtectedAudience), - BudgetDeniedBehavior::kDontSendReport)) + EXPECT_CALL(mock_callback_, + Run(_, _, + Property(&PrivateAggregationBudgetKey::api, + PrivateAggregationCallerApi::kProtectedAudience), + BudgetDeniedBehavior::kDontSendReport)) .WillOnce(GenerateAndSaveReportRequest(&validated_request)); std::vector<blink::mojom::AggregatableReportHistogramContributionPtr> @@ -248,9 +247,9 @@ const url::Origin kMainFrameOrigin = url::Origin::Create(GURL("https://main_frame.com")); - const auto apis = std::to_array<const PrivateAggregationBudgetKey::Api>({ - PrivateAggregationBudgetKey::Api::kProtectedAudience, - PrivateAggregationBudgetKey::Api::kSharedStorage, + const auto apis = std::to_array<const PrivateAggregationCallerApi>({ + PrivateAggregationCallerApi::kProtectedAudience, + PrivateAggregationCallerApi::kSharedStorage, }); std::vector<mojo::Remote<blink::mojom::PrivateAggregationHost>> remotes{ @@ -329,7 +328,7 @@ for (int i = 0; i < 3; ++i) { EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -386,40 +385,39 @@ EXPECT_TRUE(host_->BindNewReceiver( kExampleOriginA, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remotes[0].BindNewPipeAndPassReceiver())); EXPECT_TRUE(host_->BindNewReceiver( kExampleOriginB, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remotes[1].BindNewPipeAndPassReceiver())); EXPECT_TRUE(host_->BindNewReceiver( kExampleOriginA, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remotes[2].BindNewPipeAndPassReceiver())); EXPECT_TRUE(host_->BindNewReceiver( kExampleOriginB, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remotes[3].BindNewPipeAndPassReceiver())); // Use the bucket as a sentinel to ensure that calls were routed correctly. - EXPECT_CALL( - mock_callback_, - Run(_, _, - Property(&PrivateAggregationBudgetKey::api, - PrivateAggregationBudgetKey::Api::kProtectedAudience), - BudgetDeniedBehavior::kDontSendReport)) + EXPECT_CALL(mock_callback_, + Run(_, _, + Property(&PrivateAggregationBudgetKey::api, + PrivateAggregationCallerApi::kProtectedAudience), + BudgetDeniedBehavior::kDontSendReport)) .WillOnce(Invoke( [&kExampleOriginB]( PrivateAggregationHost::ReportRequestGenerator generator, @@ -438,7 +436,7 @@ EXPECT_CALL(mock_callback_, Run(_, _, Property(&PrivateAggregationBudgetKey::api, - PrivateAggregationBudgetKey::Api::kSharedStorage), + PrivateAggregationCallerApi::kSharedStorage), BudgetDeniedBehavior::kDontSendReport)) .WillOnce(Invoke( [&kExampleOriginA]( @@ -499,7 +497,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote_1; EXPECT_FALSE(host_->BindNewReceiver( kInsecureOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -508,7 +506,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote_2; EXPECT_FALSE(host_->BindNewReceiver( kOpaqueOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -547,7 +545,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_FALSE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, kTooLongContextId, + PrivateAggregationCallerApi::kProtectedAudience, kTooLongContextId, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -580,7 +578,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_FALSE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, @@ -597,7 +595,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/"example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, @@ -621,7 +619,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, @@ -653,7 +651,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -671,7 +669,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -696,35 +694,35 @@ constexpr struct { std::string_view label; bool should_enable_per_calling_api_sizing; - PrivateAggregationBudgetKey::Api caller_api; + PrivateAggregationCallerApi caller_api; size_t expected_num_contributions; } kMaxNumContributionsTestCases[]{ { "Shared Storage gets legacy number of contributions when " "per-caller-API report sizing is disabled", /*should_enable_per_calling_api_sizing=*/false, - /*caller_api=*/PrivateAggregationBudgetKey::Api::kSharedStorage, + /*caller_api=*/PrivateAggregationCallerApi::kSharedStorage, /*expected_num_contributions=*/20, }, { "Protected Audience gets legacy number of contributions when " "per-caller-API report sizing is disabled", /*should_enable_per_calling_api_sizing=*/false, - /*caller_api=*/PrivateAggregationBudgetKey::Api::kProtectedAudience, + /*caller_api=*/PrivateAggregationCallerApi::kProtectedAudience, /*expected_num_contributions=*/20, }, { "Shared Storage is unaffected when per-caller-API report sizing is " "enabled", /*should_enable_per_calling_api_sizing=*/true, - /*caller_api=*/PrivateAggregationBudgetKey::Api::kSharedStorage, + /*caller_api=*/PrivateAggregationCallerApi::kSharedStorage, /*expected_num_contributions=*/20, }, { "Protected Audience gets more contributions when per-caller-API " "report sizing is enabled", /*should_enable_per_calling_api_sizing=*/true, - /*caller_api=*/PrivateAggregationBudgetKey::Api::kProtectedAudience, + /*caller_api=*/PrivateAggregationCallerApi::kProtectedAudience, /*expected_num_contributions=*/100, }}; @@ -866,7 +864,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -920,7 +918,7 @@ /*bucket=*/124, /*value=*/1, /*filtering_id=*/std::nullopt)))); ExpectNumberOfContributionMergeKeysHistogram( - histogram, 3, PrivateAggregationBudgetKey::Api::kProtectedAudience, + histogram, 3, PrivateAggregationCallerApi::kProtectedAudience, /*is_reduced_delay=*/false); } @@ -939,7 +937,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -1196,35 +1194,35 @@ const struct { const std::string_view description; - PrivateAggregationBudgetKey::Api api; + PrivateAggregationCallerApi api; std::optional<std::string> context_id; size_t filtering_id_max_bytes; std::optional<base::TimeDelta> timeout; } kTestCases[] = { { "Protected Audience", - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, /*timeout=*/std::nullopt, }, { "Shared Storage full delay", - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, /*context_id=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, /*timeout=*/std::nullopt, }, { "Shared Storage reduced delay due to context ID", - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, /*context_id=*/"example_context_id", PrivateAggregationHost::kDefaultFilteringIdMaxBytes, /*timeout=*/base::Seconds(5), }, { "Shared Storage reduced delay due to filtering ID max bytes", - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, /*context_id=*/std::nullopt, /*filtering_id_max_bytes=*/3, /*timeout=*/base::Seconds(5), @@ -1276,7 +1274,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -1318,7 +1316,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -1356,8 +1354,8 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, - "example_context_id", /*timeout=*/std::nullopt, + PrivateAggregationCallerApi::kProtectedAudience, "example_context_id", + /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remote.BindNewPipeAndPassReceiver())); @@ -1427,8 +1425,8 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, - "example_context_id", /*timeout=*/std::nullopt, + PrivateAggregationCallerApi::kProtectedAudience, "example_context_id", + /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remote.BindNewPipeAndPassReceiver())); @@ -1472,7 +1470,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -1487,7 +1485,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -1550,7 +1548,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; bool bind_result = host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, test_case.aggregation_coordinator_origin, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -1632,7 +1630,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; bool bind_result = host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/test_case.filtering_id_max_bytes, @@ -1719,7 +1717,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; bool bind_result = host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/test_case.filtering_id_max_bytes, @@ -1816,7 +1814,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; bool bind_result = host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/test_case.filtering_id_max_bytes, @@ -1882,7 +1880,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; bool bind_result = host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/test_case.filtering_id_max_bytes, @@ -1991,19 +1989,18 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remote.BindNewPipeAndPassReceiver())); std::optional<AggregatableReportRequest> validated_request; - EXPECT_CALL( - mock_callback_, - Run(_, _, - Property(&PrivateAggregationBudgetKey::api, - PrivateAggregationBudgetKey::Api::kProtectedAudience), - BudgetDeniedBehavior::kDontSendReport)) + EXPECT_CALL(mock_callback_, + Run(_, _, + Property(&PrivateAggregationBudgetKey::api, + PrivateAggregationCallerApi::kProtectedAudience), + BudgetDeniedBehavior::kDontSendReport)) .WillOnce(GenerateAndSaveReportRequest(&validated_request)); std::vector<blink::mojom::AggregatableReportHistogramContributionPtr> @@ -2056,7 +2053,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2084,7 +2081,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2144,7 +2141,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2221,7 +2218,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2306,7 +2303,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2357,7 +2354,7 @@ EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2365,7 +2362,7 @@ EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Seconds(61), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2442,7 +2439,7 @@ EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2450,7 +2447,7 @@ EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Seconds(61), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2511,7 +2508,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2544,7 +2541,7 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2576,7 +2573,7 @@ EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2584,7 +2581,7 @@ EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Minutes(1), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, @@ -2624,19 +2621,18 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remote.BindNewPipeAndPassReceiver())); std::optional<AggregatableReportRequest> validated_request; - EXPECT_CALL( - mock_callback_, - Run(_, _, - Property(&PrivateAggregationBudgetKey::api, - PrivateAggregationBudgetKey::Api::kProtectedAudience), - BudgetDeniedBehavior::kDontSendReport)) + EXPECT_CALL(mock_callback_, + Run(_, _, + Property(&PrivateAggregationBudgetKey::api, + PrivateAggregationCallerApi::kProtectedAudience), + BudgetDeniedBehavior::kDontSendReport)) .WillOnce(GenerateAndSaveReportRequest(&validated_request)); std::vector<blink::mojom::AggregatableReportHistogramContributionPtr> @@ -2666,19 +2662,18 @@ mojo::Remote<blink::mojom::PrivateAggregationHost> remote; EXPECT_TRUE(host_->BindNewReceiver( kExampleOrigin, kMainFrameOrigin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/"example_context_id", /*timeout=*/base::Seconds(30), /*aggregation_coordinator_origin=*/std::nullopt, PrivateAggregationHost::kDefaultFilteringIdMaxBytes, remote.BindNewPipeAndPassReceiver())); std::optional<AggregatableReportRequest> validated_request; - EXPECT_CALL( - mock_callback_, - Run(_, _, - Property(&PrivateAggregationBudgetKey::api, - PrivateAggregationBudgetKey::Api::kProtectedAudience), - BudgetDeniedBehavior::kSendNullReport)) + EXPECT_CALL(mock_callback_, + Run(_, _, + Property(&PrivateAggregationBudgetKey::api, + PrivateAggregationCallerApi::kProtectedAudience), + BudgetDeniedBehavior::kSendNullReport)) .WillOnce(GenerateAndSaveReportRequest(&validated_request)); std::vector<blink::mojom::AggregatableReportHistogramContributionPtr>
diff --git a/content/browser/private_aggregation/private_aggregation_manager.h b/content/browser/private_aggregation/private_aggregation_manager.h index c29c78e5..f069c208 100644 --- a/content/browser/private_aggregation/private_aggregation_manager.h +++ b/content/browser/private_aggregation/private_aggregation_manager.h
@@ -12,7 +12,7 @@ #include "base/functional/callback_forward.h" #include "base/time/time.h" -#include "content/browser/private_aggregation/private_aggregation_budget_key.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/common/content_export.h" #include "content/public/browser/storage_partition.h" #include "mojo/public/cpp/bindings/pending_receiver.h" @@ -48,7 +48,7 @@ [[nodiscard]] virtual bool BindNewReceiver( url::Origin worklet_origin, url::Origin top_frame_origin, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, std::optional<std::string> context_id, std::optional<base::TimeDelta> timeout, std::optional<url::Origin> aggregation_coordinator_origin,
diff --git a/content/browser/private_aggregation/private_aggregation_manager_impl.cc b/content/browser/private_aggregation/private_aggregation_manager_impl.cc index d8d8d4b4..8fa7891 100644 --- a/content/browser/private_aggregation/private_aggregation_manager_impl.cc +++ b/content/browser/private_aggregation/private_aggregation_manager_impl.cc
@@ -32,6 +32,7 @@ #include "content/browser/aggregation_service/aggregation_service.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budgeter.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_features.h" #include "content/browser/private_aggregation/private_aggregation_host.h" #include "content/browser/private_aggregation/private_aggregation_utils.h" @@ -107,7 +108,7 @@ bool PrivateAggregationManagerImpl::BindNewReceiver( url::Origin worklet_origin, url::Origin top_frame_origin, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, std::optional<std::string> context_id, std::optional<base::TimeDelta> timeout, std::optional<url::Origin> aggregation_coordinator_origin, @@ -149,7 +150,7 @@ const blink::mojom::AggregatableReportHistogramContribution& contribution) { return running_sum + contribution.value; }); - PrivateAggregationBudgetKey::Api api_for_budgeting = budget_key.api(); + PrivateAggregationCallerApi api_for_budgeting = budget_key.api(); if (!budget_needed.IsValid()) { OnConsumeBudgetReturned(std::move(report_request_generator), @@ -194,7 +195,7 @@ PrivateAggregationHost::ReportRequestGenerator report_request_generator, std::vector<blink::mojom::AggregatableReportHistogramContribution> contributions, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, PrivateAggregationBudgeter::BudgetDeniedBehavior budget_denied_behavior, PrivateAggregationBudgeter::RequestResult request_result) { RecordBudgeterResultHistogram(request_result); @@ -225,7 +226,7 @@ PrivateAggregationHost::ReportRequestGenerator report_request_generator, std::vector<blink::mojom::AggregatableReportHistogramContribution> contributions, - PrivateAggregationBudgetKey::Api api_for_budgeting) { + PrivateAggregationCallerApi api_for_budgeting) { AggregationService* aggregation_service = GetAggregationService(); if (!aggregation_service) { return;
diff --git a/content/browser/private_aggregation/private_aggregation_manager_impl.h b/content/browser/private_aggregation/private_aggregation_manager_impl.h index 05caaa21..869394e 100644 --- a/content/browser/private_aggregation/private_aggregation_manager_impl.h +++ b/content/browser/private_aggregation/private_aggregation_manager_impl.h
@@ -17,6 +17,7 @@ #include "base/time/time.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budgeter.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_host.h" #include "content/browser/private_aggregation/private_aggregation_manager.h" #include "content/common/content_export.h" @@ -69,7 +70,7 @@ [[nodiscard]] bool BindNewReceiver( url::Origin worklet_origin, url::Origin top_frame_origin, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, std::optional<std::string> context_id, std::optional<base::TimeDelta> timeout, std::optional<url::Origin> aggregation_coordinator_origin, @@ -115,7 +116,7 @@ PrivateAggregationHost::ReportRequestGenerator report_request_generator, std::vector<blink::mojom::AggregatableReportHistogramContribution> contributions, - PrivateAggregationBudgetKey::Api api_for_budgeting, + PrivateAggregationCallerApi api_for_budgeting, PrivateAggregationBudgeter::BudgetDeniedBehavior budget_denied_behavior, PrivateAggregationBudgeter::RequestResult request_result); @@ -123,7 +124,7 @@ PrivateAggregationHost::ReportRequestGenerator report_request_generator, std::vector<blink::mojom::AggregatableReportHistogramContribution> contributions, - PrivateAggregationBudgetKey::Api api_for_budgeting); + PrivateAggregationCallerApi api_for_budgeting); virtual void OnBudgeterGetAllDataKeysReturned( base::OnceCallback<void(std::set<DataKey>)> callback,
diff --git a/content/browser/private_aggregation/private_aggregation_manager_impl_unittest.cc b/content/browser/private_aggregation/private_aggregation_manager_impl_unittest.cc index 93fba0a8..e7eab1c 100644 --- a/content/browser/private_aggregation/private_aggregation_manager_impl_unittest.cc +++ b/content/browser/private_aggregation/private_aggregation_manager_impl_unittest.cc
@@ -27,6 +27,7 @@ #include "content/browser/aggregation_service/aggregation_service_test_utils.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budgeter.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_features.h" #include "content/browser/private_aggregation/private_aggregation_host.h" #include "content/browser/private_aggregation/private_aggregation_test_utils.h" @@ -154,7 +155,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); AggregatableReportRequest expected_request = @@ -220,7 +221,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); AggregatableReportRequest example_request = @@ -296,7 +297,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); AggregatableReportRequest expected_request = @@ -353,7 +354,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); AggregatableReportRequest example_request = @@ -405,7 +406,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_request.shared_info().reporting_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); std::optional<AggregatableReportRequest> standard_request = @@ -476,7 +477,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_request.shared_info().reporting_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); std::optional<AggregatableReportRequest> standard_request = @@ -552,12 +553,12 @@ PrivateAggregationBudgetKey protected_audience_key = PrivateAggregationBudgetKey::Create( example_request.shared_info().reporting_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); PrivateAggregationBudgetKey shared_storage_key = PrivateAggregationBudgetKey::Create( example_request.shared_info().reporting_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kSharedStorage) + PrivateAggregationCallerApi::kSharedStorage) .value(); Checkpoint checkpoint; @@ -642,7 +643,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_request.shared_info().reporting_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); std::optional<AggregatableReportRequest> standard_request = @@ -695,7 +696,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_request.shared_info().reporting_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); AggregationServicePayloadContents null_payload = @@ -779,7 +780,7 @@ PrivateAggregationBudgetKey example_key = PrivateAggregationBudgetKey::Create( example_request.shared_info().reporting_origin, kExampleTime, - PrivateAggregationBudgetKey::Api::kProtectedAudience) + PrivateAggregationCallerApi::kProtectedAudience) .value(); AggregationServicePayloadContents null_payload = @@ -846,13 +847,13 @@ EXPECT_CALL(*host_, BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, testing::Eq(std::nullopt), testing::Eq(std::nullopt), testing::Eq(std::nullopt), 1, _)) .WillOnce(Return(true)); EXPECT_TRUE(manager_.BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/1, @@ -860,43 +861,43 @@ EXPECT_CALL(*host_, BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, testing::Eq(std::nullopt), testing::Eq(std::nullopt), testing::Eq(std::nullopt), 1, _)) .WillOnce(Return(false)); EXPECT_FALSE(manager_.BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/1, mojo::PendingReceiver<blink::mojom::PrivateAggregationHost>())); EXPECT_CALL(*host_, - BindNewReceiver( - example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, - testing::Eq("example_context_id"), testing::Eq(std::nullopt), - testing::Eq(std::nullopt), 1, _)) + BindNewReceiver(example_origin, example_main_frame_origin, + PrivateAggregationCallerApi::kProtectedAudience, + testing::Eq("example_context_id"), + testing::Eq(std::nullopt), + testing::Eq(std::nullopt), 1, _)) .WillOnce(Return(true)); EXPECT_TRUE(manager_.BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, - "example_context_id", /*timeout=*/std::nullopt, + PrivateAggregationCallerApi::kProtectedAudience, "example_context_id", + /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/1, mojo::PendingReceiver<blink::mojom::PrivateAggregationHost>())); EXPECT_CALL(*host_, BindNewReceiver(example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, testing::Eq("example_context_id"), testing::Eq(base::Seconds(5)), testing::Eq(std::nullopt), 1, _)) .WillOnce(Return(true)); EXPECT_TRUE(manager_.BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kSharedStorage, "example_context_id", + PrivateAggregationCallerApi::kSharedStorage, "example_context_id", /*timeout=*/base::Seconds(5), /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/1, @@ -904,26 +905,26 @@ EXPECT_CALL(*host_, BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, testing::Eq(std::nullopt), testing::Eq(std::nullopt), testing::Eq(example_coordinator_origin), 1, _)) .WillOnce(Return(true)); EXPECT_TRUE(manager_.BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, example_coordinator_origin, /*filtering_id_max_bytes=*/1, mojo::PendingReceiver<blink::mojom::PrivateAggregationHost>())); EXPECT_CALL(*host_, BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, testing::Eq(std::nullopt), testing::Eq(std::nullopt), testing::Eq(std::nullopt), 8, _)) .WillOnce(Return(true)); EXPECT_TRUE(manager_.BindNewReceiver( example_origin, example_main_frame_origin, - PrivateAggregationBudgetKey::Api::kProtectedAudience, + PrivateAggregationCallerApi::kProtectedAudience, /*context_id=*/std::nullopt, /*timeout=*/std::nullopt, /*aggregation_coordinator_origin=*/std::nullopt, /*filtering_id_max_bytes=*/8,
diff --git a/content/browser/private_aggregation/private_aggregation_report_golden_unittest.cc b/content/browser/private_aggregation/private_aggregation_report_golden_unittest.cc index e049e0d..c80d1b4 100644 --- a/content/browser/private_aggregation/private_aggregation_report_golden_unittest.cc +++ b/content/browser/private_aggregation/private_aggregation_report_golden_unittest.cc
@@ -40,6 +40,7 @@ #include "content/browser/aggregation_service/aggregation_service_test_utils.h" #include "content/browser/aggregation_service/public_key.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_features.h" #include "content/browser/private_aggregation/private_aggregation_host.h" #include "content/browser/private_aggregation/private_aggregation_utils.h" @@ -113,7 +114,7 @@ blink::mojom::DebugModeDetailsPtr debug_details, std::vector<blink::mojom::AggregatableReportHistogramContribution> contributions, - PrivateAggregationBudgetKey::Api api_identifier, + PrivateAggregationCallerApi api_identifier, std::string_view report_file, std::string_view cleartext_payloads_file, size_t filtering_id_max_bytes, @@ -349,7 +350,7 @@ blink::mojom::DebugModeDetailsPtr debug_details; std::vector<blink::mojom::AggregatableReportHistogramContribution> contributions; - PrivateAggregationBudgetKey::Api api_identifier; + PrivateAggregationCallerApi api_identifier; std::string_view report_file; std::string_view cleartext_payloads_file; size_t filtering_id_max_bytes = 1; @@ -360,13 +361,13 @@ /*debug_key=*/blink::mojom::DebugKey::New(/*value=*/123u)), .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_1.json", .cleartext_payloads_file = "report_1_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New(), .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_2.json", .cleartext_payloads_file = "report_2_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New( @@ -378,7 +379,7 @@ blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/3, /*value=*/4, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kSharedStorage, + .api_identifier = PrivateAggregationCallerApi::kSharedStorage, .report_file = "report_3.json", .cleartext_payloads_file = "report_3_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New(), @@ -388,7 +389,7 @@ blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/3, /*value=*/4, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kSharedStorage, + .api_identifier = PrivateAggregationCallerApi::kSharedStorage, .report_file = "report_4.json", .cleartext_payloads_file = "report_4_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New( @@ -397,20 +398,20 @@ .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/absl::Uint128Max(), /*value=*/2, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_5.json", .cleartext_payloads_file = "report_5_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New(), .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/absl::Uint128Max(), /*value=*/2, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_6.json", .cleartext_payloads_file = "report_6_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New(), .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/0, /*value=*/0, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kSharedStorage, + .api_identifier = PrivateAggregationCallerApi::kSharedStorage, .report_file = "report_7.json", .cleartext_payloads_file = "report_7_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New( @@ -418,13 +419,13 @@ /*debug_key=*/blink::mojom::DebugKey::New(/*value=*/123u)), .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/3)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_8.json", .cleartext_payloads_file = "report_8_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New(), .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/3)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_9.json", .cleartext_payloads_file = "report_9_cleartext_payloads.json"}, {.debug_details = blink::mojom::DebugModeDetails::New( @@ -433,7 +434,7 @@ .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::numeric_limits<uint64_t>::max())}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_10.json", .cleartext_payloads_file = "report_10_cleartext_payloads.json", .filtering_id_max_bytes = 8}, @@ -442,14 +443,14 @@ /*debug_key=*/blink::mojom::DebugKey::New(/*value=*/123u)), .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_11.json", .cleartext_payloads_file = "report_11_cleartext_payloads.json", .enable_100_contributions_for_protected_audience = true}, {.debug_details = blink::mojom::DebugModeDetails::New(), .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::nullopt)}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_12.json", .cleartext_payloads_file = "report_12_cleartext_payloads.json", .enable_100_contributions_for_protected_audience = true}, @@ -461,7 +462,7 @@ 99, blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::nullopt)), - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_13.json", .cleartext_payloads_file = "report_13_cleartext_payloads.json", .enable_100_contributions_for_protected_audience = true}, @@ -473,7 +474,7 @@ 100, blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::nullopt)), - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_14.json", .cleartext_payloads_file = "report_14_cleartext_payloads.json", .enable_100_contributions_for_protected_audience = true}, @@ -484,7 +485,7 @@ std::vector<blink::mojom::AggregatableReportHistogramContribution>( 100, blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/3)), - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_15.json", .cleartext_payloads_file = "report_15_cleartext_payloads.json", .enable_100_contributions_for_protected_audience = true}, @@ -496,7 +497,7 @@ 100, blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::numeric_limits<uint64_t>::max())), - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_16.json", .cleartext_payloads_file = "report_16_cleartext_payloads.json", .filtering_id_max_bytes = 8, @@ -507,7 +508,7 @@ .contributions = {blink::mojom::AggregatableReportHistogramContribution( /*bucket=*/1, /*value=*/2, /*filtering_id=*/std::numeric_limits<uint64_t>::max())}, - .api_identifier = PrivateAggregationBudgetKey::Api::kProtectedAudience, + .api_identifier = PrivateAggregationCallerApi::kProtectedAudience, .report_file = "report_17.json", .cleartext_payloads_file = "report_17_cleartext_payloads.json", .filtering_id_max_bytes = 8,
diff --git a/content/browser/private_aggregation/private_aggregation_test_utils.h b/content/browser/private_aggregation/private_aggregation_test_utils.h index 64e8f69..a8df322 100644 --- a/content/browser/private_aggregation/private_aggregation_test_utils.h +++ b/content/browser/private_aggregation/private_aggregation_test_utils.h
@@ -17,6 +17,7 @@ #include "content/browser/aggregation_service/aggregatable_report.h" #include "content/browser/private_aggregation/private_aggregation_budget_key.h" #include "content/browser/private_aggregation/private_aggregation_budgeter.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_host.h" #include "content/browser/private_aggregation/private_aggregation_manager_impl.h" #include "content/public/browser/storage_partition.h" @@ -80,7 +81,7 @@ BindNewReceiver, (url::Origin, url::Origin, - PrivateAggregationBudgetKey::Api, + PrivateAggregationCallerApi, std::optional<std::string>, std::optional<base::TimeDelta>, std::optional<url::Origin>, @@ -109,7 +110,7 @@ BindNewReceiver, (url::Origin, url::Origin, - PrivateAggregationBudgetKey::Api, + PrivateAggregationCallerApi, std::optional<std::string>, std::optional<base::TimeDelta>, std::optional<url::Origin>,
diff --git a/content/browser/private_aggregation/private_aggregation_utils.cc b/content/browser/private_aggregation/private_aggregation_utils.cc index bc49b739..b079f566 100644 --- a/content/browser/private_aggregation/private_aggregation_utils.cc +++ b/content/browser/private_aggregation/private_aggregation_utils.cc
@@ -8,11 +8,11 @@ #include <string_view> #include "base/strings/strcat.h" -#include "content/browser/private_aggregation/private_aggregation_budget_key.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" namespace content::private_aggregation { -std::string GetReportingPath(PrivateAggregationBudgetKey::Api api, +std::string GetReportingPath(PrivateAggregationCallerApi api, bool is_immediate_debug_report) { // TODO(alexmt): Consider updating or making a FeatureParam. static constexpr char kSharedReportingPathPrefix[] = @@ -25,10 +25,10 @@ std::string_view api_suffix; switch (api) { - case PrivateAggregationBudgetKey::Api::kProtectedAudience: + case PrivateAggregationCallerApi::kProtectedAudience: api_suffix = kProtectedAudienceReportingPathSuffix; break; - case PrivateAggregationBudgetKey::Api::kSharedStorage: + case PrivateAggregationCallerApi::kSharedStorage: api_suffix = kSharedStorageReportingPathSuffix; break; } @@ -38,11 +38,11 @@ is_immediate_debug_report ? kDebugReportingPathInfix : "", api_suffix}); } -std::string GetApiIdentifier(PrivateAggregationBudgetKey::Api api) { +std::string GetApiIdentifier(PrivateAggregationCallerApi api) { switch (api) { - case PrivateAggregationBudgetKey::Api::kProtectedAudience: + case PrivateAggregationCallerApi::kProtectedAudience: return "protected-audience"; - case PrivateAggregationBudgetKey::Api::kSharedStorage: + case PrivateAggregationCallerApi::kSharedStorage: return "shared-storage"; } }
diff --git a/content/browser/private_aggregation/private_aggregation_utils.h b/content/browser/private_aggregation/private_aggregation_utils.h index 3800a1d..42cd890 100644 --- a/content/browser/private_aggregation/private_aggregation_utils.h +++ b/content/browser/private_aggregation/private_aggregation_utils.h
@@ -7,14 +7,14 @@ #include <string> -#include "content/browser/private_aggregation/private_aggregation_budget_key.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" namespace content::private_aggregation { -std::string GetReportingPath(PrivateAggregationBudgetKey::Api api, +std::string GetReportingPath(PrivateAggregationCallerApi api, bool is_immediate_debug_report); -std::string GetApiIdentifier(PrivateAggregationBudgetKey::Api api); +std::string GetApiIdentifier(PrivateAggregationCallerApi api); } // namespace content::private_aggregation
diff --git a/content/browser/renderer_host/commit_deferring_condition_runner.h b/content/browser/renderer_host/commit_deferring_condition_runner.h index 6a4e52f..9a3cb4f 100644 --- a/content/browser/renderer_host/commit_deferring_condition_runner.h +++ b/content/browser/renderer_host/commit_deferring_condition_runner.h
@@ -52,7 +52,8 @@ // details. virtual void OnCommitDeferringConditionChecksComplete( CommitDeferringCondition::NavigationType navigation_type, - std::optional<int> candidate_prerender_frame_tree_node_id) = 0; + std::optional<FrameTreeNodeId> + candidate_prerender_frame_tree_node_id) = 0; }; // Creates the runner and adds all the conditions in
diff --git a/content/browser/renderer_host/commit_deferring_condition_runner_unittest.cc b/content/browser/renderer_host/commit_deferring_condition_runner_unittest.cc index 7042bda8..503d1100 100644 --- a/content/browser/renderer_host/commit_deferring_condition_runner_unittest.cc +++ b/content/browser/renderer_host/commit_deferring_condition_runner_unittest.cc
@@ -35,7 +35,8 @@ // CommitDeferringConditionRunner::Delegate: void OnCommitDeferringConditionChecksComplete( CommitDeferringCondition::NavigationType navigation_type, - std::optional<int> candidate_prerender_frame_tree_node_id) override { + std::optional<FrameTreeNodeId> candidate_prerender_frame_tree_node_id) + override { EXPECT_EQ(navigation_type, CommitDeferringCondition::NavigationType::kOther); EXPECT_FALSE(candidate_prerender_frame_tree_node_id.has_value());
diff --git a/content/browser/renderer_host/frame_tree.cc b/content/browser/renderer_host/frame_tree.cc index fa44e90..a4e2cd3e 100644 --- a/content/browser/renderer_host/frame_tree.cc +++ b/content/browser/renderer_host/frame_tree.cc
@@ -210,7 +210,6 @@ navigator_delegate, navigation_controller_delegate), type_(type), - focused_frame_tree_node_id_(FrameTreeNode::kFrameTreeNodeInvalidId), load_progress_(0.0), root_(*this, nullptr, @@ -258,7 +257,7 @@ speculative_render_view_host_.reset(); } -FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { +FrameTreeNode* FrameTree::FindByID(FrameTreeNodeId frame_tree_node_id) { for (FrameTreeNode* node : Nodes()) { if (node->frame_tree_node_id() == frame_tree_node_id) return node; @@ -753,7 +752,7 @@ void FrameTree::FrameUnloading(FrameTreeNode* frame) { if (frame->frame_tree_node_id() == focused_frame_tree_node_id_) - focused_frame_tree_node_id_ = FrameTreeNode::kFrameTreeNodeInvalidId; + focused_frame_tree_node_id_ = FrameTreeNodeId(); // Ensure frames that are about to be deleted aren't visible from the other // processes anymore. @@ -762,7 +761,7 @@ void FrameTree::FrameRemoved(FrameTreeNode* frame) { if (frame->frame_tree_node_id() == focused_frame_tree_node_id_) - focused_frame_tree_node_id_ = FrameTreeNode::kFrameTreeNodeInvalidId; + focused_frame_tree_node_id_ = FrameTreeNodeId(); } double FrameTree::GetLoadProgress() {
diff --git a/content/browser/renderer_host/frame_tree.h b/content/browser/renderer_host/frame_tree.h index 4398e2bb..c1d7534 100644 --- a/content/browser/renderer_host/frame_tree.h +++ b/content/browser/renderer_host/frame_tree.h
@@ -174,9 +174,8 @@ // there may be a FrameTreeNode in the outer FrameTree that is considered // our outer delegate FrameTreeNode. This method returns the outer delegate // FrameTreeNode ID if one exists. If we don't have a an outer delegate - // FrameTreeNode, this method returns - // FrameTreeNode::kFrameTreeNodeInvalidId. - virtual int GetOuterDelegateFrameTreeNodeId() = 0; + // FrameTreeNode, this method returns an invalid value. + virtual FrameTreeNodeId GetOuterDelegateFrameTreeNodeId() = 0; // If the FrameTree using this delegate is an inner/nested FrameTree that // has not yet been attached to an outer FrameTreeNode, returns the parent @@ -312,7 +311,7 @@ // Returns the FrameTreeNode with the given |frame_tree_node_id| if it is part // of this FrameTree. - FrameTreeNode* FindByID(int frame_tree_node_id); + FrameTreeNode* FindByID(FrameTreeNodeId frame_tree_node_id); // Returns the FrameTreeNode with the given renderer-specific |routing_id|. FrameTreeNode* FindByRoutingID(int process_id, int routing_id); @@ -644,7 +643,7 @@ // Indicates type of frame tree. const Type type_; - int focused_frame_tree_node_id_; + FrameTreeNodeId focused_frame_tree_node_id_; // Overall load progress. double load_progress_;
diff --git a/content/browser/renderer_host/frame_tree_node.cc b/content/browser/renderer_host/frame_tree_node.cc index 509e3e7f..5286f97 100644 --- a/content/browser/renderer_host/frame_tree_node.cc +++ b/content/browser/renderer_host/frame_tree_node.cc
@@ -48,7 +48,8 @@ // This is a global map between frame_tree_node_ids and pointers to // FrameTreeNodes. -typedef std::unordered_map<int, FrameTreeNode*> FrameTreeNodeIdMap; +using FrameTreeNodeIdMap = std:: + unordered_map<FrameTreeNodeId, FrameTreeNode*, FrameTreeNodeId::Hasher>; base::LazyInstance<FrameTreeNodeIdMap>::DestructorAtExit g_frame_tree_node_id_map = LAZY_INSTANCE_INITIALIZER; @@ -114,16 +115,20 @@ bool observing_original_opener_; }; +// TODO(https://crbug.com/361344235): Remove. const int FrameTreeNode::kFrameTreeNodeInvalidId = -1; +// TODO(https://crbug.com/361344235): Remove. static_assert(FrameTreeNode::kFrameTreeNodeInvalidId == RenderFrameHost::kNoFrameTreeNodeId, "Have consistent sentinel values for an invalid FTN id."); -int FrameTreeNode::next_frame_tree_node_id_ = 1; +// static +FrameTreeNodeId::Generator FrameTreeNode::frame_tree_node_id_generator_; // static -FrameTreeNode* FrameTreeNode::GloballyFindByID(int frame_tree_node_id) { +FrameTreeNode* FrameTreeNode::GloballyFindByID( + FrameTreeNodeId frame_tree_node_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); FrameTreeNodeIdMap* nodes = g_frame_tree_node_id_map.Pointer(); auto it = nodes->find(frame_tree_node_id); @@ -162,7 +167,7 @@ blink::FrameOwnerElementType owner_type, const blink::FramePolicy& frame_policy) : frame_tree_(frame_tree), - frame_tree_node_id_(next_frame_tree_node_id_++), + frame_tree_node_id_(frame_tree_node_id_generator_.GenerateNextId()), parent_(parent), frame_owner_element_type_(owner_type), tree_scope_type_(tree_scope_type), @@ -192,8 +197,7 @@ // lifetime and is dealt with separately. bool is_outer_dummy_node = false; if (current_frame_host() && - current_frame_host()->inner_tree_main_frame_tree_node_id() != - FrameTreeNode::kFrameTreeNodeInvalidId) { + current_frame_host()->inner_tree_main_frame_tree_node_id()) { is_outer_dummy_node = true; } @@ -958,7 +962,7 @@ void FrameTreeNode::WriteIntoTrace( perfetto::TracedProto<TraceProto> proto) const { - proto->set_frame_tree_node_id(frame_tree_node_id()); + proto->set_frame_tree_node_id(frame_tree_node_id().value()); proto->set_is_main_frame(IsMainFrame()); proto.Set(TraceProto::kCurrentFrameHost, current_frame_host()); proto.Set(TraceProto::kSpeculativeFrameHost,
diff --git a/content/browser/renderer_host/frame_tree_node.h b/content/browser/renderer_host/frame_tree_node.h index 65e3b3c9..e8e626d6 100644 --- a/content/browser/renderer_host/frame_tree_node.h +++ b/content/browser/renderer_host/frame_tree_node.h
@@ -73,11 +73,12 @@ virtual ~Observer() = default; }; + // TODO(https://crbug.com/361344235): Remove. static const int kFrameTreeNodeInvalidId; // Returns the FrameTreeNode with the given global |frame_tree_node_id|, // regardless of which FrameTree it is in. - static FrameTreeNode* GloballyFindByID(int frame_tree_node_id); + static FrameTreeNode* GloballyFindByID(FrameTreeNodeId frame_tree_node_id); // Returns the FrameTreeNode for the given |rfh|. Same as // rfh->frame_tree_node(), but also supports nullptrs. @@ -118,7 +119,7 @@ const RenderFrameHostManager* render_manager() const { return &render_manager_; } - int frame_tree_node_id() const { return frame_tree_node_id_; } + FrameTreeNodeId frame_tree_node_id() const { return frame_tree_node_id_; } // This reflects window.name, which is initially set to the the "name" // attribute. But this won't reflect changes of 'name' attribute and instead // reflect changes to the Window object's name property. @@ -786,8 +787,8 @@ // See `RestartBackForwardCachedNavigationAsync()`. void RestartBackForwardCachedNavigationImpl(int nav_entry_id); - // The next available browser-global FrameTreeNode ID. - static int next_frame_tree_node_id_; + // The browser-global FrameTreeNodeId generator. + static FrameTreeNodeId::Generator frame_tree_node_id_generator_; // The FrameTree owning |this|. It can change with Prerender2 during // activation. @@ -795,7 +796,7 @@ // A browser-global identifier for the frame in the page, which stays stable // even if the frame does a cross-process navigation. - const int frame_tree_node_id_; + const FrameTreeNodeId frame_tree_node_id_; // The RenderFrameHost owning this FrameTreeNode, which cannot change for the // life of this FrameTreeNode. |nullptr| if this node is the root.
diff --git a/content/browser/renderer_host/frame_tree_unittest.cc b/content/browser/renderer_host/frame_tree_unittest.cc index 4baf016d..3d928c8 100644 --- a/content/browser/renderer_host/frame_tree_unittest.cc +++ b/content/browser/renderer_host/frame_tree_unittest.cc
@@ -503,7 +503,7 @@ EXPECT_EQ(child1, frame_tree.FindByID(child1->frame_tree_node_id())); EXPECT_EQ(child2, frame_tree.FindByID(child2->frame_tree_node_id())); EXPECT_EQ(grandchild, frame_tree.FindByID(grandchild->frame_tree_node_id())); - EXPECT_EQ(nullptr, frame_tree.FindByID(-1)); + EXPECT_EQ(nullptr, frame_tree.FindByID(FrameTreeNodeId())); // Ensure they can be found by routing id. int process_id = main_test_rfh()->GetProcess()->GetID(); @@ -734,9 +734,9 @@ blink::mojom::FrameOwnerProperties(), kOwnerType, ukm::kInvalidSourceId); // Ensure they can be found by id. - int id1 = root->child_at(0)->frame_tree_node_id(); - int id2 = root->child_at(1)->frame_tree_node_id(); - int id3 = root->child_at(0)->child_at(0)->frame_tree_node_id(); + FrameTreeNodeId id1 = root->child_at(0)->frame_tree_node_id(); + FrameTreeNodeId id2 = root->child_at(1)->frame_tree_node_id(); + FrameTreeNodeId id3 = root->child_at(0)->child_at(0)->frame_tree_node_id(); EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id1)); EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id2)); EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id3));
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index cd9e803..5357302 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -3621,9 +3621,8 @@ const LoadURLParams& params) { // Find the appropriate FrameTreeNode. FrameTreeNode* node = nullptr; - if (params.frame_tree_node_id != RenderFrameHost::kNoFrameTreeNodeId || - !params.frame_name.empty()) { - node = params.frame_tree_node_id != RenderFrameHost::kNoFrameTreeNodeId + if (params.frame_tree_node_id || !params.frame_name.empty()) { + node = params.frame_tree_node_id ? frame_tree_->FindByID(params.frame_tree_node_id) : frame_tree_->FindByName(params.frame_name); DCHECK(!node || &node->frame_tree() == &frame_tree()); @@ -4839,9 +4838,9 @@ // provided, then report it as the `previous_entry`. FrameNavigationEntry* previous_entry = nullptr; if (frame_tree_->is_prerendering()) { - int initiator_id = PrerenderHost::GetFromFrameTreeNode(*node) - .initiator_frame_tree_node_id(); - if (initiator_id != RenderFrameHost::kNoFrameTreeNodeId) { + FrameTreeNodeId initiator_id = PrerenderHost::GetFromFrameTreeNode(*node) + .initiator_frame_tree_node_id(); + if (initiator_id) { auto* initiator_node = FrameTreeNode::GloballyFindByID(initiator_id); previous_entry = initiator_node->frame_tree() .controller()
diff --git a/content/browser/renderer_host/navigation_controller_impl.h b/content/browser/renderer_host/navigation_controller_impl.h index 42e1717..377b6df 100644 --- a/content/browser/renderer_host/navigation_controller_impl.h +++ b/content/browser/renderer_host/navigation_controller_impl.h
@@ -584,11 +584,12 @@ // to their respective FrameTreeNodes, and FrameTreeNode ids to their // current document sequences numbers. std::map<std::string, FrameTreeNode*> names_to_nodes_; - std::map<int, int64_t> frame_tree_node_id_to_doc_seq_nos_; + std::map<FrameTreeNodeId, int64_t> frame_tree_node_id_to_doc_seq_nos_; // The output of PopulateKeySet(), which maps FrameTreeNode ids to the keys // that frame knows about in the renderer. Used in the destructor. - std::map<int, std::set<std::string>> frame_tree_node_id_to_keys_; + std::map<FrameTreeNodeId, std::set<std::string>> + frame_tree_node_id_to_keys_; }; // Navigates in session history to the given index. Returns all the created
diff --git a/content/browser/renderer_host/navigation_entry_impl.cc b/content/browser/renderer_host/navigation_entry_impl.cc index ee99d82..bdbc75e 100644 --- a/content/browser/renderer_host/navigation_entry_impl.cc +++ b/content/browser/renderer_host/navigation_entry_impl.cc
@@ -433,7 +433,6 @@ is_renderer_initiated_(is_renderer_initiated), should_clear_history_list_(false), can_load_local_resources_(false), - frame_tree_node_id_(FrameTreeNode::kFrameTreeNodeInvalidId), has_user_gesture_(false), reload_type_(ReloadType::NONE), started_from_context_menu_(false), @@ -1029,7 +1028,7 @@ set_is_renderer_initiated(false); set_should_clear_history_list(false); - set_frame_tree_node_id(FrameTreeNode::kFrameTreeNodeInvalidId); + set_frame_tree_node_id(FrameTreeNodeId()); set_reload_type(ReloadType::NONE); if (frame_entry) {
diff --git a/content/browser/renderer_host/navigation_entry_impl.h b/content/browser/renderer_host/navigation_entry_impl.h index dfc027c..ea0fc2d 100644 --- a/content/browser/renderer_host/navigation_entry_impl.h +++ b/content/browser/renderer_host/navigation_entry_impl.h
@@ -23,6 +23,7 @@ #include "content/browser/site_instance_impl.h" #include "content/common/content_export.h" #include "content/public/browser/favicon_status.h" +#include "content/public/browser/frame_tree_node_id.h" #include "content/public/browser/global_request_id.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/reload_type.h" @@ -396,8 +397,8 @@ // Indicates which FrameTreeNode to navigate. Currently only used if the // --site-per-process flag is passed. - int frame_tree_node_id() const { return frame_tree_node_id_; } - void set_frame_tree_node_id(int frame_tree_node_id) { + FrameTreeNodeId frame_tree_node_id() const { return frame_tree_node_id_; } + void set_frame_tree_node_id(FrameTreeNodeId frame_tree_node_id) { frame_tree_node_id_ = frame_tree_node_id; } @@ -601,12 +602,12 @@ // value is not needed after the entry commits and is not persisted. bool can_load_local_resources_; - // If not -1, this indicates which FrameTreeNode to navigate. This field is + // If valid, this indicates which FrameTreeNode to navigate. This field is // not persisted because it is experimental and only used when the // --site-per-process flag is passed. It is cleared in |ResetForCommit| // because we only use it while the navigation is pending. // TODO(creis): Move this to FrameNavigationEntry. - int frame_tree_node_id_; + FrameTreeNodeId frame_tree_node_id_; // Whether the URL load carries a user gesture. bool has_user_gesture_;
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index e2e5d3b..e8fa39c 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -2441,10 +2441,9 @@ bool NavigationRequest::MaybeStartPrerenderingActivationChecks() { // Find an available prerendered page for this request. If it's found, this // request may activate it instead of loading a page via network. - int candidate_prerender_frame_tree_node_id = + FrameTreeNodeId candidate_prerender_frame_tree_node_id = GetPrerenderHostRegistry().FindPotentialHostToActivate(*this); - if (candidate_prerender_frame_tree_node_id == - RenderFrameHost::kNoFrameTreeNodeId) { + if (candidate_prerender_frame_tree_node_id.is_null()) { return false; } @@ -2472,7 +2471,7 @@ void NavigationRequest::OnPrerenderingActivationChecksComplete( CommitDeferringCondition::NavigationType navigation_type, - std::optional<int> candidate_prerender_frame_tree_node_id) { + std::optional<FrameTreeNodeId> candidate_prerender_frame_tree_node_id) { TRACE_EVENT_WITH_FLOW0( "navigation", "NavigationRequest::OnPrerenderingActivationChecksComplete", TRACE_ID_WITH_SCOPE(kNavigationRequestScope, @@ -2494,8 +2493,7 @@ prerender_frame_tree_node_id_ = GetPrerenderHostRegistry().ReserveHostToActivate( *this, candidate_prerender_frame_tree_node_id.value()); - if (prerender_frame_tree_node_id_.value() == - RenderFrameHost::kNoFrameTreeNodeId) { + if (prerender_frame_tree_node_id_.value().is_null()) { // If we ran commit deferring conditions for a potential pre-render which // eventually wasn't activated, abort the ViewTransition. The state was // cached assuming this navigation will be same-origin which might not be @@ -5866,7 +5864,7 @@ void NavigationRequest::OnCommitDeferringConditionChecksComplete( CommitDeferringCondition::NavigationType navigation_type, - std::optional<int> candidate_prerender_frame_tree_node_id) { + std::optional<FrameTreeNodeId> candidate_prerender_frame_tree_node_id) { switch (navigation_type) { case CommitDeferringCondition::NavigationType::kPrerenderedPageActivation: OnPrerenderingActivationChecksComplete( @@ -8682,7 +8680,7 @@ bool NavigationRequest::IsPrerenderedPageActivation() const { CHECK(prerender_frame_tree_node_id_.has_value()); - return prerender_frame_tree_node_id_ != RenderFrameHost::kNoFrameTreeNodeId; + return !prerender_frame_tree_node_id_.value().is_null(); } bool NavigationRequest::IsInFencedFrameTree() const { @@ -8693,7 +8691,7 @@ return frame_tree_node()->GetFrameType(); } -int NavigationRequest::GetFrameTreeNodeId() { +FrameTreeNodeId NavigationRequest::GetFrameTreeNodeId() { return frame_tree_node()->frame_tree_node_id(); } @@ -10316,7 +10314,7 @@ // This navigation won't activate a prerendered page. Otherwise, // `prerender_frame_tree_node_id_` should have already been set before this // in OnPrerenderingActivationChecksComplete(). - prerender_frame_tree_node_id_ = RenderFrameHost::kNoFrameTreeNodeId; + prerender_frame_tree_node_id_ = FrameTreeNodeId(); } }
diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h index 260b8db..e704d8b 100644 --- a/content/browser/renderer_host/navigation_request.h +++ b/content/browser/renderer_host/navigation_request.h
@@ -348,7 +348,7 @@ bool IsSameOrigin() override; bool WasServerRedirect() override; const std::vector<GURL>& GetRedirectChain() override; - int GetFrameTreeNodeId() override; + FrameTreeNodeId GetFrameTreeNodeId() override; RenderFrameHostImpl* GetParentFrame() override; RenderFrameHostImpl* GetParentFrameOrOuterDocument() override; base::TimeTicks NavigationStart() override; @@ -1057,7 +1057,7 @@ return is_running_potential_prerender_activation_checks_; } - int prerender_frame_tree_node_id() const { + FrameTreeNodeId prerender_frame_tree_node_id() const { DCHECK(prerender_frame_tree_node_id_.has_value()) << "Must be called after StartNavigation()"; return prerender_frame_tree_node_id_.value(); @@ -1406,7 +1406,7 @@ // activating a prerendered page. void OnPrerenderingActivationChecksComplete( CommitDeferringCondition::NavigationType navigation_type, - std::optional<int> candidate_prerender_frame_tree_node_id); + std::optional<FrameTreeNodeId> candidate_prerender_frame_tree_node_id); // Get the `FencedFrameURLMapping` associated with the current page. FencedFrameURLMapping& GetFencedFrameURLMap(); @@ -1532,7 +1532,8 @@ // navigation can proceed to commit. void OnCommitDeferringConditionChecksComplete( CommitDeferringCondition::NavigationType navigation_type, - std::optional<int> candidate_prerender_frame_tree_node_id) override; + std::optional<FrameTreeNodeId> candidate_prerender_frame_tree_node_id) + override; // Called either by OnFailureChecksComplete() or OnRequestFailed() directly. // |error_page_content| contains the content of the error page (i.e. flattened @@ -2576,12 +2577,12 @@ base::TimeTicks fenced_frame_url_mapping_start_time_; // The root frame tree node id of the prerendered page. This will be a valid - // FrameTreeNode id when this navigation will activate a prerendered page. - // For all other navigations this will be - // RenderFrameHost::kNoFrameTreeNodeId. We only know whether this is the case - // when BeginNavigation is called so the optional will be empty until then - // and callers must not query its value before it's been computed. - std::optional<int> prerender_frame_tree_node_id_; + // FrameTreeNodeId value when this navigation will activate a prerendered + // page. For all other navigations this will be an invalid FrameTreeNodeId. We + // only know whether this is the case when BeginNavigation is called so the + // optional will be empty until then and callers must not query its value + // before it's been computed. + std::optional<FrameTreeNodeId> prerender_frame_tree_node_id_; // Contains state pertaining to a prerender activation. This is only used if // this navigation is a prerender activation.
diff --git a/content/browser/renderer_host/navigation_request_info.cc b/content/browser/renderer_host/navigation_request_info.cc index 8df23ae6..76962db 100644 --- a/content/browser/renderer_host/navigation_request_info.cc +++ b/content/browser/renderer_host/navigation_request_info.cc
@@ -18,7 +18,7 @@ bool is_outermost_main_frame, bool is_main_frame, bool are_ancestors_secure, - int frame_tree_node_id, + FrameTreeNodeId frame_tree_node_id, bool report_raw_headers, bool upgrade_if_insecure, std::unique_ptr<network::PendingSharedURLLoaderFactory>
diff --git a/content/browser/renderer_host/navigation_request_info.h b/content/browser/renderer_host/navigation_request_info.h index 09a36b0..7d11280 100644 --- a/content/browser/renderer_host/navigation_request_info.h +++ b/content/browser/renderer_host/navigation_request_info.h
@@ -9,6 +9,7 @@ #include "base/unguessable_token.h" #include "content/common/content_export.h" +#include "content/public/browser/frame_tree_node_id.h" #include "content/public/browser/global_routing_id.h" #include "content/public/browser/weak_document_ptr.h" #include "content/public/common/referrer.h" @@ -39,7 +40,7 @@ bool is_outermost_main_frame, bool is_main_frame, bool are_ancestors_secure, - int frame_tree_node_id, + FrameTreeNodeId frame_tree_node_id, bool report_raw_headers, bool upgrade_if_insecure, std::unique_ptr<network::PendingSharedURLLoaderFactory> @@ -107,7 +108,7 @@ // origin. True for main frames. const bool are_ancestors_secure; - const int frame_tree_node_id; + const FrameTreeNodeId frame_tree_node_id; const bool report_raw_headers;
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc index 27d20a9..c45b18e 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc
@@ -880,7 +880,7 @@ // redirects. http://crbug.com/311721. std::vector<GURL> redirect_chain; - int frame_tree_node_id = FrameTreeNode::kFrameTreeNodeInvalidId; + FrameTreeNodeId frame_tree_node_id; // Send the navigation to the current FrameTreeNode if it's destined for a // subframe in the current tab. We'll assume it's for the main frame @@ -896,7 +896,7 @@ // means this function currently can't be called for prerendering main frames. DCHECK(render_frame_host->lifecycle_state() != RenderFrameHostImpl::LifecycleStateImpl::kPrerendering || - frame_tree_node_id != FrameTreeNode::kFrameTreeNodeInvalidId); + frame_tree_node_id); OpenURLParams params(url, referrer, frame_tree_node_id, disposition, ui::PAGE_TRANSITION_LINK,
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index c0b926a..8acbe54 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -904,7 +904,7 @@ data->set_has_pending_commit(rfh->HasPendingCommitNavigation()); data->set_has_pending_cross_document_commit( rfh->HasPendingCommitForCrossDocumentNavigation()); - data->set_frame_tree_node_id(rfh->GetFrameTreeNodeId()); + data->set_frame_tree_node_id(rfh->GetFrameTreeNodeId().value()); data->set_intent(FrameDeleteIntentionToProto(intent)); } @@ -1889,8 +1889,6 @@ media_device_id_salt_base_(CreateRandomMediaDeviceIDSalt()), document_associated_data_(std::in_place, *this, document_token), lifecycle_state_(lifecycle_state), - inner_tree_main_frame_tree_node_id_( - FrameTreeNode::kFrameTreeNodeInvalidId), code_cache_host_receivers_( GetProcess()->GetStoragePartition()->GetGeneratedCodeCacheContext()), fenced_frame_status_(fenced_frame_status), @@ -2336,8 +2334,7 @@ SetLifecycleState(LifecycleStateImpl::kInBackForwardCache); // If we are a delegate node we don't need to do anything else. - if (inner_tree_main_frame_tree_node_id_ != - FrameTreeNode::kFrameTreeNodeInvalidId) { + if (inner_tree_main_frame_tree_node_id_) { return; } @@ -2382,8 +2379,7 @@ DCHECK(!back_forward_cache_eviction_timer_.IsRunning()); // If we are a delegate node we don't need to do anything else. - if (inner_tree_main_frame_tree_node_id_ != - FrameTreeNode::kFrameTreeNodeInvalidId) { + if (inner_tree_main_frame_tree_node_id_) { return; } @@ -2619,7 +2615,7 @@ } } -int RenderFrameHostImpl::GetFrameTreeNodeId() const { +FrameTreeNodeId RenderFrameHostImpl::GetFrameTreeNodeId() const { return frame_tree_node_->frame_tree_node_id(); } @@ -6726,7 +6722,7 @@ void RenderFrameHostImpl::WriteIntoTrace( perfetto::TracedProto<TraceProto> proto) const { proto.Set(TraceProto::kRenderFrameHostId, GetGlobalId()); - proto->set_frame_tree_node_id(GetFrameTreeNodeId()); + proto->set_frame_tree_node_id(GetFrameTreeNodeId().value()); proto->set_lifecycle_state(LifecycleStateToProto()); proto->set_frame_type(GetFrameTypeProto()); proto->set_origin(GetLastCommittedOrigin().GetDebugString()); @@ -9799,7 +9795,7 @@ std::vector<FrameTreeNode*> subframe_nodes(std::next(node_range.begin()), node_range.end()); std::reverse(subframe_nodes.begin(), subframe_nodes.end()); - std::set<int> nodes_not_eligible_for_network_cutoff; + std::set<FrameTreeNodeId> nodes_not_eligible_for_network_cutoff; // This loop traverses up the frame tree, determining if each fenced frame // root node meets the criteria for network cutoff. We look at the most deeply // nested nodes first since each node's network cutoff status is reliant on @@ -10302,7 +10298,7 @@ SCOPED_CRASH_KEY_NUMBER("ax", "render_frame_state", static_cast<int>(render_frame_state_)); SCOPED_CRASH_KEY_NUMBER("ax", "inner_tree_main_frame_tree_node_id", - inner_tree_main_frame_tree_node_id_); + inner_tree_main_frame_tree_node_id_.value()); // TODO: crbug.com/40069097 - switch to CHECK. DUMP_WILL_BE_CHECK(false); } @@ -12448,22 +12444,25 @@ } // static -int RenderFrameHost::GetFrameTreeNodeIdForRoutingId(int process_id, - int routing_id) { +FrameTreeNodeId RenderFrameHost::GetFrameTreeNodeIdForRoutingId( + int process_id, + int routing_id) { auto frame_or_proxy = LookupRenderFrameHostOrProxy(process_id, routing_id); - if (frame_or_proxy) + if (frame_or_proxy) { return frame_or_proxy.GetFrameTreeNode()->frame_tree_node_id(); - return kNoFrameTreeNodeId; + } + return FrameTreeNodeId(); } // static -int RenderFrameHost::GetFrameTreeNodeIdForFrameToken( +FrameTreeNodeId RenderFrameHost::GetFrameTreeNodeIdForFrameToken( int process_id, const ::blink::FrameToken& frame_token) { auto frame_or_proxy = LookupRenderFrameHostOrProxy(process_id, frame_token); - if (frame_or_proxy) + if (frame_or_proxy) { return frame_or_proxy.GetFrameTreeNode()->frame_tree_node_id(); - return kNoFrameTreeNodeId; + } + return FrameTreeNodeId(); } // static
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 46cccdb..f4cab06 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -80,6 +80,7 @@ #include "content/public/browser/back_forward_cache.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/frame_tree_node_id.h" #include "content/public/browser/global_request_id.h" #include "content/public/browser/global_routing_id.h" #include "content/public/browser/javascript_dialog_manager.h" @@ -446,7 +447,7 @@ base::FunctionRef<void(RenderFrameHost*)> on_frame) override; // TODO (crbug.com/1251545) : Frame tree node id should only be known for // subframes. As such, update this method. - int GetFrameTreeNodeId() const override; + FrameTreeNodeId GetFrameTreeNodeId() const override; const base::UnguessableToken& GetDevToolsFrameToken() override; std::optional<base::UnguessableToken> GetEmbeddingToken() override; const std::string& GetFrameName() override; @@ -2280,10 +2281,10 @@ return media_device_id_salt_base_; } - void set_inner_tree_main_frame_tree_node_id(int id) { + void set_inner_tree_main_frame_tree_node_id(FrameTreeNodeId id) { inner_tree_main_frame_tree_node_id_ = id; } - int inner_tree_main_frame_tree_node_id() const { + FrameTreeNodeId inner_tree_main_frame_tree_node_id() const { return inner_tree_main_frame_tree_node_id_; } @@ -5041,9 +5042,8 @@ vibration_manager_listeners_; // Indicates whether this frame is an outer delegate frame for some other - // RenderFrameHost. This will be a valid ID if so, and - // `kFrameTreeNodeInvalidId` otherwise. - int inner_tree_main_frame_tree_node_id_; + // RenderFrameHost. This will be a valid ID if so, and invalid otherwise. + FrameTreeNodeId inner_tree_main_frame_tree_node_id_; // Indicates whether navigator.credentials.get({otp: {transport:"sms"}}) has // been used on a document (regardless of the outcome).
diff --git a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc index 1edbd940..dd9505d 100644 --- a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc
@@ -192,8 +192,9 @@ } mojo::PendingRemote<network::mojom::URLLoaderFactory> - CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme, - int frame_tree_node_id) override { + CreateNonNetworkNavigationURLLoaderFactory( + const std::string& scheme, + FrameTreeNodeId frame_tree_node_id) override { if (scheme == "trustme") { mojo::PendingRemote<network::mojom::URLLoaderFactory> trustme_remote; trustme_factory_->Clone(trustme_remote.InitWithNewPipeAndPassReceiver());
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc index ec1fce0..1ece46f 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -289,7 +289,7 @@ } } -void TraceShouldSwapBrowsingInstanceResult(int frame_tree_node_id, +void TraceShouldSwapBrowsingInstanceResult(FrameTreeNodeId frame_tree_node_id, ShouldSwapBrowsingInstance result) { TRACE_EVENT_INSTANT( "navigation", @@ -297,7 +297,7 @@ [&](perfetto::EventContext ctx) { auto* event = ctx.event<ChromeTrackEvent>(); auto* data = event->set_should_swap_browsing_instances_result(); - data->set_frame_tree_node_id(frame_tree_node_id); + data->set_frame_tree_node_id(frame_tree_node_id.value()); data->set_result(ShouldSwapBrowsingInstanceToProto(result)); }); } @@ -667,13 +667,12 @@ bool RenderFrameHostManager::IsMainFrameForInnerDelegate() { return frame_tree_node_->IsMainFrame() && frame_tree_node_->frame_tree() - .delegate() - ->GetOuterDelegateFrameTreeNodeId() != - FrameTreeNode::kFrameTreeNodeInvalidId; + .delegate() + ->GetOuterDelegateFrameTreeNodeId(); } FrameTreeNode* RenderFrameHostManager::GetOuterDelegateNode() const { - int outer_contents_frame_tree_node_id = + FrameTreeNodeId outer_contents_frame_tree_node_id = frame_tree_node_->frame_tree() .delegate() ->GetOuterDelegateFrameTreeNodeId();
diff --git a/content/browser/renderer_host/render_widget_host_view_ios_uiview.mm b/content/browser/renderer_host/render_widget_host_view_ios_uiview.mm index 82ff33c..4ada8e4 100644 --- a/content/browser/renderer_host/render_widget_host_view_ios_uiview.mm +++ b/content/browser/renderer_host/render_widget_host_view_ios_uiview.mm
@@ -7,7 +7,7 @@ #include "base/apple/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "components/input/web_input_event_builders_ios.h" -#include "content/browser/accessibility/browser_accessibility_manager.h" +#include "ui/accessibility/platform/browser_accessibility_manager.h" static void* kObservingContext = &kObservingContext; @@ -818,7 +818,7 @@ } - (NSArray*)accessibilityElements { - content::BrowserAccessibilityManager* manager = + ui::BrowserAccessibilityManager* manager = _view->host()->GetRootBrowserAccessibilityManager(); if (manager) { id root = manager->GetBrowserAccessibilityRoot()->GetNativeViewAccessible();
diff --git a/content/browser/shared_storage/shared_storage_browsertest.cc b/content/browser/shared_storage/shared_storage_browsertest.cc index d961c53f..f28f891 100644 --- a/content/browser/shared_storage/shared_storage_browsertest.cc +++ b/content/browser/shared_storage/shared_storage_browsertest.cc
@@ -29,6 +29,7 @@ #include "base/test/with_feature_override.h" #include "base/time/time.h" #include "content/browser/aggregation_service/aggregatable_report.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_manager_impl.h" #include "content/browser/private_aggregation/private_aggregation_test_utils.h" #include "content/browser/renderer_host/navigation_request.h" @@ -7599,7 +7600,7 @@ EXPECT_EQ(request.shared_info().reporting_origin, a_test_origin_); EXPECT_EQ(budget_key.origin(), a_test_origin_); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); EXPECT_TRUE(request.additional_fields().empty()); EXPECT_EQ(budget_denied_behavior, PrivateAggregationBudgeter::BudgetDeniedBehavior:: @@ -7689,7 +7690,7 @@ EXPECT_EQ(request.shared_info().reporting_origin, a_test_origin_); EXPECT_EQ(budget_key.origin(), a_test_origin_); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); EXPECT_EQ(budget_denied_behavior, PrivateAggregationBudgeter::BudgetDeniedBehavior:: kDontSendReport); @@ -7740,7 +7741,7 @@ EXPECT_EQ(request.shared_info().reporting_origin, a_test_origin_); EXPECT_EQ(budget_key.origin(), a_test_origin_); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); EXPECT_EQ(budget_denied_behavior, PrivateAggregationBudgeter::BudgetDeniedBehavior:: kSendNullReport); @@ -7808,7 +7809,7 @@ EXPECT_EQ(request.shared_info().reporting_origin, a_test_origin_); EXPECT_EQ(budget_key.origin(), a_test_origin_); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); EXPECT_THAT(request.additional_fields(), testing::ElementsAre( testing::Pair("context_id", "example_context_id"))); @@ -7867,7 +7868,7 @@ EXPECT_EQ(request.shared_info().reporting_origin, a_test_origin_); EXPECT_EQ(budget_key.origin(), a_test_origin_); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); EXPECT_THAT(request.additional_fields(), testing::ElementsAre(testing::Pair("context_id", ""))); EXPECT_EQ(budget_denied_behavior, @@ -7926,7 +7927,7 @@ EXPECT_EQ(request.shared_info().reporting_origin, a_test_origin_); EXPECT_EQ(budget_key.origin(), a_test_origin_); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); EXPECT_THAT(request.additional_fields(), testing::ElementsAre( testing::Pair("context_id", @@ -9234,7 +9235,7 @@ EXPECT_EQ(request.shared_info().reporting_origin, a_test_origin_); EXPECT_EQ(budget_key.origin(), a_test_origin_); EXPECT_EQ(budget_key.api(), - PrivateAggregationBudgetKey::Api::kSharedStorage); + PrivateAggregationCallerApi::kSharedStorage); EXPECT_EQ(budget_denied_behavior, PrivateAggregationBudgeter::BudgetDeniedBehavior:: kDontSendReport);
diff --git a/content/browser/shared_storage/shared_storage_worklet_host.cc b/content/browser/shared_storage/shared_storage_worklet_host.cc index b48ffe9e..89591f7 100644 --- a/content/browser/shared_storage/shared_storage_worklet_host.cc +++ b/content/browser/shared_storage/shared_storage_worklet_host.cc
@@ -21,7 +21,7 @@ #include "content/browser/devtools/devtools_instrumentation.h" #include "content/browser/devtools/shared_storage_worklet_devtools_manager.h" #include "content/browser/fenced_frame/fenced_frame_reporter.h" -#include "content/browser/private_aggregation/private_aggregation_budget_key.h" +#include "content/browser/private_aggregation/private_aggregation_caller_api.h" #include "content/browser/private_aggregation/private_aggregation_host.h" #include "content/browser/private_aggregation/private_aggregation_manager.h" #include "content/browser/renderer_host/page_impl.h" @@ -1459,7 +1459,7 @@ // TODO(crbug.com/330744610): Allow filtering ID byte size to be set. bool success = private_aggregation_manager->BindNewReceiver( shared_storage_origin_, main_frame_origin_, - PrivateAggregationBudgetKey::Api::kSharedStorage, + PrivateAggregationCallerApi::kSharedStorage, private_aggregation_config->context_id, std::move(timeout), private_aggregation_config->aggregation_coordinator_origin, private_aggregation_config->filtering_id_max_bytes,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index d33f1cba..657b3361 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -10872,7 +10872,7 @@ delegate_->OnCanResizeFromWebAPIChanged(); } -int WebContentsImpl::GetOuterDelegateFrameTreeNodeId() { +FrameTreeNodeId WebContentsImpl::GetOuterDelegateFrameTreeNodeId() { return node_.outer_contents_frame_tree_node_id(); }
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index a17690b2..0c53649 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -1179,7 +1179,7 @@ void DidStartLoading(FrameTreeNode* frame_tree_node) override; void DidStopLoading() override; bool IsHidden() override; - int GetOuterDelegateFrameTreeNodeId() override; + FrameTreeNodeId GetOuterDelegateFrameTreeNodeId() override; RenderFrameHostImpl* GetProspectiveOuterDocument() override; FrameTree* LoadingTree() override; void SetFocusedFrame(FrameTreeNode* node, SiteInstanceGroup* source) override;
diff --git a/content/browser/xr/service/vr_service_impl.cc b/content/browser/xr/service/vr_service_impl.cc index 57139810..55ecfa1 100644 --- a/content/browser/xr/service/vr_service_impl.cc +++ b/content/browser/xr/service/vr_service_impl.cc
@@ -588,21 +588,13 @@ const std::vector<blink::PermissionType> permissions_for_mode = GetRequiredPermissionsForMode(request.options->mode); - // Note that if we prompt for any permissions because of *features*, we could - // cause re-entrant behavior if those permissions would preempt the permission - // that we just queried for. To that end, post a task to handle the result of - // the permissions query to avoid that re-entrant behavior. - // TODO(crbug.com/357776212): Remove this if the re-entrant behavior is fixed - // on the permissions side. permission_controller->RequestPermissionsFromCurrentDocument( render_frame_host_, PermissionRequestDescription(permissions_for_mode, /*user_gesture=*/true), - base::BindPostTask( - base::SequencedTaskRunner::GetCurrentDefault(), - base::BindOnce(&VRServiceImpl::OnPermissionResultsForMode, - weak_ptr_factory_.GetWeakPtr(), std::move(request), - permissions_for_mode))); + base::BindOnce(&VRServiceImpl::OnPermissionResultsForMode, + weak_ptr_factory_.GetWeakPtr(), std::move(request), + permissions_for_mode)); } void VRServiceImpl::OnPermissionResultsForMode(
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn index 1647a08..f13b56d 100644 --- a/content/public/browser/BUILD.gn +++ b/content/public/browser/BUILD.gn
@@ -200,6 +200,7 @@ "frame_accept_header.cc", "frame_accept_header.h", "frame_rate_throttling.h", + "frame_tree_node_id.h", "frame_type.h", "fullscreen_types.h", "generated_code_cache_settings.h",
diff --git a/content/public/browser/ax_inspect_factory.cc b/content/public/browser/ax_inspect_factory.cc index fd505d5..9cf256c 100644 --- a/content/public/browser/ax_inspect_factory.cc +++ b/content/public/browser/ax_inspect_factory.cc
@@ -22,14 +22,6 @@ return AXInspectFactory::CreateFormatter(DefaultPlatformFormatterType()); } -// static -std::unique_ptr<ui::AXEventRecorder> AXInspectFactory::CreatePlatformRecorder( - ui::AXPlatformTreeManager* manager, - base::ProcessId pid, - const ui::AXTreeSelector& selector) { - return AXInspectFactory::CreateRecorder(DefaultPlatformRecorderType()); -} - // TODO(crbug.com/336611337): Add iOS-specific AXInspectorFactory logic. #if !BUILDFLAG(HAS_PLATFORM_ACCESSIBILITY_SUPPORT) || BUILDFLAG(IS_IOS)
diff --git a/content/public/browser/ax_inspect_factory.h b/content/public/browser/ax_inspect_factory.h index 85c5e22..134398b 100644 --- a/content/public/browser/ax_inspect_factory.h +++ b/content/public/browser/ax_inspect_factory.h
@@ -34,13 +34,6 @@ // Returns the API type of the current platform's default platform recorder. static ui::AXApiType::Type DefaultPlatformRecorderType(); - // Creates the appropriate event recorder for the platform we are currently - // running on. - static std::unique_ptr<ui::AXEventRecorder> CreatePlatformRecorder( - ui::AXPlatformTreeManager* manager = nullptr, - base::ProcessId pid = 0, - const ui::AXTreeSelector& selector = {}); - // Creates the internal accessibility tree formatter, AKA the Blink tree // formatter, which is used to dump the Blink accessibility tree to a string static std::unique_ptr<ui::AXTreeFormatter> CreateBlinkFormatter();
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index 881c8f4..9d02344 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc
@@ -1029,7 +1029,7 @@ mojo::PendingRemote<network::mojom::URLLoaderFactory> ContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory( const std::string& scheme, - int frame_tree_node_id) { + FrameTreeNodeId frame_tree_node_id) { return {}; }
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 7c435bbf..2e57a8e 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h
@@ -13,6 +13,7 @@ #include <set> #include <string> #include <string_view> +#include <variant> #include <vector> #include "base/containers/flat_map.h" @@ -39,6 +40,7 @@ #include "content/public/browser/digital_identity_interstitial_type.h" #include "content/public/browser/digital_identity_provider.h" #include "content/public/browser/file_system_access_permission_context.h" +#include "content/public/browser/frame_tree_node_id.h" #include "content/public/browser/generated_code_cache_settings.h" #include "content/public/browser/interest_group_api_operation.h" #include "content/public/browser/interest_group_manager.h" @@ -1827,8 +1829,9 @@ // Note that a RenderFrameHost or RenderProcessHost aren't passed in because // these can change during a navigation (e.g. depending on redirects). virtual mojo::PendingRemote<network::mojom::URLLoaderFactory> - CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme, - int frame_tree_node_id); + CreateNonNetworkNavigationURLLoaderFactory( + const std::string& scheme, + FrameTreeNodeId frame_tree_node_id); using NonNetworkURLLoaderFactoryMap = std::map<std::string,
diff --git a/content/public/browser/dips_delegate.h b/content/public/browser/dips_delegate.h index 9bfbe97f..d9fd8b6 100644 --- a/content/public/browser/dips_delegate.h +++ b/content/public/browser/dips_delegate.h
@@ -5,10 +5,6 @@ #ifndef CONTENT_PUBLIC_BROWSER_DIPS_DELEGATE_H_ #define CONTENT_PUBLIC_BROWSER_DIPS_DELEGATE_H_ -#include <string> -#include <vector> - -#include "base/functional/callback_forward.h" #include "content/common/content_export.h" namespace content { @@ -23,18 +19,10 @@ // ContentBrowserClient::CreateDipsDelegate(). class CONTENT_EXPORT DipsDelegate { public: - using EngagedSitesCallback = - base::OnceCallback<void(std::vector<std::string>)>; - virtual ~DipsDelegate(); // DIPS will be enabled in browser contexts for which this returns true. virtual bool ShouldEnableDips(BrowserContext* browser_context) = 0; - - // On the first startup, GetEngagedSites() will be called and the DIPS - // Database will be prepopulated with the sites passed to `callback`. - virtual void GetEngagedSites(BrowserContext* browser_context, - EngagedSitesCallback callback) = 0; }; } // namespace content
diff --git a/content/public/browser/frame_tree_node_id.h b/content/public/browser/frame_tree_node_id.h new file mode 100644 index 0000000..ac9a8bb --- /dev/null +++ b/content/public/browser/frame_tree_node_id.h
@@ -0,0 +1,68 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_BROWSER_FRAME_TREE_NODE_ID_H_ +#define CONTENT_PUBLIC_BROWSER_FRAME_TREE_NODE_ID_H_ + +#include "base/types/id_type.h" + +namespace content { + +// A FrameTreeNode ID is a browser-global value that uniquely identifies a +// browser-side concept of a frame (a "FrameTreeNode") that hosts content. +// +// When the FrameTreeNode is removed, the ID is not reused. +// +// A FrameTreeNode can outlive its current RenderFrameHost, and may be +// associated with multiple RenderFrameHosts over time. This happens because +// some navigations require a "RenderFrameHost swap" which causes a new +// RenderFrameHost to be housed in the FrameTreeNode. For example, this happens +// for any cross-process navigation, since a RenderFrameHost is tied to a +// process. +// +// In the other direction, a RenderFrameHost can also transfer to a different +// FrameTreeNode! Prior to the advent of prerendered pages +// (content/browser/preloading/prerender/README.md), that was not true, and it +// could be assumed that the return value of +// RenderFrameHost::GetFrameTreeNodeId() was constant over the lifetime of the +// RenderFrameHost. But with prerender activations, the main frame of the +// prerendered page transfers to a new FrameTreeNode, so newer code should no +// longer make that assumption. This transfer only happens for main frames +// (currently only during a prerender activation navigation) and never happens +// for subframes. +// +// TODO(https://crbug.com/361344235): Remove this whole class and replace it +// with a simple using declaration: +// +// using FrameTreeNodeId = base::IdType<class FrameTreeNodeIdTag, +// int32_t, +// /*kInvalidValue=*/-1, +// /*kFirstGeneratedId=*/1, +// /*kExtraInvalidValues=*/0>; +// +class FrameTreeNodeId + : public base::IdType<class FrameTreeNodeId, int32_t, -1, 1, 0> { + public: + // Default-construct in the null state. The null state has an invalid value + // and will test `false` when converted to boolean. (Generation of new values + // is done with `FrameTreeNodeId::Generator`.) + constexpr FrameTreeNodeId() = default; + + // During the transition, allow implicit construction from int. + constexpr FrameTreeNodeId(int id) + : base::IdType<FrameTreeNodeId, int32_t, -1, 1, 0>(id) {} + + // During the transition, allow implicit construction from the IdType that + // this will become. + constexpr FrameTreeNodeId( + base::IdType<class FrameTreeNodeId, int32_t, -1, 1, 0> id) + : base::IdType<FrameTreeNodeId, int32_t, -1, 1, 0>(id.value()) {} + + // During the transition, allow implicit conversion to int. + constexpr operator const int&() const& { return value_; } +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_FRAME_TREE_NODE_ID_H_
diff --git a/content/public/browser/gpu_utils.cc b/content/public/browser/gpu_utils.cc index c6fcb37..751959d 100644 --- a/content/public/browser/gpu_utils.cc +++ b/content/public/browser/gpu_utils.cc
@@ -29,6 +29,7 @@ #include "media/media_buildflags.h" #include "third_party/blink/public/common/features.h" #include "ui/gfx/switches.h" +#include "ui/gl/gl_features.h" #if BUILDFLAG(IS_CHROMEOS_LACROS) #include "chromeos/startup/browser_params_proxy.h" @@ -82,7 +83,8 @@ !command_line->HasSwitch(switches::kDisableNv12DxgiVideo); #endif gpu_preferences.disable_software_rasterizer = - command_line->HasSwitch(switches::kDisableSoftwareRasterizer); + command_line->HasSwitch(switches::kDisableSoftwareRasterizer) || + !features::IsSwiftShaderAllowed(command_line); gpu_preferences.log_gpu_control_list_decisions = command_line->HasSwitch(switches::kLogGpuControlListDecisions); gpu_preferences.gpu_startup_dialog =
diff --git a/content/public/browser/navigation_controller.h b/content/public/browser/navigation_controller.h index 15a52f84..e770fad 100644 --- a/content/public/browser/navigation_controller.h +++ b/content/public/browser/navigation_controller.h
@@ -197,9 +197,9 @@ // Note the default value in constructor below. ui::PageTransition transition_type = ui::PAGE_TRANSITION_LINK; - // The browser-global FrameTreeNode ID for the frame to navigate, or - // RenderFrameHost::kNoFrameTreeNodeId for the main frame. - int frame_tree_node_id = RenderFrameHost::kNoFrameTreeNodeId; + // The browser-global FrameTreeNode ID for the frame to navigate, or the + // default-constructed invalid value to indicate the main frame. + FrameTreeNodeId frame_tree_node_id; // Referrer for this load. Empty if none. Referrer referrer;
diff --git a/content/public/browser/navigation_handle.h b/content/public/browser/navigation_handle.h index 1ab784e9..39be3ca 100644 --- a/content/public/browser/navigation_handle.h +++ b/content/public/browser/navigation_handle.h
@@ -13,6 +13,7 @@ #include "base/memory/safe_ref.h" #include "base/supports_user_data.h" #include "content/common/content_export.h" +#include "content/public/browser/frame_tree_node_id.h" #include "content/public/browser/frame_type.h" #include "content/public/browser/navigation_discard_reason.h" #include "content/public/browser/navigation_handle_timing.h" @@ -199,7 +200,7 @@ // navigation is committed into may later transfer to another FrameTreeNode. // See documentation for RenderFrameHost::GetFrameTreeNodeId() for more // details. - virtual int GetFrameTreeNodeId() = 0; + virtual FrameTreeNodeId GetFrameTreeNodeId() = 0; // Returns the RenderFrameHost for the parent frame, or nullptr if this // navigation is taking place in the main frame. This value will not change
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h index 3431457..da6ca6a 100644 --- a/content/public/browser/render_frame_host.h +++ b/content/public/browser/render_frame_host.h
@@ -19,6 +19,7 @@ #include "build/buildflag.h" #include "content/common/content_export.h" #include "content/public/browser/back_forward_cache.h" +#include "content/public/browser/frame_tree_node_id.h" #include "content/public/browser/web_exposed_isolation_level.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/extra_mojo_js_features.mojom.h" @@ -146,6 +147,7 @@ public: // Constant used to denote that a lookup of a FrameTreeNode ID has failed. + // TODO(https://crbug.com/361344235): Remove. enum { kNoFrameTreeNodeId = -1 }; // Returns the RenderFrameHost given its ID and the ID of its render process. @@ -169,12 +171,13 @@ // Returns the FrameTreeNode ID corresponding to the specified |process_id| // and |routing_id|. This routing ID pair may represent a placeholder for // frame that is currently rendered in a different process than |process_id|. - static int GetFrameTreeNodeIdForRoutingId(int process_id, int routing_id); + static FrameTreeNodeId GetFrameTreeNodeIdForRoutingId(int process_id, + int routing_id); // Returns the FrameTreeNode ID corresponding to the specified |process_id| // and |frame_token|. This routing ID pair may represent a placeholder for // frame that is currently rendered in a different process than |process_id|. - static int GetFrameTreeNodeIdForFrameToken( + static FrameTreeNodeId GetFrameTreeNodeIdForFrameToken( int process_id, const ::blink::FrameToken& frame_token); @@ -433,36 +436,14 @@ virtual void ForEachRenderFrameHost( base::FunctionRef<void(RenderFrameHost*)> on_frame) = 0; - // Returns the FrameTreeNode ID associated with this RenderFrameHost. This ID - // is browser-global and uniquely identifies a browser-side concept of a frame - // (a "FrameTreeNode") that hosts content. - // - // When the FrameTreeNode is removed, the ID is not used again. - // - // A FrameTreeNode can outlive its current RenderFrameHost, and may be - // associated with multiple RenderFrameHosts over time. This happens because - // some navigations require a "RenderFrameHost swap" which causes a new - // RenderFrameHost to be housed in the FrameTreeNode. For example, this - // happens for any cross-process navigation, since a RenderFrameHost is tied - // to a process. - // - // In the other direction, a RenderFrameHost can also transfer to a different - // FrameTreeNode! Prior to the advent of prerendered pages - // (content/browser/preloading/prerender/README.md), that was not true, and it - // could be assumed that the return value of - // RenderFrameHost::GetFrameTreeNodeId() was constant over the lifetime of the - // RenderFrameHost. But with prerender activations, the main frame of the - // prerendered page transfers to a new FrameTreeNode, so newer code should no - // longer make that assumption. This transfer only happens for main frames - // (currently only during a prerender activation navigation) and never happens - // for subframes. + // Returns the FrameTreeNode ID associated with this RenderFrameHost. // // If a stable identifier is needed, GetGlobalId() always refers to this // RenderFrameHost, while this RenderFrameHost might host multiple documents // over its lifetime, and this RenderFrameHost might have a shorter lifetime // than the frame hosting content, as explained above. For associating data // with a single document, DocumentUserData can be used. - virtual int GetFrameTreeNodeId() const = 0; + virtual FrameTreeNodeId GetFrameTreeNodeId() const = 0; // Used for devtools instrumentation and trace-ability. The token is // propagated to Blink's LocalFrame and both Blink and content/
diff --git a/content/public/test/mock_navigation_handle.h b/content/public/test/mock_navigation_handle.h index a9ef9b6..17788c2 100644 --- a/content/public/test/mock_navigation_handle.h +++ b/content/public/test/mock_navigation_handle.h
@@ -83,7 +83,7 @@ bool IsInOutermostMainFrame() override { return !GetParentFrameOrOuterDocument(); } - MOCK_METHOD0(GetFrameTreeNodeId, int()); + MOCK_METHOD0(GetFrameTreeNodeId, FrameTreeNodeId()); MOCK_METHOD0(GetPreviousRenderFrameHostId, GlobalRenderFrameHostId()); MOCK_METHOD(int, GetExpectedRenderProcessHostId, ()); bool IsServedFromBackForwardCache() override {
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 41fc6a5..620346c 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -2501,7 +2501,6 @@ "../browser/file_system_access/file_system_access_handle_base_unittest.cc", "../browser/file_system_access/file_system_access_lock_manager_unittest.cc", "../browser/file_system_access/file_system_access_manager_impl_unittest.cc", - "../browser/file_system_access/file_system_access_observer_observation_unittest.cc", "../browser/file_system_access/file_system_access_safe_move_helper_unittest.cc", "../browser/file_system_access/file_system_access_watch_scope_unittest.cc", "../browser/file_system_access/file_system_access_watcher_manager_unittest.cc", @@ -2983,6 +2982,10 @@ [ "../browser/media/web_app_system_media_controls_manager_unittest.cc" ] } + if (is_win || is_mac || is_linux || is_chromeos) { + sources += [ "../browser/file_system_access/file_system_access_observer_observation_unittest.cc" ] + } + if (is_android || is_linux || is_chromeos || is_mac || is_win || is_fuchsia) { data = [ "$root_out_dir/content_shell.pak",
diff --git a/content/test/gpu/gpu_tests/context_lost_integration_test.py b/content/test/gpu/gpu_tests/context_lost_integration_test.py index 06a9b6f..0ed4397 100644 --- a/content/test/gpu/gpu_tests/context_lost_integration_test.py +++ b/content/test/gpu/gpu_tests/context_lost_integration_test.py
@@ -721,8 +721,9 @@ if not self.IsDualGPUMacLaptop(): logging.info('Skipping test because not running on dual-GPU Mac laptop') self.skipTest('Not running on dual-GPU Mac laptop') - self.RestartBrowserIfNecessaryWithArgs( - [cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS]) + self.RestartBrowserIfNecessaryWithArgs([ + cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS, '--enable-unsafe-swiftshader' + ]) active_vendor_id = self._GetActiveVendorId(False) # Load WebGL content and switch to discrete GPU. self._NavigateAndWaitForLoad(test_path)
diff --git a/content/test/gpu/gpu_tests/gpu_process_integration_test.py b/content/test/gpu/gpu_tests/gpu_process_integration_test.py index 2aa5ade..bd4be04 100644 --- a/content/test/gpu/gpu_tests/gpu_process_integration_test.py +++ b/content/test/gpu/gpu_tests/gpu_process_integration_test.py
@@ -120,6 +120,8 @@ ('GpuProcess_mac_webgl_terminated_high_performance', 'gpu/functional_blank.html'), ('GpuProcess_swiftshader_for_webgl', 'gpu/functional_webgl.html'), + ('GpuProcess_no_swiftshader_for_webgl_without_flags', + 'gpu/functional_webgl.html'), ('GpuProcess_webgl_disabled_extension', 'gpu/functional_webgl_disabled_extension.html'), ('GpuProcess_webgpu_iframe_removed', 'gpu/webgpu-iframe-removed.html'), @@ -311,7 +313,8 @@ def _GpuProcess_feature_status_under_swiftshader(self, test_path: str) -> None: # Hit test group 2 with entry 153 from kSoftwareRenderingListEntries. - self.RestartBrowserIfNecessaryWithArgs(['--gpu-blocklist-test-group=2']) + self.RestartBrowserIfNecessaryWithArgs( + ['--gpu-blocklist-test-group=2', '--enable-unsafe-swiftshader']) self._Navigate(test_path) feature_status_list = _GetBrowserBridgeProperty( self.tab, 'gpuInfo.featureStatus.featureStatus') @@ -472,9 +475,9 @@ # attempt to use an API which would start the GPU process. args_list = ( # Triggering test_group 2 where WebGL is blocklisted. - ['--gpu-blocklist-test-group=2'], + ['--gpu-blocklist-test-group=2', '--enable-unsafe-swiftshader'], # Explicitly disable GPU access. - [cba.DISABLE_GPU]) + [cba.DISABLE_GPU, '--enable-unsafe-swiftshader']) for args in args_list: self.RestartBrowserIfNecessaryWithArgs(args) self._NavigateAndWait(test_path) @@ -523,6 +526,48 @@ if tab.EvaluateJavaScript('!gl_context.getExtension("' + ext + '")'): self.fail('Expected %s support' % ext) + def _GpuProcess_no_swiftshader_for_webgl_without_flags( + self, test_path: str) -> None: + # This test loads functional_webgl.html with GPU disabled and verifies that + # SwiftShader is not available without the --enable-unsafe-swiftshader flag + # or AllowSwiftShaderFallback killswitch. + # Because AllowSwiftShaderFallback is currently enabled by default, disable + # it to test the upcoming default behavior + disable_hardware_webgl_args_list = [ + # Triggering test_group 2 where WebGL is blocklisted. + ['--gpu-blocklist-test-group=2'], + # Explicitly disable GPU access. + [cba.DISABLE_GPU], + ] + disable_swiftshader_fallback_feature = [ + '--disable-features=AllowSwiftShaderFallback' + ] + allow_swiftshader_args_list = [ + ['--enable-unsafe-swiftshader'], + ['--use-gl=angle', '--use-angle=swiftshader'], + ['--enable-features=AllowSwiftShaderFallback'] + ] + for disable_hardware_webgl_args in disable_hardware_webgl_args_list: + self.RestartBrowserIfNecessaryWithArgs( + disable_hardware_webgl_args + disable_swiftshader_fallback_feature) + self._NavigateAndWait(test_path) + + renderer = self.tab.EvaluateJavaScript('gl_renderer') + if renderer: + self.fail('Expected no WebGL renderer; instead got ' + renderer) + + for allow_swiftshader_args in allow_swiftshader_args_list: + self.RestartBrowserIfNecessaryWithArgs(disable_hardware_webgl_args + + allow_swiftshader_args) + self._NavigateAndWait(test_path) + + # Validate the WebGL unmasked renderer string. + renderer = self.tab.EvaluateJavaScript('gl_renderer') + if not renderer: + self.fail('getParameter(UNMASKED_RENDERER_WEBGL) was null') + if 'SwiftShader' not in renderer: + self.fail('Expected SwiftShader renderer; instead got ' + renderer) + def _GpuProcess_webgl_disabled_extension(self, test_path: str) -> None: # Hit exception from id 257 from kGpuDriverBugListEntries. self.RestartBrowserIfNecessaryWithArgs([
diff --git a/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt index c0c36051..141d3af7 100644 --- a/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/gpu_process_expectations.txt
@@ -106,18 +106,15 @@ # Android and Fuchsia do not support software fallback. [ android ] GpuProcess_disable_gpu [ Skip ] [ android ] GpuProcess_disable_gpu_and_swiftshader [ Skip ] +[ android ] GpuProcess_no_swiftshader_for_webgl_without_flags [ Skip ] [ android ] GpuProcess_feature_status_under_swiftshader [ Skip ] [ android ] GpuProcess_swiftshader_for_webgl [ Skip ] [ fuchsia ] GpuProcess_disable_gpu [ Skip ] [ fuchsia ] GpuProcess_disable_gpu_and_swiftshader [ Skip ] +[ fuchsia ] GpuProcess_no_swiftshader_for_webgl_without_flags [ Skip ] [ fuchsia ] GpuProcess_feature_status_under_swiftshader [ Skip ] [ fuchsia ] GpuProcess_swiftshader_for_webgl [ Skip ] -# SwiftShader is not supported on arm64. -[ win qualcomm-0x41333430 ] GpuProcess_swiftshader_for_webgl [ Skip ] -[ win qualcomm-0x36333630 ] GpuProcess_swiftshader_for_webgl [ Skip ] -[ win qualcomm-0x36334330 ] GpuProcess_swiftshader_for_webgl [ Skip ] - # Software Compositing is not supported on ChromeOS. crbug.com/1084796 [ chromeos ] GpuProcess_readback_webgl_gpu_process [ Skip ] @@ -136,13 +133,11 @@ # SwiftShader GL does not work on CrOS, wait for it to be replaced by SwANGLE. crbug.com/1084794 [ chromeos ] GpuProcess_feature_status_under_swiftshader [ Skip ] crbug.com/1084794 [ chromeos ] GpuProcess_swiftshader_for_webgl [ Skip ] +crbug.com/1084794 [ chromeos ] GpuProcess_no_swiftshader_for_webgl_without_flags [ Skip ] # Seems to kill the system UI/otherwise make the device unusable. crbug.com/1294065 [ android android-shield-android-tv ] GpuProcess_visibility [ Skip ] -# SwiftShader is disabled on Mac M1 -crbug.com/1378476 [ mac mac-arm64 ] GpuProcess_swiftshader_for_webgl [ Skip ] - ################### # Failures/Flakes # ###################
diff --git a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt index 2e4a8b72..3bf5f58 100644 --- a/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/pixel_expectations.txt
@@ -337,6 +337,9 @@ # Nexus 5x consistently fail for View transition capture on webview. crbug.com/349071740 [ android-webview-instrumentation android-nexus-5x ] Pixel_ViewTransitionsCapture [ Failure ] +# Flaky timeout on Linux +crbug.com/364179193 [ linux ] Pixel_Video_Media_Stream_Incompatible_Stride [ Skip ] + ############################### # Permanent Slow Expectations # ###############################
diff --git a/content/test/gpu/gpu_tests/test_expectations/trace_test_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/trace_test_expectations.txt index 930fd1f8..ce52f5f0 100644 --- a/content/test/gpu/gpu_tests/test_expectations/trace_test_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/trace_test_expectations.txt
@@ -180,6 +180,8 @@ crbug.com/40145992 [ win nvidia ] TraceTest_MediaFoundationD3D11VideoCapture [ Skip ] crbug.com/40145992 [ win qualcomm ] TraceTest_MediaFoundationD3D11VideoCapture [ Skip ] +crbug.com/364179193 [ linux ] TraceTest_Video_Media_Stream_Incompatible_Stride [ Skip ] + ################### # Failures/Flakes # ###################
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt index 3487b15..8001e55 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt
@@ -367,9 +367,6 @@ # Skip test that breaks subsequent tests. crbug.com/1043953 [ chromeos chromeos-board-amd64-generic ] conformance/textures/misc/texture-size-limit.html [ Skip ] -# SwiftShader is disabled on Mac M1 -crbug.com/1378476 [ mac mac-arm64 angle-swiftshader ] conformance/rendering/gl-drawelements.html [ Skip ] - # Old hardware + use of validating decoder. Can be removed once the validating # decoder has been unshipped on Mac. crbug.com/1321312 [ mac nvidia-0xfe9 no-passthrough ] conformance/glsl/bugs/gl-fragcoord-multisampling-bug.html [ Skip ]
diff --git a/content/test/gpu/gpu_tests/trace_integration_test.py b/content/test/gpu/gpu_tests/trace_integration_test.py index 560d167..6e3fa82 100644 --- a/content/test/gpu/gpu_tests/trace_integration_test.py +++ b/content/test/gpu/gpu_tests/trace_integration_test.py
@@ -278,11 +278,6 @@ def _GetSerialTests(self) -> Set[str]: serial_tests = set() - if host_information.IsLinux(): - serial_tests |= { - # crbug.com/357559355 - 'TraceTest_Video_Media_Stream_Incompatible_Stride', - } if host_information.IsMac(): serial_tests |= { # Flaky when run in parallel on Mac.
diff --git a/device/fido/features.cc b/device/fido/features.cc index 1e35918..2a27a64e0 100644 --- a/device/fido/features.cc +++ b/device/fido/features.cc
@@ -105,16 +105,6 @@ "WebAuthenticationRelatedOrigin", base::FEATURE_ENABLED_BY_DEFAULT); -// Enabled in M122. Remove in or after M125. -BASE_FEATURE(kAllowExtensionsToSetWebAuthnRpIds, - "AllowExtensionsToSetWebAuthnRpIds", - base::FEATURE_ENABLED_BY_DEFAULT); - -// Default enabled in M123. Remove in or after M126. -BASE_FEATURE(kWebAuthnPreferVirtualPlatformAuthenticator, - "WebAuthenticationPreferVirtualPlatformAuthenticator", - base::FEATURE_ENABLED_BY_DEFAULT); - // Deprecation flag. // Default disabled in M125. Remove in or after M128. BASE_FEATURE(kWebAuthnEnableAndroidCableAuthenticator,
diff --git a/device/fido/features.h b/device/fido/features.h index 8a9514e..9b7bccb 100644 --- a/device/fido/features.h +++ b/device/fido/features.h
@@ -80,17 +80,6 @@ COMPONENT_EXPORT(DEVICE_FIDO) BASE_DECLARE_FEATURE(kWebAuthnRelatedOrigin); -// Allow extensions to assert WebAuthn relying party identifiers for domains -// they have host permissions for. -// Added in M121. Remove in or after M124. -COMPONENT_EXPORT(DEVICE_FIDO) -BASE_DECLARE_FEATURE(kAllowExtensionsToSetWebAuthnRpIds); - -// Prefer dispatching to a platform (i.e. internal transport) virtual -// authenticator if available. -COMPONENT_EXPORT(DEVICE_FIDO) -BASE_DECLARE_FEATURE(kWebAuthnPreferVirtualPlatformAuthenticator); - // Enable the Chrome Android cable authenticator. This lets a Chrome module // handle cable requests from scanning a QR code, tapping on an FCM // notification, or coming from Play Services. The Chrome Android cable
diff --git a/docs/chrome_browser_design_principles.md b/docs/chrome_browser_design_principles.md index 16c42b89..ecad4c0 100644 --- a/docs/chrome_browser_design_principles.md +++ b/docs/chrome_browser_design_principles.md
@@ -275,6 +275,11 @@ flag (e.g. `BUILDFLAG(ENABLE_EXTENSIONS)`) to glue this into the main source is allowed. The glue code should be kept to a minimum. * Avoid run-time channel checking. +* Macros are rarely appropriate. See google [style + guide](https://google.github.io/styleguide/cppguide.html#Preprocessor_Macros) + * As a rule of thumb, the macros themselves should not contain conditional + logic. Macros should not be triply (or more deeply) nested. When in doubt, + ask a member of //chrome/OWNERS. * Avoid test only conditionals * This was historically common in unit_tests, because it was not possible to stub out dependencies due to lack of a clear API surface. By requiring
diff --git a/docs/gpu/swiftshader.md b/docs/gpu/swiftshader.md index 703bb2b1..f42d41e 100644 --- a/docs/gpu/swiftshader.md +++ b/docs/gpu/swiftshader.md
@@ -2,7 +2,7 @@ SwiftShader is an open-source high-performance implementation of the Vulkan and OpenGL ES graphics APIs which runs purely on the CPU. Thus no graphics processor (GPU) is required for advanced (3D) graphics. -Chromium uses SwiftShader in two different ways: +When requested, Chromium uses SwiftShader in two different ways: 1) **As the OpenGL ES driver** @@ -12,12 +12,27 @@ When Chromium uses SwiftShader as the WebGL fallback, Chromium runs in all software mode and only uses SwiftShader to render WebGL content. +## Automatic SwiftShader WebGL fallback is deprecated + +Allowing automatic fallback to WebGL backed by SwiftShader has been deprecated and WebGL context creation will soon fail instead of falling back to SwiftShader. This was done for two primary reasons: +1) SwiftShader is a high security risk due to JIT-ed code running in Chromium's GPU process. +2) Users have a poor experience when falling back from a high-performance GPU-backed WebGL to a CPU-backed implementation. Users have no control over this behavior and it is difficult to describe in bug reports. + +SwiftShader is a useful tool for web developers to test their sites on systems that are headless or do not have a supported GPU. This use case will still be supported by opting in but is not intended for running untrusted content. + +To opt-in to lower security guarantees and allow SwiftShader for WebGL, run the **chrome** executable with the following command line switch: +>**\-\-enable-unsafe-swiftshader** + +During the deprecation period, a warning will appear in the javascript console when a WebGL context is created and backed with SwiftShader. Passing **\-\-enable-unsafe-swiftshader** will remove this warning message. + +Chromium and other browsers do not guarantee WebGL availability. Please test and handle WebGL context creation failure and fall back to other web APIs such as Canvas2D or an appropriate message to the user. + ## Relevant Chromium command line switches When running the **chrome** executable from the command line, SwiftShader can be enabled using the following Switches: 1) As the OpenGL ES driver, SwANGLE (ANGLE + SwiftShader Vulkan) >**\-\-use-gl=angle \-\-use-angle=swiftshader** -2) As the WebGL fallback, SwANGLE (ANGLE + SwiftShader Vulkan) ->**\-\-use-gl=angle \-\-use-angle=swiftshader-webgl** +2) As the **unsafe** WebGL fallback, SwANGLE (ANGLE + SwiftShader Vulkan) +>**\-\-use-gl=angle \-\-use-angle=swiftshader-webgl \-\-enable-unsafe-swiftshader*** 3) As the Vulkan driver (requires the [enable_swiftshader_vulkan](https://source.chromium.org/chromium/chromium/src/+/main:gpu/vulkan/features.gni;l=16) feature) >**--use-vulkan=swiftshader**
diff --git a/extensions/browser/extension_api_frame_id_map.cc b/extensions/browser/extension_api_frame_id_map.cc index b8cca9c..05df88b 100644 --- a/extensions/browser/extension_api_frame_id_map.cc +++ b/extensions/browser/extension_api_frame_id_map.cc
@@ -95,7 +95,7 @@ content::NavigationHandle* navigation_handle) { return navigation_handle->IsInPrimaryMainFrame() ? kTopFrameId - : navigation_handle->GetFrameTreeNodeId(); + : navigation_handle->GetFrameTreeNodeId().value(); } // static
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index 70b543616..abb845c 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1959,6 +1959,8 @@ ACCESSIBILITY_PRIVATE_SCROLLATPOINT = 1897, STORAGE_GETKEYS = 1898, ACCESSIBILITY_PRIVATE_SENDGESTUREINFOTOSETTINGS = 1899, + ENTERPRISEREPORTINGPRIVATE_REPORTDATAMASKINGEVENT = 1900, + // Last entry: Add new entries above, then run: // tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/common/extension_features.cc b/extensions/common/extension_features.cc index 129c9475..d99cedc 100644 --- a/extensions/common/extension_features.cc +++ b/extensions/common/extension_features.cc
@@ -39,6 +39,10 @@ "RestrictFileURLNavigation", base::FEATURE_ENABLED_BY_DEFAULT); +BASE_FEATURE(kApiEnterpriseReportingPrivateReportDataMaskingEvent, + "ApiEnterpriseReportingPrivateReportDataMaskingEvent", + base::FEATURE_DISABLED_BY_DEFAULT); + /////////////////////////////////////////////////////////////////////////////// // Other Features ///////////////////////////////////////////////////////////////////////////////
diff --git a/extensions/common/extension_features.h b/extensions/common/extension_features.h index 9a74e92..ca11abe 100644 --- a/extensions/common/extension_features.h +++ b/extensions/common/extension_features.h
@@ -59,6 +59,10 @@ // Controls the availability of navigation to file URLs. BASE_DECLARE_FEATURE(kRestrictFileURLNavigation); +// If enabled, allows using the +// `enterprise.reportingPrivate.reportDataMaskingEvent` API. +BASE_DECLARE_FEATURE(kApiEnterpriseReportingPrivateReportDataMaskingEvent); + /////////////////////////////////////////////////////////////////////////////// // Other Features ///////////////////////////////////////////////////////////////////////////////
diff --git a/extensions/common/features/feature_flags.cc b/extensions/common/features/feature_flags.cc index 301afe0..24804a1d 100644 --- a/extensions/common/features/feature_flags.cc +++ b/extensions/common/features/feature_flags.cc
@@ -28,6 +28,7 @@ &extensions_features::kApiOdfsConfigPrivate, &extensions_features::kExtensionIconVariants, &extensions_features::kTelemetryExtensionPendingApprovalApi, + &extensions_features::kApiEnterpriseReportingPrivateReportDataMaskingEvent, }; constinit base::span<const base::Feature*> g_feature_flags_test_override;
diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc index 87906a7..ab64eeb4 100644 --- a/extensions/shell/browser/shell_content_browser_client.cc +++ b/extensions/shell/browser/shell_content_browser_client.cc
@@ -272,7 +272,7 @@ mojo::PendingRemote<network::mojom::URLLoaderFactory> ShellContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory( const std::string& scheme, - int frame_tree_node_id) { + content::FrameTreeNodeId frame_tree_node_id) { if (scheme == extensions::kExtensionScheme) { content::WebContents* web_contents = content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
diff --git a/extensions/shell/browser/shell_content_browser_client.h b/extensions/shell/browser/shell_content_browser_client.h index 62f20799..5963da9 100644 --- a/extensions/shell/browser/shell_content_browser_client.h +++ b/extensions/shell/browser/shell_content_browser_client.h
@@ -94,8 +94,9 @@ std::unique_ptr<content::NavigationUIData> GetNavigationUIData( content::NavigationHandle* navigation_handle) override; mojo::PendingRemote<network::mojom::URLLoaderFactory> - CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme, - int frame_tree_node_id) override; + CreateNonNetworkNavigationURLLoaderFactory( + const std::string& scheme, + content::FrameTreeNodeId frame_tree_node_id) override; void RegisterNonNetworkWorkerMainResourceURLLoaderFactories( content::BrowserContext* browser_context, NonNetworkURLLoaderFactoryMap* factories) override;
diff --git a/fuchsia_web/webengine/browser/web_engine_content_browser_client.cc b/fuchsia_web/webengine/browser/web_engine_content_browser_client.cc index aeabd4b..336d6b2 100644 --- a/fuchsia_web/webengine/browser/web_engine_content_browser_client.cc +++ b/fuchsia_web/webengine/browser/web_engine_content_browser_client.cc
@@ -225,7 +225,7 @@ mojo::PendingRemote<network::mojom::URLLoaderFactory> WebEngineContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory( const std::string& scheme, - int frame_tree_node_id) { + content::FrameTreeNodeId frame_tree_node_id) { if (scheme == kFuchsiaDirScheme) { if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableContentDirectories)) {
diff --git a/fuchsia_web/webengine/browser/web_engine_content_browser_client.h b/fuchsia_web/webengine/browser/web_engine_content_browser_client.h index d32b7b0..b9f4c279 100644 --- a/fuchsia_web/webengine/browser/web_engine_content_browser_client.h +++ b/fuchsia_web/webengine/browser/web_engine_content_browser_client.h
@@ -39,8 +39,9 @@ content::RenderFrameHost* render_frame_host, mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override; mojo::PendingRemote<network::mojom::URLLoaderFactory> - CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme, - int frame_tree_node_id) override; + CreateNonNetworkNavigationURLLoaderFactory( + const std::string& scheme, + content::FrameTreeNodeId frame_tree_node_id) override; void RegisterNonNetworkSubresourceURLLoaderFactories( int render_process_id, int render_frame_id,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc index 3148d52..21b55f1 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
@@ -1041,6 +1041,19 @@ ui::GpuSwitchingManager::GetInstance()->AddObserver(this); } + // Deprecation warning for SwiftShader WebGL fallback + if (feature_info_->IsWebGLContext() && + gl::GetANGLEImplementation() == gl::ANGLEImplementation::kSwiftShader && + !base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableUnsafeSwiftShader)) { + constexpr const char* kSwiftShaderFallbackDeprcationMessage = + "Automatic fallback to software WebGL has been deprecated. Please use " + "the --enable-unsafe-swiftshader flag to opt in to lower security " + "guarantees for trusted content."; + logger_.LogMessage(__FILE__, __LINE__, + kSwiftShaderFallbackDeprcationMessage); + } + set_initialized(); return gpu::ContextResult::kSuccess; }
diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc index 3f1d5830..d6a47081 100644 --- a/gpu/config/gpu_finch_features.cc +++ b/gpu/config/gpu_finch_features.cc
@@ -163,7 +163,7 @@ "CanvasOopRasterization", #if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_WIN) || \ (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) base::FEATURE_ENABLED_BY_DEFAULT #else base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/gpu/ipc/client/client_shared_image_interface.cc b/gpu/ipc/client/client_shared_image_interface.cc index 647645d..ec49933 100644 --- a/gpu/ipc/client/client_shared_image_interface.cc +++ b/gpu/ipc/client/client_shared_image_interface.cc
@@ -96,9 +96,10 @@ DCHECK_EQ(surface_handle, kNullSurfaceHandle); DCHECK(gpu::IsValidClientUsage(si_info.meta.usage)) << uint32_t(si_info.meta.usage); + auto mailbox = proxy_->CreateSharedImage(si_info); return base::MakeRefCounted<ClientSharedImage>( - AddMailbox(proxy_->CreateSharedImage(si_info)), si_info.meta, - GenUnverifiedSyncToken(), holder_, gfx::EMPTY_BUFFER); + AddMailbox(mailbox), si_info.meta, GenUnverifiedSyncToken(), holder_, + gfx::EMPTY_BUFFER); } scoped_refptr<ClientSharedImage> ClientSharedImageInterface::CreateSharedImage( @@ -167,9 +168,9 @@ << si_info.meta.format.ToString(); #endif auto client_buffer_handle = buffer_handle.Clone(); + auto mailbox = proxy_->CreateSharedImage(si_info, std::move(buffer_handle)); return base::MakeRefCounted<ClientSharedImage>( - AddMailbox(proxy_->CreateSharedImage(si_info, std::move(buffer_handle))), - si_info.meta, GenUnverifiedSyncToken(), + AddMailbox(mailbox), si_info.meta, GenUnverifiedSyncToken(), GpuMemoryBufferHandleInfo(std::move(client_buffer_handle), si_info.meta.format, si_info.meta.size, buffer_usage), @@ -190,9 +191,10 @@ << si_info.meta.format.ToString(); #endif auto buffer_handle_type = buffer_handle.type; + auto mailbox = proxy_->CreateSharedImage(si_info, std::move(buffer_handle)); return base::MakeRefCounted<ClientSharedImage>( - AddMailbox(proxy_->CreateSharedImage(si_info, std::move(buffer_handle))), - si_info.meta, GenUnverifiedSyncToken(), holder_, buffer_handle_type); + AddMailbox(mailbox), si_info.meta, GenUnverifiedSyncToken(), holder_, + buffer_handle_type); } SharedImageInterface::SharedImageMapping @@ -238,9 +240,9 @@ gfx::RowSizeForBufferFormat(si_info.meta.size.width(), buffer_format, 0)); handle.region = std::move(shared_memory_region); + auto mailbox = proxy_->CreateSharedImage(si_info, std::move(handle)); shared_image_mapping.shared_image = base::MakeRefCounted<ClientSharedImage>( - AddMailbox(proxy_->CreateSharedImage(si_info, std::move(handle))), - si_info.meta, GenUnverifiedSyncToken(), holder_, + AddMailbox(mailbox), si_info.meta, GenUnverifiedSyncToken(), holder_, gfx::SHARED_MEMORY_BUFFER); return shared_image_mapping; }
diff --git a/infra/config/generated/builder-owners/chrome-memory-safety-team@google.com.txt b/infra/config/generated/builder-owners/chrome-memory-safety-team@google.com.txt index 1e66f5a..ba7c55d 100644 --- a/infra/config/generated/builder-owners/chrome-memory-safety-team@google.com.txt +++ b/infra/config/generated/builder-owners/chrome-memory-safety-team@google.com.txt
@@ -1 +1,2 @@ -ci/linux-codeql-generator \ No newline at end of file +ci/linux-codeql-generator +ci/linux-codeql-query-runner \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/android-binary-size-generator/gn-args.json b/infra/config/generated/builders/ci/android-binary-size-generator/gn-args.json index 842a24b2..eeed677b 100644 --- a/infra/config/generated/builders/ci/android-binary-size-generator/gn-args.json +++ b/infra/config/generated/builders/ci/android-binary-size-generator/gn-args.json
@@ -1,7 +1,6 @@ { "gn_args": { "android_channel": "stable", - "chrome_pgo_phase": 0, "debuggable_apks": false, "ffmpeg_branding": "Chrome", "is_high_end_android_secondary_toolchain": false,
diff --git a/infra/config/generated/builders/try/android-binary-size/gn-args.json b/infra/config/generated/builders/try/android-binary-size/gn-args.json index 842a24b2..eeed677b 100644 --- a/infra/config/generated/builders/try/android-binary-size/gn-args.json +++ b/infra/config/generated/builders/try/android-binary-size/gn-args.json
@@ -1,7 +1,6 @@ { "gn_args": { "android_channel": "stable", - "chrome_pgo_phase": 0, "debuggable_apks": false, "ffmpeg_branding": "Chrome", "is_high_end_android_secondary_toolchain": false,
diff --git a/infra/config/generated/builders/try/android_cronet/properties.json b/infra/config/generated/builders/try/android_cronet/properties.json index 7128f21..bac8ba0 100644 --- a/infra/config/generated/builders/try/android_cronet/properties.json +++ b/infra/config/generated/builders/try/android_cronet/properties.json
@@ -50,10 +50,6 @@ "targets_spec_directory": "src/infra/config/generated/builders/try/android_cronet/targets" } }, - "$build/flakiness": { - "check_for_flakiness": true, - "check_for_flakiness_with_resultdb": true - }, "$build/reclient": { "instance": "rbe-chromium-untrusted", "metrics_project": "chromium-reclient-metrics", @@ -77,6 +73,5 @@ ] }, "builder_group": "tryserver.chromium.android", - "cq": "required", "recipe": "chromium_trybot" } \ No newline at end of file
diff --git a/infra/config/generated/cq-builders.md b/infra/config/generated/cq-builders.md index 32cba39..bf9164eb 100644 --- a/infra/config/generated/cq-builders.md +++ b/infra/config/generated/cq-builders.md
@@ -27,6 +27,8 @@ * [android-binary-size](https://ci.chromium.org/p/chromium/builders/try/android-binary-size) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""android-binary-size"")) +* [android-cronet-arm-rel](https://ci.chromium.org/p/chromium/builders/try/android-cronet-arm-rel) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""android-cronet-arm-rel"")) + * [android-x64-cast](https://ci.chromium.org/p/chromium/builders/try/android-x64-cast) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""android-x64-cast"")) * [android-x64-rel](https://ci.chromium.org/p/chromium/builders/try/android-x64-rel) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""android-x64-rel"")) @@ -35,8 +37,6 @@ * [android_compile_dbg](https://ci.chromium.org/p/chromium/builders/try/android_compile_dbg) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""android_compile_dbg"")) -* [android_cronet](https://ci.chromium.org/p/chromium/builders/try/android_cronet) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""android_cronet"")) - * [chromeos-amd64-generic-rel-gtest](https://ci.chromium.org/p/chromium/builders/try/chromeos-amd64-generic-rel-gtest) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""chromeos-amd64-generic-rel-gtest"")) * Replaced with builder: [chromeos-amd64-generic-rel-gtest-and-tast](https://ci.chromium.org/p/chromium/builders/try/chromeos-amd64-generic-rel-gtest-and-tast) when CL owner is in group [google/chromeos-pa@google.com](https://chrome-infra-auth.appspot.com/auth/lookup?p=google/chromeos-pa@google.com) @@ -691,9 +691,6 @@ as required builders. ### chromium -* [android-cronet-arm-rel](https://ci.chromium.org/p/chromium/builders/try/android-cronet-arm-rel) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""android-cronet-arm-rel"")) - * Experiment percentage: 100.0 - * [android-cronet-x86-dbg-lollipop-fyi-tests](https://ci.chromium.org/p/chromium/builders/try/android-cronet-x86-dbg-lollipop-fyi-tests) ([definition](https://cs.chromium.org/search?q=+file:/try/.*\.star$+""android-cronet-x86-dbg-lollipop-fyi-tests"")) * Experiment percentage: 100.0
diff --git a/infra/config/generated/cq-usage/default.cfg b/infra/config/generated/cq-usage/default.cfg index cfa14bcb..a3f1740 100644 --- a/infra/config/generated/cq-usage/default.cfg +++ b/infra/config/generated/cq-usage/default.cfg
@@ -28,6 +28,9 @@ name: "chromium/try/android-binary-size" } builders { + name: "chromium/try/android-cronet-arm-rel" + } + builders { name: "chromium/try/android-x64-cast" } builders { @@ -40,9 +43,6 @@ name: "chromium/try/android_compile_dbg" } builders { - name: "chromium/try/android_cronet" - } - builders { name: "chromium/try/chromeos-amd64-generic-rel-gtest" } builders {
diff --git a/infra/config/generated/cq-usage/full.cfg b/infra/config/generated/cq-usage/full.cfg index 4bdb3a3..2c12157e 100644 --- a/infra/config/generated/cq-usage/full.cfg +++ b/infra/config/generated/cq-usage/full.cfg
@@ -193,6 +193,29 @@ } } builders { + name: "chromium/try/android-cronet-arm-rel" + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" + gerrit_ref_regexp: ".*" + path_regexp: "infra/config/.+" + exclude: true + } + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" + gerrit_ref_regexp: ".*" + path_regexp: "docs/.+" + exclude: true + } + location_filters { + gerrit_host_regexp: ".*" + gerrit_project_regexp: ".*" + gerrit_ref_regexp: ".*" + path_regexp: "infra/config/generated/builders/try/android-cronet-arm-rel/.+" + } + } + builders { name: "chromium/try/android-cronet-x64-dbg-14-tests" location_filters { gerrit_host_regexp: ".*" @@ -801,29 +824,6 @@ } } builders { - name: "chromium/try/android_cronet" - location_filters { - gerrit_host_regexp: ".*" - gerrit_project_regexp: ".*" - gerrit_ref_regexp: ".*" - path_regexp: "infra/config/.+" - exclude: true - } - location_filters { - gerrit_host_regexp: ".*" - gerrit_project_regexp: ".*" - gerrit_ref_regexp: ".*" - path_regexp: "docs/.+" - exclude: true - } - location_filters { - gerrit_host_regexp: ".*" - gerrit_project_regexp: ".*" - gerrit_ref_regexp: ".*" - path_regexp: "infra/config/generated/builders/try/android_cronet/.+" - } - } - builders { name: "chromium/try/android_optional_gpu_tests_rel" location_filters { gerrit_host_regexp: ".*"
diff --git a/infra/config/generated/health-specs/health-specs.json b/infra/config/generated/health-specs/health-specs.json index 61af1cb..cae96c35 100644 --- a/infra/config/generated/health-specs/health-specs.json +++ b/infra/config/generated/health-specs/health-specs.json
@@ -10013,6 +10013,27 @@ } ] }, + "linux-codeql-query-runner": { + "contact_team_email": "chrome-memory-safety-team@google.com", + "problem_specs": [ + { + "name": "Unhealthy", + "period_days": 7, + "score": 5, + "thresholds": { + "_default": "_default" + } + }, + { + "name": "Low Value", + "period_days": 90, + "score": 1, + "thresholds": { + "_default": "_default" + } + } + ] + }, "linux-enterprise-companion-builder-dbg": { "contact_team_email": "omaha-client-dev@google.com", "problem_specs": [
diff --git a/infra/config/generated/luci/commit-queue.cfg b/infra/config/generated/luci/commit-queue.cfg index 9758d08..f53e586d 100644 --- a/infra/config/generated/luci/commit-queue.cfg +++ b/infra/config/generated/luci/commit-queue.cfg
@@ -778,7 +778,6 @@ } builders { name: "chromium/try/android-cronet-arm-rel" - experiment_percentage: 100 location_filters { gerrit_host_regexp: ".*" gerrit_project_regexp: ".*" @@ -1690,28 +1689,7 @@ } builders { name: "chromium/try/android_cronet" - location_filters { - gerrit_host_regexp: ".*" - gerrit_project_regexp: ".*" - gerrit_ref_regexp: ".*" - path_regexp: "infra/config/.+" - exclude: true - } - location_filters { - gerrit_host_regexp: ".*" - gerrit_project_regexp: ".*" - gerrit_ref_regexp: ".*" - path_regexp: "docs/.+" - exclude: true - } - location_filters { - gerrit_host_regexp: ".*" - gerrit_project_regexp: ".*" - gerrit_ref_regexp: ".*" - path_regexp: "infra/config/generated/builders/try/android_cronet/.+" - } - mode_allowlist: "DRY_RUN" - mode_allowlist: "FULL_RUN" + includable_only: true } builders { name: "chromium/try/android_optional_gpu_tests_rel"
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index fdce0025..2365aae 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -14362,7 +14362,7 @@ name: "GPU FYI Mac Builder (asan)" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" - dimensions: "cpu:arm64" + dimensions: "cpu:x86-64" dimensions: "free_space:standard" dimensions: "os:Mac" dimensions: "pool:luci.chromium.gpu.ci" @@ -47883,6 +47883,118 @@ contact_team_email: "chrome-memory-safety-team@google.com" } builders { + name: "linux-codeql-query-runner" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builderless:1" + dimensions: "cores:32" + dimensions: "cpu:x86-64" + dimensions: "free_space:standard" + dimensions: "os:Ubuntu-22.04" + dimensions: "pool:luci.chromium.ci" + dimensions: "ssd:1" + exe { + cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" + cipd_version: "refs/heads/main" + cmd: "luciexe" + } + properties: + '{' + ' "$build/reclient": {' + ' "instance": "rbe-chromium-trusted",' + ' "metrics_project": "chromium-reclient-metrics",' + ' "scandeps_server": true' + ' },' + ' "$build/siso": {' + ' "configs": [' + ' "builder"' + ' ],' + ' "enable_cloud_profiler": true,' + ' "enable_cloud_trace": true,' + ' "experiments": [],' + ' "project": "rbe-chromium-trusted",' + ' "remote_jobs": 500' + ' },' + ' "$recipe_engine/resultdb/test_presentation": {' + ' "column_keys": [],' + ' "grouping_keys": [' + ' "status",' + ' "v.test_suite"' + ' ]' + ' },' + ' "builder_group": "chromium.memory",' + ' "recipe": "chrome_codeql_query_runner"' + '}' + execution_timeout_secs: 64800 + build_numbers: YES + service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" + experiments { + key: "chromium_swarming.expose_merge_script_failures" + value: 100 + } + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "ci_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://(chrome|content)/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_ci_test_results" + test_results { + predicate { + test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*_wpt_tests/.+)" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + description_html: "Runs a set of CodeQL queries against a CodeQL database on a Linux host and uploads the result." + shadow_builder_adjustments { + service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" + pool: "luci.chromium.try" + properties: + '{' + ' "$build/reclient": {' + ' "instance": "rbe-chromium-untrusted",' + ' "metrics_project": "chromium-reclient-metrics",' + ' "scandeps_server": true' + ' },' + ' "$build/siso": {' + ' "configs": [' + ' "builder"' + ' ],' + ' "enable_cloud_profiler": true,' + ' "enable_cloud_trace": true,' + ' "experiments": [],' + ' "project": "rbe-chromium-untrusted",' + ' "remote_jobs": 500' + ' }' + '}' + dimensions: "free_space:" + dimensions: "pool:luci.chromium.try" + } + contact_team_email: "chrome-memory-safety-team@google.com" + } + builders { name: "linux-enterprise-companion-builder-dbg" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" @@ -76544,7 +76656,6 @@ ' }' ' },' ' "builder_group": "tryserver.chromium.android",' - ' "cq": "required",' ' "led_builder_is_bootstrapped": true,' ' "recipe": "chromium_trybot"' '}' @@ -104596,7 +104707,7 @@ name: "mac_upload_clang_arm" swarming_host: "chromium-swarm.appspot.com" dimensions: "builder:mac_upload_clang_arm" - dimensions: "cpu:x86-64" + dimensions: "cpu:arm64" dimensions: "os:Mac-14" dimensions: "pool:luci.chromium.try" dimensions: "ssd:1"
diff --git a/infra/config/generated/luci/luci-milo.cfg b/infra/config/generated/luci/luci-milo.cfg index 5351db6..5e09edf6 100644 --- a/infra/config/generated/luci/luci-milo.cfg +++ b/infra/config/generated/luci/luci-milo.cfg
@@ -1038,6 +1038,11 @@ short_name: "cdql-lnx" } builders { + name: "buildbucket/luci.chromium.ci/linux-codeql-query-runner" + category: "chromium.memory|codeql-linux-queries" + short_name: "cdql-lnx-qrs" + } + builders { name: "buildbucket/luci.chromium.ci/ios-asan" category: "chromium.memory|iOS" short_name: "asn" @@ -13183,6 +13188,11 @@ short_name: "cdql-lnx" } builders { + name: "buildbucket/luci.chromium.ci/linux-codeql-query-runner" + category: "codeql-linux-queries" + short_name: "cdql-lnx-qrs" + } + builders { name: "buildbucket/luci.chromium.ci/ios-asan" category: "iOS" short_name: "asn"
diff --git a/infra/config/generated/luci/luci-notify.cfg b/infra/config/generated/luci/luci-notify.cfg index 5316b2a..e5b7748 100644 --- a/infra/config/generated/luci/luci-notify.cfg +++ b/infra/config/generated/luci/luci-notify.cfg
@@ -3281,6 +3281,31 @@ template: "tree_closure_email_template" } notifications { + on_change: true + email { + recipients: "flowerhack@google.com" + } + } + builders { + bucket: "ci" + name: "linux-codeql-query-runner" + repository: "https://chromium.googlesource.com/chromium/src" + } + tree_closers { + tree_status_host: "chromium-status.appspot.com" + failed_step_regexp: "\\b(bot_update|compile|gclient runhooks|generate_build_files|runhooks|update|\\w*nocompile_test)\\b" + } +} +notifiers { + notifications { + on_occurrence: FAILURE + failed_step_regexp: "\\b(bot_update|compile|gclient runhooks|generate_build_files|runhooks|update|\\w*nocompile_test)\\b" + email { + rotation_urls: "https://chrome-ops-rotation-proxy.appspot.com/current/oncallator:chrome-build-sheriff" + } + template: "tree_closure_email_template" + } + notifications { on_occurrence: FAILURE failed_step_regexp: "\\b(bot_update|compile|gclient runhooks|generate_build_files|runhooks|update|\\w*nocompile_test)\\b" email {
diff --git a/infra/config/generated/luci/luci-scheduler.cfg b/infra/config/generated/luci/luci-scheduler.cfg index 4d4f4a6..c1cceab1 100644 --- a/infra/config/generated/luci/luci-scheduler.cfg +++ b/infra/config/generated/luci/luci-scheduler.cfg
@@ -4996,6 +4996,16 @@ } } job { + id: "linux-codeql-query-runner" + realm: "ci" + schedule: "0 13 * * *" + buildbucket { + server: "cr-buildbucket.appspot.com" + bucket: "ci" + builder: "linux-codeql-query-runner" + } +} +job { id: "linux-enterprise-companion-builder-dbg" realm: "ci" buildbucket { @@ -6782,6 +6792,7 @@ triggers: "linux-chromeos-dbg-oslogin" triggers: "linux-chromeos-rel" triggers: "linux-codeql-generator" + triggers: "linux-codeql-query-runner" triggers: "linux-enterprise-companion-builder-dbg" triggers: "linux-enterprise-companion-builder-rel" triggers: "linux-extended-tracing-rel"
diff --git a/infra/config/generated/testing/gn_isolate_map.pyl b/infra/config/generated/testing/gn_isolate_map.pyl index 9491db9..afb3a4b4 100644 --- a/infra/config/generated/testing/gn_isolate_map.pyl +++ b/infra/config/generated/testing/gn_isolate_map.pyl
@@ -2011,6 +2011,7 @@ "--test-launcher-jobs=1", "--test-launcher-retry-limit=0", "--enable-pixel-output-in-tests", + "--enable-unsafe-swiftshader", ], }, "xvfb_py_unittests": {
diff --git a/infra/config/generated/testing/mixins.pyl b/infra/config/generated/testing/mixins.pyl index a64e516..11c352d2 100644 --- a/infra/config/generated/testing/mixins.pyl +++ b/infra/config/generated/testing/mixins.pyl
@@ -1262,13 +1262,6 @@ }, }, }, - 'web-test-asan': { - 'args': [ - '--additional-expectations', - '../../third_party/blink/web_tests/ASANExpectations', - '--enable-sanitizer', - ], - }, 'web-test-leak': { 'args': [ '--additional-expectations', @@ -1276,13 +1269,6 @@ '--enable-leak-detection', ], }, - 'web-test-msan': { - 'args': [ - '--additional-expectations', - '../../third_party/blink/web_tests/MSANExpectations', - '--enable-sanitizer', - ], - }, 'webgpu_cts': { 'args': [ '--initialize-webgpu-adapter-at-startup-timeout-ms=60000',
diff --git a/infra/config/gn_args/gn_args.star b/infra/config/gn_args/gn_args.star index 963d958..4a3afce 100644 --- a/infra/config/gn_args/gn_args.star +++ b/infra/config/gn_args/gn_args.star
@@ -1070,13 +1070,6 @@ ) gn_args.config( - name = "pgo_phase_0", - args = { - "chrome_pgo_phase": 0, - }, -) - -gn_args.config( name = "pgo_phase_1", args = { "chrome_pgo_phase": 1,
diff --git a/infra/config/recipes.star b/infra/config/recipes.star index 5748ed2..88f8e539 100644 --- a/infra/config/recipes.star +++ b/infra/config/recipes.star
@@ -231,6 +231,10 @@ ) build_recipe( + name = "recipe:chrome_codeql_query_runner", +) + +build_recipe( name = "recipe:chromium_codesearch", )
diff --git a/infra/config/subprojects/chromium/ci/chromium.android.star b/infra/config/subprojects/chromium/ci/chromium.android.star index b053aa4..ec0ba95 100644 --- a/infra/config/subprojects/chromium/ci/chromium.android.star +++ b/infra/config/subprojects/chromium/ci/chromium.android.star
@@ -1027,8 +1027,6 @@ # Allows the bot to measure low-end arm32 and high-end arm64 using # a single build. "android_low_end_secondary_toolchain", - # Disable PGO due to too much volatility: https://crbug.com/344608183 - "pgo_phase_0", ], ), builderless = False,
diff --git a/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star b/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star index 7bdb999..f4779ff 100644 --- a/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star
@@ -744,8 +744,6 @@ "mac", ], ), - cores = None, - cpu = cpu.ARM64, console_view_entry = consoles.console_view_entry( category = "Mac|Builder", short_name = "asn",
diff --git a/infra/config/subprojects/chromium/ci/chromium.memory.star b/infra/config/subprojects/chromium/ci/chromium.memory.star index 8bba40b..fef407d 100644 --- a/infra/config/subprojects/chromium/ci/chromium.memory.star +++ b/infra/config/subprojects/chromium/ci/chromium.memory.star
@@ -793,3 +793,23 @@ execution_timeout = 18 * time.hour, notifies = ["codeql-infra"], ) + +ci.builder( + name = "linux-codeql-query-runner", + description_html = "Runs a set of CodeQL queries against a CodeQL database on a Linux host and uploads the result.", + executable = "recipe:chrome_codeql_query_runner", + # Run once daily at 5am Pacific/1 PM UTC + schedule = "0 13 * * *", + cores = 32, + ssd = True, + gardener_rotations = args.ignore_default(None), + console_view_entry = [ + consoles.console_view_entry( + category = "codeql-linux-queries", + short_name = "cdql-lnx-qrs", + ), + ], + contact_team_email = "chrome-memory-safety-team@google.com", + execution_timeout = 18 * time.hour, + notifies = ["codeql-infra"], +)
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.android.star b/infra/config/subprojects/chromium/try/tryserver.chromium.android.star index 9a972cc..25a3920 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.android.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.android.star
@@ -350,8 +350,6 @@ # Allows the bot to measure low-end arm32 and high-end arm64 using # a single build. "android_low_end_secondary_toolchain", - # Disable PGO due to too much volatility: https://crbug.com/344608183 - "pgo_phase_0", ], ), builderless = not settings.is_main, @@ -447,10 +445,7 @@ "chromium.enable_cleandead": 50, }, main_list_view = "try", - tryjob = try_.job( - # TODO(crbug.com/363275110): Promote to CQ. - experiment_percentage = 100, - ), + tryjob = try_.job(), ) try_.builder( @@ -1379,9 +1374,6 @@ "chromium.enable_cleandead": 50, }, main_list_view = "try", - # TODO(crbug.com/363275110): drop from CQ after android-cronet-arm-rel is - # promoted to CQ. - tryjob = try_.job(), ) try_.gpu.optional_tests_builder(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.mac.star b/infra/config/subprojects/chromium/try/tryserver.chromium.mac.star index 335972c4..3e4804e 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.mac.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.mac.star
@@ -482,6 +482,7 @@ name = "mac_upload_clang_arm", executable = "recipe:chromium_toolchain/package_clang", builderless = False, + cpu = cpu.ARM64, execution_timeout = 8 * time.hour, )
diff --git a/infra/config/targets/autoshard_exceptions.json b/infra/config/targets/autoshard_exceptions.json index f5d7dae..c3defb3 100644 --- a/infra/config/targets/autoshard_exceptions.json +++ b/infra/config/targets/autoshard_exceptions.json
@@ -483,18 +483,18 @@ "Linux Tests": { "blink_web_tests": { "debug": { - "avg_num_builds_per_peak_hour": 98, - "estimated_bot_hour_delta": 3.7, - "prev_avg_pending_time_sec": 25.7, + "avg_num_builds_per_peak_hour": 85, + "estimated_bot_hour_delta": 2.36, + "prev_avg_pending_time_sec": 16.8, "prev_p50_pending_time_sec": 1.0, - "prev_p90_pending_time_sec": 84.0, - "prev_percentile_duration_minutes": 16.63, - "prev_shard_count": 7, - "simulated_max_shard_duration": 14.83, - "test_overhead_min": 2.2666666666666666, + "prev_p90_pending_time_sec": 65.0, + "prev_percentile_duration_minutes": 17.18, + "prev_shard_count": 8, + "simulated_max_shard_duration": 13.91, + "test_overhead_min": 0.8333333333333334, "try_builder": "linux-rel" }, - "shards": 8 + "shards": 10 }, "blink_wpt_tests": { "debug": {
diff --git a/infra/config/targets/binaries.star b/infra/config/targets/binaries.star index 00eb56d..f14fa0b7 100644 --- a/infra/config/targets/binaries.star +++ b/infra/config/targets/binaries.star
@@ -2191,6 +2191,7 @@ "--test-launcher-jobs=1", "--test-launcher-retry-limit=0", "--enable-pixel-output-in-tests", + "--enable-unsafe-swiftshader", ], )
diff --git a/infra/config/targets/mixins.star b/infra/config/targets/mixins.star index c4fa261..03f1400 100644 --- a/infra/config/targets/mixins.star +++ b/infra/config/targets/mixins.star
@@ -1736,15 +1736,6 @@ ) targets.mixin( - name = "web-test-asan", - args = [ - "--additional-expectations", - "../../third_party/blink/web_tests/ASANExpectations", - "--enable-sanitizer", - ], -) - -targets.mixin( name = "web-test-leak", args = [ "--additional-expectations", @@ -1754,15 +1745,6 @@ ) targets.mixin( - name = "web-test-msan", - args = [ - "--additional-expectations", - "../../third_party/blink/web_tests/MSANExpectations", - "--enable-sanitizer", - ], -) - -targets.mixin( name = "webgpu_cts", args = [ # crbug.com/953991 Ensure WebGPU is ready before running tests
diff --git a/ios/chrome/app/BUILD.gn b/ios/chrome/app/BUILD.gn index ce254a0..91b0481e 100644 --- a/ios/chrome/app/BUILD.gn +++ b/ios/chrome/app/BUILD.gn
@@ -670,6 +670,7 @@ "//ios/components/cookie_util", "//ios/net", "//ios/public/provider/chrome/browser/app_distribution:app_distribution_api", + "//ios/public/provider/chrome/browser/memory_experimenter:memory_experimenter_api", "//ios/public/provider/chrome/browser/overrides:overrides_api", "//ios/public/provider/chrome/browser/raccoon:raccoon_api", "//ios/public/provider/chrome/browser/signin:choice_api",
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index de1fcc2..0c3f474 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -147,6 +147,7 @@ #import "ios/net/cookies/cookie_store_ios.h" #import "ios/net/empty_nsurlcache.h" #import "ios/public/provider/chrome/browser/app_distribution/app_distribution_api.h" +#import "ios/public/provider/chrome/browser/memory_experimenter/memory_experimenter_api.h" #import "ios/public/provider/chrome/browser/overrides/overrides_api.h" #import "ios/public/provider/chrome/browser/raccoon/raccoon_api.h" #import "ios/public/provider/chrome/browser/ui_utils/ui_utils_api.h" @@ -229,6 +230,9 @@ // Constants for deferred favicons clean up. NSString* const kFaviconsCleanup = @"FaviconsCleanup"; +// Constant for deffered memory experimentation. +NSString* const kMemoryExperimentation = @"BeginMemoryExperimentation"; + // The minimum amount of time (2 weeks) between calculating and // logging metrics about the amount of device storage space used by Chrome. const base::TimeDelta kMinimumTimeBetweenDocumentsSizeLogging = base::Days(14); @@ -255,6 +259,18 @@ // The delay, in seconds, for cleaning external files. const int kExternalFilesCleanupDelaySeconds = 60; +// The delay before beginning memory experimentation. +constexpr base::TimeDelta kMemoryExperimentationDelay = base::Minutes(1); + +// Schedules memory experimentation. +void BeginMemoryExperimentationAfterDelay() { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, + kMemoryExperimentationDelay.InNanoseconds()), + dispatch_get_main_queue(), ^{ + ios::provider::BeginMemoryExperimentation(); + }); +} + // Delegate for the AuthenticationService. // TODO(crbug.com/325612973): When browsing data removal is factored into a // keyed service, make that service an AuthenticationServiceDelegate and just @@ -417,6 +433,8 @@ // Schedule the deletion of the temporary passwords files that might // be left over from incomplete export operations. - (void)scheduleDeleteTempPasswordsDirectory; +// Schedule the start of memory experimentation. +- (void)scheduleMemoryExperimentation; // Crashes the application if requested. - (void)crashIfRequested; // Performs synchronous browser state initialization steps. @@ -1310,6 +1328,7 @@ [self scheduleSaveFieldTrialValuesForExternals]; [self scheduleEnterpriseManagedDeviceCheck]; [self scheduleFaviconsCleanup]; + [self scheduleMemoryExperimentation]; #if !TARGET_IPHONE_SIMULATOR [self scheduleLogDocumentsSize]; #endif @@ -1347,6 +1366,14 @@ }]; } +- (void)scheduleMemoryExperimentation { + [[DeferredInitializationRunner sharedInstance] + enqueueBlockNamed:kMemoryExperimentation + block:^{ + BeginMemoryExperimentationAfterDelay(); + }]; +} + - (void)scheduleLogSiriShortcuts { __weak StartupTasks* startupTasks = _startupTasks; [[DeferredInitializationRunner sharedInstance]
diff --git a/ios/chrome/app/strings/ios_chromium_strings.grd b/ios/chrome/app/strings/ios_chromium_strings.grd index d7f2eec5..99772d6 100644 --- a/ios/chrome/app/strings/ios_chromium_strings.grd +++ b/ios/chrome/app/strings/ios_chromium_strings.grd
@@ -547,6 +547,9 @@ <message name="IDS_IOS_INTENTS_VIEW_CHROME_HISTORY_TITLE" desc="Siri Shortcut for view chromium history title [iOS only]"> View Your Chromium History </message> + <message name="IDS_IOS_LENS_PROMO_IPH_TEXT" desc="The text of an iph bubble that points to the Fakebox's Lens icon"> + You can open Lens here. + </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_LENS_PROMO_IPH_TEXT.png.sha1 b/ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_LENS_PROMO_IPH_TEXT.png.sha1 new file mode 100644 index 0000000..84e30e7 --- /dev/null +++ b/ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_LENS_PROMO_IPH_TEXT.png.sha1
@@ -0,0 +1 @@ +35811bde0d7f037e2efa9bbe14b8ed3a511740d0 \ 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 51daea1..09c95fa 100644 --- a/ios/chrome/app/strings/ios_google_chrome_strings.grd +++ b/ios/chrome/app/strings/ios_google_chrome_strings.grd
@@ -547,6 +547,9 @@ <message name="IDS_IOS_INTENTS_VIEW_CHROME_HISTORY_TITLE" desc="Siri Shortcut for view chrome history title [iOS only]"> View Your Chrome History </message> + <message name="IDS_IOS_LENS_PROMO_IPH_TEXT" desc="The text of an iph bubble that points to the Fakebox's Lens icon"> + You can open Google Lens here. + </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_LENS_PROMO_IPH_TEXT.png.sha1 b/ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_LENS_PROMO_IPH_TEXT.png.sha1 new file mode 100644 index 0000000..84e30e7 --- /dev/null +++ b/ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_LENS_PROMO_IPH_TEXT.png.sha1
@@ -0,0 +1 @@ +35811bde0d7f037e2efa9bbe14b8ed3a511740d0 \ No newline at end of file
diff --git a/ios/chrome/browser/badges/ui_bundled/badge_mediator.mm b/ios/chrome/browser/badges/ui_bundled/badge_mediator.mm index 7b8e620..060e54f 100644 --- a/ios/chrome/browser/badges/ui_bundled/badge_mediator.mm +++ b/ios/chrome/browser/badges/ui_bundled/badge_mediator.mm
@@ -118,6 +118,7 @@ } - (void)disconnect { + self.consumer = nil; [self disconnectWebState]; [self disconnectWebStateList]; [self disconnectOverlayPresenter];
diff --git a/ios/chrome/browser/browser_view/ui_bundled/browser_coordinator.mm b/ios/chrome/browser/browser_view/ui_bundled/browser_coordinator.mm index 45ae2896..0f3b73e0 100644 --- a/ios/chrome/browser/browser_view/ui_bundled/browser_coordinator.mm +++ b/ios/chrome/browser/browser_view/ui_bundled/browser_coordinator.mm
@@ -3528,6 +3528,14 @@ _urlLoadingBrowserAgent->Load(urlLoadParams); } +- (void)presentLensIconBubble { + __weak NewTabPageCoordinator* weakNTPCoordinator = _NTPCoordinator; + [HandlerForProtocol(self.dispatcher, ApplicationCommands) + prepareToPresentModal:^{ + [weakNTPCoordinator presentLensIconBubble]; + }]; +} + #pragma mark - WebNavigationNTPDelegate - (BOOL)isNTPActiveForCurrentWebState {
diff --git a/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_coordinator.mm b/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_coordinator.mm index b1f7f48..0deb80da 100644 --- a/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_coordinator.mm +++ b/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_coordinator.mm
@@ -352,6 +352,14 @@ [_resultMediator loadResultsURL:url]; } +- (void)handleSearchRequestStarted { + [_resultMediator handleSearchRequestStarted]; +} + +- (void)handleSearchRequestErrored { + [_resultMediator handleSearchRequestErrored]; +} + #pragma mark - LensResultPageWebStateDelegate - (void)lensResultPageWebStateDestroyed {
diff --git a/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_mediator.mm b/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_mediator.mm index 9fe323e7..d8bf018 100644 --- a/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_mediator.mm +++ b/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_mediator.mm
@@ -163,12 +163,12 @@ // The lens overlay started searching for a result. - (void)lensOverlayDidStartSearchRequest:(id<ChromeLensOverlay>)lensOverlay { - // TODO(crbug.com/358582651): React to loading when UI is implemented. + [self.resultConsumer handleSearchRequestStarted]; } // The lens overlay search request produced an error. - (void)lensOverlayDidReceiveError:(id<ChromeLensOverlay>)lensOverlay { - // TODO(crbug.com/358582651): React to error when UI is implemented. + [self.resultConsumer handleSearchRequestErrored]; } // The lens overlay search request produced a valid result.
diff --git a/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_mediator_unittest.mm b/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_mediator_unittest.mm index 231debc..f4efe03 100644 --- a/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_mediator_unittest.mm +++ b/ios/chrome/browser/lens_overlay/coordinator/lens_overlay_mediator_unittest.mm
@@ -43,6 +43,14 @@ } } +- (void)handleSearchRequestStarted { + // NO-OP +} + +- (void)handleSearchRequestErrored { + // NO-OP +} + - (void)disconnect { self.webState = nil; }
diff --git a/ios/chrome/browser/lens_overlay/coordinator/lens_result_page_mediator.mm b/ios/chrome/browser/lens_overlay/coordinator/lens_result_page_mediator.mm index 0998777..6b6224f 100644 --- a/ios/chrome/browser/lens_overlay/coordinator/lens_result_page_mediator.mm +++ b/ios/chrome/browser/lens_overlay/coordinator/lens_result_page_mediator.mm
@@ -53,6 +53,30 @@ return base::EqualsCaseInsensitiveASCII(host, "resultpanel-header-hide"); } +// Maps `value` of the closed interval [`in_min`, `in_max`] to +// [`out_min`, `out_max`]. +float IntervalMap(float value, + float in_min, + float in_max, + float out_min, + float out_max) { + CHECK_GE(value, in_min); + CHECK_LE(value, in_max); + return out_min + (value - in_min) * (out_max - out_min) / (in_max - in_min); +} + +// Value of the progress bar when lens request starts. +const CGFloat kProgressBarLensRequestStarted = 0.15f; + +// Value of the progress bar when a response is received. +const CGFloat kProgressBarLensResponseReceived = 0.40f; + +// Value of an empty progress bar. +const CGFloat kProgressBarEmpty = 0.0f; + +// Value of a full progress bar. +const CGFloat kProgressBarFull = 1.0f; + } // namespace @interface LensResultPageMediator () <CRWWebStateDelegate, @@ -74,6 +98,8 @@ std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegateBridge; /// Bridges C++ WebStateObserver methods to this mediator. std::unique_ptr<web::WebStateObserverBridge> _webStateObserverBridge; + /// Whether the inflight request was initiated by Lens. + BOOL _isInflightRequestLensInitiated; } - (instancetype) @@ -123,11 +149,21 @@ - (void)loadResultsURL:(GURL)URL { CHECK(_webState, kLensOverlayNotFatalUntil); + _isInflightRequestLensInitiated = YES; + [_consumer setLoadingProgress:kProgressBarLensResponseReceived]; _webState->OpenURL(web::WebState::OpenURLParams( URL, web::Referrer(), WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false)); } +- (void)handleSearchRequestStarted { + [_consumer setLoadingProgress:kProgressBarLensRequestStarted]; +} + +- (void)handleSearchRequestErrored { + [_consumer setLoadingProgress:kProgressBarFull]; +} + #pragma mark - CRWWebStatePolicyDecider - (void)shouldAllowRequest:(NSURLRequest*)request @@ -163,6 +199,7 @@ - (void)webState:(web::WebState*)webState didFinishNavigation:(web::NavigationContext*)navigationContext { + _isInflightRequestLensInitiated = NO; [self updateBackgroundColor]; } @@ -171,7 +208,19 @@ } - (void)webState:(web::WebState*)webState - didChangeLoadingProgress:(double)progress { + didChangeLoadingProgress:(double)webStateProgress { + float progress = webStateProgress; + + // If the current navigation is the direct product of a Lens Overlay search, + // then the progress from before the search should be factored in, and the + // webState loading progress should be adjusted to reflect the remaining + // portion of the overall progress. + if (_isInflightRequestLensInitiated) { + progress = + IntervalMap(webStateProgress, kProgressBarEmpty, kProgressBarFull, + kProgressBarLensResponseReceived, kProgressBarFull); + } + [_consumer setLoadingProgress:progress]; }
diff --git a/ios/chrome/browser/lens_overlay/ui/BUILD.gn b/ios/chrome/browser/lens_overlay/ui/BUILD.gn index 8ab56769c..6252141f 100644 --- a/ios/chrome/browser/lens_overlay/ui/BUILD.gn +++ b/ios/chrome/browser/lens_overlay/ui/BUILD.gn
@@ -24,6 +24,7 @@ ] deps = [ ":lens_overlay_accessibility_identifier_constants", + ":lens_overlay_progress_bar", ":protocols", "//base", "//components/strings", @@ -46,6 +47,20 @@ frameworks = [ "UIKit.framework" ] } +source_set("lens_overlay_progress_bar") { + sources = [ + "lens_overlay_progress_bar.h", + "lens_overlay_progress_bar.mm", + ] + deps = [ + "//base", + "//components/strings", + "//ios/chrome/app/strings", + "//ios/third_party/material_components_ios", + "//ui/base", + ] +} + source_set("lens_overlay_accessibility_identifier_constants") { sources = [ "lens_overlay_accessibility_identifier_constants.h",
diff --git a/ios/chrome/browser/lens_overlay/ui/lens_overlay_progress_bar.h b/ios/chrome/browser/lens_overlay/ui/lens_overlay_progress_bar.h new file mode 100644 index 0000000..0c5441cf --- /dev/null +++ b/ios/chrome/browser/lens_overlay/ui/lens_overlay_progress_bar.h
@@ -0,0 +1,14 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_LENS_OVERLAY_UI_LENS_OVERLAY_PROGRESS_BAR_H_ +#define IOS_CHROME_BROWSER_LENS_OVERLAY_UI_LENS_OVERLAY_PROGRESS_BAR_H_ + +#import <MaterialComponents/MaterialProgressView.h> + +// Progress bar for Lens Overlay +@interface LensOverlayProgressBar : MDCProgressView +@end + +#endif // IOS_CHROME_BROWSER_LENS_OVERLAY_UI_LENS_OVERLAY_PROGRESS_BAR_H_
diff --git a/ios/chrome/browser/lens_overlay/ui/lens_overlay_progress_bar.mm b/ios/chrome/browser/lens_overlay/ui/lens_overlay_progress_bar.mm new file mode 100644 index 0000000..fc6d58d --- /dev/null +++ b/ios/chrome/browser/lens_overlay/ui/lens_overlay_progress_bar.mm
@@ -0,0 +1,19 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/lens_overlay/ui/lens_overlay_progress_bar.h" + +#import "base/strings/sys_string_conversions.h" +#import "ios/chrome/grit/ios_strings.h" +#import "ui/base/l10n/l10n_util.h" + +@implementation LensOverlayProgressBar + +- (NSString*)accessibilityValue { + return l10n_util::GetNSStringF( + IDS_IOS_PROGRESS_BAR_ACCESSIBILITY, + base::SysNSStringToUTF16([super accessibilityValue])); +} + +@end
diff --git a/ios/chrome/browser/lens_overlay/ui/lens_overlay_result_consumer.h b/ios/chrome/browser/lens_overlay/ui/lens_overlay_result_consumer.h index 1b2fd69..47b88125 100644 --- a/ios/chrome/browser/lens_overlay/ui/lens_overlay_result_consumer.h +++ b/ios/chrome/browser/lens_overlay/ui/lens_overlay_result_consumer.h
@@ -10,6 +10,13 @@ /// Consumer for lens overlay result selection UI. @protocol LensOverlayResultConsumer +// Notifies the consumer that the a new Lens search request started. +- (void)handleSearchRequestStarted; + +// Notifies the consumer that the Lens search request received an error. +- (void)handleSearchRequestErrored; + +// Loads a new results URL. - (void)loadResultsURL:(GURL)url; @end
diff --git a/ios/chrome/browser/lens_overlay/ui/lens_result_page_view_controller.mm b/ios/chrome/browser/lens_overlay/ui/lens_result_page_view_controller.mm index e1c712b..96e593d 100644 --- a/ios/chrome/browser/lens_overlay/ui/lens_result_page_view_controller.mm +++ b/ios/chrome/browser/lens_overlay/ui/lens_result_page_view_controller.mm
@@ -7,6 +7,7 @@ #import "base/check.h" #import "components/strings/grit/components_strings.h" #import "ios/chrome/browser/keyboard/ui_bundled/UIKeyCommand+Chrome.h" +#import "ios/chrome/browser/lens_overlay/ui/lens_overlay_progress_bar.h" #import "ios/chrome/browser/lens_overlay/ui/lens_toolbar_mutator.h" #import "ios/chrome/browser/shared/public/features/features.h" #import "ios/chrome/browser/shared/ui/symbols/symbols.h" @@ -40,6 +41,11 @@ /// container. const CGFloat kWebContainerTopPadding = 8; +/// Height of the progress bar. +const CGFloat kProgressBarHeight = 2.0f; +/// Value of a full progress bar. +const CGFloat kProgressBarFull = 1.0f; + } // namespace @interface LensResultPageViewController () @@ -72,6 +78,8 @@ UIButton* _omniboxPopupContainer; /// Button to focus the omnibox. UIButton* _omniboxTapTarget; + /// Loading progress bar. + LensOverlayProgressBar* _progressBar; } - (instancetype)init { @@ -84,6 +92,7 @@ // `viewDidLoad`. _omniboxContainer = [[UIView alloc] init]; _omniboxTapTarget = [[UIButton alloc] init]; + _progressBar = [[LensOverlayProgressBar alloc] init]; [_omniboxContainer addSubview:_omniboxTapTarget]; } return self; @@ -171,6 +180,11 @@ _horizontalStackView.distribution = UIStackViewDistributionFill; [self.view addSubview:_horizontalStackView]; + // Progress bar. + _progressBar.translatesAutoresizingMaskIntoConstraints = NO; + _progressBar.hidden = YES; + [self.view addSubview:_progressBar]; + NSLayoutConstraint* omniboxLeadingConstraint = [_omniboxContainer.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor @@ -194,6 +208,13 @@ constant:kWebContainerTopPadding], [_omniboxPopupContainer.topAnchor constraintEqualToAnchor:_horizontalStackView.bottomAnchor], + [_progressBar.topAnchor + constraintEqualToAnchor:_webViewContainer.topAnchor], + [_progressBar.leadingAnchor + constraintEqualToAnchor:_webViewContainer.leadingAnchor], + [_progressBar.trailingAnchor + constraintEqualToAnchor:_webViewContainer.trailingAnchor], + [_progressBar.heightAnchor constraintEqualToConstant:kProgressBarHeight], ]]; AddSameConstraintsToSides( self.webViewContainer, self.view, @@ -255,9 +276,21 @@ } - (void)setLoadingProgress:(float)progress { - // TODO(crbug.com/351817993): React to loading progres change. + [self updateProgressBarVisibilityForProgress:progress]; + [_progressBar setProgress:progress animated:YES completion:nil]; } +- (void)updateProgressBarVisibilityForProgress:(float)progress { + BOOL isLoading = progress != kProgressBarFull; + BOOL shouldShowProgressBar = isLoading && _progressBar.hidden; + BOOL shouldHideProgressBar = !isLoading && !_progressBar.hidden; + + if (shouldShowProgressBar) { + [_progressBar setHidden:NO animated:YES completion:nil]; + } else if (shouldHideProgressBar) { + [_progressBar setHidden:YES animated:YES completion:nil]; + } +} #pragma mark - OmniboxPopupPresenterDelegate - (UIView*)popupParentViewForPresenter:(OmniboxPopupPresenter*)presenter {
diff --git a/ios/chrome/browser/ntp/shared/metrics/feed_metrics_recorder.h b/ios/chrome/browser/ntp/shared/metrics/feed_metrics_recorder.h index 9bd3600..26486ca 100644 --- a/ios/chrome/browser/ntp/shared/metrics/feed_metrics_recorder.h +++ b/ios/chrome/browser/ntp/shared/metrics/feed_metrics_recorder.h
@@ -15,7 +15,7 @@ @protocol FeedControlDelegate; @protocol NewTabPageFollowDelegate; -@protocol NewTabPageMetricsDelegate; +@protocol NewTabPageActionsDelegate; @class NewTabPageState; class PrefService; @@ -35,8 +35,8 @@ // Whether or not the feed is currently being shown on the Start Surface. @property(nonatomic, assign) BOOL isShownOnStartSurface; -// Delegate for reporting feed actions to the NTP metrics recorder. -@property(nonatomic, weak) id<NewTabPageMetricsDelegate> NTPMetricsDelegate; +// Delegate for reporting feed actions. +@property(nonatomic, weak) id<NewTabPageActionsDelegate> NTPActionsDelegate; - (instancetype)initWithPrefService:(PrefService*)prefService NS_DESIGNATED_INITIALIZER;
diff --git a/ios/chrome/browser/ntp/shared/metrics/feed_metrics_recorder.mm b/ios/chrome/browser/ntp/shared/metrics/feed_metrics_recorder.mm index 9c6cc73..13aa537 100644 --- a/ios/chrome/browser/ntp/shared/metrics/feed_metrics_recorder.mm +++ b/ios/chrome/browser/ntp/shared/metrics/feed_metrics_recorder.mm
@@ -18,10 +18,10 @@ #import "components/prefs/pref_service.h" #import "ios/chrome/browser/metrics/model/constants.h" #import "ios/chrome/browser/ntp/model/new_tab_page_state.h" -#import "ios/chrome/browser/ntp/ui_bundled/feed_control_delegate.h" #import "ios/chrome/browser/ntp/shared/metrics/feed_metrics_constants.h" +#import "ios/chrome/browser/ntp/ui_bundled/feed_control_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_follow_delegate.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" #import "ios/chrome/browser/shared/public/features/features.h" namespace { @@ -1375,7 +1375,7 @@ self.prefService->SetTime(kArticleVisitTimestampKey, base::Time::Now()); self.prefService->SetInteger(kLastUsedFeedForGoodVisitsKey, self.NTPState.selectedFeed); - [self.NTPMetricsDelegate feedArticleOpened]; + [self.NTPActionsDelegate feedArticleOpened]; } #pragma mark - Converters
diff --git a/ios/chrome/browser/ntp/ui_bundled/BUILD.gn b/ios/chrome/browser/ntp/ui_bundled/BUILD.gn index 1a46c4f2..54449cee 100644 --- a/ios/chrome/browser/ntp/ui_bundled/BUILD.gn +++ b/ios/chrome/browser/ntp/ui_bundled/BUILD.gn
@@ -9,12 +9,12 @@ "feed_control_delegate.h", "feed_sign_in_promo_delegate.h", "home_start_data_source.h", + "new_tab_page_actions_delegate.h", "new_tab_page_configuring.h", "new_tab_page_content_delegate.h", "new_tab_page_controller_delegate.h", "new_tab_page_delegate.h", "new_tab_page_follow_delegate.h", - "new_tab_page_metrics_delegate.h", "new_tab_page_url_loader_delegate.h", ] public_deps = [ @@ -106,6 +106,7 @@ "//components/supervised_user/core/common:features", "//ios/chrome/app/application_delegate:app_state_header", "//ios/chrome/app/strings", + "//ios/chrome/browser/bubble/ui_bundled", "//ios/chrome/browser/context_menu/ui_bundled/link_preview", "//ios/chrome/browser/discover_feed/model", "//ios/chrome/browser/discover_feed/model:constants", @@ -156,6 +157,7 @@ "//ios/chrome/browser/ui/sharing", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/url_loading/model", + "//ios/chrome/common:timing", "//ios/chrome/common/ui/util", "//ios/public/provider/chrome/browser/ui_utils:ui_utils_api", "//ios/web/public", @@ -203,6 +205,7 @@ "//ios/chrome/browser/discover_feed/model", "//ios/chrome/browser/discover_feed/model:constants", "//ios/chrome/browser/discover_feed/model:discover_feed_factory", + "//ios/chrome/browser/home_customization/coordinator", "//ios/chrome/browser/metrics/model:metrics_internal", "//ios/chrome/browser/ntp/model", "//ios/chrome/browser/ntp/model:util",
diff --git a/ios/chrome/browser/ntp/ui_bundled/DEPS b/ios/chrome/browser/ntp/ui_bundled/DEPS index a62aa25..6e1674b 100644 --- a/ios/chrome/browser/ntp/ui_bundled/DEPS +++ b/ios/chrome/browser/ntp/ui_bundled/DEPS
@@ -1,5 +1,5 @@ include_rules = [ - "+ios/chrome/browser/bubble/ui_bundled/bubble_presenter.h", + "+ios/chrome/browser/bubble/ui_bundled", "+ios/chrome/browser/context_menu/ui_bundled/link_preview", "+ios/chrome/browser/favicon/ui_bundled", "+ios/chrome/browser/follow/ui_bundled",
diff --git a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h similarity index 77% rename from ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h rename to ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h index 093fb0a..ab278a7 100644 --- a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h +++ b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_METRICS_DELEGATE_H_ -#define IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_METRICS_DELEGATE_H_ +#ifndef IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_ACTIONS_DELEGATE_H_ +#define IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_ACTIONS_DELEGATE_H_ -// Delegate for actions to be reported back to the NTP metrics recorder. -@protocol NewTabPageMetricsDelegate +// Delegate for actions to be reported back to the NTP. +@protocol NewTabPageActionsDelegate // The recent tab tile has been tapped. - (void)recentTabTileOpenedAtIndex:(NSUInteger)index; @@ -40,4 +40,4 @@ @end -#endif // IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_METRICS_DELEGATE_H_ +#endif // IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_ACTIONS_DELEGATE_H_
diff --git a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator+Testing.h b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator+Testing.h index 7938408..df5e023 100644 --- a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator+Testing.h +++ b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator+Testing.h
@@ -5,11 +5,10 @@ #ifndef IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_COORDINATOR_TESTING_H_ #define IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_COORDINATOR_TESTING_H_ -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.h" - #import "ios/chrome/browser/ntp/ui_bundled/feed_wrapper_view_controller.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_commands.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" @class ContentSuggestionsCoordinator; @class FeedHeaderViewController; @@ -23,7 +22,7 @@ // new_tab_page_coordinator.mm and tests. @interface NewTabPageCoordinator (Testing) <FeedWrapperViewControllerDelegate, NewTabPageHeaderCommands, - NewTabPageMetricsDelegate> + NewTabPageActionsDelegate> @property(nonatomic, strong, readonly) NewTabPageHeaderViewController* headerViewController;
diff --git a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.h b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.h index ccbb169..7da51a2 100644 --- a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.h +++ b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.h
@@ -103,6 +103,9 @@ // Returns YES if the fakebox is pinned or scrolled to the top. - (BOOL)isFakeboxPinned; +// Presents an IPH bubble to highlight the Lens icon in the NTP Fakebox. +- (void)presentLensIconBubble; + @end #endif // IOS_CHROME_BROWSER_NTP_UI_BUNDLED_NEW_TAB_PAGE_COORDINATOR_H_
diff --git a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.mm b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.mm index 842da9de..02eb0f8 100644 --- a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.mm +++ b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator.mm
@@ -28,6 +28,7 @@ #import "components/supervised_user/core/common/features.h" #import "components/sync/service/sync_service.h" #import "ios/chrome/app/application_delegate/app_state.h" +#import "ios/chrome/browser/bubble/ui_bundled/bubble_view_controller_presenter.h" #import "ios/chrome/browser/context_menu/ui_bundled/link_preview/link_preview_coordinator.h" #import "ios/chrome/browser/discover_feed/model/discover_feed_observer_bridge.h" #import "ios/chrome/browser/discover_feed/model/discover_feed_service.h" @@ -61,6 +62,7 @@ #import "ios/chrome/browser/ntp/ui_bundled/home_start_data_source.h" #import "ios/chrome/browser/ntp/ui_bundled/incognito/incognito_view_controller.h" #import "ios/chrome/browser/ntp/ui_bundled/logo_vendor.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_component_factory_protocol.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_constants.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_content_delegate.h" @@ -72,7 +74,6 @@ #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_commands.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_mediator.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_view_controller.h" #import "ios/chrome/browser/overscroll_actions/ui_bundled/overscroll_actions_controller.h" #import "ios/chrome/browser/search_engines/model/template_url_service_factory.h" @@ -118,7 +119,9 @@ #import "ios/chrome/browser/ui/sharing/sharing_params.h" #import "ios/chrome/browser/ui/toolbar/public/fakebox_focuser.h" #import "ios/chrome/browser/url_loading/model/url_loading_browser_agent.h" +#import "ios/chrome/common/material_timing.h" #import "ios/chrome/common/ui/util/constraints_ui_util.h" +#import "ios/chrome/grit/ios_branded_strings.h" #import "ios/chrome/grit/ios_strings.h" #import "ios/public/provider/chrome/browser/ui_utils/ui_utils_api.h" #import "ios/web/public/navigation/navigation_context.h" @@ -146,7 +149,7 @@ NewTabPageDelegate, NewTabPageFollowDelegate, NewTabPageHeaderCommands, - NewTabPageMetricsDelegate, + NewTabPageActionsDelegate, OverscrollActionsControllerDelegate, SceneStateObserver, SupervisedUserCapabilitiesObserving> { @@ -164,6 +167,8 @@ // Observer to track changes to supervision-related capabilities. std::unique_ptr<supervised_user::SupervisedUserCapabilitiesObserverBridge> _supervisedUserCapabilitiesObserverBridge; + + BubbleViewControllerPresenter* _fakeboxLensIconBubblePresenter; } // Coordinator for the ContentSuggestions. @@ -428,7 +433,7 @@ self.feedWrapperViewController = nil; self.feedViewController = nil; self.feedMetricsRecorder.followDelegate = nil; - self.feedMetricsRecorder.NTPMetricsDelegate = nil; + self.feedMetricsRecorder.NTPActionsDelegate = nil; self.feedMetricsRecorder = nil; [self.feedExpandedPref setObserver:nil]; @@ -450,6 +455,8 @@ [self stopAccountMenuCoordinator]; + [_fakeboxLensIconBubblePresenter dismissAnimated:NO]; + self.started = NO; } @@ -581,6 +588,22 @@ return self.NTPViewController.isFakeboxPinned; } +- (void)presentLensIconBubble { + if (!self.isScrolledToTop) { + __weak __typeof(self) weakSelf = self; + [UIView animateWithDuration:kMaterialDuration1 + animations:^{ + [weakSelf setContentOffsetToTop]; + } + completion:^(BOOL finished) { + [weakSelf presentLensIconBubbleNow]; + }]; + return; + } + + [self presentLensIconBubbleNow]; +} + #pragma mark - Setters - (void)setSelectedFeed:(FeedType)selectedFeed { @@ -738,6 +761,7 @@ OmniboxCommands, FakeboxFocuser, LensCommands>>( self.browser->GetCommandDispatcher()); self.headerViewController.commandHandler = self; + self.headerViewController.customizationDelegate = self; self.headerViewController.delegate = self.NTPViewController; self.headerViewController.layoutGuideCenter = LayoutGuideCenterForBrowser(self.browser); @@ -751,8 +775,9 @@ - (void)configureContentSuggestionsCoordinator { self.contentSuggestionsCoordinator.webState = self.webState; self.contentSuggestionsCoordinator.delegate = self; - self.contentSuggestionsCoordinator.NTPMetricsDelegate = self; + self.contentSuggestionsCoordinator.NTPActionsDelegate = self; self.contentSuggestionsCoordinator.homeStartDataSource = self; + self.contentSuggestionsCoordinator.customizationDelegate = self; [self.contentSuggestionsCoordinator start]; } @@ -773,7 +798,7 @@ self.feedMetricsRecorder.NTPState = NewTabPageTabHelper::FromWebState(self.webState)->GetNTPState(); self.feedMetricsRecorder.followDelegate = self; - self.feedMetricsRecorder.NTPMetricsDelegate = self; + self.feedMetricsRecorder.NTPActionsDelegate = self; } // Configures `self.NTPViewController` and sets it up as the main ViewController @@ -1317,7 +1342,7 @@ return followBrowserAgent->GetFollowedWebSites(); } -#pragma mark - NewTabPageMetricsDelegate +#pragma mark - NewTabPageActionsDelegate - (void)recentTabTileOpenedAtIndex:(NSUInteger)index { RecordMagicStackClick(ContentSuggestionsModuleType::kTabResumption, @@ -1355,22 +1380,26 @@ RecordMagicStackClick(ContentSuggestionsModuleType::kShortcuts, [self isStartSurface]); RecordHomeAction(IOSHomeActionType::kShortcuts, [self isStartSurface]); + [self dismissCustomizationMenu]; } - (void)setUpListItemOpened { RecordHomeAction(IOSHomeActionType::kSetUpList, [self isStartSurface]); + [self dismissCustomizationMenu]; } - (void)safetyCheckOpened { RecordMagicStackClick(ContentSuggestionsModuleType::kSafetyCheck, [self isStartSurface]); RecordHomeAction(IOSHomeActionType::kSafetyCheck, [self isStartSurface]); + [self dismissCustomizationMenu]; } - (void)parcelTrackingOpened { RecordMagicStackClick(ContentSuggestionsModuleType::kParcelTracking, [self isStartSurface]); RecordHomeAction(IOSHomeActionType::kParcelTracking, [self isStartSurface]); + [self dismissCustomizationMenu]; } #pragma mark - OverscrollActionsControllerDelegate @@ -1879,6 +1908,32 @@ NOTREACHED_NORETURN(); } +// Presents the Fakebox Lens icon IPH bubble without checking scroll position. +- (void)presentLensIconBubbleNow { + NSString* text = l10n_util::GetNSString(IDS_IOS_LENS_PROMO_IPH_TEXT); + UIView* icon = [LayoutGuideCenterForBrowser(self.browser) + referencedViewUnderName:kFakeboxLensIconGuide]; + CGPoint anchorPoint = [icon.superview convertPoint:icon.frame.origin + toView:nil]; + anchorPoint.x += icon.frame.size.width / 2; + anchorPoint.y += icon.frame.size.height; + + BubbleViewControllerPresenter* presenter = + [[BubbleViewControllerPresenter alloc] + initDefaultBubbleWithText:text + arrowDirection:BubbleArrowDirectionUp + alignment:BubbleAlignmentBottomOrTrailing + dismissalCallback:nil]; + // Discard if it doesn't fit in the view as it is currently shown. + if (![presenter canPresentInView:self.NTPViewController.view + anchorPoint:anchorPoint]) { + return; + } + [presenter presentInViewController:self.NTPViewController + anchorPoint:anchorPoint]; + _fakeboxLensIconBubblePresenter = presenter; +} + #pragma mark - AccountMenuCoordinatorDelegate - (void)acountMenuCoordinatorShouldStop:(AccountMenuCoordinator*)coordinator { @@ -1889,6 +1944,11 @@ #pragma mark - HomeCustomizationDelegate - (void)dismissCustomizationMenu { + // Return early if the customization menu is not presented to avoid dismissing + // another view controller. + if (!_customizationCoordinator) { + return; + } [self.NTPViewController dismissViewControllerAnimated:YES completion:nil]; [_customizationCoordinator stop]; _customizationCoordinator = nil;
diff --git a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator_unittest.mm b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator_unittest.mm index 26d2932..6583fb8 100644 --- a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator_unittest.mm +++ b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator_unittest.mm
@@ -15,6 +15,19 @@ #import "ios/chrome/browser/commerce/model/shopping_service_factory.h" #import "ios/chrome/browser/favicon/model/ios_chrome_large_icon_service_factory.h" #import "ios/chrome/browser/ntp/model/new_tab_page_tab_helper.h" +#import "ios/chrome/browser/ntp/shared/metrics/home_metrics.h" +#import "ios/chrome/browser/ntp/shared/metrics/new_tab_page_metrics_constants.h" +#import "ios/chrome/browser/ntp/shared/metrics/new_tab_page_metrics_recorder.h" +#import "ios/chrome/browser/ntp/ui_bundled/feed_wrapper_view_controller.h" +#import "ios/chrome/browser/ntp/ui_bundled/incognito/incognito_view_controller.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_component_factory.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_controller_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator+Testing.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_feature.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_mediator.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_view_controller.h" #import "ios/chrome/browser/safety_check/model/ios_chrome_safety_check_manager_factory.h" #import "ios/chrome/browser/search_engines/model/template_url_service_factory.h" #import "ios/chrome/browser/segmentation_platform/model/segmentation_platform_service_factory.h" @@ -41,19 +54,6 @@ #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h" -#import "ios/chrome/browser/ntp/ui_bundled/feed_wrapper_view_controller.h" -#import "ios/chrome/browser/ntp/ui_bundled/incognito/incognito_view_controller.h" -#import "ios/chrome/browser/ntp/shared/metrics/home_metrics.h" -#import "ios/chrome/browser/ntp/shared/metrics/new_tab_page_metrics_constants.h" -#import "ios/chrome/browser/ntp/shared/metrics/new_tab_page_metrics_recorder.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_component_factory.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_controller_delegate.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_coordinator+Testing.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_feature.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_mediator.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_view_controller.h" #import "ios/chrome/browser/ui/toolbar/public/fakebox_focuser.h" #import "ios/chrome/browser/url_loading/model/fake_url_loading_browser_agent.h" #import "ios/chrome/browser/url_loading/model/url_loading_notifier_browser_agent.h"
diff --git a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.h b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.h index fe2e40c6..686c332 100644 --- a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.h +++ b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.h
@@ -14,6 +14,7 @@ @protocol ApplicationCommands; @protocol BrowserCoordinatorCommands; @protocol FakeboxFocuser; +@protocol HomeCustomizationDelegate; @protocol NewTabPageControllerDelegate; @protocol NewTabPageHeaderCommands; @class NewTabPageMetricsRecorder; @@ -78,6 +79,9 @@ // font scale, for example, during a fakebox defocus animation. @property(nonatomic, assign) BOOL allowFontScaleAnimation; +// The delegate for the Home Customization menu. +@property(nonatomic, weak) id<HomeCustomizationDelegate> customizationDelegate; + // Animation to expand this header in response to focusing the omnibox to match // the fake omnibox with the omnibox's. - (void)expandHeaderForFocus;
diff --git a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.mm b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.mm index 8a0ef0b0f..222573b 100644 --- a/ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.mm +++ b/ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller.mm
@@ -13,7 +13,17 @@ #import "components/prefs/pref_service.h" #import "components/signin/public/base/signin_switches.h" #import "components/strings/grit/components_strings.h" +#import "ios/chrome/browser/home_customization/coordinator/home_customization_delegate.h" #import "ios/chrome/browser/ntp/model/new_tab_page_tab_helper.h" +#import "ios/chrome/browser/ntp/shared/metrics/new_tab_page_metrics_recorder.h" +#import "ios/chrome/browser/ntp/ui_bundled/logo_vendor.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_constants.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_controller_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_feature.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_commands.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_constants.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller_delegate.h" #import "ios/chrome/browser/shared/public/commands/application_commands.h" #import "ios/chrome/browser/shared/public/commands/browser_coordinator_commands.h" #import "ios/chrome/browser/shared/public/commands/lens_commands.h" @@ -30,15 +40,6 @@ #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_utils.h" #import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" #import "ios/chrome/browser/ui/lens/lens_entrypoint.h" -#import "ios/chrome/browser/ntp/ui_bundled/logo_vendor.h" -#import "ios/chrome/browser/ntp/shared/metrics/new_tab_page_metrics_recorder.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_constants.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_controller_delegate.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_feature.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_commands.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_constants.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_view_controller_delegate.h" #import "ios/chrome/browser/ui/toolbar/public/fakebox_focuser.h" #import "ios/chrome/browser/ui/toolbar/public/toolbar_utils.h" #import "ios/chrome/common/material_timing.h" @@ -422,6 +423,8 @@ [self.headerView.lensButton addTarget:self action:@selector(openLens) forControlEvents:UIControlEventTouchUpInside]; + [self.layoutGuideCenter referenceView:self.headerView.lensButton + underName:kFakeboxLensIconGuide]; } [self updateVoiceSearchDisplay]; } @@ -532,6 +535,7 @@ initWithEntryPoint:LensEntrypoint::NewTabPage presentationStyle:LensInputSelectionPresentationStyle::SlideFromRight presentationCompletion:nil]; + [self.customizationDelegate dismissCustomizationMenu]; [self.dispatcher openLensInputSelection:command]; } @@ -542,6 +546,7 @@ UIView* voiceSearchButton = base::apple::ObjCCastStrict<UIView>(sender); [self.layoutGuideCenter referenceView:voiceSearchButton underName:kVoiceSearchButtonGuide]; + [self.customizationDelegate dismissCustomizationMenu]; [self.dispatcher startVoiceSearch]; }
diff --git a/ios/chrome/browser/profile/model/BUILD.gn b/ios/chrome/browser/profile/model/BUILD.gn index afe15455..bcbc9df3 100644 --- a/ios/chrome/browser/profile/model/BUILD.gn +++ b/ios/chrome/browser/profile/model/BUILD.gn
@@ -44,7 +44,6 @@ "//ios/chrome/browser/net/model:network_delegate", "//ios/chrome/browser/optimization_guide/model", "//ios/chrome/browser/prefs/model", - "//ios/chrome/browser/push_notification/model:browser_state_service_factory", "//ios/chrome/browser/segmentation_platform/model", "//ios/chrome/browser/shared/model/application_context", "//ios/chrome/browser/shared/model/browser_state",
diff --git a/ios/chrome/browser/profile/model/profile_manager_ios_impl.mm b/ios/chrome/browser/profile/model/profile_manager_ios_impl.mm index 0401e322..07e272a 100644 --- a/ios/chrome/browser/profile/model/profile_manager_ios_impl.mm +++ b/ios/chrome/browser/profile/model/profile_manager_ios_impl.mm
@@ -26,7 +26,6 @@ #import "ios/chrome/browser/profile/model/constants.h" #import "ios/chrome/browser/profile/model/off_the_record_profile_ios_impl.h" #import "ios/chrome/browser/profile/model/profile_ios_impl.h" -#import "ios/chrome/browser/push_notification/model/push_notification_profile_service_factory.h" #import "ios/chrome/browser/segmentation_platform/model/segmentation_platform_service_factory.h" #import "ios/chrome/browser/shared/model/prefs/pref_names.h" #import "ios/chrome/browser/shared/model/profile/profile_attributes_ios.h" @@ -500,7 +499,5 @@ segmentation_platform::SegmentationPlatformServiceFactory::GetForBrowserState( profile); - PushNotificationProfileServiceFactory::GetForProfile(profile); - SupervisedUserServiceFactory::GetForProfile(profile)->Init(); }
diff --git a/ios/chrome/browser/providers/memory_experimenter/chromium_memory_experimenter.mm b/ios/chrome/browser/providers/memory_experimenter/chromium_memory_experimenter.mm index 35d72c25..e57174e 100644 --- a/ios/chrome/browser/providers/memory_experimenter/chromium_memory_experimenter.mm +++ b/ios/chrome/browser/providers/memory_experimenter/chromium_memory_experimenter.mm
@@ -8,4 +8,6 @@ void BeginMemoryExperimentation() {} +void StopMemoryExperimentation() {} + } // namespace ios::provider
diff --git a/ios/chrome/browser/push_notification/model/push_notification_profile_service_factory.mm b/ios/chrome/browser/push_notification/model/push_notification_profile_service_factory.mm index c15cb522..a2be03d 100644 --- a/ios/chrome/browser/push_notification/model/push_notification_profile_service_factory.mm +++ b/ios/chrome/browser/push_notification/model/push_notification_profile_service_factory.mm
@@ -27,6 +27,7 @@ PushNotificationProfileServiceFactory::PushNotificationProfileServiceFactory() : ProfileKeyedServiceFactoryIOS("PushNotificationProfileService", + ServiceCreation::kCreateWithProfile, TestingCreation::kNoServiceForTests) { DependsOn(IdentityManagerFactory::GetInstance()); }
diff --git a/ios/chrome/browser/shared/public/commands/new_tab_page_commands.h b/ios/chrome/browser/shared/public/commands/new_tab_page_commands.h index b6e29230..ebf4494 100644 --- a/ios/chrome/browser/shared/public/commands/new_tab_page_commands.h +++ b/ios/chrome/browser/shared/public/commands/new_tab_page_commands.h
@@ -27,6 +27,9 @@ - (void)handleFeedModelOfType:(FeedType)feedType didEndUpdates:(FeedLayoutUpdateType)updateType; +// Presents an IPH bubble to highlight the Lens icon in the NTP Fakebox. +- (void)presentLensIconBubble; + @end #endif // IOS_CHROME_BROWSER_SHARED_PUBLIC_COMMANDS_NEW_TAB_PAGE_COMMANDS_H_
diff --git a/ios/chrome/browser/shared/ui/util/layout_guide_names.h b/ios/chrome/browser/shared/ui/util/layout_guide_names.h index a57fdfd2..48259e6 100644 --- a/ios/chrome/browser/shared/ui/util/layout_guide_names.h +++ b/ios/chrome/browser/shared/ui/util/layout_guide_names.h
@@ -61,5 +61,8 @@ // A guide that is constrained to match the frame of the Contextual Panel's // entrypoint when it is large, otherwise this stays nil. extern GuideName* const kContextualPanelLargeEntrypointGuide; +// A guide that is constrained to match the frame of the Lens icon in the NTP's +// Fakebox. +extern GuideName* const kFakeboxLensIconGuide; #endif // IOS_CHROME_BROWSER_SHARED_UI_UTIL_LAYOUT_GUIDE_NAMES_H_
diff --git a/ios/chrome/browser/shared/ui/util/layout_guide_names.mm b/ios/chrome/browser/shared/ui/util/layout_guide_names.mm index 223d2ab..5bd810f 100644 --- a/ios/chrome/browser/shared/ui/util/layout_guide_names.mm +++ b/ios/chrome/browser/shared/ui/util/layout_guide_names.mm
@@ -25,3 +25,4 @@ GuideName* const kMagicStackGuide = @"kMagicStackGuide"; GuideName* const kContextualPanelLargeEntrypointGuide = @"kContextualPanelLargeEntrypointGuide"; +GuideName* const kFakeboxLensIconGuide = @"kFakeboxLensIconGuide";
diff --git a/ios/chrome/browser/tips_notifications/coordinator/lens_promo_coordinator.mm b/ios/chrome/browser/tips_notifications/coordinator/lens_promo_coordinator.mm index 9de597c..5cd1c62d 100644 --- a/ios/chrome/browser/tips_notifications/coordinator/lens_promo_coordinator.mm +++ b/ios/chrome/browser/tips_notifications/coordinator/lens_promo_coordinator.mm
@@ -4,9 +4,11 @@ #import "ios/chrome/browser/tips_notifications/coordinator/lens_promo_coordinator.h" +#import "base/ios/block_types.h" #import "ios/chrome/browser/shared/model/browser/browser.h" #import "ios/chrome/browser/shared/public/commands/browser_coordinator_commands.h" #import "ios/chrome/browser/shared/public/commands/command_dispatcher.h" +#import "ios/chrome/browser/shared/public/commands/new_tab_page_commands.h" #import "ios/chrome/browser/tips_notifications/ui/lens_promo_instructions_view_controller.h" #import "ios/chrome/browser/tips_notifications/ui/lens_promo_view_controller.h" #import "ios/chrome/common/ui/confirmation_alert/confirmation_alert_action_handler.h" @@ -19,6 +21,7 @@ @implementation LensPromoCoordinator { LensPromoViewController* _viewController; LensPromoInstructionsViewController* _instructionsViewController; + BOOL _presentBubbleOnDismiss; } #pragma mark - ChromeCoordinator @@ -34,20 +37,28 @@ animated:YES completion:nil]; navigationController.presentationController.delegate = self; + _presentBubbleOnDismiss = NO; } - (void)stop { _instructionsViewController.actionHandler = nil; _instructionsViewController = nil; - [_viewController.presentingViewController dismissViewControllerAnimated:YES - completion:nil]; + ProceduralBlock completion = nil; + if (_presentBubbleOnDismiss) { + completion = ^{ + [self presentBubble]; + }; + } + [_viewController.presentingViewController + dismissViewControllerAnimated:YES + completion:completion]; _viewController = nil; } #pragma mark - PromoStyleViewControllerDelegate - (void)didTapPrimaryActionButton { - [self goToLens]; + _presentBubbleOnDismiss = YES; [self dismissScreen]; } @@ -68,7 +79,7 @@ #pragma mark - ConfirmationAlertPrimaryAction - (void)confirmationAlertPrimaryAction { - [self goToLens]; + _presentBubbleOnDismiss = YES; [self dismissScreen]; } @@ -101,8 +112,9 @@ } // Opens the NTP and displays an IPH bubble to call attention to the Lens icon. -- (void)goToLens { - // TODO(crbug.com/362981235): Go to the NTP and display IPH bubble for Lens. +- (void)presentBubble { + CommandDispatcher* dispatcher = self.browser->GetCommandDispatcher(); + [HandlerForProtocol(dispatcher, NewTabPageCommands) presentLensIconBubble]; } @end
diff --git a/ios/chrome/browser/ui/content_suggestions/BUILD.gn b/ios/chrome/browser/ui/content_suggestions/BUILD.gn index efd21708..b8624a76 100644 --- a/ios/chrome/browser/ui/content_suggestions/BUILD.gn +++ b/ios/chrome/browser/ui/content_suggestions/BUILD.gn
@@ -41,6 +41,7 @@ "//ios/chrome/browser/discover_feed/model:discover_feed_factory", "//ios/chrome/browser/favicon/model", "//ios/chrome/browser/feature_engagement/model", + "//ios/chrome/browser/home_customization/coordinator", "//ios/chrome/browser/net/model:crurl", "//ios/chrome/browser/ntp/model", "//ios/chrome/browser/ntp/model:set_up_list_item_type",
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator.h b/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator.h index d01e2b3..6b2df8e 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator.h +++ b/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator.h
@@ -28,7 +28,7 @@ @class ContentSuggestionsMetricsRecorder; class LargeIconCache; @class MostVisitedTilesConfig; -@protocol NewTabPageMetricsDelegate; +@protocol NewTabPageActionsDelegate; class PrefService; @protocol SnackbarCommands; class UrlLoadingBrowserAgent; @@ -75,9 +75,8 @@ // Delegate used to communicate events back to the owner of this class. @property(nonatomic, weak) id<MostVisitedTilesMediatorDelegate> delegate; -// Delegate for reporting content suggestions actions to the NTP metrics -// recorder. -@property(nonatomic, weak) id<NewTabPageMetricsDelegate> NTPMetricsDelegate; +// Delegate for reporting content suggestions actions to the NTP. +@property(nonatomic, weak) id<NewTabPageActionsDelegate> NTPActionsDelegate; // Dispatcher. @property(nonatomic, weak) id<SnackbarCommands> snackbarHandler;
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator.mm b/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator.mm index 0b2c9795..913fda1 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator.mm
@@ -19,7 +19,7 @@ #import "components/strings/grit/components_strings.h" #import "ios/chrome/browser/favicon/ui_bundled/favicon_attributes_provider.h" #import "ios/chrome/browser/net/model/crurl.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/ntp_tiles/model/most_visited_sites_observer_bridge.h" #import "ios/chrome/browser/policy/model/policy_util.h" #import "ios/chrome/browser/shared/model/application_context/application_context.h" @@ -374,7 +374,7 @@ // Logs a histogram due to a Most Visited item being opened. - (void)logMostVisitedOpening:(ContentSuggestionsMostVisitedItem*)item atIndex:(NSInteger)mostVisitedIndex { - [self.NTPMetricsDelegate mostVisitedTileOpened]; + [self.NTPActionsDelegate mostVisitedTileOpened]; if (ShouldPutMostVisitedSitesInMagicStack()) { [self.delegate logMagicStackEngagementForType:ContentSuggestionsModuleType:: kMostVisited];
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator_unittest.mm index f77ee22..a833884 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/most_visited_tiles_mediator_unittest.mm
@@ -9,7 +9,7 @@ #import "components/sync_preferences/testing_pref_service_syncable.h" #import "ios/chrome/browser/favicon/model/ios_chrome_large_icon_cache_factory.h" #import "ios/chrome/browser/favicon/model/ios_chrome_large_icon_service_factory.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/shared/model/application_context/application_context.h" #import "ios/chrome/browser/shared/model/browser/browser.h" #import "ios/chrome/browser/shared/model/browser/test/test_browser.h" @@ -62,8 +62,8 @@ metrics_recorder_ = [[ContentSuggestionsMetricsRecorder alloc] initWithLocalState:local_state()]; mediator_.contentSuggestionsMetricsRecorder = metrics_recorder_; - mediator_.NTPMetricsDelegate = - OCMProtocolMock(@protocol(NewTabPageMetricsDelegate)); + mediator_.NTPActionsDelegate = + OCMProtocolMock(@protocol(NewTabPageActionsDelegate)); } ~MostVisitedTilesMediatorTest() override { [mediator_ disconnect]; } @@ -93,7 +93,7 @@ initWithConfiguration:item]; UIGestureRecognizer* recognizer = [[UIGestureRecognizer alloc] init]; [view addGestureRecognizer:recognizer]; - OCMExpect([mediator_.NTPMetricsDelegate mostVisitedTileOpened]); + OCMExpect([mediator_.NTPActionsDelegate mostVisitedTileOpened]); // Action. [mediator_ mostVisitedTileTapped:recognizer];
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator.h b/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator.h index 9e39754..151ee8d 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator.h +++ b/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator.h
@@ -19,7 +19,7 @@ @protocol ContentSuggestionsConsumer; @class ContentSuggestionsMetricsRecorder; enum class ContentSuggestionsModuleType; -@protocol NewTabPageMetricsDelegate; +@protocol NewTabPageActionsDelegate; class ReadingListModel; @class ShortcutsConfig; @protocol WhatsNewCommands; @@ -49,9 +49,8 @@ // Delegate used to communicate events back to the owner of this class. @property(nonatomic, weak) id<ShortcutsMediatorDelegate> delegate; -// Delegate for reporting content suggestions actions to the NTP metrics -// recorder. -@property(nonatomic, weak) id<NewTabPageMetricsDelegate> NTPMetricsDelegate; +// Delegate for reporting content suggestions actions to the NTP. +@property(nonatomic, weak) id<NewTabPageActionsDelegate> NTPActionsDelegate; // Dispatcher. @property(nonatomic, weak)
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator.mm b/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator.mm index 9a17cd1..1476683c 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator.mm
@@ -9,7 +9,7 @@ #import "components/feature_engagement/public/tracker.h" #import "components/reading_list/core/reading_list_model.h" #import "components/reading_list/ios/reading_list_model_bridge_observer.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/shared/public/commands/application_commands.h" #import "ios/chrome/browser/shared/public/commands/browser_coordinator_commands.h" #import "ios/chrome/browser/shared/public/commands/whats_new_commands.h" @@ -123,9 +123,9 @@ if (shortcutsItem.disabled) { return; } - [self.NTPMetricsDelegate shortcutTileOpened]; - [self.delegate logMagicStackEngagementForType:ContentSuggestionsModuleType:: - kShortcuts]; + [self.NTPActionsDelegate shortcutTileOpened]; + [self.delegate + logMagicStackEngagementForType:ContentSuggestionsModuleType::kShortcuts]; [self.contentSuggestionsMetricsRecorder recordShortcutTileTapped:shortcutsItem.collectionShortcutType]; switch (shortcutsItem.collectionShortcutType) {
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator_unittest.mm index 3f43b22..1831717c0 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/shortcuts_mediator_unittest.mm
@@ -7,7 +7,7 @@ #import "components/feature_engagement/test/mock_tracker.h" #import "components/reading_list/core/reading_list_model_impl.h" #import "ios/chrome/browser/feature_engagement/model/tracker_factory.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/reading_list/model/reading_list_model_factory.h" #import "ios/chrome/browser/reading_list/model/reading_list_test_utils.h" #import "ios/chrome/browser/shared/model/profile/test/test_profile_ios.h" @@ -75,8 +75,8 @@ mediator_.contentSuggestionsMetricsRecorder = metrics_recorder_; mediator_.dispatcher = dispatcher_; mediator_.delegate = OCMProtocolMock(@protocol(ShortcutsMediatorDelegate)); - mediator_.NTPMetricsDelegate = - OCMProtocolMock(@protocol(NewTabPageMetricsDelegate)); + mediator_.NTPActionsDelegate = + OCMProtocolMock(@protocol(NewTabPageActionsDelegate)); } protected: @@ -93,7 +93,7 @@ TEST_F(ShortcutsMediatorTest, TestOpenReadingList) { OCMExpect([dispatcher_ showReadingList]); - OCMExpect([mediator_.NTPMetricsDelegate shortcutTileOpened]); + OCMExpect([mediator_.NTPActionsDelegate shortcutTileOpened]); OCMExpect([mediator_.delegate logMagicStackEngagementForType:ContentSuggestionsModuleType::kShortcuts]); @@ -116,7 +116,7 @@ TEST_F(ShortcutsMediatorTest, TestOpenWhatsNew) { OCMExpect([dispatcher_ showWhatsNew]); - OCMExpect([mediator_.NTPMetricsDelegate shortcutTileOpened]); + OCMExpect([mediator_.NTPActionsDelegate shortcutTileOpened]); OCMExpect([mediator_.delegate logMagicStackEngagementForType:ContentSuggestionsModuleType::kShortcuts]);
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h index ba12090f..fdf31ad8 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.h
@@ -14,10 +14,11 @@ @protocol ContentSuggestionsDelegate; @class ContentSuggestionsMediator; @class ContentSuggestionsViewController; +@protocol HomeCustomizationDelegate; @protocol HomeStartDataSource; @class MagicStackCollectionViewController; @protocol NewTabPageControllerDelegate; -@protocol NewTabPageMetricsDelegate; +@protocol NewTabPageActionsDelegate; // Coordinator to manage the Suggestions UI via a // ContentSuggestionsViewController. @@ -48,13 +49,15 @@ // Delegate used to communicate Content Suggestions events to the delegate. @property(nonatomic, weak) id<ContentSuggestionsDelegate> delegate; -// Delegate for reporting content suggestions actions to the NTP metrics -// recorder. -@property(nonatomic, weak) id<NewTabPageMetricsDelegate> NTPMetricsDelegate; +// Delegate for reporting content suggestions actions to the NTP. +@property(nonatomic, weak) id<NewTabPageActionsDelegate> NTPActionsDelegate; // Data Source for the Home Start state. @property(nonatomic, weak) id<HomeStartDataSource> homeStartDataSource; +// Delegate for the Home Customization menu. +@property(nonatomic, weak) id<HomeCustomizationDelegate> customizationDelegate; + // Refreshes the contents owned by this coordinator. - (void)refresh;
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm index 0b45a75..8771caec 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm
@@ -33,14 +33,15 @@ #import "ios/chrome/browser/favicon/model/ios_chrome_large_icon_service_factory.h" #import "ios/chrome/browser/favicon/model/large_icon_cache.h" #import "ios/chrome/browser/feature_engagement/model/tracker_factory.h" +#import "ios/chrome/browser/home_customization/coordinator/home_customization_delegate.h" #import "ios/chrome/browser/ntp/model/new_tab_page_tab_helper.h" #import "ios/chrome/browser/ntp/model/set_up_list_item_type.h" #import "ios/chrome/browser/ntp/model/set_up_list_prefs.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_constants.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_delegate.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_feature.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_header_constants.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" #import "ios/chrome/browser/ntp_tiles/model/ios_most_visited_sites_factory.h" #import "ios/chrome/browser/parcel_tracking/features.h" #import "ios/chrome/browser/parcel_tracking/parcel_tracking_prefs.h" @@ -214,7 +215,7 @@ - (void)start { DCHECK(self.browser); - DCHECK(self.NTPMetricsDelegate); + DCHECK(self.NTPActionsDelegate); if (self.started) { // Prevent this coordinator from being started twice in a row return; @@ -282,7 +283,7 @@ scenario:kMenuScenarioHistogramMostVisitedEntry]; _mostVisitedTilesMediator.snackbarHandler = static_cast<id<SnackbarCommands>>(self.browser->GetCommandDispatcher()); - _mostVisitedTilesMediator.NTPMetricsDelegate = self.NTPMetricsDelegate; + _mostVisitedTilesMediator.NTPActionsDelegate = self.NTPActionsDelegate; [moduleMediators addObject:_mostVisitedTilesMediator]; self.contentSuggestionsMediator.mostVisitedTilesMediator = _mostVisitedTilesMediator; @@ -294,7 +295,7 @@ authService:authenticationService]; _shortcutsMediator.contentSuggestionsMetricsRecorder = self.contentSuggestionsMetricsRecorder; - _shortcutsMediator.NTPMetricsDelegate = self.NTPMetricsDelegate; + _shortcutsMediator.NTPActionsDelegate = self.NTPActionsDelegate; _shortcutsMediator.dispatcher = static_cast< id<ApplicationCommands, BrowserCoordinatorCommands, WhatsNewCommands>>( self.browser->GetCommandDispatcher()); @@ -307,7 +308,7 @@ prefService:prefs identityManager:identityManager browser:self.browser]; - _tabResumptionMediator.NTPMetricsDelegate = self.NTPMetricsDelegate; + _tabResumptionMediator.NTPActionsDelegate = self.NTPActionsDelegate; _tabResumptionMediator.contentSuggestionsMetricsRecorder = self.contentSuggestionsMetricsRecorder; [moduleMediators addObject:_tabResumptionMediator]; @@ -334,7 +335,7 @@ prefService:IsHomeCustomizationEnabled() ? prefs : GetApplicationContext()->GetLocalState()]; - _parcelTrackingMediator.NTPMetricsDelegate = self.NTPMetricsDelegate; + _parcelTrackingMediator.NTPActionsDelegate = self.NTPActionsDelegate; [moduleMediators addObject:_parcelTrackingMediator]; } if (IsSafetyCheckMagicStackEnabled()) { @@ -579,6 +580,7 @@ #pragma mark - MagicStackModuleContainerDelegate - (void)seeMoreWasTappedForModuleType:(ContentSuggestionsModuleType)type { + [self.customizationDelegate dismissCustomizationMenu]; switch (type) { case ContentSuggestionsModuleType::kSafetyCheck: [self didSelectSafetyCheckItem:SafetyCheckItemType::kDefault]; @@ -784,7 +786,7 @@ - (void)didSelectSafetyCheckItem:(SafetyCheckItemType)type { CHECK(IsSafetyCheckMagicStackEnabled()); - [self.NTPMetricsDelegate safetyCheckOpened]; + [self.NTPActionsDelegate safetyCheckOpened]; Browser* browser = self.browser; [_magicStackRankingModel logMagicStackEngagementForType: ContentSuggestionsModuleType::kSafetyCheck]; @@ -838,7 +840,7 @@ type)]; } [self.contentSuggestionsMetricsRecorder recordSetUpListItemSelected:type]; - [self.NTPMetricsDelegate setUpListItemOpened]; + [self.NTPActionsDelegate setUpListItemOpened]; PrefService* localState = GetApplicationContext()->GetLocalState(); set_up_list_prefs::RecordInteraction(localState);
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm index e848f58..61d9799 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm
@@ -26,8 +26,8 @@ #import "ios/chrome/browser/net/model/crurl.h" #import "ios/chrome/browser/ntp/model/new_tab_page_tab_helper.h" #import "ios/chrome/browser/ntp/shared/metrics/home_metrics.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_feature.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" #import "ios/chrome/browser/shared/coordinator/scene/scene_state.h" #import "ios/chrome/browser/shared/model/application_context/application_context.h" #import "ios/chrome/browser/shared/model/prefs/pref_names.h"
diff --git a/ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_mediator.h b/ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_mediator.h index ba6afaea..b9e7472 100644 --- a/ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_mediator.h +++ b/ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_mediator.h
@@ -14,7 +14,7 @@ } enum class ContentSuggestionsModuleType; -@protocol NewTabPageMetricsDelegate; +@protocol NewTabPageActionsDelegate; @class ParcelTrackingItem; enum class ParcelType; class UrlLoadingBrowserAgent; @@ -42,9 +42,8 @@ // Delegate used to communicate events back to the owner of this class. @property(nonatomic, weak) id<ParcelTrackingMediatorDelegate> delegate; -// Delegate for reporting content suggestions actions to the NTP metrics -// recorder. -@property(nonatomic, weak) id<NewTabPageMetricsDelegate> NTPMetricsDelegate; +// Delegate for reporting content suggestions actions to the NTP. +@property(nonatomic, weak) id<NewTabPageActionsDelegate> NTPActionsDelegate; // Default initializer. - (instancetype)
diff --git a/ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_mediator.mm b/ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_mediator.mm index 0235671..b9311e1 100644 --- a/ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_mediator.mm
@@ -11,7 +11,7 @@ #import "components/prefs/ios/pref_observer_bridge.h" #import "components/prefs/pref_change_registrar.h" #import "ios/chrome/browser/ntp/shared/metrics/home_metrics.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/parcel_tracking/features.h" #import "ios/chrome/browser/parcel_tracking/metrics.h" #import "ios/chrome/browser/parcel_tracking/parcel_tracking_prefs.h" @@ -150,7 +150,7 @@ #pragma mark - ParcelTrackingCommands - (void)loadParcelTrackingPage:(GURL)parcelTrackingURL { - [self.NTPMetricsDelegate parcelTrackingOpened]; + [self.NTPActionsDelegate parcelTrackingOpened]; [self.delegate logMagicStackEngagementForType:ContentSuggestionsModuleType:: kParcelTracking]; _URLLoadingBrowserAgent->Load(UrlLoadParams::InCurrentTab(parcelTrackingURL));
diff --git a/ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.h b/ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.h index e2421c7..9d2e5e4 100644 --- a/ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.h +++ b/ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.h
@@ -9,7 +9,7 @@ class Browser; @class ContentSuggestionsMetricsRecorder; -@protocol NewTabPageMetricsDelegate; +@protocol NewTabPageActionsDelegate; class PrefService; @protocol TabResumptionHelperDelegate; @class TabResumptionItem; @@ -27,9 +27,8 @@ // The delegate for this helper class. @property(nonatomic, weak) id<TabResumptionHelperDelegate> delegate; -// Delegate for reporting content suggestions actions to the NTP metrics -// recorder. -@property(nonatomic, weak) id<NewTabPageMetricsDelegate> NTPMetricsDelegate; +// Delegate for reporting content suggestions actions to the NTP. +@property(nonatomic, weak) id<NewTabPageActionsDelegate> NTPActionsDelegate; // Recorder for content suggestions metrics. @property(nonatomic, weak)
diff --git a/ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.mm b/ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.mm index 57663ce..a4c0bc9f 100644 --- a/ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.mm
@@ -18,13 +18,14 @@ #import "components/sync/service/sync_user_settings.h" #import "components/sync_sessions/open_tabs_ui_delegate.h" #import "components/sync_sessions/session_sync_service.h" +#import "components/visited_url_ranking/public/url_visit_util.h" #import "components/visited_url_ranking/public/visited_url_ranking_service.h" #import "ios/chrome/browser/favicon/model/favicon_loader.h" #import "ios/chrome/browser/favicon/model/ios_chrome_favicon_loader_factory.h" #import "ios/chrome/browser/intents/intents_donation_helper.h" #import "ios/chrome/browser/metrics/model/new_tab_page_uma.h" #import "ios/chrome/browser/ntp/model/new_tab_page_tab_helper.h" -#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_metrics_delegate.h" +#import "ios/chrome/browser/ntp/ui_bundled/new_tab_page_actions_delegate.h" #import "ios/chrome/browser/ntp_tiles/model/tab_resumption/tab_resumption_prefs.h" #import "ios/chrome/browser/page_image/model/page_image_service_factory.h" #import "ios/chrome/browser/sessions/model/session_util.h" @@ -280,11 +281,11 @@ switch (item.itemType) { case TabResumptionItemType::kLastSyncedTab: - [self.NTPMetricsDelegate distantTabResumptionOpenedAtIndex:index]; + [self.NTPActionsDelegate distantTabResumptionOpenedAtIndex:index]; [self openDistantTab:item]; break; case TabResumptionItemType::kMostRecentTab: { - [self.NTPMetricsDelegate recentTabTileOpenedAtIndex:index]; + [self.NTPActionsDelegate recentTabTileOpenedAtIndex:index]; [IntentDonationHelper donateIntent:IntentType::kOpenLatestTab]; web::NavigationManager::WebLoadParams webLoadParams = web::NavigationManager::WebLoadParams(item.tabURL); @@ -351,10 +352,10 @@ } switch (self.itemConfig.itemType) { case TabResumptionItemType::kLastSyncedTab: - [self.NTPMetricsDelegate distantTabResumptionDisplayedAtIndex:index]; + [self.NTPActionsDelegate distantTabResumptionDisplayedAtIndex:index]; break; case TabResumptionItemType::kMostRecentTab: - [self.NTPMetricsDelegate recentTabTileDisplayedAtIndex:index]; + [self.NTPActionsDelegate recentTabTileDisplayedAtIndex:index]; break; } } @@ -723,14 +724,49 @@ })); } -// Called when the URLs have been ranked. Pass the first one to MagicStack. +// Called when the URLs have been ranked. Select the first one and decorate it. - (void)onURLRanked:(std::vector<visited_url_ranking::URLVisitAggregate>)URLs withStatus:(visited_url_ranking::ResultStatus)status { if (status != visited_url_ranking::ResultStatus::kSuccess || URLs.size() == 0) { return; } + if (!IsTabResumption2BubbleEnabled()) { + return [self onURLDecorated:std::move(URLs) withStatus:status]; + } + size_t index; + // Select the first URL with tab data. + for (index = 0; index < URLs.size(); index++) { + if (ExtractTabData(URLs[index])) { + break; + } + } + if (index == URLs.size()) { + return; + } + + std::vector<visited_url_ranking::URLVisitAggregate> selectedURLs; + selectedURLs.push_back(std::move(URLs[index])); + + __weak __typeof(self) weakSelf = self; + _visitedURLRankingService->DecorateURLVisitAggregates( + {}, std::move(selectedURLs), + base::BindOnce( + ^(visited_url_ranking::ResultStatus decorateStatus, + std::vector<visited_url_ranking::URLVisitAggregate> decoratedURLs) { + [weakSelf onURLDecorated:std::move(decoratedURLs) + withStatus:decorateStatus]; + })); +} + +// Called when the URLs have been decorated. +- (void)onURLDecorated:(std::vector<visited_url_ranking::URLVisitAggregate>)URLs + withStatus:(visited_url_ranking::ResultStatus)status { + if (status != visited_url_ranking::ResultStatus::kSuccess || + URLs.size() == 0) { + return; + } const visited_url_ranking::URLVisitAggregate::TabData* tabData = nullptr; const visited_url_ranking::URLVisitAggregate* URLAggregate = nullptr; for (auto& aggregate : URLs) { @@ -761,9 +797,11 @@ item.commandHandler = self; item.delegate = self; if (IsTabResumption2BubbleEnabled()) { - // Dummy reason for now as TR2 does not return one. - // TODO(crbug.com/342389622): put the correct reason. - item.reason = @"TEST TR2 REASON."; + if (URLAggregate->decorations.size()) { + item.reason = base::SysUTF16ToNSString( + visited_url_ranking::GetMostRelevantDecoration(*URLAggregate) + .GetDisplayString()); + } } if (tab.id > 0 && tab.session_tag && !isLocal) { item.sessionName = base::SysUTF8ToNSString(tab.session_name.value());
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm index b967dec..f305aca 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm
@@ -775,7 +775,8 @@ - (void)enhancedSafeBrowsingInlinePromoTriggerCriteriaMet { if (!base::FeatureList::IsEnabled( - feature_engagement::kIPHiOSInlineEnhancedSafeBrowsingPromoFeature)) { + feature_engagement::kIPHiOSInlineEnhancedSafeBrowsingPromoFeature) || + !self.browserState) { return; } feature_engagement::Tracker* tracker =
diff --git a/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller.mm b/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller.mm index 275657c..c697ffe 100644 --- a/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller.mm
@@ -831,7 +831,8 @@ - (void)enhancedSafeBrowsingInlinePromoTriggerCriteriaMet { if (!base::FeatureList::IsEnabled( - feature_engagement::kIPHiOSInlineEnhancedSafeBrowsingPromoFeature)) { + feature_engagement::kIPHiOSInlineEnhancedSafeBrowsingPromoFeature) || + !_browserState) { return; } feature_engagement::Tracker* tracker =
diff --git a/ios/chrome/test/earl_grey2/OWNERS b/ios/chrome/test/earl_grey2/OWNERS new file mode 100644 index 0000000..7cb2f30 --- /dev/null +++ b/ios/chrome/test/earl_grey2/OWNERS
@@ -0,0 +1,6 @@ +# This is for the common case of adding, removing, or renaming deps entries for +# EG2 test targets (e.g.. deps entries of the form "..foo:eg2_tests"). For other +# changes, including adding new `chrome_ios_eg2_test` targets (e.g., targets of +# of the form "ios_chrome_foo_eg2tests_module") please use the usual set of +# OWNERS. +per-file BUILD.gn=*
diff --git a/ios/chrome/test/providers/BUILD.gn b/ios/chrome/test/providers/BUILD.gn index 646558f..d2b5eef 100644 --- a/ios/chrome/test/providers/BUILD.gn +++ b/ios/chrome/test/providers/BUILD.gn
@@ -21,6 +21,7 @@ "//ios/chrome/test/providers/lottie", "//ios/chrome/test/providers/mailto_handler", "//ios/chrome/test/providers/material", + "//ios/chrome/test/providers/memory_experimenter", "//ios/chrome/test/providers/mini_map", "//ios/chrome/test/providers/modals", "//ios/chrome/test/providers/omaha",
diff --git a/ios/chrome/test/providers/memory_experimenter/BUILD.gn b/ios/chrome/test/providers/memory_experimenter/BUILD.gn new file mode 100644 index 0000000..88d2bc9 --- /dev/null +++ b/ios/chrome/test/providers/memory_experimenter/BUILD.gn
@@ -0,0 +1,8 @@ +# Copyright 2024 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("memory_experimenter") { + sources = [ "test_memory_experimenter.mm" ] + deps = [ "//ios/public/provider/chrome/browser/memory_experimenter:memory_experimenter_api" ] +}
diff --git a/ios/chrome/test/providers/memory_experimenter/test_memory_experimenter.mm b/ios/chrome/test/providers/memory_experimenter/test_memory_experimenter.mm new file mode 100644 index 0000000..fa0e5639 --- /dev/null +++ b/ios/chrome/test/providers/memory_experimenter/test_memory_experimenter.mm
@@ -0,0 +1,15 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/public/provider/chrome/browser/memory_experimenter/memory_experimenter_api.h" + +namespace ios { +namespace provider { + +void BeginMemoryExperimentation() {} + +void StopMemoryExperimentation() {} + +} // namespace provider +} // namespace ios
diff --git a/ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.h b/ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.h index 955c0a85..a6c172f 100644 --- a/ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.h +++ b/ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.h
@@ -24,6 +24,15 @@ class SafeBrowsingClient; @protocol SafeBrowsingTabHelperDelegate; +// Used to identify which redirect chain logic branch should be used. For +// example, `kPendingMainFrame` will use logic related to +// `pending_main_frame_redirect_chain_`. +enum class RedirectChain { + kPendingMainFrame = 0, + kToBeCommitted = 1, + kCommitted = 2, +}; + // Filters used to look for specific types of queries while iterating through a // redirect chain. These filters can be used to affect if a partially completed // policy decision is made. For example, `kSyncQueries` can be used to see if @@ -167,7 +176,7 @@ // Iterates through the `redirect_chain` and uses `query_data` to return an // unanswered sync or async query. MainFrameUrlQuery* GetUnansweredQueryForRedirectChain( - std::list<MainFrameUrlQuery>& redirect_chain, + RedirectChain redirect_chain, const SafeBrowsingQueryManager::QueryData& query_data); // Callback invoked when a main frame query for `url` has finished with @@ -194,6 +203,12 @@ const SafeBrowsingQueryManager::QueryData& query_data, web::WebStatePolicyDecider::PolicyDecision decision); + // Updates a MainFrameUrlQuery's components and the related policy + // `decision`. + void UpdateQuery(MainFrameUrlQuery* query, + QueryType query_type, + web::WebStatePolicyDecider::PolicyDecision decision); + // Returns the policy decision determined by the results of queries for URLs // in the main-frame redirect chain and the `pending_main_frame_query`. If // at least one such query has received a decision to cancel the navigation, @@ -206,16 +221,17 @@ MainFrameRedirectChainDecision(); // Returns the policy decision determined by the results of queries for URLs - // in the `pending_main_frame_redirect_chain_`, the - // `pending_main_frame_query`, and a redirect chain filter. Regardless of - // the `filter`, if at least one such query has received a decision to - // cancel the navigation, the overall decision is to cancel, even if some - // queries have not yet received a response. After applying the `filter`, if - // all queries have a decision to allow the navigation, then the decision is - // to allow the navigation. Otherwise, the overall decision depends on query - // results that have not yet been received, so std::nullopt is returned. + // in a `redirect_chain`, and a redirect chain filter. Regardless of the + // `filter`, if at least one such query has received a decision to cancel + // the navigation, the overall decision is to cancel, even if some queries + // have not yet received a response. After applying the `filter`, if the + // relevant queries have a decision to allow the navigation, then the + // decision is to allow the navigation. Otherwise, the overall decision + // depends on query results that have not yet been received, so std::nullopt + // is returned. std::optional<web::WebStatePolicyDecider::PolicyDecision> - RedirectChainDecisionWithFilter(RedirectChainFilter filter); + RedirectChainDecisionWithFilter(RedirectChain redirect_chain, + RedirectChainFilter filter); // The sync_check_complete and async_check_complete from `query` are used to // detect if a query belongs to a certain RedirectChainFilter. Returns
diff --git a/ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.mm b/ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.mm index 188114ea..d073063 100644 --- a/ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.mm +++ b/ios/components/security_interstitials/safe_browsing/safe_browsing_tab_helper.mm
@@ -341,8 +341,8 @@ safe_browsing::kSafeBrowsingAsyncRealTimeCheck)) { // Logic only needs to check if sync queries in the redirect chain are // completed since async queries can respond after navigation. - decision = - RedirectChainDecisionWithFilter(RedirectChainFilter::kSyncQueries); + decision = RedirectChainDecisionWithFilter( + RedirectChain::kPendingMainFrame, RedirectChainFilter::kSyncQueries); } else { decision = MainFrameRedirectChainDecision(); } @@ -386,7 +386,7 @@ const GURL& url = query_data.query.url; MainFrameUrlQuery* redirect_chain_query = GetUnansweredQueryForRedirectChain( - pending_main_frame_redirect_chain_, query_data); + RedirectChain::kPendingMainFrame, query_data); if (redirect_chain_query) { return redirect_chain_query; } @@ -410,7 +410,7 @@ SafeBrowsingTabHelper::PolicyDecider::GetOldestPendingToBeCommittedQuery( const SafeBrowsingQueryManager::QueryData& query_data) { MainFrameUrlQuery* redirect_chain_query = GetUnansweredQueryForRedirectChain( - to_be_committed_redirect_chain_, query_data); + RedirectChain::kToBeCommitted, query_data); return redirect_chain_query; } @@ -418,18 +418,32 @@ SafeBrowsingTabHelper::PolicyDecider::GetOldestPendingCommittedQuery( const SafeBrowsingQueryManager::QueryData& query_data) { MainFrameUrlQuery* redirect_chain_query = - GetUnansweredQueryForRedirectChain(committed_redirect_chain_, query_data); + GetUnansweredQueryForRedirectChain(RedirectChain::kCommitted, query_data); return redirect_chain_query; } SafeBrowsingTabHelper::PolicyDecider::MainFrameUrlQuery* SafeBrowsingTabHelper::PolicyDecider::GetUnansweredQueryForRedirectChain( - std::list<SafeBrowsingTabHelper::PolicyDecider::MainFrameUrlQuery>& - redirect_chain, + RedirectChain redirect_chain, const SafeBrowsingQueryManager::QueryData& query_data) { const GURL& url = query_data.query.url; + std::list<MainFrameUrlQuery>* selected_redirect_chain = nullptr; - for (auto& query : redirect_chain) { + switch (redirect_chain) { + case RedirectChain::kPendingMainFrame: + selected_redirect_chain = &pending_main_frame_redirect_chain_; + break; + case RedirectChain::kToBeCommitted: + selected_redirect_chain = &to_be_committed_redirect_chain_; + break; + case RedirectChain::kCommitted: + selected_redirect_chain = &committed_redirect_chain_; + break; + default: + break; + } + + for (auto& query : *selected_redirect_chain) { if (query.url == url) { if (query_data.type == QueryType::kAsync && !query.async_check_complete) { return &query; @@ -485,8 +499,7 @@ SafeBrowsingUrlCheckerImpl::PerformedCheck performed_check = query_data.performed_check; MainFrameUrlQuery* query = GetOldestPendingMainFrameQuery(query_data); - query->decision = decision; - query->sync_check_complete = true; + UpdateQuery(query, query_data.type, decision); // If ShouldAllowResponse() has already been called for this URL, and if // an overall decision for the redirect chain can be computed, invoke this @@ -494,7 +507,8 @@ auto& response_callback = pending_main_frame_query_->response_callback; if (!response_callback.is_null()) { std::optional<web::WebStatePolicyDecider::PolicyDecision> sync_decision = - RedirectChainDecisionWithFilter(RedirectChainFilter::kSyncQueries); + RedirectChainDecisionWithFilter(RedirectChain::kPendingMainFrame, + RedirectChainFilter::kSyncQueries); if (sync_decision) { if (sync_decision->ShouldAllowNavigation()) { RecordTotalDelayMetricForDelayedAllowedNavigation( @@ -524,18 +538,53 @@ void SafeBrowsingTabHelper::PolicyDecider::OnMainFrameUrlAsyncQueryDecided( const SafeBrowsingQueryManager::QueryData& query_data, web::WebStatePolicyDecider::PolicyDecision decision) { - MainFrameUrlQuery* query = GetOldestPendingMainFrameQuery(query_data); - query->async_check_complete = true; - std::optional<web::WebStatePolicyDecider::PolicyDecision> query_decision = - query->decision; + MainFrameUrlQuery* committed_query = + GetOldestPendingCommittedQuery(query_data); + if (committed_query) { + UpdateQuery(committed_query, query_data.type, decision); + // TODO(crbug.com/337243708): Add logic for if query is found in committed + // query + return; + } - if (query_decision->ShouldAllowNavigation() || !query_decision) { - query_decision = decision; + MainFrameUrlQuery* to_be_committed_query = + GetOldestPendingToBeCommittedQuery(query_data); + if (to_be_committed_query) { + UpdateQuery(to_be_committed_query, query_data.type, decision); + // TODO(crbug.com/337243708): Add logic for if query is found in + // to_be_committed query + return; + } + + MainFrameUrlQuery* pending_main_frame_query = + GetOldestPendingMainFrameQuery(query_data); + if (pending_main_frame_query) { + UpdateQuery(pending_main_frame_query, query_data.type, decision); + // TODO(crbug.com/337243708): Add logic for if query is found in pending + // main frame query } // TODO(crbug.com/337243708): Add async logic. } +void SafeBrowsingTabHelper::PolicyDecider::UpdateQuery( + MainFrameUrlQuery* query, + QueryType query_type, + web::WebStatePolicyDecider::PolicyDecision decision) { + if (query_type == QueryType::kSync) { + query->sync_check_complete = true; + } else if (query_type == QueryType::kAsync) { + query->async_check_complete = true; + } + + std::optional<web::WebStatePolicyDecider::PolicyDecision>& query_decision = + query->decision; + + if (!query_decision || query_decision->ShouldAllowNavigation()) { + query_decision = decision; + } +} + std::optional<web::WebStatePolicyDecider::PolicyDecision> SafeBrowsingTabHelper::PolicyDecider::MainFrameRedirectChainDecision() { if (pending_main_frame_query_->decision && @@ -562,16 +611,31 @@ std::optional<web::WebStatePolicyDecider::PolicyDecision> SafeBrowsingTabHelper::PolicyDecider::RedirectChainDecisionWithFilter( + RedirectChain redirect_chain, RedirectChainFilter filter) { - if (pending_main_frame_query_->decision && - pending_main_frame_query_->decision->ShouldCancelNavigation()) { - return pending_main_frame_query_->decision; + std::optional<web::WebStatePolicyDecider::PolicyDecision> decision = + std::nullopt; + std::list<MainFrameUrlQuery>* selected_redirect_chain = nullptr; + + if (redirect_chain == RedirectChain::kPendingMainFrame) { + if (pending_main_frame_query_->decision && + pending_main_frame_query_->decision->ShouldCancelNavigation()) { + return pending_main_frame_query_->decision; + } + + decision = pending_main_frame_query_->decision; + selected_redirect_chain = &pending_main_frame_redirect_chain_; } - std::optional<web::WebStatePolicyDecider::PolicyDecision> decision = - pending_main_frame_query_->decision; + if (redirect_chain == RedirectChain::kToBeCommitted) { + selected_redirect_chain = &to_be_committed_redirect_chain_; + } - for (auto& query : pending_main_frame_redirect_chain_) { + if (redirect_chain == RedirectChain::kCommitted) { + selected_redirect_chain = &committed_redirect_chain_; + } + + for (auto& query : *selected_redirect_chain) { if (!query.decision) { decision = std::nullopt; } else if (query.decision->ShouldCancelNavigation()) {
diff --git a/ios/public/provider/chrome/browser/memory_experimenter/memory_experimenter_api.h b/ios/public/provider/chrome/browser/memory_experimenter/memory_experimenter_api.h index 74c3640..815121a 100644 --- a/ios/public/provider/chrome/browser/memory_experimenter/memory_experimenter_api.h +++ b/ios/public/provider/chrome/browser/memory_experimenter/memory_experimenter_api.h
@@ -12,6 +12,9 @@ // Begin memory experimentation. void BeginMemoryExperimentation(); +// Stop memory experimentation. +void StopMemoryExperimentation(); + } // namespace ios::provider #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_MEMORY_EXPERIMENTER_MEMORY_EXPERIMENTER_API_H_
diff --git a/ios_internal b/ios_internal index bdca260a..e1ff465 160000 --- a/ios_internal +++ b/ios_internal
@@ -1 +1 @@ -Subproject commit bdca260aab34fa4e5b2998c7d38fcdb88cae3ea2 +Subproject commit e1ff46553ed49b436b1625eb106928181bfb4a2c
diff --git a/net/base/features.cc b/net/base/features.cc index 44eed5c5..1a91d863 100644 --- a/net/base/features.cc +++ b/net/base/features.cc
@@ -164,6 +164,8 @@ base::FEATURE_ENABLED_BY_DEFAULT); #endif +BASE_FEATURE(kUseMLKEM, "UseMLKEM", base::FEATURE_DISABLED_BY_DEFAULT); + BASE_FEATURE(kNetUnusedIdleSocketTimeout, "NetUnusedIdleSocketTimeout", base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/net/base/features.h b/net/base/features.h index b170b3b..25aca24 100644 --- a/net/base/features.h +++ b/net/base/features.h
@@ -203,9 +203,15 @@ // servers. NET_EXPORT BASE_DECLARE_FEATURE(kTLS13KeyUpdate); -// Enables Kyber-based post-quantum key-agreements in TLS 1.3 connections. +// Enables post-quantum key-agreements in TLS 1.3 connections. kUseMLKEM +// controls whether ML-KEM or Kyber is used. NET_EXPORT BASE_DECLARE_FEATURE(kPostQuantumKyber); +// Causes TLS 1.3 connections to use the ML-KEM standard instead of the Kyber +// draft standard for post-quantum key-agreement. Post-quantum key-agreement +// must be enabled (e.g. via kPostQuantumKyber) for this to have an effect. +NET_EXPORT BASE_DECLARE_FEATURE(kUseMLKEM); + // Changes the timeout after which unused sockets idle sockets are cleaned up. NET_EXPORT BASE_DECLARE_FEATURE(kNetUnusedIdleSocketTimeout);
diff --git a/net/http/transport_security_state_static.pins b/net/http/transport_security_state_static.pins index a5e2458..511ae19 100644 --- a/net/http/transport_security_state_static.pins +++ b/net/http/transport_security_state_static.pins
@@ -43,9 +43,9 @@ # hash function for preloaded entries again (we have already done so once). # -# Last updated: 2024-09-02 12:56 UTC +# Last updated: 2024-09-03 12:56 UTC PinsListTimestamp -1725281790 +1725368160 TestSPKI sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
diff --git a/net/http/transport_security_state_static_pins.json b/net/http/transport_security_state_static_pins.json index 99fde853..f50035a 100644 --- a/net/http/transport_security_state_static_pins.json +++ b/net/http/transport_security_state_static_pins.json
@@ -31,7 +31,7 @@ // the 'static_spki_hashes' and 'bad_static_spki_hashes' fields in 'pinsets' // refer to, and the timestamp at which the pins list was last updated. // -// Last updated: 2024-09-02 12:56 UTC +// Last updated: 2024-09-03 12:56 UTC // { "pinsets": [
diff --git a/net/quic/quic_session_pool.cc b/net/quic/quic_session_pool.cc index 2e51a17..323cd88 100644 --- a/net/quic/quic_session_pool.cc +++ b/net/quic/quic_session_pool.cc
@@ -423,9 +423,12 @@ base::Unretained(this))); if (quic_session_pool_->ssl_config_service_->GetSSLContextConfig() .PostQuantumKeyAgreementEnabled()) { - config_.set_preferred_groups({SSL_GROUP_X25519_KYBER768_DRAFT00, - SSL_GROUP_X25519, SSL_GROUP_SECP256R1, - SSL_GROUP_SECP384R1}); + uint16_t postquantum_group = + base::FeatureList::IsEnabled(features::kUseMLKEM) + ? SSL_GROUP_X25519_MLKEM768 + : SSL_GROUP_X25519_KYBER768_DRAFT00; + config_.set_preferred_groups({postquantum_group, SSL_GROUP_X25519, + SSL_GROUP_SECP256R1, SSL_GROUP_SECP384R1}); } } QuicSessionPool::QuicCryptoClientConfigOwner::~QuicCryptoClientConfigOwner() {
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc index d23f680..9d5910d 100644 --- a/net/socket/ssl_client_socket_impl.cc +++ b/net/socket/ssl_client_socket_impl.cc
@@ -653,9 +653,13 @@ } if (context_->config().PostQuantumKeyAgreementEnabled()) { - static const int kCurves[] = {NID_X25519Kyber768Draft00, NID_X25519, - NID_X9_62_prime256v1, NID_secp384r1}; - if (!SSL_set1_curves(ssl_.get(), kCurves, std::size(kCurves))) { + const uint16_t postquantum_group = + base::FeatureList::IsEnabled(features::kUseMLKEM) + ? SSL_GROUP_X25519_MLKEM768 + : SSL_GROUP_X25519_KYBER768_DRAFT00; + const uint16_t kGroups[] = {postquantum_group, SSL_GROUP_X25519, + SSL_GROUP_SECP256R1, SSL_GROUP_SECP384R1}; + if (!SSL_set1_group_ids(ssl_.get(), kGroups, std::size(kGroups))) { return ERR_UNEXPECTED; } }
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 63b9190..3750f82 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc
@@ -6187,6 +6187,40 @@ EXPECT_EQ(got_server_name, std::nullopt); } +TEST_F(SSLClientSocketTest, PostQuantumKeyExchange) { + for (bool server_mlkem : {false, true}) { + SCOPED_TRACE(server_mlkem); + + SSLServerConfig server_config; + server_config.curves_for_testing.push_back( + server_mlkem ? NID_X25519MLKEM768 : NID_X25519Kyber768Draft00); + ASSERT_TRUE( + StartEmbeddedTestServer(EmbeddedTestServer::CERT_OK, server_config)); + + for (bool client_mlkem : {false, true}) { + SCOPED_TRACE(client_mlkem); + + base::test::ScopedFeatureList feature_list; + feature_list.InitWithFeatureState(features::kUseMLKEM, client_mlkem); + + for (bool enabled : {false, true}) { + SCOPED_TRACE(enabled); + + SSLContextConfig config; + config.post_quantum_override = enabled; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); + if (enabled && server_mlkem == client_mlkem) { + EXPECT_THAT(rv, IsOk()); + } else { + EXPECT_THAT(rv, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); + } + } + } + } +} + class SSLClientSocketAlpsTest : public SSLClientSocketTest, public ::testing::WithParamInterface<std::tuple<bool, bool, bool>> {
diff --git a/pdf/mojom/pdf.mojom b/pdf/mojom/pdf.mojom index c4acec1..31a0730e 100644 --- a/pdf/mojom/pdf.mojom +++ b/pdf/mojom/pdf.mojom
@@ -18,6 +18,9 @@ // Sets the selection to be between |base| and |extent|. The |extent| will // be moved if the selection is modified. SetSelectionBounds(gfx.mojom.PointF base, gfx.mojom.PointF extent); + + // Get PDF bytes. + GetPdfBytes() => (array<uint8> bytes); }; // Browser-side interface used by PDF renderers. @@ -35,8 +38,10 @@ // Notifies the embedder of the top-left and bottom-right coordinates of the // current selection. - SelectionChanged(gfx.mojom.PointF left, int32 left_height, - gfx.mojom.PointF right, int32 right_height); + SelectionChanged(gfx.mojom.PointF left, + int32 left_height, + gfx.mojom.PointF right, + int32 right_height); // Notifies the embedder know the plugin can handle save commands internally. SetPluginCanSave(bool can_save);
diff --git a/pdf/pdf_view_web_plugin.cc b/pdf/pdf_view_web_plugin.cc index e8d305e..f1d886c7 100644 --- a/pdf/pdf_view_web_plugin.cc +++ b/pdf/pdf_view_web_plugin.cc
@@ -1362,6 +1362,10 @@ FrameToPdfCoordinates(extent)); } +void PdfViewWebPlugin::GetPdfBytes(GetPdfBytesCallback callback) { + std::move(callback).Run(engine_->GetSaveData()); +} + bool PdfViewWebPlugin::IsValid() const { return client_->HasFrame(); }
diff --git a/pdf/pdf_view_web_plugin.h b/pdf/pdf_view_web_plugin.h index 5dda097..df3590e 100644 --- a/pdf/pdf_view_web_plugin.h +++ b/pdf/pdf_view_web_plugin.h
@@ -369,6 +369,7 @@ void MoveRangeSelectionExtent(const gfx::PointF& extent) override; void SetSelectionBounds(const gfx::PointF& base, const gfx::PointF& extent) override; + void GetPdfBytes(GetPdfBytesCallback callback) override; // UrlLoader::Client: bool IsValid() const override;
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index 8e06842..57898ba1 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc
@@ -16,7 +16,6 @@ #include "base/check.h" #include "base/compiler_specific.h" #include "base/memory/singleton.h" -#include "base/notreached.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/var_serialization_rules.h" @@ -42,9 +41,7 @@ // Handle the first time for a given API by creating the proxy for it. InterfaceProxy::Factory factory = InterfaceList::GetInstance()->GetFactoryForID(id); - if (!factory) { - NOTREACHED(); - } + CHECK(factory); proxy = factory(this); DCHECK(proxy); proxies_[id].reset(proxy); @@ -68,9 +65,7 @@ InterfaceProxy* proxy = GetInterfaceProxy( static_cast<ApiID>(msg.routing_id())); - if (!proxy) { - NOTREACHED(); - } + CHECK(proxy); return proxy->OnMessageReceived(msg); }
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc index 5d6f990..0bd19af 100644 --- a/ppapi/proxy/file_io_resource.cc +++ b/ppapi/proxy/file_io_resource.cc
@@ -7,6 +7,7 @@ #include <limits> #include <utility> +#include "base/check.h" #include "base/containers/heap_array.h" #include "base/functional/bind.h" #include "ipc/ipc_message.h" @@ -133,9 +134,7 @@ PPB_FileRef_API* file_ref_api = enter_file_ref.object(); const FileRefCreateInfo& create_info = file_ref_api->GetCreateInfo(); - if (!FileSystemTypeIsValid(create_info.file_system_type)) { - NOTREACHED(); - } + CHECK(FileSystemTypeIsValid(create_info.file_system_type)); int32_t rv = state_manager_.CheckOperationState( FileIOStateManager::OPERATION_EXCLUSIVE, false); if (rv != PP_OK)
diff --git a/ppapi/proxy/file_system_resource.cc b/ppapi/proxy/file_system_resource.cc index f511b9b..26909c85 100644 --- a/ppapi/proxy/file_system_resource.cc +++ b/ppapi/proxy/file_system_resource.cc
@@ -5,6 +5,7 @@ #include "ppapi/proxy/file_system_resource.h" #include "base/barrier_closure.h" +#include "base/check.h" #include "base/containers/contains.h" #include "base/functional/bind.h" #include "ipc/ipc_message.h" @@ -182,9 +183,7 @@ for (std::set<PP_Resource>::iterator it = files_.begin(); it != files_.end(); ++it) { EnterResourceNoLock<PPB_FileIO_API> enter(*it, true); - if (enter.failed()) { - NOTREACHED(); - } + CHECK(!enter.failed()); PPB_FileIO_API* file_io_api = enter.object(); file_growths[*it] = FileGrowth( file_io_api->GetMaxWrittenOffset(),
diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc index 49f4547a..f6d5cf84 100644 --- a/ppapi/proxy/plugin_var_tracker.cc +++ b/ppapi/proxy/plugin_var_tracker.cc
@@ -8,6 +8,7 @@ #include <limits> +#include "base/check.h" #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" #include "base/not_fatal_until.h" @@ -128,9 +129,7 @@ Var* var = GetVar(plugin_object); ProxyObjectVar* object = var->AsProxyObjectVar(); - if (!object) { - NOTREACHED(); - } + CHECK(object); // Make a var with the host ID. PP_Var ret = { PP_VARTYPE_OBJECT }; @@ -369,9 +368,7 @@ void PluginVarTracker::TrackedObjectGettingOneRef(VarMap::const_iterator iter) { ProxyObjectVar* object = iter->second.var->AsProxyObjectVar(); - if (!object) { - NOTREACHED(); - } + CHECK(object); DCHECK(iter->second.ref_count == 0); @@ -386,9 +383,7 @@ void PluginVarTracker::ObjectGettingZeroRef(VarMap::iterator iter) { ProxyObjectVar* object = iter->second.var->AsProxyObjectVar(); - if (!object) { - NOTREACHED(); - } + CHECK(object); // Notify the host we're no longer holding our ref. DCHECK(iter->second.ref_count == 0);
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 2432bf8..3cac80a 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "base/check.h" #include "base/functional/bind.h" #include "base/memory/ref_counted.h" #include "base/numerics/safe_conversions.h" @@ -638,11 +639,8 @@ if (enter.failed()) return; - if (dispatcher()->IsPlugin()) { - NOTREACHED(); - } else { - static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); - } + CHECK(!dispatcher()->IsPlugin()); + static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); result.Return(dispatcher(), enter.functions()->ExecuteScript( instance, @@ -862,9 +860,7 @@ GetInstanceData(instance); if (!data) return; // Instance was probably deleted. - if (!TrackedCallback::IsPending(data->mouse_lock_callback)) { - NOTREACHED(); - } + CHECK(TrackedCallback::IsPending(data->mouse_lock_callback)); data->mouse_lock_callback->Run(result); }
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc index e0863636..0cbee2e 100644 --- a/ppapi/proxy/ppb_var_deprecated_proxy.cc +++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc
@@ -6,8 +6,8 @@ #include <stdlib.h> // For malloc +#include "base/check.h" #include "base/functional/bind.h" -#include "base/notreached.h" #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/pp_var.h" #include "ppapi/c/ppb_core.h" @@ -507,11 +507,8 @@ } void PPB_Var_Deprecated_Proxy::SetAllowPluginReentrancy() { - if (dispatcher()->IsPlugin()) { - NOTREACHED(); - } else { - static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); - } + CHECK(!dispatcher()->IsPlugin()); + static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); } void PPB_Var_Deprecated_Proxy::DoReleaseObject(int64_t object_id) {
diff --git a/ppapi/proxy/ppp_input_event_proxy.cc b/ppapi/proxy/ppp_input_event_proxy.cc index edd0031..0914bcc 100644 --- a/ppapi/proxy/ppp_input_event_proxy.cc +++ b/ppapi/proxy/ppp_input_event_proxy.cc
@@ -4,6 +4,7 @@ #include "ppapi/proxy/ppp_input_event_proxy.h" +#include "base/check.h" #include "build/build_config.h" #include "ppapi/c/ppp_input_event.h" #include "ppapi/proxy/host_dispatcher.h" @@ -24,14 +25,10 @@ #if !BUILDFLAG(IS_NACL) PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource input_event) { EnterResourceNoLock<PPB_InputEvent_API> enter(input_event, false); - if (enter.failed()) { - NOTREACHED(); - } + CHECK(!enter.failed()); const InputEventData& data = enter.object()->GetInputEventData(); HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); - if (!dispatcher) { - NOTREACHED(); - } + CHECK(dispatcher); // Need to send different messages depending on whether filtering is needed. PP_Bool result = PP_FALSE;
diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index 17d1a86..dc40207b 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc
@@ -14,6 +14,7 @@ #include <algorithm> +#include "base/check.h" #include "base/functional/bind.h" #include "build/build_config.h" #include "ppapi/c/pp_var.h" @@ -73,9 +74,7 @@ HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); EnterResourceNoLock<PPB_View_API> enter_view(view_resource, false); - if (enter_view.failed()) { - NOTREACHED(); - } + CHECK(!enter_view.failed()); EnterInstanceNoLock enter_instance(instance); dispatcher->Send(new PpapiMsg_PPPInstance_DidChangeView(
diff --git a/ppapi/proxy/raw_var_data.cc b/ppapi/proxy/raw_var_data.cc index 332b3fb..032b489 100644 --- a/ppapi/proxy/raw_var_data.cc +++ b/ppapi/proxy/raw_var_data.cc
@@ -7,6 +7,7 @@ #include <memory> #include <unordered_set> +#include "base/check.h" #include "base/containers/stack.h" #include "base/logging.h" #include "base/memory/ptr_util.h" @@ -110,16 +111,13 @@ if (CanHaveChildren(current_var)) parent_ids.insert(current_var.value.as_id); - if (!current_var_data->Init(current_var, instance)) { - NOTREACHED(); - } + const bool success = current_var_data->Init(current_var, instance); + CHECK(success); // Add child nodes to the stack. if (current_var.type == PP_VARTYPE_ARRAY) { ArrayVar* array_var = ArrayVar::FromPPVar(current_var); - if (!array_var) { - NOTREACHED(); - } + CHECK(array_var); for (ArrayVar::ElementVector::const_iterator iter = array_var->elements().begin(); iter != array_var->elements().end(); @@ -137,9 +135,7 @@ } } else if (current_var.type == PP_VARTYPE_DICTIONARY) { DictionaryVar* dict_var = DictionaryVar::FromPPVar(current_var); - if (!dict_var) { - NOTREACHED(); - } + CHECK(dict_var); for (DictionaryVar::KeyValueMap::const_iterator iter = dict_var->key_value_map().begin(); iter != dict_var->key_value_map().end();
diff --git a/ppapi/proxy/tcp_socket_resource_base.cc b/ppapi/proxy/tcp_socket_resource_base.cc index 4242126..c7b44da 100644 --- a/ppapi/proxy/tcp_socket_resource_base.cc +++ b/ppapi/proxy/tcp_socket_resource_base.cc
@@ -7,6 +7,7 @@ #include <cstring> #include <iterator> +#include "base/check.h" #include "base/check_op.h" #include "base/functional/bind.h" #include "base/notreached.h" @@ -481,9 +482,7 @@ void TCPSocketResourceBase::OnPluginMsgSetOptionReply( const ResourceMessageReplyParams& params) { - if (set_option_callbacks_.empty()) { - NOTREACHED(); - } + CHECK(!set_option_callbacks_.empty()); scoped_refptr<TrackedCallback> callback = set_option_callbacks_.front(); set_option_callbacks_.pop(); if (TrackedCallback::IsPending(callback))
diff --git a/ppapi/shared_impl/tracked_callback.cc b/ppapi/shared_impl/tracked_callback.cc index 64fae678..6d13fe3 100644 --- a/ppapi/shared_impl/tracked_callback.cc +++ b/ppapi/shared_impl/tracked_callback.cc
@@ -242,9 +242,7 @@ void TrackedCallback::PostRunWithLock(int32_t result) { lock_.AssertAcquired(); - if (completed_) { - NOTREACHED(); - } + CHECK(!completed_); if (result == PP_ERROR_ABORTED) aborted_ = true; // We might abort when there's already a scheduled callback, but callers
diff --git a/remoting/codec/webrtc_video_encoder_gpu.cc b/remoting/codec/webrtc_video_encoder_gpu.cc index 24f20d6a..ab10201 100644 --- a/remoting/codec/webrtc_video_encoder_gpu.cc +++ b/remoting/codec/webrtc_video_encoder_gpu.cc
@@ -285,7 +285,7 @@ const gfx::Size& input_coded_size, size_t output_buffer_size) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(state_ == INITIALIZING); + CHECK(state_ == INITIALIZING); input_coded_size_ = input_coded_size; output_buffer_size_ = output_buffer_size; @@ -317,7 +317,7 @@ auto encoded_frame = std::make_unique<EncodedFrame>(); OutputBuffer* output_buffer = output_buffers_[bitstream_buffer_id].get(); - DCHECK(output_buffer->IsValid()); + CHECK(output_buffer->IsValid()); base::span<uint8_t> data_span = output_buffer->mapping.GetMemoryAsSpan<uint8_t>( metadata.payload_size_bytes); @@ -333,7 +333,7 @@ UseOutputBitstreamBufferId(bitstream_buffer_id); auto callback_it = callbacks_.find(metadata.timestamp); - DCHECK(callback_it != callbacks_.end()) + CHECK(callback_it != callbacks_.end()) << "Callback not found for timestamp " << metadata.timestamp; std::move(std::get<1>(*callback_it)) .Run(EncodeResult::SUCCEEDED, std::move(encoded_frame));
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index d7deba44..ae39284 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -1434,7 +1434,7 @@ "os": "Ubuntu-22.04" }, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 8 + "shards": 10 }, "test": "blink_web_tests", "test_id_prefix": "ninja://:blink_web_tests/"
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 38ab733..0275c19 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -10647,9 +10647,6 @@ "args": [ "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", - "--additional-expectations", - "../../third_party/blink/web_tests/ASANExpectations", - "--enable-sanitizer", "--timeout-ms", "48000" ], @@ -10679,9 +10676,6 @@ "args": [ "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", - "--additional-expectations", - "../../third_party/blink/web_tests/ASANExpectations", - "--enable-sanitizer", "--timeout-ms", "48000" ], @@ -10709,10 +10703,7 @@ }, { "args": [ - "--test-launcher-filter-file=../../third_party/blink/web_tests/TestLists/chrome.filter", - "--additional-expectations", - "../../third_party/blink/web_tests/ASANExpectations", - "--enable-sanitizer" + "--test-launcher-filter-file=../../third_party/blink/web_tests/TestLists/chrome.filter" ], "merge": { "args": [ @@ -10743,10 +10734,7 @@ "crashtest", "print-reftest", "--inverted-test-launcher-filter-file=../../third_party/blink/web_tests/TestLists/chrome.filter", - "--test-launcher-filter-file=../../third_party/blink/web_tests/TestLists/headless_shell.filter", - "--additional-expectations", - "../../third_party/blink/web_tests/ASANExpectations", - "--enable-sanitizer" + "--test-launcher-filter-file=../../third_party/blink/web_tests/TestLists/headless_shell.filter" ], "merge": { "args": [ @@ -10910,9 +10898,6 @@ "args": [ "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", - "--additional-expectations", - "../../third_party/blink/web_tests/MSANExpectations", - "--enable-sanitizer", "--timeout-ms", "66000" ], @@ -10945,9 +10930,6 @@ "args": [ "--num-retries=3", "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", - "--additional-expectations", - "../../third_party/blink/web_tests/MSANExpectations", - "--enable-sanitizer", "--timeout-ms", "66000" ], @@ -10978,10 +10960,7 @@ }, { "args": [ - "--test-launcher-filter-file=../../third_party/blink/web_tests/TestLists/chrome.filter", - "--additional-expectations", - "../../third_party/blink/web_tests/MSANExpectations", - "--enable-sanitizer" + "--test-launcher-filter-file=../../third_party/blink/web_tests/TestLists/chrome.filter" ], "merge": { "args": [
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index a64e516..11c352d2 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -1262,13 +1262,6 @@ }, }, }, - 'web-test-asan': { - 'args': [ - '--additional-expectations', - '../../third_party/blink/web_tests/ASANExpectations', - '--enable-sanitizer', - ], - }, 'web-test-leak': { 'args': [ '--additional-expectations', @@ -1276,13 +1269,6 @@ '--enable-leak-detection', ], }, - 'web-test-msan': { - 'args': [ - '--additional-expectations', - '../../third_party/blink/web_tests/MSANExpectations', - '--enable-sanitizer', - ], - }, 'webgpu_cts': { 'args': [ '--initialize-webgpu-adapter-at-startup-timeout-ms=60000',
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 2be1d47..1cc36d6 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -4531,7 +4531,6 @@ 'WebKit Linux ASAN': { 'mixins': [ 'linux-jammy', - 'web-test-asan', ], 'test_suites': { 'isolated_scripts': 'chromium_webkit_isolated_scripts', @@ -4552,7 +4551,6 @@ 'WebKit Linux MSAN': { 'mixins': [ 'linux-jammy', - 'web-test-msan', ], 'test_suites': { 'isolated_scripts': 'chromium_webkit_isolated_scripts',
diff --git a/testing/libfuzzer/research/fuzzilli_idl_fuzzing/generator.py b/testing/libfuzzer/research/fuzzilli_idl_fuzzing/generator.py index 6e8e9a92..8366e40 100755 --- a/testing/libfuzzer/research/fuzzilli_idl_fuzzing/generator.py +++ b/testing/libfuzzer/research/fuzzilli_idl_fuzzing/generator.py
@@ -369,7 +369,7 @@ # before plain arguments, which doesn't really make sense in JS. rev_args = [] has_seen_plain = False - for arg in args: + for arg in reversed(args): if arg.is_optional: if has_seen_plain: rev_args.append(ParameterType.plain(idl_type_to_iltype(arg.idl_type)))
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index b62eb307..e2891926 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -3746,25 +3746,6 @@ ] } ], - "CPUInterventionEvaluationLogging": [ - { - "platforms": [ - "chromeos", - "chromeos_lacros", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled_20240215", - "enable_features": [ - "CPUInterventionEvaluationLogging" - ] - } - ] - } - ], "CPUMeasurementInFreezingPolicy": [ { "platforms": [ @@ -7587,21 +7568,6 @@ ] } ], - "DeferConciergeStartup": [ - { - "platforms": [ - "chromeos" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "DeferConciergeStartup" - ] - } - ] - } - ], "DeferRendererTasksAfterInput": [ { "platforms": [ @@ -18304,26 +18270,6 @@ ] } ], - "PrivacySandboxAttestationsLoadPreInstalledComponent": [ - { - "platforms": [ - "android", - "chromeos", - "chromeos_lacros", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled_PrivacySandboxAttestationsLoadPreInstalledComponent", - "enable_features": [ - "PrivacySandboxAttestationsLoadPreInstalledComponent" - ] - } - ] - } - ], "PrivacySandboxHatsForDesktopM1": [ { "platforms": [
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn index cb48828..cb3f8b0 100644 --- a/third_party/android_deps/BUILD.gn +++ b/third_party/android_deps/BUILD.gn
@@ -180,6 +180,7 @@ output_name = "com_google_auto_service_auto_service_annotations" supports_android = true enable_bytecode_checks = false + preferred_dep = true } # This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
diff --git a/third_party/android_deps/buildSrc/src/main/groovy/BuildConfigGenerator.groovy b/third_party/android_deps/buildSrc/src/main/groovy/BuildConfigGenerator.groovy index 7757409..7071bc8 100644 --- a/third_party/android_deps/buildSrc/src/main/groovy/BuildConfigGenerator.groovy +++ b/third_party/android_deps/buildSrc/src/main/groovy/BuildConfigGenerator.groovy
@@ -805,6 +805,9 @@ // and android_aar_prebuilt template will fail if it's not set explictly. sb.append(' extract_native_libraries = true\n') break + case 'com_google_auto_service_auto_service_annotations_java': + sb.append(' preferred_dep = true\n') + break case 'com_google_guava_guava': case 'com_google_guava_guava_android': sb.append('\n')
diff --git a/third_party/angle b/third_party/angle index e5532e6..177d15b 160000 --- a/third_party/angle +++ b/third_party/angle
@@ -1 +1 @@ -Subproject commit e5532e6c7f2e04dcc586b8d9d5ac426cbce8e35f +Subproject commit 177d15b3807b2db8df7168f5fef51705bd600592
diff --git a/third_party/blink/renderer/bindings/core/v8/observable_array_exotic_object_handler.h b/third_party/blink/renderer/bindings/core/v8/observable_array_exotic_object_handler.h index 116e3b16..4a6afae2 100644 --- a/third_party/blink/renderer/bindings/core/v8/observable_array_exotic_object_handler.h +++ b/third_party/blink/renderer/bindings/core/v8/observable_array_exotic_object_handler.h
@@ -570,8 +570,9 @@ if (!backing_list.set_algorithm_callback_) return true; - (backing_list.GetPlatformObject()->*backing_list.set_algorithm_callback_)( - script_state, backing_list, index, value, exception_state); + backing_list.set_algorithm_callback_(backing_list.GetPlatformObject(), + script_state, backing_list, index, + value, exception_state); return !exception_state.HadException(); } @@ -583,9 +584,9 @@ if (!backing_list.delete_algorithm_callback_) return true; - (backing_list.GetPlatformObject() - ->*backing_list.delete_algorithm_callback_)(script_state, backing_list, - index, exception_state); + backing_list.delete_algorithm_callback_(backing_list.GetPlatformObject(), + script_state, backing_list, index, + exception_state); return !exception_state.HadException(); } };
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/observable_array.py b/third_party/blink/renderer/bindings/scripts/bind_gen/observable_array.py index e89cb07..d26d773 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/observable_array.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/observable_array.py
@@ -131,7 +131,7 @@ func_decl = CxxFuncDeclNode( name=cg_context.class_name, arg_decls=[ - "ScriptWrappable* platform_object", + "GarbageCollectedMixin* platform_object", "SetAlgorithmCallback set_algorithm_callback", "DeleteAlgorithmCallback delete_algorithm_callback", ], @@ -140,7 +140,7 @@ func_def = CxxFuncDefNode( name=cg_context.class_name, arg_decls=[ - "ScriptWrappable* platform_object", + "GarbageCollectedMixin* platform_object", "SetAlgorithmCallback set_algorithm_callback", "DeleteAlgorithmCallback delete_algorithm_callback", ], @@ -479,7 +479,8 @@ class_def.public_section.append( TextNode("using SetAlgorithmCallback = " - "void (ScriptWrappable::*)(" + "void (*)(" + "GarbageCollectedMixin* platform_object, " "ScriptState* script_state, " "{}& observable_array, " "size_type index, " @@ -488,7 +489,8 @@ cg_context.class_name))) class_def.public_section.append( TextNode("using DeleteAlgorithmCallback = " - "void (ScriptWrappable::*)(" + "void (*)(" + "GarbageCollectedMixin* platform_object, " "ScriptState* script_state, " "{}& observable_array, " "size_type index, "
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index f4db032..53a97f1 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -6905,6 +6905,7 @@ keywords: ["auto"], typedom_types: ["Keyword", "Number"], valid_for_permission_element: true, + valid_for_page_context: true, invalidate: ["z-index"], },
diff --git a/third_party/blink/renderer/core/css/document_style_sheet_collection.cc b/third_party/blink/renderer/core/css/document_style_sheet_collection.cc index d3eb307..94048f51a 100644 --- a/third_party/blink/renderer/core/css/document_style_sheet_collection.cc +++ b/third_party/blink/renderer/core/css/document_style_sheet_collection.cc
@@ -81,11 +81,13 @@ css_sheet->Contents()->ClearRuleSetDiff(); } } - if (!GetTreeScope().HasAdoptedStyleSheets()) { + + const TreeScope& tree_scope = GetTreeScope(); + if (!tree_scope.HasAdoptedStyleSheets()) { return; } - for (CSSStyleSheet* sheet : *GetTreeScope().AdoptedStyleSheets()) { + for (CSSStyleSheet* sheet : *tree_scope.AdoptedStyleSheets()) { if (!sheet || !sheet->CanBeActivated( GetDocument().GetStyleEngine().PreferredStylesheetSetName())) {
diff --git a/third_party/blink/renderer/core/css/remote_font_face_source.cc b/third_party/blink/renderer/core/css/remote_font_face_source.cc index c7e491886..1c178c6 100644 --- a/third_party/blink/renderer/core/css/remote_font_face_source.cc +++ b/third_party/blink/renderer/core/css/remote_font_face_source.cc
@@ -6,6 +6,7 @@ #include "base/metrics/histogram_functions.h" #include "base/task/single_thread_task_runner.h" +#include "base/trace_event/typed_macros.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" @@ -396,6 +397,9 @@ auto* font = To<FontResource>(GetResource()); CHECK(font); if (font->StillNeedsLoad()) { + TRACE_EVENT("devtools.timeline", "BeginRemoteFontLoad", "id", + font->InspectorId(), "display", + face_->GetFontFace()->display()); if (font->IsLowPriorityLoadingAllowedForRemoteFont()) { execution_context->AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( mojom::blink::ConsoleMessageSource::kIntervention,
diff --git a/third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.cc b/third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.cc index 2b753a1..e2a03f4 100644 --- a/third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.cc +++ b/third_party/blink/renderer/core/css/shadow_tree_style_sheet_collection.cc
@@ -66,11 +66,13 @@ css_sheet, rule_set_scope.RuleSetForSheet(engine, css_sheet))); } } - if (!GetTreeScope().HasAdoptedStyleSheets()) { + + const TreeScope& tree_scope = GetTreeScope(); + if (!tree_scope.HasAdoptedStyleSheets()) { return; } - for (CSSStyleSheet* sheet : *GetTreeScope().AdoptedStyleSheets()) { + for (CSSStyleSheet* sheet : *tree_scope.AdoptedStyleSheets()) { if (!sheet || !sheet->CanBeActivated(g_null_atom)) { continue; }
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index ce7d61f..1688657e 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -782,12 +782,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags document_classes) : ContainerNode(nullptr, kCreateDocument), - TreeScope( - *this, - static_cast<V8ObservableArrayCSSStyleSheet::SetAlgorithmCallback>( - &Document::OnAdoptedStyleSheetSet), - static_cast<V8ObservableArrayCSSStyleSheet::DeleteAlgorithmCallback>( - &Document::OnAdoptedStyleSheetDelete)), + TreeScope(*this), token_(initializer.GetToken()), is_initial_empty_document_(initializer.IsInitialEmptyDocument()), is_prerendering_(initializer.IsPrerendering()), @@ -5615,27 +5610,6 @@ new_focused_element); } -// This forwards to the TreeScope implementation. -void Document::OnAdoptedStyleSheetSet( - ScriptState* script_state, - V8ObservableArrayCSSStyleSheet& observable_array, - uint32_t index, - Member<CSSStyleSheet>& sheet, - ExceptionState& exception_state) { - TreeScope::OnAdoptedStyleSheetSet(script_state, observable_array, index, - sheet, exception_state); -} - -// This forwards to the TreeScope implementation. -void Document::OnAdoptedStyleSheetDelete( - ScriptState* script_state, - V8ObservableArrayCSSStyleSheet& observable_array, - uint32_t index, - ExceptionState& exception_state) { - TreeScope::OnAdoptedStyleSheetDelete(script_state, observable_array, index, - exception_state); -} - void Document::SetSequentialFocusNavigationStartingPoint(Node* node) { if (!dom_window_) return;
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index dc334ea..642049e8 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -250,7 +250,6 @@ class TreeWalker; class TrustedHTML; class V8NodeFilter; -class V8ObservableArrayCSSStyleSheet; class V8UnionStringOrTrustedHTML; class ViewportData; class VisitedLinkState; @@ -2124,16 +2123,6 @@ return parser_sync_policy_; } - void OnAdoptedStyleSheetSet(ScriptState*, - V8ObservableArrayCSSStyleSheet&, - uint32_t, - Member<CSSStyleSheet>&, - ExceptionState&) override; - void OnAdoptedStyleSheetDelete(ScriptState*, - V8ObservableArrayCSSStyleSheet&, - uint32_t, - ExceptionState&) override; - private: friend class DocumentTest; friend class IgnoreDestructiveWriteCountIncrementer;
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 5aee773b..1caea06 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -5648,6 +5648,10 @@ shadow_root_init_dict->slotAssignment() == "manual") ? SlotAssignmentMode::kManual : SlotAssignmentMode::kNamed; + auto reference_target = + shadow_root_init_dict->hasReferenceTarget() + ? AtomicString(shadow_root_init_dict->referenceTarget()) + : g_null_atom; CustomElementRegistry* registry = shadow_root_init_dict->hasRegistry() ? shadow_root_init_dict->registry() : nullptr; @@ -5685,7 +5689,7 @@ ShadowRoot& shadow_root = AttachShadowRootInternal( mode, focus_delegation, slot_assignment, registry, serializable, clonable, - /*reference_target*/ g_null_atom); + reference_target); // Ensure that the returned shadow root is not marked as declarative so that // attachShadow() calls after the first one do not succeed for a shadow host
diff --git a/third_party/blink/renderer/core/dom/shadow_root.cc b/third_party/blink/renderer/core/dom/shadow_root.cc index c1d0d65..1738c527 100644 --- a/third_party/blink/renderer/core/dom/shadow_root.cc +++ b/third_party/blink/renderer/core/dom/shadow_root.cc
@@ -53,7 +53,7 @@ class ReferenceTargetIdObserver : public IdTargetObserver { public: ReferenceTargetIdObserver(const AtomicString& id, ShadowRoot* root) - : IdTargetObserver(root->GetIdTargetObserverRegistry(), id), + : IdTargetObserver(root->EnsureIdTargetObserverRegistry(), id), root_(root) {} using IdTargetObserver::Id; @@ -82,13 +82,7 @@ ShadowRootMode mode, SlotAssignmentMode assignment_mode) : DocumentFragment(nullptr, kCreateShadowRoot), - TreeScope( - *this, - document, - static_cast<V8ObservableArrayCSSStyleSheet::SetAlgorithmCallback>( - &ShadowRoot::OnAdoptedStyleSheetSet), - static_cast<V8ObservableArrayCSSStyleSheet::DeleteAlgorithmCallback>( - &ShadowRoot::OnAdoptedStyleSheetDelete)), + TreeScope(*this, document), child_shadow_root_count_(0), mode_(static_cast<unsigned>(mode)), registered_with_parent_shadow_root_(false), @@ -133,27 +127,6 @@ return CreateMarkup(this, kChildrenOnly); } -// This forwards to the TreeScope implementation. -void ShadowRoot::OnAdoptedStyleSheetSet( - ScriptState* script_state, - V8ObservableArrayCSSStyleSheet& observable_array, - uint32_t index, - Member<CSSStyleSheet>& sheet, - ExceptionState& exception_state) { - TreeScope::OnAdoptedStyleSheetSet(script_state, observable_array, index, - sheet, exception_state); -} - -// This forwards to the TreeScope implementation. -void ShadowRoot::OnAdoptedStyleSheetDelete( - ScriptState* script_state, - V8ObservableArrayCSSStyleSheet& observable_array, - uint32_t index, - ExceptionState& exception_state) { - TreeScope::OnAdoptedStyleSheetDelete(script_state, observable_array, index, - exception_state); -} - void ShadowRoot::setInnerHTML(const String& html, ExceptionState& exception_state) { if (DocumentFragment* fragment = CreateFragmentForInnerOuterHTML( @@ -325,7 +298,9 @@ // the host element's ID, since they may have been referring to the reference // target instead. if (const auto& id = host().GetIdAttribute()) { - host().GetTreeScope().GetIdTargetObserverRegistry().NotifyObservers(id); + if (auto* registry = host().GetTreeScope().GetIdTargetObserverRegistry()) { + registry->NotifyObservers(id); + } } }
diff --git a/third_party/blink/renderer/core/dom/shadow_root.h b/third_party/blink/renderer/core/dom/shadow_root.h index 66caf473..d4700a8 100644 --- a/third_party/blink/renderer/core/dom/shadow_root.h +++ b/third_party/blink/renderer/core/dom/shadow_root.h
@@ -45,7 +45,6 @@ class ExceptionState; class SlotAssignment; class ReferenceTargetIdObserver; -class V8ObservableArrayCSSStyleSheet; class WhitespaceAttacher; enum class ShadowRootMode { kOpen, kClosed, kUserAgent }; @@ -189,17 +188,6 @@ void Trace(Visitor*) const override; - protected: - void OnAdoptedStyleSheetSet(ScriptState*, - V8ObservableArrayCSSStyleSheet&, - uint32_t, - Member<CSSStyleSheet>&, - ExceptionState&) override; - void OnAdoptedStyleSheetDelete(ScriptState*, - V8ObservableArrayCSSStyleSheet&, - uint32_t, - ExceptionState&) override; - private: friend class ReferenceTargetIdObserver;
diff --git a/third_party/blink/renderer/core/dom/shadow_root_init.idl b/third_party/blink/renderer/core/dom/shadow_root_init.idl index 3baead6..6a96a030 100644 --- a/third_party/blink/renderer/core/dom/shadow_root_init.idl +++ b/third_party/blink/renderer/core/dom/shadow_root_init.idl
@@ -14,6 +14,7 @@ [RuntimeEnabled=ScopedCustomElementRegistry] CustomElementRegistry registry; boolean serializable; boolean clonable; + [RuntimeEnabled=ShadowRootReferenceTarget] DOMString referenceTarget; // Note: if you add a parameter here, be sure to add it to the list of checks // in Element::attachShadow() for existing declarative shadow roots. };
diff --git a/third_party/blink/renderer/core/dom/tree_scope.cc b/third_party/blink/renderer/core/dom/tree_scope.cc index ee18833..998f2dc 100644 --- a/third_party/blink/renderer/core/dom/tree_scope.cc +++ b/third_party/blink/renderer/core/dom/tree_scope.cc
@@ -65,41 +65,16 @@ namespace blink { -TreeScope::TreeScope(ContainerNode& root_node, - Document& document, - V8ObservableArrayCSSStyleSheet::SetAlgorithmCallback - adopted_style_sheets_set_callback, - V8ObservableArrayCSSStyleSheet::DeleteAlgorithmCallback - adopted_style_sheets_delete_callback) +TreeScope::TreeScope(ContainerNode& root_node, Document& document) : document_(&document), root_node_(&root_node), - parent_tree_scope_(&document), - id_target_observer_registry_( - MakeGarbageCollected<IdTargetObserverRegistry>()), - adopted_style_sheets_( - MakeGarbageCollected<V8ObservableArrayCSSStyleSheet>( - &root_node, - adopted_style_sheets_set_callback, - adopted_style_sheets_delete_callback)) { + parent_tree_scope_(&document) { DCHECK_NE(root_node, document); root_node_->SetTreeScope(this); } -TreeScope::TreeScope(Document& document, - V8ObservableArrayCSSStyleSheet::SetAlgorithmCallback - adopted_style_sheets_set_callback, - V8ObservableArrayCSSStyleSheet::DeleteAlgorithmCallback - adopted_style_sheets_delete_callback) - : document_(&document), - root_node_(document), - parent_tree_scope_(nullptr), - id_target_observer_registry_( - MakeGarbageCollected<IdTargetObserverRegistry>()), - adopted_style_sheets_( - MakeGarbageCollected<V8ObservableArrayCSSStyleSheet>( - &document, - adopted_style_sheets_set_callback, - adopted_style_sheets_delete_callback)) { +TreeScope::TreeScope(Document& document) + : document_(&document), root_node_(document) { root_node_->SetTreeScope(this); } @@ -156,18 +131,24 @@ void TreeScope::AddElementById(const AtomicString& element_id, Element& element) { - if (!elements_by_id_) + if (!elements_by_id_) { elements_by_id_ = MakeGarbageCollected<TreeOrderedMap>(); + } elements_by_id_->Add(element_id, element); - id_target_observer_registry_->NotifyObservers(element_id); + if (id_target_observer_registry_) { + id_target_observer_registry_->NotifyObservers(element_id); + } } void TreeScope::RemoveElementById(const AtomicString& element_id, Element& element) { - if (!elements_by_id_) + if (!elements_by_id_) { return; + } elements_by_id_->Remove(element_id, element); - id_target_observer_registry_->NotifyObservers(element_id); + if (id_target_observer_registry_) { + id_target_observer_registry_->NotifyObservers(element_id); + } } Node* TreeScope::AncestorInThisScope(Node* node) const { @@ -367,8 +348,17 @@ return *svg_tree_scoped_resources_; } +V8ObservableArrayCSSStyleSheet& TreeScope::EnsureAdoptedStyleSheets() { + if (!adopted_style_sheets_) [[unlikely]] { + adopted_style_sheets_ = + MakeGarbageCollected<V8ObservableArrayCSSStyleSheet>( + this, &OnAdoptedStyleSheetSet, &OnAdoptedStyleSheetDelete); + } + return *adopted_style_sheets_; +} + bool TreeScope::HasAdoptedStyleSheets() const { - return adopted_style_sheets_->size(); + return adopted_style_sheets_ && adopted_style_sheets_->size(); } void TreeScope::StyleSheetWasAdded(CSSStyleSheet* sheet) { @@ -379,7 +369,17 @@ GetDocument().GetStyleEngine().AdoptedStyleSheetRemoved(*this, sheet); } +// We pass TreeScope to the bindings array to be informed via set and delete +// callbacks. Bindings doesn't know about DOM types, so we can only pass +// ScriptWrappable (i.e. Document or ShadowRoot) or a GarbageCollectedMixin. We +// choose the mixin as that avoids dispatching from Document back to TreeScope +// essentially implementing a cast. The mixin is passed as void*-like object +// that is only passed back from the observable array into the set/delete +// callbacks where it is again used as TreeScope. +// +// static void TreeScope::OnAdoptedStyleSheetSet( + GarbageCollectedMixin* tree_scope, ScriptState* script_state, V8ObservableArrayCSSStyleSheet& observable_array, uint32_t index, @@ -391,25 +391,34 @@ "Can't adopt non-constructed stylesheets."); return; } + TreeScope* self = reinterpret_cast<TreeScope*>(tree_scope); Document* document = sheet->ConstructorDocument(); - if (document && *document != GetDocument()) { + if (document && *document != self->GetDocument()) { exception_state.ThrowDOMException(DOMExceptionCode::kNotAllowedError, "Sharing constructed stylesheets in " "multiple documents is not allowed"); return; } - StyleSheetWasAdded(sheet.Get()); + self->StyleSheetWasAdded(sheet.Get()); } +// See OnAdoptedStyleSheetSet() for description around inner workings. +// +// static void TreeScope::OnAdoptedStyleSheetDelete( + GarbageCollectedMixin* tree_scope, ScriptState* script_state, V8ObservableArrayCSSStyleSheet& observable_array, uint32_t index, ExceptionState& exception_state) { - StyleSheetWasRemoved(adopted_style_sheets_->at(index)); + TreeScope* self = reinterpret_cast<TreeScope*>(tree_scope); + self->StyleSheetWasRemoved(self->adopted_style_sheets_->at(index)); } void TreeScope::ClearAdoptedStyleSheets() { + if (!HasAdoptedStyleSheets()) { + return; + } HeapVector<Member<CSSStyleSheet>> removed; removed.AppendRange(adopted_style_sheets_->begin(), adopted_style_sheets_->end()); @@ -422,6 +431,7 @@ void TreeScope::SetAdoptedStyleSheetsForTesting( HeapVector<Member<CSSStyleSheet>>& adopted_style_sheets) { ClearAdoptedStyleSheets(); + EnsureAdoptedStyleSheets(); for (auto sheet : adopted_style_sheets) { DCHECK(sheet->IsConstructed()); DCHECK_EQ(sheet->ConstructorDocument(), GetDocument()); @@ -747,4 +757,12 @@ visitor->Trace(adopted_style_sheets_); } +IdTargetObserverRegistry& TreeScope::EnsureIdTargetObserverRegistry() { + if (!id_target_observer_registry_) [[unlikely]] { + id_target_observer_registry_ = + MakeGarbageCollected<IdTargetObserverRegistry>(); + } + return *id_target_observer_registry_; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/dom/tree_scope.h b/third_party/blink/renderer/core/dom/tree_scope.h index 7450a53..0c293bd 100644 --- a/third_party/blink/renderer/core/dom/tree_scope.h +++ b/third_party/blink/renderer/core/dom/tree_scope.h
@@ -75,7 +75,7 @@ Element* activeElement() const; StyleSheetList* styleSheets() { return &StyleSheets(); } V8ObservableArrayCSSStyleSheet* adoptedStyleSheets() { - return AdoptedStyleSheets(); + return &EnsureAdoptedStyleSheets(); } DOMSelection* getSelection() { return GetSelection(); } HeapVector<Member<Animation>> getAnimations(); @@ -143,9 +143,11 @@ ContainerNode& RootNode() const { return *root_node_; } - IdTargetObserverRegistry& GetIdTargetObserverRegistry() const { - return *id_target_observer_registry_.Get(); + IdTargetObserverRegistry* GetIdTargetObserverRegistry() const { + return id_target_observer_registry_ ? id_target_observer_registry_.Get() + : nullptr; } + IdTargetObserverRegistry& EnsureIdTargetObserverRegistry(); RadioButtonGroupScope& GetRadioButtonGroupScope() { return radio_button_group_scope_; @@ -174,6 +176,7 @@ V8ObservableArrayCSSStyleSheet* AdoptedStyleSheets() const { return adopted_style_sheets_.Get(); } + V8ObservableArrayCSSStyleSheet& EnsureAdoptedStyleSheets(); bool HasAdoptedStyleSheets() const; void SetAdoptedStyleSheetsForTesting(HeapVector<Member<CSSStyleSheet>>&); void ClearAdoptedStyleSheets(); @@ -200,29 +203,26 @@ const AtomicString& is); protected: - explicit TreeScope(ContainerNode&, - Document&, - V8ObservableArrayCSSStyleSheet::SetAlgorithmCallback, - V8ObservableArrayCSSStyleSheet::DeleteAlgorithmCallback); - explicit TreeScope(Document&, - V8ObservableArrayCSSStyleSheet::SetAlgorithmCallback, - V8ObservableArrayCSSStyleSheet::DeleteAlgorithmCallback); + TreeScope(ContainerNode&, Document&); + explicit TreeScope(Document&); virtual ~TreeScope(); void SetDocument(Document& document) { document_ = &document; } void SetParentTreeScope(TreeScope&); - virtual void OnAdoptedStyleSheetSet(ScriptState*, - V8ObservableArrayCSSStyleSheet&, - uint32_t, - Member<CSSStyleSheet>&, - ExceptionState&); - virtual void OnAdoptedStyleSheetDelete(ScriptState*, - V8ObservableArrayCSSStyleSheet&, - uint32_t, - ExceptionState&); - private: + static void OnAdoptedStyleSheetSet(GarbageCollectedMixin*, + ScriptState*, + V8ObservableArrayCSSStyleSheet&, + uint32_t, + Member<CSSStyleSheet>&, + ExceptionState&); + static void OnAdoptedStyleSheetDelete(GarbageCollectedMixin*, + ScriptState*, + V8ObservableArrayCSSStyleSheet&, + uint32_t, + ExceptionState&); + Element* HitTestPointInternal(Node*, HitTestPointType) const; Element* FindAnchorWithName(const String& name);
diff --git a/third_party/blink/renderer/core/frame/root_frame_viewport.h b/third_party/blink/renderer/core/frame/root_frame_viewport.h index 031cf2bf..2aec6b2 100644 --- a/third_party/blink/renderer/core/frame/root_frame_viewport.h +++ b/third_party/blink/renderer/core/frame/root_frame_viewport.h
@@ -148,7 +148,8 @@ void SetPendingHistoryRestoreScrollOffset( const HistoryItem::ViewState& view_state, - bool should_restore_scroll) override { + bool should_restore_scroll, + mojom::blink::ScrollBehavior scroll_behavior) override { pending_view_state_ = view_state; should_restore_scroll_ = should_restore_scroll; }
diff --git a/third_party/blink/renderer/core/frame/root_frame_viewport_test.cc b/third_party/blink/renderer/core/frame/root_frame_viewport_test.cc index 5a22730..dd4b8ce 100644 --- a/third_party/blink/renderer/core/frame/root_frame_viewport_test.cc +++ b/third_party/blink/renderer/core/frame/root_frame_viewport_test.cc
@@ -643,7 +643,8 @@ view_state.page_scale_factor_ = 1.5; RootFrameViewport* root_frame_viewport = static_cast<RootFrameViewport*>( GetDocument().View()->GetScrollableArea()); - root_frame_viewport->SetPendingHistoryRestoreScrollOffset(view_state, false); + root_frame_viewport->SetPendingHistoryRestoreScrollOffset( + view_state, false, mojom::blink::ScrollBehavior::kAuto); root_frame_viewport->ApplyPendingHistoryRestoreScrollOffset(); // Override the 1.5 scale with 1.0.
diff --git a/third_party/blink/renderer/core/html/anchor_element_observer.cc b/third_party/blink/renderer/core/html/anchor_element_observer.cc index 91d35e2..a335c38 100644 --- a/third_party/blink/renderer/core/html/anchor_element_observer.cc +++ b/third_party/blink/renderer/core/html/anchor_element_observer.cc
@@ -18,7 +18,7 @@ AnchorElementObserver* anchor_element_observer) : IdTargetObserver(anchor_element_observer->GetSourceElement() .GetTreeScope() - .GetIdTargetObserverRegistry(), + .EnsureIdTargetObserverRegistry(), id), anchor_element_observer_(anchor_element_observer) {}
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_registry.idl b/third_party/blink/renderer/core/html/custom/custom_element_registry.idl index 76a968f..b80004a 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_registry.idl +++ b/third_party/blink/renderer/core/html/custom/custom_element_registry.idl
@@ -9,7 +9,7 @@ [CallWith=ScriptState, RuntimeEnabled=ScopedCustomElementRegistry] constructor(); [CallWith=ScriptState, CEReactions, RaisesException, MeasureAs=CustomElementRegistryDefine] void define(DOMString name, CustomElementConstructor constructor, optional ElementDefinitionOptions options = {}); any get(DOMString name); - [RuntimeEnabled=CustomElementsGetName] DOMString? getName(CustomElementConstructor constructor); + DOMString? getName(CustomElementConstructor constructor); [CallWith=ScriptState,RaisesException] Promise<CustomElementConstructor> whenDefined(DOMString name); [CEReactions] void upgrade(Node root); };
diff --git a/third_party/blink/renderer/core/html/forms/html_data_list_element.cc b/third_party/blink/renderer/core/html/forms/html_data_list_element.cc index aa1168a4..685e7cc 100644 --- a/third_party/blink/renderer/core/html/forms/html_data_list_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_data_list_element.cc
@@ -58,20 +58,23 @@ void HTMLDataListElement::ChildrenChanged(const ChildrenChange& change) { HTMLElement::ChildrenChanged(change); if (!change.ByParser()) { - GetTreeScope().GetIdTargetObserverRegistry().NotifyObservers( - GetIdAttribute()); + if (auto* registry = GetTreeScope().GetIdTargetObserverRegistry()) { + registry->NotifyObservers(GetIdAttribute()); + } } } void HTMLDataListElement::FinishParsingChildren() { HTMLElement::FinishParsingChildren(); - GetTreeScope().GetIdTargetObserverRegistry().NotifyObservers( - GetIdAttribute()); + if (auto* registry = GetTreeScope().GetIdTargetObserverRegistry()) { + registry->NotifyObservers(GetIdAttribute()); + } } void HTMLDataListElement::OptionElementChildrenChanged() { - GetTreeScope().GetIdTargetObserverRegistry().NotifyObservers( - GetIdAttribute()); + if (auto* registry = GetTreeScope().GetIdTargetObserverRegistry()) { + registry->NotifyObservers(GetIdAttribute()); + } } void HTMLDataListElement::DidMoveToNewDocument(Document& old_doc) {
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element.cc b/third_party/blink/renderer/core/html/forms/html_input_element.cc index 103c075..23de70a 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_input_element.cc
@@ -2158,7 +2158,7 @@ ListAttributeTargetObserver::ListAttributeTargetObserver( const AtomicString& id, HTMLInputElement* element) - : IdTargetObserver(element->GetTreeScope().GetIdTargetObserverRegistry(), + : IdTargetObserver(element->GetTreeScope().EnsureIdTargetObserverRegistry(), id), element_(element) {}
diff --git a/third_party/blink/renderer/core/html/forms/listed_element.cc b/third_party/blink/renderer/core/html/forms/listed_element.cc index 74ea1ea..8028a4e 100644 --- a/third_party/blink/renderer/core/html/forms/listed_element.cc +++ b/third_party/blink/renderer/core/html/forms/listed_element.cc
@@ -765,9 +765,10 @@ FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id, ListedElement* element) - : IdTargetObserver( - element->ToHTMLElement().GetTreeScope().GetIdTargetObserverRegistry(), - id), + : IdTargetObserver(element->ToHTMLElement() + .GetTreeScope() + .EnsureIdTargetObserverRegistry(), + id), element_(element) {} void FormAttributeTargetObserver::Trace(Visitor* visitor) const {
diff --git a/third_party/blink/renderer/core/html/resources/html.css b/third_party/blink/renderer/core/html/resources/html.css index 02fcc3c..d077329 100644 --- a/third_party/blink/renderer/core/html/resources/html.css +++ b/third_party/blink/renderer/core/html/resources/html.css
@@ -393,25 +393,32 @@ cursor: default; } -legend { - display: block; - padding-inline-start: 2px; - padding-inline-end: 2px; - border: none -} - fieldset { display: block; - margin-inline-start: 2px; - margin-inline-end: 2px; - padding-block-start: 0.35em; - padding-inline-start: 0.75em; - padding-inline-end: 0.75em; - padding-block-end: 0.625em; - border: 2px groove #C0C0C0; + margin-inline: 2px; + border: groove 2px ThreeDFace; + padding-block: 0.35em 0.625em; + padding-inline: 0.75em; min-inline-size: min-content; } +legend { + display: block; + padding-inline: 2px; +} + +legend[align=left i] { + justify-self: left; +} + +legend[align=center i] { + justify-self: center; +} + +legend[align=right i] { + justify-self: right; +} + button { appearance: auto; -internal-align-content-block: center;
diff --git a/third_party/blink/renderer/core/layout/page_container_layout_algorithm.cc b/third_party/blink/renderer/core/layout/page_container_layout_algorithm.cc index 04c21b4..d1b5582 100644 --- a/third_party/blink/renderer/core/layout/page_container_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/page_container_layout_algorithm.cc
@@ -216,8 +216,14 @@ ResolvePageBoxGeometry(page_border_box_node, containing_block_size * layout_scale, &geometry); - LayoutAlgorithmParams params(page_border_box_node, geometry, - GetConstraintSpace(), /*break_token=*/nullptr); + ConstraintSpaceBuilder space_builder(GetConstraintSpace(), + Style().GetWritingDirection(), + /*is_new_fc=*/true); + space_builder.SetAvailableSize(GetConstraintSpace().AvailableSize()); + space_builder.SetIsPaintedAtomically(true); + ConstraintSpace child_space = space_builder.ToConstraintSpace(); + LayoutAlgorithmParams params(page_border_box_node, geometry, child_space, + /*break_token=*/nullptr); PageBorderBoxLayoutAlgorithm child_algorithm(params, content_node_, page_area_params_); const LayoutResult* result = child_algorithm.Layout();
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc index eec80f1..614ca73 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -1681,13 +1681,13 @@ client_redirect_policy, has_transient_user_activation, WTF::RetainedRef(initiator_origin), is_browser_initiated, is_synchronously_committed, triggering_event_info, - soft_navigation_heuristics_task_id)); + soft_navigation_heuristics_task_id, has_ua_visual_transition)); } else { CommitSameDocumentNavigationInternal( url, frame_load_type, history_item, same_document_navigation_type, client_redirect_policy, has_transient_user_activation, initiator_origin, is_browser_initiated, is_synchronously_committed, triggering_event_info, - soft_navigation_heuristics_task_id); + soft_navigation_heuristics_task_id, has_ua_visual_transition); } return mojom::CommitResult::Ok; } @@ -1704,7 +1704,8 @@ bool is_synchronously_committed, mojom::blink::TriggeringEventInfo triggering_event_info, std::optional<scheduler::TaskAttributionId> - soft_navigation_heuristics_task_id) { + soft_navigation_heuristics_task_id, + bool has_ua_visual_transition) { // If this function was scheduled to run asynchronously, this DocumentLoader // might have been detached before the task ran. if (!frame_) @@ -1778,8 +1779,12 @@ frame_->Owner()->DispatchLoad(); } + auto scroll_behavior = has_ua_visual_transition + ? mojom::blink::ScrollBehavior::kInstant + : mojom::blink::ScrollBehavior::kAuto; GetFrameLoader().ProcessScrollForSameDocumentNavigation( - url, frame_load_type, view_state, scroll_restoration_type); + url, frame_load_type, view_state, scroll_restoration_type, + scroll_behavior); } void DocumentLoader::ProcessDataBuffer(BodyData* data) {
diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h index 6062cd7..c2e86a2f 100644 --- a/third_party/blink/renderer/core/loader/document_loader.h +++ b/third_party/blink/renderer/core/loader/document_loader.h
@@ -557,7 +557,8 @@ bool is_synchronously_committed, mojom::blink::TriggeringEventInfo, std::optional<scheduler::TaskAttributionId> - soft_navigation_heuristics_task_id); + soft_navigation_heuristics_task_id, + bool has_ua_visual_transition); // Use these method only where it's guaranteed that |m_frame| hasn't been // cleared.
diff --git a/third_party/blink/renderer/core/loader/frame_loader.cc b/third_party/blink/renderer/core/loader/frame_loader.cc index 1c91f62d..a10c7994 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.cc +++ b/third_party/blink/renderer/core/loader/frame_loader.cc
@@ -513,10 +513,11 @@ const KURL& url, WebFrameLoadType frame_load_type, std::optional<HistoryItem::ViewState> view_state, - mojom::blink::ScrollRestorationType scroll_restoration_type) { + mojom::blink::ScrollRestorationType scroll_restoration_type, + mojom::blink::ScrollBehavior scroll_behavior) { if (view_state) { RestoreScrollPositionAndViewState(frame_load_type, *view_state, - scroll_restoration_type); + scroll_restoration_type, scroll_behavior); } // We need to scroll to the fragment whether or not a hash change occurred, @@ -1396,16 +1397,25 @@ !GetDocumentLoader()->NavigationScrollAllowed()) { return; } + + // We need to suppress scroll restoration animations for navigations with + // visual transitions for the same-document case only. This is done in + // ProcessScrollForSameDocumentNavigation. + // + // For cross-document navigations (which take this path) the animation is + // suppressed by default. RestoreScrollPositionAndViewState( GetDocumentLoader()->LoadType(), *GetDocumentLoader()->GetHistoryItem()->GetViewState(), - GetDocumentLoader()->GetHistoryItem()->ScrollRestorationType()); + GetDocumentLoader()->GetHistoryItem()->ScrollRestorationType(), + mojom::blink::ScrollBehavior::kAuto); } void FrameLoader::RestoreScrollPositionAndViewState( WebFrameLoadType load_type, const HistoryItem::ViewState& view_state, - mojom::blink::ScrollRestorationType scroll_restoration_type) { + mojom::blink::ScrollRestorationType scroll_restoration_type, + mojom::blink::ScrollBehavior scroll_behavior) { LocalFrameView* view = frame_->View(); if (!view || !view->LayoutViewport() || !frame_->IsAttached() || frame_->GetDocument()->IsInitialEmptyDocument()) { @@ -1416,10 +1426,12 @@ view->LayoutViewport()->SetPendingHistoryRestoreScrollOffset( view_state, - scroll_restoration_type != mojom::blink::ScrollRestorationType::kManual); + scroll_restoration_type != mojom::blink::ScrollRestorationType::kManual, + scroll_behavior); view->GetScrollableArea()->SetPendingHistoryRestoreScrollOffset( view_state, - scroll_restoration_type != mojom::blink::ScrollRestorationType::kManual); + scroll_restoration_type != mojom::blink::ScrollRestorationType::kManual, + scroll_behavior); view->ScheduleAnimation(); }
diff --git a/third_party/blink/renderer/core/loader/frame_loader.h b/third_party/blink/renderer/core/loader/frame_loader.h index 3795d04..9460048 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.h +++ b/third_party/blink/renderer/core/loader/frame_loader.h
@@ -181,7 +181,8 @@ const KURL&, WebFrameLoadType, std::optional<HistoryItem::ViewState>, - mojom::blink::ScrollRestorationType); + mojom::blink::ScrollRestorationType, + mojom::blink::ScrollBehavior scroll_behavior); // This will attempt to detach the current document. It will dispatch unload // events and abort XHR requests. Returns true if the frame is ready to @@ -272,9 +273,11 @@ // Clears any information about client navigation, see client_navigation_. void ClearClientNavigation(); - void RestoreScrollPositionAndViewState(WebFrameLoadType, - const HistoryItem::ViewState&, - mojom::blink::ScrollRestorationType); + void RestoreScrollPositionAndViewState( + WebFrameLoadType, + const HistoryItem::ViewState&, + mojom::blink::ScrollRestorationType, + mojom::blink::ScrollBehavior scroll_behavior); void DetachDocumentLoader(Member<DocumentLoader>&, bool flush_microtask_queue = false);
diff --git a/third_party/blink/renderer/core/navigation_api/navigate_event.cc b/third_party/blink/renderer/core/navigation_api/navigate_event.cc index 5335479b..9cc98d78 100644 --- a/third_party/blink/renderer/core/navigation_api/navigate_event.cc +++ b/third_party/blink/renderer/core/navigation_api/navigate_event.cc
@@ -485,13 +485,16 @@ dispatch_params_->destination_item ? dispatch_params_->destination_item->GetViewState() : std::nullopt; + auto scroll_behavior = has_ua_visual_transition_ + ? mojom::blink::ScrollBehavior::kInstant + : mojom::blink::ScrollBehavior::kAuto; // Use mojom::blink::ScrollRestorationType::kAuto unconditionally here // because we are certain that we want to actually scroll if we reach this // point. Using mojom::blink::ScrollRestorationType::kManual would block the // scroll. DomWindow()->GetFrame()->Loader().ProcessScrollForSameDocumentNavigation( dispatch_params_->url, LoadTypeFromNavigation(navigation_type_), - view_state, mojom::blink::ScrollRestorationType::kAuto); + view_state, mojom::blink::ScrollRestorationType::kAuto, scroll_behavior); } const AtomicString& NavigateEvent::InterfaceName() const {
diff --git a/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc b/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc index a11a8e41..fc834e86 100644 --- a/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/root_scroller_test.cc
@@ -1994,9 +1994,10 @@ GetDocument() .View() ->GetScrollableArea() - ->SetPendingHistoryRestoreScrollOffset(view_state, true); + ->SetPendingHistoryRestoreScrollOffset( + view_state, true, mojom::blink::ScrollBehavior::kAuto); GetDocument().View()->LayoutViewport()->SetPendingHistoryRestoreScrollOffset( - view_state, true); + view_state, true, mojom::blink::ScrollBehavior::kAuto); GetDocument().View()->ScheduleAnimation(); Compositor().BeginFrame();
diff --git a/third_party/blink/renderer/core/paint/box_fragment_painter.cc b/third_party/blink/renderer/core/paint/box_fragment_painter.cc index 8ced753..928515c 100644 --- a/third_party/blink/renderer/core/paint/box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/box_fragment_painter.cc
@@ -4,6 +4,10 @@ #include "third_party/blink/renderer/core/paint/box_fragment_painter.h" +#include <algorithm> +#include <numeric> +#include <vector> + #include "base/containers/adapters.h" #include "base/ranges/algorithm.h" #include "third_party/blink/renderer/core/css/style_engine.h" @@ -661,6 +665,8 @@ } else if (items_) { DCHECK(fragment.IsBlockFlow()); PaintLineBoxes(paint_info, paint_offset); + } else if (fragment.IsPaginatedRoot()) { + PaintCurrentPageContainer(paint_info); } else if (!fragment.IsInlineFormattingContext()) { PaintBlockChildren(paint_info, paint_offset); } @@ -820,29 +826,63 @@ PaintLineBoxChildItems(&children, child_paint_info, paint_offset); } +void BoxFragmentPainter::PaintCurrentPageContainer( + const PaintInfo& paint_info) { + DCHECK(box_fragment_.IsPaginatedRoot()); + + PaintInfo paint_info_for_descendants = paint_info.ForDescendants(); + // The correct page box fragment for the given page has been selected, and + // that's all that's going to be painted now. The cull rect used during + // printing is for the paginated content only, in the stitched coordinate + // system with all the page areas stacked after oneanother. However, no + // paginated content will be painted here (that's in separate paint layers), + // only page box decorations and margin fragments. + paint_info_for_descendants.SetCullRect(CullRect::Infinite()); + + PaintInfo paint_info_for_page_container = paint_info_for_descendants; + // We only want the page container to paint itself and return (and then handle + // its children on our own here, further below). + paint_info_for_page_container.SetDescendantPaintingBlocked(); + + const PaginationState* pagination_state = + box_fragment_.GetDocument().View()->GetPaginationState(); + wtf_size_t page_index = pagination_state->CurrentPageIndex(); + + const auto& page_container = + To<PhysicalBoxFragment>(*box_fragment_.Children()[page_index]); + BoxFragmentPainter(page_container).Paint(paint_info_for_page_container); + + // Paint children of the page container - that is the page border box + // fragment, and any surrounding page margin boxes. Paint sorted by + // z-index. We sort a vector of fragment indices, rather than sorting a + // temporary list of fragments directly, as that would involve oilpan + // allocations and garbage for no reason. + // + // TODO(crbug.com/363031541) Although the page background and borders (and + // outlines, etc) are painted at the correct time, the paginated document + // contents (the page areas) will be painted on top of everything, since the + // document root element, and anything contained by the initial containing + // block, are separate layers. + base::span<const PhysicalFragmentLink> children = page_container.Children(); + std::vector<wtf_size_t> indices; + indices.resize(children.size()); + std::iota(indices.begin(), indices.end(), 0); + std::stable_sort( + indices.begin(), indices.end(), [&children](wtf_size_t a, wtf_size_t b) { + return children[a]->Style().ZIndex() < children[b]->Style().ZIndex(); + }); + for (wtf_size_t index : indices) { + const PhysicalFragmentLink& child = children[index]; + const auto& child_fragment = To<PhysicalBoxFragment>(*child); + DCHECK(!child_fragment.HasSelfPaintingLayer()); + BoxFragmentPainter(child_fragment).Paint(paint_info_for_descendants); + } +} + void BoxFragmentPainter::PaintBlockChildren(const PaintInfo& paint_info, PhysicalOffset paint_offset) { DCHECK(!box_fragment_.IsInlineFormattingContext()); PaintInfo paint_info_for_descendants = paint_info.ForDescendants(); - if (box_fragment_.IsPaginatedRoot()) { - const PaginationState* pagination_state = - box_fragment_.GetDocument().View()->GetPaginationState(); - wtf_size_t page_index = pagination_state->CurrentPageIndex(); - const auto& page_box = box_fragment_.Children()[page_index]; - - // The correct page box fragment for the given page has been selected, and - // that's all that's going to be painted now. The cull rect used during - // printing is for the paginated content only, in the stitched coordinate - // system with all the page areas stacked after oneanother. However, no - // paginated content will be painted here (that's in separate paint layers), - // only page box decorations and margin fragments. - paint_info_for_descendants.SetCullRect(CullRect::Infinite()); - - PaintBlockChild(page_box, paint_info, paint_info_for_descendants, - paint_offset); - return; - } - for (const PhysicalFragmentLink& child : box_fragment_.Children()) { const PhysicalFragment& child_fragment = *child; DCHECK(child_fragment.IsBox());
diff --git a/third_party/blink/renderer/core/paint/box_fragment_painter.h b/third_party/blink/renderer/core/paint/box_fragment_painter.h index 81a61291..e845c9c 100644 --- a/third_party/blink/renderer/core/paint/box_fragment_painter.h +++ b/third_party/blink/renderer/core/paint/box_fragment_painter.h
@@ -132,6 +132,7 @@ void PaintInternal(const PaintInfo&); void PaintAllPhasesAtomically(const PaintInfo&); + void PaintCurrentPageContainer(const PaintInfo&); void PaintBlockChildren(const PaintInfo&, PhysicalOffset); void PaintBlockChild(const PhysicalFragmentLink& child, const PaintInfo& paint_info,
diff --git a/third_party/blink/renderer/core/paint/paint_info.h b/third_party/blink/renderer/core/paint/paint_info.h index f3b70f8..780b619 100644 --- a/third_party/blink/renderer/core/paint/paint_info.h +++ b/third_party/blink/renderer/core/paint/paint_info.h
@@ -172,6 +172,7 @@ bool DescendantPaintingBlocked() const { return descendant_painting_blocked_; } + void SetDescendantPaintingBlocked() { descendant_painting_blocked_ = true; } GraphicsContext& context; PaintPhase phase; @@ -196,8 +197,6 @@ bool is_painting_background_in_contents_space = false; bool skips_background_ = false; - - // Used by display-locking. bool descendant_painting_blocked_ = false; };
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc index b59aff1..da6f9f1d 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc
@@ -240,13 +240,13 @@ // TODO(pnoland): attempt to restore the anchor in more places than this. // Anchor-based restore should allow for earlier restoration. bool did_restore = RestoreScrollAnchor( - {pending_view_state_->scroll_anchor_data_.selector_, - LayoutPoint(pending_view_state_->scroll_anchor_data_.offset_), - pending_view_state_->scroll_anchor_data_.simhash_}); + {pending_view_state_->state.scroll_anchor_data_.selector_, + LayoutPoint(pending_view_state_->state.scroll_anchor_data_.offset_), + pending_view_state_->state.scroll_anchor_data_.simhash_}); if (!did_restore) { - SetScrollOffset(pending_view_state_->scroll_offset_, + SetScrollOffset(pending_view_state_->state.scroll_offset_, mojom::blink::ScrollType::kProgrammatic, - mojom::blink::ScrollBehavior::kAuto); + pending_view_state_->scroll_behavior); } pending_view_state_.reset();
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h index d0252b8..2657de5 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h
@@ -582,10 +582,13 @@ void SetPendingHistoryRestoreScrollOffset( const HistoryItem::ViewState& view_state, - bool should_restore_scroll) override { + bool should_restore_scroll, + mojom::blink::ScrollBehavior scroll_behavior) override { if (!should_restore_scroll) return; - pending_view_state_ = view_state; + pending_view_state_.emplace(); + pending_view_state_->state = view_state; + pending_view_state_->scroll_behavior = scroll_behavior; } void ApplyPendingHistoryRestoreScrollOffset() override; @@ -868,7 +871,13 @@ MakeGarbageCollected<ScrollingBackgroundDisplayItemClient>(*this); Member<ScrollCornerDisplayItemClient> scroll_corner_display_item_client_ = MakeGarbageCollected<ScrollCornerDisplayItemClient>(*this); - std::optional<HistoryItem::ViewState> pending_view_state_; + + struct PendingViewState { + HistoryItem::ViewState state; + mojom::blink::ScrollBehavior scroll_behavior = + mojom::blink::ScrollBehavior::kAuto; + }; + std::optional<PendingViewState> pending_view_state_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc index 113d42c..d44600a 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area_test.cc
@@ -1391,7 +1391,8 @@ HistoryItem::ViewState view_state; view_state.scroll_offset_ = ScrollOffset(0, 100); - scrollable_area->SetPendingHistoryRestoreScrollOffset(view_state, true); + scrollable_area->SetPendingHistoryRestoreScrollOffset( + view_state, true, mojom::blink::ScrollBehavior::kAuto); scrollable_area->ApplyPendingHistoryRestoreScrollOffset(); EXPECT_EQ(ScrollOffset(0, 100), scrollable_area->GetScrollOffset());
diff --git a/third_party/blink/renderer/core/scroll/scrollable_area.h b/third_party/blink/renderer/core/scroll/scrollable_area.h index a0427c50..f19e1c5 100644 --- a/third_party/blink/renderer/core/scroll/scrollable_area.h +++ b/third_party/blink/renderer/core/scroll/scrollable_area.h
@@ -147,7 +147,8 @@ virtual void SetPendingHistoryRestoreScrollOffset( const HistoryItem::ViewState& view_state, - bool should_restore_scroll) {} + bool should_restore_scroll, + mojom::blink::ScrollBehavior scroll_behavior) {} virtual void ApplyPendingHistoryRestoreScrollOffset() {} virtual bool HasPendingHistoryRestoreScrollOffset() { return false; }
diff --git a/third_party/blink/renderer/core/svg/svg_element.cc b/third_party/blink/renderer/core/svg/svg_element.cc index 100ea4f..4716f3b 100644 --- a/third_party/blink/renderer/core/svg/svg_element.cc +++ b/third_party/blink/renderer/core/svg/svg_element.cc
@@ -22,11 +22,6 @@ * Boston, MA 02110-1301, USA. */ -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(crbug.com/351564777): Remove this and convert code to safer constructs. -#pragma allow_unsafe_buffers -#endif - #include "third_party/blink/renderer/core/svg/svg_element.h" #include "base/auto_reset.h" @@ -414,7 +409,7 @@ property_name_to_id_map = new HashMap<StringImpl*, CSSPropertyID>; // This is a list of all base CSS and SVG CSS properties which are exposed // as SVG XML attributes - const QualifiedName* const attr_names[] = { + const auto attr_names = std::to_array<const QualifiedName*>({ &svg_names::kAlignmentBaselineAttr, &svg_names::kBaselineShiftAttr, &svg_names::kBufferedRenderingAttr, @@ -473,13 +468,12 @@ &svg_names::kVisibilityAttr, &svg_names::kWordSpacingAttr, &svg_names::kWritingModeAttr, - }; - for (size_t i = 0; i < std::size(attr_names); i++) { + }); + for (const auto* qname : attr_names) { CSSPropertyID property_id = - CssPropertyID(execution_context, attr_names[i]->LocalName()); + CssPropertyID(execution_context, qname->LocalName()); DCHECK_GT(property_id, CSSPropertyID::kInvalid); - property_name_to_id_map->Set(attr_names[i]->LocalName().Impl(), - property_id); + property_name_to_id_map->Set(qname->LocalName().Impl(), property_id); } } @@ -712,7 +706,7 @@ const QualifiedName& attr; const AnimatedPropertyType prop_type; }; - const AttrToTypeEntry attr_to_types[] = { + const auto attr_to_types = std::to_array<const AttrToTypeEntry>({ {svg_names::kAlignmentBaselineAttr, kAnimatedString}, {svg_names::kBaselineShiftAttr, kAnimatedString}, {svg_names::kBufferedRenderingAttr, kAnimatedString}, @@ -766,9 +760,10 @@ {svg_names::kVectorEffectAttr, kAnimatedString}, {svg_names::kVisibilityAttr, kAnimatedString}, {svg_names::kWordSpacingAttr, kAnimatedLength}, - }; - for (size_t i = 0; i < std::size(attr_to_types); i++) - css_property_map.Set(attr_to_types[i].attr, attr_to_types[i].prop_type); + }); + for (const auto& item : attr_to_types) { + css_property_map.Set(item.attr, item.prop_type); + } } auto it = css_property_map.find(attribute_name); if (it == css_property_map.end())
diff --git a/third_party/blink/renderer/core/svg/svg_length.cc b/third_party/blink/renderer/core/svg/svg_length.cc index 7161273..f86785d 100644 --- a/third_party/blink/renderer/core/svg/svg_length.cc +++ b/third_party/blink/renderer/core/svg/svg_length.cc
@@ -19,11 +19,6 @@ * Boston, MA 02110-1301, USA. */ -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(crbug.com/351564777): Remove this and convert code to safer constructs. -#pragma allow_unsafe_buffers -#endif - #include "third_party/blink/renderer/core/svg/svg_length.h" #include "third_party/blink/renderer/core/css/css_math_function_value.h" @@ -49,15 +44,19 @@ // Table of initial values for SVGLength properties. Indexed by the // SVGLength::Initial enumeration, hence these two need to be kept // synchronized. -const struct { +struct InitialLengthData { int8_t value; uint8_t unit; -} g_initial_lengths_table[] = { - {0, CAST_UNIT(kUserUnits)}, {-10, CAST_UNIT(kPercentage)}, - {0, CAST_UNIT(kPercentage)}, {50, CAST_UNIT(kPercentage)}, - {100, CAST_UNIT(kPercentage)}, {120, CAST_UNIT(kPercentage)}, - {3, CAST_UNIT(kUserUnits)}, }; +const auto g_initial_lengths_table = std::to_array<InitialLengthData>({ + {0, CAST_UNIT(kUserUnits)}, + {-10, CAST_UNIT(kPercentage)}, + {0, CAST_UNIT(kPercentage)}, + {50, CAST_UNIT(kPercentage)}, + {100, CAST_UNIT(kPercentage)}, + {120, CAST_UNIT(kPercentage)}, + {3, CAST_UNIT(kUserUnits)}, +}); static_assert(static_cast<size_t>(SVGLength::Initial::kNumValues) == std::size(g_initial_lengths_table), "the enumeration is synchronized with the value table");
diff --git a/third_party/blink/renderer/core/svg/svg_path_string_builder.cc b/third_party/blink/renderer/core/svg/svg_path_string_builder.cc index 8381580..4b05c53 100644 --- a/third_party/blink/renderer/core/svg/svg_path_string_builder.cc +++ b/third_party/blink/renderer/core/svg/svg_path_string_builder.cc
@@ -17,11 +17,6 @@ * Boston, MA 02110-1301, USA. */ -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(crbug.com/351564777): Remove this and convert code to safer constructs. -#pragma allow_unsafe_buffers -#endif - #include "third_party/blink/renderer/core/svg/svg_path_string_builder.h" #include "base/notreached.h" @@ -58,7 +53,7 @@ } // TODO(fs): Centralized location for this (SVGPathSeg.h?) -static const char kPathSegmentCharacter[] = { +static const auto kPathSegmentCharacter = std::to_array<char>({ 0, // PathSegUnknown 'Z', // PathSegClosePath 'M', // PathSegMoveToAbs @@ -79,7 +74,7 @@ 's', // PathSegCurveToCubicSmoothRel 'T', // PathSegCurveToQuadraticSmoothAbs 't', // PathSegCurveToQuadraticSmoothRel -}; +}); void SVGPathStringBuilder::EmitSegment(const PathSegmentData& segment) { DCHECK_GT(segment.command, kPathSegUnknown);
diff --git a/third_party/blink/renderer/core/svg/svg_transform.cc b/third_party/blink/renderer/core/svg/svg_transform.cc index c7dfed9..47801f39 100644 --- a/third_party/blink/renderer/core/svg/svg_transform.cc +++ b/third_party/blink/renderer/core/svg/svg_transform.cc
@@ -18,11 +18,6 @@ * Boston, MA 02110-1301, USA. */ -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(crbug.com/351564777): Remove this and convert code to safer constructs. -#pragma allow_unsafe_buffers -#endif - #include "third_party/blink/renderer/core/svg/svg_transform.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" @@ -168,7 +163,7 @@ } // namespace String SVGTransform::ValueAsString() const { - double arguments[6]; + std::array<double, 6> arguments; size_t argument_count = 0; switch (transform_type_) { case SVGTransformType::kUnknown:
diff --git a/third_party/blink/renderer/core/svg/svg_uri_reference.cc b/third_party/blink/renderer/core/svg/svg_uri_reference.cc index 67ea8d1..b77c94e 100644 --- a/third_party/blink/renderer/core/svg/svg_uri_reference.cc +++ b/third_party/blink/renderer/core/svg/svg_uri_reference.cc
@@ -39,7 +39,7 @@ SVGElementReferenceObserver(TreeScope& tree_scope, const AtomicString& id, base::RepeatingClosure closure) - : IdTargetObserver(tree_scope.GetIdTargetObserverRegistry(), id), + : IdTargetObserver(tree_scope.EnsureIdTargetObserverRegistry(), id), closure_(std::move(closure)) {} private:
diff --git a/third_party/blink/renderer/modules/ad_auction/protected_audience.cc b/third_party/blink/renderer/modules/ad_auction/protected_audience.cc index 82ce6e9..64ed7e0bc 100644 --- a/third_party/blink/renderer/modules/ad_auction/protected_audience.cc +++ b/third_party/blink/renderer/modules/ad_auction/protected_audience.cc
@@ -57,6 +57,10 @@ String("realTimeReporting"), FeatureVal(RuntimeEnabledFeatures::FledgeRealTimeReportingEnabled( execution_context))); + feature_status.emplace_back( + String("selectableReportingIds"), + FeatureVal(RuntimeEnabledFeatures::FledgeAuctionDealSupportEnabled( + execution_context))); return feature_status; }
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.idl b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.idl index 4fb6e33..6ab3d28 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.idl +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.idl
@@ -23,8 +23,8 @@ readonly attribute RTCRtpTransceiverDirection? currentDirection; [Measure, RaisesException] void stop(); [RaisesException] void setCodecPreferences(sequence<RTCRtpCodecCapability> codecs); - [RuntimeEnabled=RTCRtpHeaderExtensionControl] sequence<RTCRtpHeaderExtensionCapability> getHeaderExtensionsToNegotiate(); - [RaisesException, RuntimeEnabled=RTCRtpHeaderExtensionControl] void setHeaderExtensionsToNegotiate( + sequence<RTCRtpHeaderExtensionCapability> getHeaderExtensionsToNegotiate(); + [RaisesException] void setHeaderExtensionsToNegotiate( sequence<RTCRtpHeaderExtensionCapability> extensions); - [RuntimeEnabled=RTCRtpHeaderExtensionControl] sequence<RTCRtpHeaderExtensionCapability> getNegotiatedHeaderExtensions(); + sequence<RTCRtpHeaderExtensionCapability> getNegotiatedHeaderExtensions(); };
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index c322dda..0cf5e15c 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -826,6 +826,7 @@ "geometry/calculation_expression_node.h", "geometry/calculation_value.cc", "geometry/calculation_value.h", + "geometry/evaluation_input.h", "geometry/float_polygon.cc", "geometry/float_polygon.h", "geometry/float_rounded_rect.cc",
diff --git a/third_party/blink/renderer/platform/bindings/observable_array.cc b/third_party/blink/renderer/platform/bindings/observable_array.cc index 4f9c221..db092877 100644 --- a/third_party/blink/renderer/platform/bindings/observable_array.cc +++ b/third_party/blink/renderer/platform/bindings/observable_array.cc
@@ -40,7 +40,7 @@ namespace bindings { ObservableArrayBase::ObservableArrayBase( - ScriptWrappable* platform_object, + GarbageCollectedMixin* platform_object, ObservableArrayExoticObject* observable_array_exotic_object) : platform_object_(platform_object), observable_array_exotic_object_(observable_array_exotic_object) {
diff --git a/third_party/blink/renderer/platform/bindings/observable_array.h b/third_party/blink/renderer/platform/bindings/observable_array.h index 0797c66..d705072 100644 --- a/third_party/blink/renderer/platform/bindings/observable_array.h +++ b/third_party/blink/renderer/platform/bindings/observable_array.h
@@ -74,7 +74,7 @@ class PLATFORM_EXPORT ObservableArrayBase : public ScriptWrappable { public: ObservableArrayBase( - ScriptWrappable* platform_object, + GarbageCollectedMixin* platform_object, ObservableArrayExoticObject* observable_array_exotic_object); ~ObservableArrayBase() override = default; @@ -90,13 +90,13 @@ void Trace(Visitor* visitor) const override; protected: - ScriptWrappable* GetPlatformObject() { return platform_object_.Get(); } + GarbageCollectedMixin* GetPlatformObject() { return platform_object_.Get(); } virtual v8::Local<v8::FunctionTemplate> GetProxyHandlerFunctionTemplate( ScriptState* script_state) = 0; private: - Member<ScriptWrappable> platform_object_; // IDL attribute owner + Member<GarbageCollectedMixin> platform_object_; // IDL attribute owner Member<ObservableArrayExoticObject> observable_array_exotic_object_; }; @@ -116,7 +116,7 @@ using const_reverse_iterator = typename BackingListType::const_reverse_iterator; - explicit ObservableArrayImplHelper(ScriptWrappable* platform_object) + explicit ObservableArrayImplHelper(GarbageCollectedMixin* platform_object) : bindings::ObservableArrayBase( platform_object, MakeGarbageCollected<ObservableArrayExoticObject>(this)) {}
diff --git a/third_party/blink/renderer/platform/geometry/calculation_expression_node.cc b/third_party/blink/renderer/platform/geometry/calculation_expression_node.cc index 702c182..c149d8d 100644 --- a/third_party/blink/renderer/platform/geometry/calculation_expression_node.cc +++ b/third_party/blink/renderer/platform/geometry/calculation_expression_node.cc
@@ -18,9 +18,8 @@ // ------ CalculationExpressionNumberNode ------ -float CalculationExpressionNumberNode::Evaluate( - float max_value, - const Length::EvaluationInput&) const { +float CalculationExpressionNumberNode::Evaluate(float max_value, + const EvaluationInput&) const { return value_; } @@ -66,7 +65,7 @@ float CalculationExpressionSizingKeywordNode::Evaluate( float max_value, - const Length::EvaluationInput& input) const { + const EvaluationInput& input) const { Length::Type intrinsic_type = Length::kFixed; switch (keyword_) { case Keyword::kSize: @@ -133,7 +132,7 @@ float CalculationExpressionPixelsAndPercentNode::Evaluate( float max_value, - const Length::EvaluationInput&) const { + const EvaluationInput&) const { return value_.pixels + value_.percent / 100 * max_value; } @@ -425,7 +424,7 @@ float CalculationExpressionOperationNode::Evaluate( float max_value, - const Length::EvaluationInput& input) const { + const EvaluationInput& input) const { switch (operator_) { case CalculationOperator::kAdd: { DCHECK_EQ(children_.size(), 2u); @@ -504,7 +503,7 @@ } case CalculationOperator::kCalcSize: { DCHECK_EQ(children_.size(), 2u); - Length::EvaluationInput calculation_input(input); + EvaluationInput calculation_input(input); calculation_input.size_keyword_basis = children_[0]->Evaluate(max_value, input); if (max_value == kIndefiniteSize.ToFloat()) {
diff --git a/third_party/blink/renderer/platform/geometry/calculation_expression_node.h b/third_party/blink/renderer/platform/geometry/calculation_expression_node.h index 5bd267b..a289bf5 100644 --- a/third_party/blink/renderer/platform/geometry/calculation_expression_node.h +++ b/third_party/blink/renderer/platform/geometry/calculation_expression_node.h
@@ -43,8 +43,7 @@ class PLATFORM_EXPORT CalculationExpressionNode : public RefCounted<CalculationExpressionNode> { public: - virtual float Evaluate(float max_value, - const Length::EvaluationInput&) const = 0; + virtual float Evaluate(float max_value, const EvaluationInput&) const = 0; bool operator==(const CalculationExpressionNode& other) const { return Equals(other); } @@ -110,7 +109,7 @@ float Value() const { return value_; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value, const Length::EvaluationInput&) const final; + float Evaluate(float max_value, const EvaluationInput&) const final; bool Equals(const CalculationExpressionNode& other) const final; scoped_refptr<const CalculationExpressionNode> Zoom( double factor) const final; @@ -145,7 +144,7 @@ const AtomicString& Value() const { return identifier_; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value, const Length::EvaluationInput&) const final { + float Evaluate(float max_value, const EvaluationInput&) const final { return 0.0f; } bool Equals(const CalculationExpressionNode& other) const final { @@ -199,7 +198,7 @@ Keyword Value() const { return keyword_; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value, const Length::EvaluationInput&) const final; + float Evaluate(float max_value, const EvaluationInput&) const final; bool Equals(const CalculationExpressionNode& other) const final { auto* other_sizing_keyword = DynamicTo<CalculationExpressionSizingKeywordNode>(other); @@ -263,7 +262,7 @@ bool HasExplicitPercent() const { return value_.has_explicit_percent; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value, const Length::EvaluationInput&) const final; + float Evaluate(float max_value, const EvaluationInput&) const final; bool Equals(const CalculationExpressionNode& other) const final; scoped_refptr<const CalculationExpressionNode> Zoom( double factor) const final; @@ -301,7 +300,7 @@ CalculationOperator GetOperator() const { return operator_; } // Implement |CalculationExpressionNode|: - float Evaluate(float max_value, const Length::EvaluationInput&) const final; + float Evaluate(float max_value, const EvaluationInput&) const final; bool Equals(const CalculationExpressionNode& other) const final; scoped_refptr<const CalculationExpressionNode> Zoom( double factor) const final;
diff --git a/third_party/blink/renderer/platform/geometry/calculation_value.cc b/third_party/blink/renderer/platform/geometry/calculation_value.cc index 71ae03e..26bae80e 100644 --- a/third_party/blink/renderer/platform/geometry/calculation_value.cc +++ b/third_party/blink/renderer/platform/geometry/calculation_value.cc
@@ -45,7 +45,7 @@ } float CalculationValue::Evaluate(float max_value, - const Length::EvaluationInput& input) const { + const EvaluationInput& input) const { float value = ClampTo<float>( is_expression_ ? data_.expression->Evaluate(max_value, input) : Pixels() + Percent() / 100 * max_value);
diff --git a/third_party/blink/renderer/platform/geometry/calculation_value.h b/third_party/blink/renderer/platform/geometry/calculation_value.h index e885f8f..7c4e984 100644 --- a/third_party/blink/renderer/platform/geometry/calculation_value.h +++ b/third_party/blink/renderer/platform/geometry/calculation_value.h
@@ -59,7 +59,7 @@ ~CalculationValue(); - float Evaluate(float max_value, const Length::EvaluationInput& = {}) const; + float Evaluate(float max_value, const EvaluationInput& = {}) const; bool operator==(const CalculationValue& o) const; bool IsExpression() const { return is_expression_; } bool IsNonNegative() const { return is_non_negative_; }
diff --git a/third_party/blink/renderer/platform/geometry/evaluation_input.h b/third_party/blink/renderer/platform/geometry/evaluation_input.h new file mode 100644 index 0000000..cc335592 --- /dev/null +++ b/third_party/blink/renderer/platform/geometry/evaluation_input.h
@@ -0,0 +1,34 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_EVALUATION_INPUT_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_EVALUATION_INPUT_H_ + +#include <optional> + +#include "base/functional/function_ref.h" +#include "third_party/blink/renderer/platform/geometry/layout_unit.h" + +namespace blink { + +class Length; + +// When calcuating the min/max content-contribution we sometimes need to coerce +// a fit-content/stretch basis to auto. +enum class CalcSizeKeywordBehavior { kAsSpecified, kAsAuto }; + +struct EvaluationInput { + STACK_ALLOCATED(); + + using IntrinsicLengthEvaluator = base::FunctionRef<LayoutUnit(const Length&)>; + + public: + std::optional<float> size_keyword_basis = std::nullopt; + std::optional<IntrinsicLengthEvaluator> intrinsic_evaluator = std::nullopt; + CalcSizeKeywordBehavior calc_size_keyword_behavior = + CalcSizeKeywordBehavior::kAsSpecified; +}; +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GEOMETRY_EVALUATION_INPUT_H_
diff --git a/third_party/blink/renderer/platform/geometry/length.h b/third_party/blink/renderer/platform/geometry/length.h index f0226eac..2251b63e 100644 --- a/third_party/blink/renderer/platform/geometry/length.h +++ b/third_party/blink/renderer/platform/geometry/length.h
@@ -28,9 +28,9 @@ #include <optional> #include "base/check_op.h" -#include "base/functional/function_ref.h" #include "base/memory/stack_allocated.h" #include "base/notreached.h" +#include "third_party/blink/renderer/platform/geometry/evaluation_input.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" @@ -42,10 +42,6 @@ namespace blink { -// When calcuating the min/max content-contribution we sometimes need to coerce -// a fit-content/stretch basis to auto. -enum class CalcSizeKeywordBehavior { kAsSpecified, kAsAuto }; - struct PixelsAndPercent { DISALLOW_NEW(); explicit PixelsAndPercent(float pixels) @@ -368,18 +364,6 @@ return value_; } - using IntrinsicLengthEvaluator = base::FunctionRef<LayoutUnit(const Length&)>; - - struct EvaluationInput { - STACK_ALLOCATED(); - - public: - std::optional<float> size_keyword_basis = std::nullopt; - std::optional<IntrinsicLengthEvaluator> intrinsic_evaluator = std::nullopt; - CalcSizeKeywordBehavior calc_size_keyword_behavior = - CalcSizeKeywordBehavior::kAsSpecified; - }; - float NonNanCalculatedValue(float max_value, const EvaluationInput&) const; Length SubtractFromOneHundredPercent() const;
diff --git a/third_party/blink/renderer/platform/geometry/length_functions.cc b/third_party/blink/renderer/platform/geometry/length_functions.cc index 2b022128..8471cd0 100644 --- a/third_party/blink/renderer/platform/geometry/length_functions.cc +++ b/third_party/blink/renderer/platform/geometry/length_functions.cc
@@ -37,7 +37,7 @@ float FloatValueForLength(const Length& length, float maximum_value, - const Length::EvaluationInput& input) { + const EvaluationInput& input) { switch (length.GetType()) { case Length::kFixed: return length.GetFloatValue(); @@ -67,7 +67,7 @@ LayoutUnit MinimumValueForLengthInternal(const Length& length, LayoutUnit maximum_value, - const Length::EvaluationInput& input) { + const EvaluationInput& input) { switch (length.GetType()) { case Length::kPercent: // Don't remove the extra cast to float. It is needed for rounding on @@ -99,7 +99,7 @@ LayoutUnit ValueForLength(const Length& length, LayoutUnit maximum_value, - const Length::EvaluationInput& input) { + const EvaluationInput& input) { switch (length.GetType()) { case Length::kFixed: case Length::kPercent:
diff --git a/third_party/blink/renderer/platform/geometry/length_functions.h b/third_party/blink/renderer/platform/geometry/length_functions.h index a20505b..8257bcf 100644 --- a/third_party/blink/renderer/platform/geometry/length_functions.h +++ b/third_party/blink/renderer/platform/geometry/length_functions.h
@@ -43,16 +43,15 @@ PLATFORM_EXPORT int IntValueForLength(const Length&, int maximum_value); PLATFORM_EXPORT float FloatValueForLength(const Length&, float maximum_value, - const Length::EvaluationInput& = {}); + const EvaluationInput& = {}); PLATFORM_EXPORT LayoutUnit MinimumValueForLengthInternal(const Length&, LayoutUnit maximum_value, - const Length::EvaluationInput&); + const EvaluationInput&); -inline LayoutUnit MinimumValueForLength( - const Length& length, - LayoutUnit maximum_value, - const Length::EvaluationInput& input = {}) { +inline LayoutUnit MinimumValueForLength(const Length& length, + LayoutUnit maximum_value, + const EvaluationInput& input = {}) { if (length.IsFixed()) [[likely]] { return LayoutUnit(length.Value()); } @@ -60,10 +59,9 @@ return MinimumValueForLengthInternal(length, maximum_value, input); } -PLATFORM_EXPORT LayoutUnit -ValueForLength(const Length&, - LayoutUnit maximum_value, - const Length::EvaluationInput& input = {}); +PLATFORM_EXPORT LayoutUnit ValueForLength(const Length&, + LayoutUnit maximum_value, + const EvaluationInput& input = {}); PLATFORM_EXPORT gfx::SizeF SizeForLengthSize(const LengthSize&, const gfx::SizeF& box_size); PLATFORM_EXPORT gfx::PointF PointForLengthPoint(const LengthPoint&,
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc index 4ea6d4f..e2d1a17 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc
@@ -293,6 +293,10 @@ layer_->ClearClient(); layer_ = nullptr; } + + for (auto& color_buffer : exported_color_buffers_) { + color_buffer->ForceCleanUp(); + } context_provider_ = nullptr; } @@ -659,17 +663,15 @@ // Context is likely lost. return false; } - gl_->CopySubTextureCHROMIUM(back_color_buffer_->texture_id, 0, + gl_->CopySubTextureCHROMIUM(back_color_buffer_->texture_id(), 0, color_buffer_for_mailbox->texture_target, - color_buffer_for_mailbox->texture_id, 0, 0, 0, + color_buffer_for_mailbox->texture_id(), 0, 0, 0, 0, 0, size_.width(), size_.height(), GL_FALSE, GL_FALSE, GL_FALSE); } // Signal we will no longer access |color_buffer_for_mailbox| before exporting // it. - gl_->EndSharedImageAccessDirectCHROMIUM(color_buffer_for_mailbox->texture_id); - // Put colorBufferForMailbox into its mailbox, and populate its // produceSyncToken with that point. { @@ -680,8 +682,8 @@ // incorrect rendering with complex WebGL content that wasn't always // properly flushed to the driver. There is now a basic assumption that // there are implicit flushes between contexts at the lowest level. - gl_->GenUnverifiedSyncTokenCHROMIUM( - color_buffer_for_mailbox->produce_sync_token.GetData()); + color_buffer_for_mailbox->produce_sync_token = + color_buffer_for_mailbox->EndAccess(); #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) // Needed for GPU back-pressure on macOS and Android. Used to be in the // middle of the commands above; try to move it to the bottom to allow them @@ -709,6 +711,7 @@ // mailbox is released (and while the release callback is running). auto func = base::BindOnce(&DrawingBuffer::NotifyMailboxReleasedGpu, color_buffer_for_mailbox); + exported_color_buffers_.insert(color_buffer_for_mailbox); *out_release_callback = std::move(func); } @@ -740,6 +743,8 @@ void DrawingBuffer::MailboxReleasedGpu(scoped_refptr<ColorBuffer> color_buffer, bool lost_resource) { + exported_color_buffers_.erase(color_buffer); + // If the mailbox has been returned by the compositor then it is no // longer being presented, and so is no longer the front buffer. if (color_buffer == front_color_buffer_) @@ -845,12 +850,9 @@ if (!recycled_color_buffer_queue_.empty()) { scoped_refptr<ColorBuffer> recycled = recycled_color_buffer_queue_.TakeLast(); - if (recycled->receive_sync_token.HasData()) - gl_->WaitSyncTokenCHROMIUM(recycled->receive_sync_token.GetData()); DCHECK(recycled->size == size_); DCHECK(recycled->color_space == color_space_); - gl_->BeginSharedImageAccessDirectCHROMIUM( - recycled->texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READWRITE_CHROMIUM); + recycled->BeginAccess(recycled->receive_sync_token, /*readonly=*/false); return recycled; } return CreateColorBuffer(size_); @@ -880,10 +882,8 @@ // fence is generated on the shared image to guarantee display reads this // frame completely. Display may still read parts of subsequent frames, // which is okay. - gl_->EndSharedImageAccessDirectCHROMIUM(color_buffer->texture_id); - gl_->BeginSharedImageAccessDirectCHROMIUM( - color_buffer->texture_id, - GL_SHARED_IMAGE_ACCESS_MODE_READWRITE_CHROMIUM); + color_buffer->EndAccess(); + color_buffer->BeginAccess(gpu::SyncToken(), /*readonly=*/false); } return ExternalCanvasResource::Create( @@ -928,9 +928,9 @@ viz::SharedImageFormat format, SkAlphaType alpha_type, GLenum texture_target, - GLuint texture_id, bool is_overlay_candidate, - scoped_refptr<gpu::ClientSharedImage> shared_image) + scoped_refptr<gpu::ClientSharedImage> shared_image, + std::unique_ptr<gpu::SharedImageTexture> shared_image_texture) : owning_thread_ref(base::PlatformThread::CurrentRef()), drawing_buffer(std::move(drawing_buffer)), size(size), @@ -938,9 +938,9 @@ format(format), alpha_type(alpha_type), texture_target(texture_target), - texture_id(texture_id), is_overlay_candidate(is_overlay_candidate), - shared_image(std::move(shared_image)) { + shared_image(std::move(shared_image)), + shared_image_texture_(std::move(shared_image_texture)) { CHECK(this->shared_image); // In all cases it should be correct for this instance to use the texture @@ -954,6 +954,11 @@ } DrawingBuffer::ColorBuffer::~ColorBuffer() { + if (scoped_shared_image_access_) { + gpu::SharedImageTexture::ScopedAccess::EndAccess( + std::move(scoped_shared_image_access_)); + } + if (base::PlatformThread::CurrentRef() != owning_thread_ref || !drawing_buffer) { // If the context has been destroyed no cleanup is necessary since all @@ -961,6 +966,7 @@ // is being destroyed on a different thread, it implies that the owning // thread was destroyed which means the associated context was also // destroyed. + CHECK(!shared_image_texture_); return; } @@ -984,7 +990,25 @@ } shared_image->UpdateDestructionSyncToken(receive_sync_token); - gl->DeleteTextures(1u, &texture_id); + shared_image_texture_.reset(); +} + +void DrawingBuffer::ColorBuffer::BeginAccess(const gpu::SyncToken& sync_token, + bool readonly) { + scoped_shared_image_access_ = + shared_image_texture_->BeginAccess(sync_token, readonly); +} + +gpu::SyncToken DrawingBuffer::ColorBuffer::EndAccess() { + return gpu::SharedImageTexture::ScopedAccess::EndAccess( + std::move(scoped_shared_image_access_)); +} + +void DrawingBuffer::ColorBuffer::ForceCleanUp() { + if (scoped_shared_image_access_) { + EndAccess(); + } + shared_image_texture_.reset(); } bool DrawingBuffer::Initialize(const gfx::Size& size, bool use_multisampling) { @@ -1098,7 +1122,7 @@ const GLboolean do_unpremultiply_alpha = GL_FALSE; gl_->CopySubTextureCHROMIUM( staging_texture_, 0, back_color_buffer_->texture_target, - back_color_buffer_->texture_id, 0, 0, 0, 0, 0, size_.width(), + back_color_buffer_->texture_id(), 0, 0, 0, 0, 0, size_.width(), size_.height(), do_flip_y, do_premultiply_alpha, do_unpremultiply_alpha); } @@ -1118,7 +1142,7 @@ // Contexts may be in a different share group. We must transfer the texture // through a mailbox first. gpu::SyncToken produce_sync_token; - GLuint texture_id_to_restore_access = 0; + bool need_restore_access = false; scoped_refptr<ColorBuffer> src_color_buffer; SkAlphaType src_alpha_type = kUnknown_SkAlphaType; if (src_buffer == kFrontBuffer && front_color_buffer_) { @@ -1128,7 +1152,7 @@ } else { src_color_buffer = back_color_buffer_; src_alpha_type = src_color_buffer->alpha_type; - texture_id_to_restore_access = src_color_buffer->texture_id; + need_restore_access = true; if (staging_texture_) { // The source for the copy must be a SharedImage that is accessible to // `dst_interface`. If the rendering results are in `staging_texture_`, @@ -1144,7 +1168,7 @@ const GLboolean do_unpremultiply_alpha = GL_FALSE; gl_->CopySubTextureCHROMIUM( staging_texture_, 0, back_color_buffer_->texture_target, - back_color_buffer_->texture_id, 0, 0, 0, 0, 0, size_.width(), + back_color_buffer_->texture_id(), 0, 0, 0, 0, 0, size_.width(), size_.height(), do_flip_y, do_premultiply_alpha, do_unpremultiply_alpha); src_alpha_type = requested_alpha_type_; @@ -1152,8 +1176,7 @@ CopyStagingTextureToBackColorBufferIfNeeded(); } } - src_gl->EndSharedImageAccessDirectCHROMIUM(back_color_buffer_->texture_id); - src_gl->GenUnverifiedSyncTokenCHROMIUM(produce_sync_token.GetData()); + produce_sync_token = back_color_buffer_->EndAccess(); } if (!produce_sync_token.HasData()) { @@ -1166,14 +1189,9 @@ src_color_buffer->format, src_alpha_type, src_color_buffer->size, src_color_buffer->color_space); - if (sync_token.has_value()) { - src_gl->WaitSyncTokenCHROMIUM(sync_token.value().GetData()); - } - - if (texture_id_to_restore_access) { - src_gl->BeginSharedImageAccessDirectCHROMIUM( - texture_id_to_restore_access, - GL_SHARED_IMAGE_ACCESS_MODE_READWRITE_CHROMIUM); + if (need_restore_access) { + src_color_buffer->BeginAccess(sync_token.value_or(gpu::SyncToken()), + /*readonly=*/false); } return sync_token.has_value(); } @@ -1205,20 +1223,18 @@ unpack_premultiply_alpha_needed = GL_TRUE; } - GLuint src_texture = dst_gl->CreateAndTexStorage2DSharedImageCHROMIUM( - src_shared_image->mailbox().name); - dst_gl->BeginSharedImageAccessDirectCHROMIUM( - src_texture, GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM); + auto src_si_texture = src_shared_image->CreateGLTexture(dst_gl); + auto src_si_access = + src_si_texture->BeginAccess(produce_sync_token, /*readonly=*/true); dst_gl->CopySubTextureCHROMIUM( - src_texture, 0, dst_texture_target, dst_texture, dst_level, - dst_texture_offset.x(), dst_texture_offset.y(), src_sub_rectangle.x(), - src_sub_rectangle.y(), src_sub_rectangle.width(), + src_si_access->texture_id(), 0, dst_texture_target, dst_texture, + dst_level, dst_texture_offset.x(), dst_texture_offset.y(), + src_sub_rectangle.x(), src_sub_rectangle.y(), src_sub_rectangle.width(), src_sub_rectangle.height(), flip_y, unpack_premultiply_alpha_needed, unpack_unpremultiply_alpha_needed); - dst_gl->EndSharedImageAccessDirectCHROMIUM(src_texture); - dst_gl->DeleteTextures(1, &src_texture); - gpu::SyncToken sync_token; - dst_gl->GenUnverifiedSyncTokenCHROMIUM(sync_token.GetData()); + auto sync_token = gpu::SharedImageTexture::ScopedAccess::EndAccess( + std::move(src_si_access)); + src_si_texture.reset(); return sync_token; }; return CopyToPlatformInternal(dst_gl, !premultiply_alpha, src_buffer, @@ -1887,12 +1903,10 @@ if (source_buffer == kFrontBuffer && front_color_buffer_) { gl_->GenFramebuffers(1, &fbo); gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo); - gl_->BeginSharedImageAccessDirectCHROMIUM( - front_color_buffer_->texture_id, - GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM); + front_color_buffer_->BeginAccess(gpu::SyncToken(), /*readonly=*/true); gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, front_color_buffer_->texture_target, - front_color_buffer_->texture_id, 0); + front_color_buffer_->texture_id(), 0); } else { gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); } @@ -1910,7 +1924,7 @@ gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, front_color_buffer_->texture_target, 0, 0); gl_->DeleteFramebuffers(1, &fbo); - gl_->EndSharedImageAccessDirectCHROMIUM(front_color_buffer_->texture_id); + front_color_buffer_->EndAccess(); } return dst_buffer; @@ -1997,15 +2011,14 @@ GLenum dest_texture_target = staging_texture_ ? GL_TEXTURE_2D : back_color_buffer_->texture_target; GLuint dest_texture_id = - staging_texture_ ? staging_texture_ : back_color_buffer_->texture_id; - gl_->BeginSharedImageAccessDirectCHROMIUM( - front_color_buffer_->texture_id, - GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM); - gl_->CopySubTextureCHROMIUM(front_color_buffer_->texture_id, 0, + staging_texture_ ? staging_texture_ : back_color_buffer_->texture_id(); + front_color_buffer_->BeginAccess(gpu::SyncToken(), /*readonly=*/true); + ; + gl_->CopySubTextureCHROMIUM(front_color_buffer_->texture_id(), 0, dest_texture_target, dest_texture_id, 0, 0, 0, 0, 0, size_.width(), size_.height(), GL_FALSE, GL_FALSE, GL_FALSE); - gl_->EndSharedImageAccessDirectCHROMIUM(front_color_buffer_->texture_id); + front_color_buffer_->EndAccess(); } contents_changed_ = false; if (preserve_drawing_buffer_ == kDiscard) { @@ -2030,7 +2043,6 @@ // Set only when using swap chains. scoped_refptr<gpu::ClientSharedImage> front_buffer_shared_image; GLenum texture_target = GL_TEXTURE_2D; - GLuint texture_id = 0; bool created_mappable_si = false; // The SharedImages created here are read to and written from by WebGL. They @@ -2193,25 +2205,29 @@ staging_texture_needed_ = true; } - gpu::SyncToken sync_token = sii->GenUnverifiedSyncToken(); - gl_->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); if (front_buffer_shared_image) { DCHECK(using_swap_chain_); // Import frontbuffer of swap chain into GL. - texture_id = gl_->CreateAndTexStorage2DSharedImageCHROMIUM( - front_buffer_shared_image->mailbox().name); + std::unique_ptr<gpu::SharedImageTexture> si_texture = + front_buffer_shared_image->CreateGLTexture(gl_); front_color_buffer_ = base::MakeRefCounted<ColorBuffer>( weak_factory_.GetWeakPtr(), size, color_space_, color_buffer_format_, - back_buffer_alpha_type, texture_target, texture_id, - /*is_overlay_candidate=*/true, std::move(front_buffer_shared_image)); + back_buffer_alpha_type, texture_target, + /*is_overlay_candidate=*/true, std::move(front_buffer_shared_image), + std::move(si_texture)); } // Import the backbuffer of swap chain or allocated SharedImage into GL. - texture_id = gl_->CreateAndTexStorage2DSharedImageCHROMIUM( - back_buffer_shared_image->mailbox().name); - gl_->BeginSharedImageAccessDirectCHROMIUM( - texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READWRITE_CHROMIUM); - gl_->BindTexture(texture_target, texture_id); + std::unique_ptr<gpu::SharedImageTexture> si_texture = + back_buffer_shared_image->CreateGLTexture(gl_); + const bool is_overlay_candidate = created_mappable_si || using_swap_chain_; + scoped_refptr<DrawingBuffer::ColorBuffer> color_buffer = + base::MakeRefCounted<ColorBuffer>( + weak_factory_.GetWeakPtr(), size, color_space_, color_buffer_format_, + back_buffer_alpha_type, texture_target, is_overlay_candidate, + std::move(back_buffer_shared_image), std::move(si_texture)); + color_buffer->BeginAccess(gpu::SyncToken(), /*readonly=*/false); + gl_->BindTexture(texture_target, color_buffer->texture_id()); // Clear the alpha channel if RGB emulation is required. if (DefaultBufferRequiresAlphaChannelToBePreserved()) { @@ -2221,7 +2237,7 @@ gl_->GenFramebuffers(1, &fbo); gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo); gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - texture_target, texture_id, 0); + texture_target, color_buffer->texture_id(), 0); gl_->ClearColor(0, 0, 0, 1); gl_->ColorMask(false, false, false, true); gl_->Disable(GL_SCISSOR_TEST); @@ -2230,12 +2246,8 @@ texture_target, 0, 0); gl_->DeleteFramebuffers(1, &fbo); } - const bool is_overlay_candidate = created_mappable_si || using_swap_chain_; - return base::MakeRefCounted<ColorBuffer>( - weak_factory_.GetWeakPtr(), size, color_space_, color_buffer_format_, - back_buffer_alpha_type, texture_target, texture_id, is_overlay_candidate, - std::move(back_buffer_shared_image)); + return color_buffer; } void DrawingBuffer::AttachColorBufferToReadFramebuffer() { @@ -2252,7 +2264,7 @@ id = staging_texture_; texture_target = GL_TEXTURE_2D; } else { - id = back_color_buffer_->texture_id; + id = back_color_buffer_->texture_id(); texture_target = back_color_buffer_->texture_target; }
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h index 35f26cc..5717bff 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h
@@ -425,12 +425,17 @@ viz::SharedImageFormat, SkAlphaType alpha_type, GLenum texture_target, - GLuint texture_id, bool is_overlay_candidate, - scoped_refptr<gpu::ClientSharedImage> shared_image); + scoped_refptr<gpu::ClientSharedImage> shared_image, + std::unique_ptr<gpu::SharedImageTexture> shared_image_texture); ColorBuffer(const ColorBuffer&) = delete; ColorBuffer& operator=(const ColorBuffer&) = delete; + GLuint texture_id() { return scoped_shared_image_access_->texture_id(); } + void BeginAccess(const gpu::SyncToken& sync_token, bool readonly); + gpu::SyncToken EndAccess(); + void ForceCleanUp(); + // The thread on which the ColorBuffer is created and the DrawingBuffer is // bound to. const base::PlatformThreadRef owning_thread_ref; @@ -444,7 +449,6 @@ const viz::SharedImageFormat format; const SkAlphaType alpha_type; GLenum texture_target; - const GLuint texture_id; const bool is_overlay_candidate; // The shared image used to send this buffer to the compositor. @@ -460,6 +464,10 @@ private: friend class ThreadSafeRefCounted<ColorBuffer>; ~ColorBuffer(); + + std::unique_ptr<gpu::SharedImageTexture> shared_image_texture_; + std::unique_ptr<gpu::SharedImageTexture::ScopedAccess> + scoped_shared_image_access_; }; using CopyFunctionRef = base::FunctionRef<std::optional<gpu::SyncToken>( @@ -712,6 +720,7 @@ // Mailboxes that were released by the compositor can be used again by this // DrawingBuffer. Deque<scoped_refptr<ColorBuffer>> recycled_color_buffer_queue_; + base::flat_set<scoped_refptr<ColorBuffer>> exported_color_buffers_; // In the case of OffscreenCanvas, we do not want to enable the // WebGLImageChromium flag, so we replace all the
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 5f3ebbb..cee8ca8 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1287,11 +1287,6 @@ // No status as this will be controlled by the matching Chromium feature. }, { - // https://html.spec.whatwg.org/#dom-customelementregistry-getname - name: "CustomElementsGetName", - status: "stable", - }, - { name: "Database", public: true, status: "experimental", @@ -1985,7 +1980,8 @@ // experiment that enters trials after it got created; this makes it easy // to polyfill by only checking older things, and makes it serve its // purpose of modularly advertising new things. - implied_by: ["FledgePermitCrossOriginTrustedSignals", + implied_by: ["FledgeAuctionDealSupport", + "FledgePermitCrossOriginTrustedSignals", "FledgeRealTimeReporting"], base_feature: "none", }, @@ -1993,7 +1989,8 @@ name: "FledgeFeatureDetection", // FledgeFeatureDetection should be on if any of the features it aims // to help detect is on. - implied_by: ["FledgeCustomMaxAuctionAdComponents", + implied_by: ["FledgeAuctionDealSupport", + "FledgeCustomMaxAuctionAdComponents", "FledgeDeprecatedRenderURLReplacements", "FledgePermitCrossOriginTrustedSignals", "FledgeRealTimeReporting", @@ -3590,13 +3587,6 @@ name: "RTCRtpEncodingParametersCodec", status: "stable", }, - // Enables the use of |RTCRtpTransceiver::getHeaderExtensionsToNegotiate|, - // |RTCRtpTransceiver::setHeaderExtensionsToNegotiate|, and - // |RTCRtpTransceiver::getNegotiatedHeaderExtensions|. - { - name: "RTCRtpHeaderExtensionControl", - status: "stable", - }, { name: "RTCRtpScriptTransform", status: "experimental",
diff --git a/third_party/blink/tools/blinkpy/common/system/executive.py b/third_party/blink/tools/blinkpy/common/system/executive.py index 849f4b4..7182d65 100644 --- a/third_party/blink/tools/blinkpy/common/system/executive.py +++ b/third_party/blink/tools/blinkpy/common/system/executive.py
@@ -276,6 +276,13 @@ # It's impossible for callers to avoid race conditions with process shutdown. pass + def terminate(self, pid): + try: + os.kill(pid, signal.SIGTERM) + except OSError: + # Silently ignore when the pid doesn't exist. + pass + # Error handlers do not need to be static methods once all callers are # updated to use an Executive object.
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/base.py b/third_party/blink/tools/blinkpy/web_tests/port/base.py index c49bb65..3af151c 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/base.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/base.py
@@ -1965,6 +1965,9 @@ if DISABLE_THREADED_ANIMATION_FLAG in args: args.remove(DISABLE_THREADED_ANIMATION_FLAG) + # Always support running web tests using SwiftShader for compositing or WebGL + args.append('--enable-unsafe-swiftshader') + startup_trace_file = self.startup_trace_file_for_test(test_name) if startup_trace_file is not None: tracing_categories = self.get_option('enable_tracing')
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py b/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py index da905a2..240b986d 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py
@@ -1854,39 +1854,42 @@ def test_args_for_test(self): port = self.make_port(with_tests=True) - self.assertEqual( - ['--disable-threaded-compositing', '--disable-threaded-animation'], - port.args_for_test('non/virtual')) - self.assertEqual( - ['--disable-threaded-compositing', '--disable-threaded-animation'], - port.args_for_test('passes/text.html')) - self.assertEqual( - ['--disable-threaded-compositing', '--disable-threaded-animation'], - port.args_for_test('virtual/non-existing/test.html')) + self.assertEqual([ + '--disable-threaded-compositing', '--disable-threaded-animation', + '--enable-unsafe-swiftshader' + ], port.args_for_test('non/virtual')) + self.assertEqual([ + '--disable-threaded-compositing', '--disable-threaded-animation', + '--enable-unsafe-swiftshader' + ], port.args_for_test('passes/text.html')) + self.assertEqual([ + '--disable-threaded-compositing', '--disable-threaded-animation', + '--enable-unsafe-swiftshader' + ], port.args_for_test('virtual/non-existing/test.html')) self.assertEqual([ '--virtual-arg', '--disable-threaded-compositing', - '--disable-threaded-animation' + '--disable-threaded-animation', '--enable-unsafe-swiftshader' ], port.args_for_test('virtual/virtual_passes/passes/text.html')) self.assertEqual([ '--virtual-arg', '--disable-threaded-compositing', - '--disable-threaded-animation' + '--disable-threaded-animation', '--enable-unsafe-swiftshader' ], port.args_for_test('virtual/virtual_passes/passes/any.html')) self.assertEqual([ '--virtual-arg', '--disable-threaded-compositing', - '--disable-threaded-animation' + '--disable-threaded-animation', '--enable-unsafe-swiftshader' ], port.args_for_test('virtual/virtual_passes/passes/')) self.assertEqual([ '--virtual-arg', '--disable-threaded-compositing', - '--disable-threaded-animation' + '--disable-threaded-animation', '--enable-unsafe-swiftshader' ], port.args_for_test('virtual/virtual_passes/passes')) self.assertEqual([ '--virtual-arg', '--disable-threaded-compositing', - '--disable-threaded-animation' + '--disable-threaded-animation', '--enable-unsafe-swiftshader' ], port.args_for_test('virtual/virtual_passes/')) self.assertEqual([ '--virtual-arg', '--disable-threaded-compositing', - '--disable-threaded-animation' + '--disable-threaded-animation', '--enable-unsafe-swiftshader' ], port.args_for_test('virtual/virtual_passes')) def test_missing_virtual_test_suite_file(self): @@ -2222,6 +2225,7 @@ self.assertEqual([ '--disable-threaded-compositing', '--disable-threaded-animation', + '--enable-unsafe-swiftshader', '--trace-startup=*,-blink', '--trace-startup-duration=0', '--trace-startup-file=trace_layout_test_non_virtual_TIME.pftrace',
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/driver.py b/third_party/blink/tools/blinkpy/web_tests/port/driver.py index 6492528..cdcf102e 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/driver.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/driver.py
@@ -379,7 +379,8 @@ # In the timeout case, we kill the hung process as well. # Add a delay to allow process to finish post-run hooks, such as dumping code coverage data. out, err = self._server_process.stop( - self._port.get_option('driver_kill_timeout_secs')) + timeout_secs=self._port.get_option('driver_kill_timeout_secs'), + send_sigterm=self._port.get_option('kill_driver_with_sigterm')) if out: text += out if err: @@ -422,7 +423,8 @@ # means that the server process is restarted after every test # anyway, so this just accelerates the inevitable. out, err = self._server_process.stop( - self._port.get_option('driver_kill_timeout_secs')) + timeout_secs=self._port.get_option('driver_kill_timeout_secs'), + send_sigterm=self._port.get_option('kill_driver_with_sigterm')) if out: text += out if err: @@ -585,12 +587,17 @@ return self._server_process.pid() def stop(self, timeout_secs=None): - if timeout_secs is None: - # Add a delay to allow process to finish post-run hooks, such as dumping code coverage data. - timeout_secs = self._port.get_option('driver_kill_timeout_secs') + # Add a delay to allow process to finish post-run hooks, such as dumping + # code coverage data; but allow for 0 timeout if explicitly requested. + if timeout_secs != 0: + timeout_secs = max( + timeout_secs or 0, + self._port.get_option('driver_kill_timeout_secs', 0)) if self._server_process: - self._server_process.stop(timeout_secs) + self._server_process.stop( + timeout_secs=timeout_secs, + send_sigterm=self._port.get_option('kill_driver_with_sigterm')) self._server_process = None if self._profiler: self._profiler.profile_after_exit()
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py b/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py index c17184a..fc81dc2 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py
@@ -227,7 +227,10 @@ def has_crashed(self): return self.crashed - def stop(self, timeout=0.0): + def stop(self, + timeout_secs=0.0, + kill_tree=True, + send_sigterm=False): pass def assert_crash(driver,
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/factory.py b/third_party/blink/tools/blinkpy/web_tests/port/factory.py index a5ce550..8adb196 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/factory.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/factory.py
@@ -666,6 +666,13 @@ 'Default is 1 second, can be overriden for specific use cases.' )) testing_group.add_argument( + '--kill-driver-with-sigterm', + action='store_true', + help=( + 'Send SIGTERM to the driver process; useful in conjunction ' + 'with "--wrapper", for wrapper executables (such as rr) that ' + 'require SIGTERM to finish cleanly.')) + testing_group.add_argument( '--ignore-testharness-expected-txt', action='store_true', help=('Ignore *-expected.txt for all testharness tests. All '
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py b/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py index 3fff471c..2ea08fb 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py
@@ -378,9 +378,9 @@ self._set_proc(proc) - def stop(self, timeout_secs=0.0, kill_tree=False): - result = super(FuchsiaServerProcess, self).stop( - timeout_secs, kill_tree) + def stop(self, timeout_secs=0.0, kill_tree=False, send_sigterm=False): + result = super(FuchsiaServerProcess, + self).stop(timeout_secs, kill_tree, send_sigterm) if self._symbolizer_proc: self._symbolizer_proc.kill() return result
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/server_process.py b/third_party/blink/tools/blinkpy/web_tests/port/server_process.py index 6eec48a..4dcd469 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/server_process.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/server_process.py
@@ -399,7 +399,7 @@ if not self._proc: self._start() - def stop(self, timeout_secs=0.0, kill_tree=True): + def stop(self, timeout_secs=0.0, kill_tree=True, send_sigterm=False): if not self._proc: return (None, None) @@ -415,6 +415,8 @@ except BrokenPipeError: pass self._proc.stdin = None + if send_sigterm: + self._host.executive.terminate(self._proc.pid) killed = False if timeout_secs: deadline = now + timeout_secs
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/server_process_mock.py b/third_party/blink/tools/blinkpy/web_tests/port/server_process_mock.py index cafc7d0..33c42964c 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/server_process_mock.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/server_process_mock.py
@@ -83,7 +83,7 @@ def start(self): self.started = True - def stop(self, timeout_sec=0.0): + def stop(self, timeout_secs=0.0, kill_tree=True, send_sigterm=False): self.stopped = True return
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/test.py b/third_party/blink/tools/blinkpy/web_tests/port/test.py index aa60428..0cda8b9 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/test.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/test.py
@@ -1030,5 +1030,5 @@ leak=test.leak, leak_log=leak_log) - def stop(self, timeout_secs=0.0): + def stop(self, timeout_secs=0.0, kill_tree=True, send_sigterm=False): self.started = False
diff --git a/third_party/blink/web_tests/NeverFixTests b/third_party/blink/web_tests/NeverFixTests index 4c1fd52..1b80fb0 100644 --- a/third_party/blink/web_tests/NeverFixTests +++ b/third_party/blink/web_tests/NeverFixTests
@@ -1684,9 +1684,6 @@ # explicitly be marked Pass in order to bypass the expected Skip of the default # version. crbug.com/1393294 printing/webgl-oversized-printing.html [ Skip ] -# SwiftShader for WebGL is not available for ARM Macs -crbug.com/1378476 [ Mac11-arm64 ] virtual/webgl-oversized-printing/printing/webgl-oversized-printing.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] virtual/webgl-oversized-printing/printing/webgl-oversized-printing.html [ Skip ] # The test causes a 1 GB allocation in the GPU process on Windows # which often fails, so skip it on this configuration. # Use the same reason as the Mac suppressions to avoid an incorrect presubmit check. @@ -1742,260 +1739,6 @@ external/wpt/worklets/animation-worklet-referrer.https.html [ Skip ] external/wpt/worklets/animation-worklet-service-worker-interception.https.html [ Skip ] -# SwiftShader for WebGL is not available for ARM on MacOS and Windows -crbug.com/1378476 [ Win11-arm64 ] compositing/backface-visibility/backface-visibility-webgl.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] compositing/backface-visibility/backface-visibility-webgl.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] compositing/backface-visibility/backface-visibility-webgl.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] compositing/backface-visibility/backface-visibility-webgl.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] compositing/draws-content/webgl-background-layer.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] compositing/draws-content/webgl-background-layer.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] compositing/draws-content/webgl-background-layer.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] compositing/draws-content/webgl-background-layer.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] compositing/draws-content/webgl-simple-background.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] compositing/draws-content/webgl-simple-background.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] compositing/draws-content/webgl-simple-background.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] compositing/draws-content/webgl-simple-background.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] compositing/visibility/visibility-simple-webgl-layer.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] compositing/visibility/visibility-simple-webgl-layer.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] compositing/visibility/visibility-simple-webgl-layer.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] compositing/visibility/visibility-simple-webgl-layer.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] compositing/webgl/* [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] compositing/webgl/* [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] compositing/webgl/* [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] compositing/webgl/* [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.w.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.w.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.w.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.w.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.w.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.w.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.w.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.w.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/paint-timing/with-first-paint/first-contentful-canvas-webgl2.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/paint-timing/with-first-paint/first-contentful-canvas-webgl2.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/paint-timing/with-first-paint/first-contentful-canvas-webgl2.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/paint-timing/with-first-paint/first-contentful-canvas-webgl2.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/video-rvfc/request-video-frame-callback-before-xr-session.https.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/video-rvfc/request-video-frame-callback-before-xr-session.https.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/video-rvfc/request-video-frame-callback-before-xr-session.https.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/video-rvfc/request-video-frame-callback-before-xr-session.https.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/video-rvfc/request-video-frame-callback-during-xr-session.https.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/video-rvfc/request-video-frame-callback-during-xr-session.https.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/video-rvfc/request-video-frame-callback-during-xr-session.https.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/video-rvfc/request-video-frame-callback-during-xr-session.https.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/webcodecs/videoFrame-texImage.any.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/webcodecs/videoFrame-texImage.any.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/webcodecs/videoFrame-texImage.any.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/webcodecs/videoFrame-texImage.any.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/webcodecs/videoFrame-texImage.any.worker.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/webcodecs/videoFrame-texImage.any.worker.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/webcodecs/videoFrame-texImage.any.worker.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/webcodecs/videoFrame-texImage.any.worker.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] external/wpt/webxr/* [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] external/wpt/webxr/* [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] external/wpt/webxr/* [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] external/wpt/webxr/* [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/arraybuffer/webgl2_size_check.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/arraybuffer/webgl2_size_check.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/arraybuffer/webgl2_size_check.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/arraybuffer/webgl2_size_check.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas-api/OffscreenCanvas-getContext-in-worker.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas-api/OffscreenCanvas-getContext-in-worker.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas-api/OffscreenCanvas-getContext-in-worker.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas-api/OffscreenCanvas-getContext-in-worker.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas-api/OffscreenCanvas-getContext.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas-api/OffscreenCanvas-getContext.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas-api/OffscreenCanvas-getContext.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas-api/OffscreenCanvas-getContext.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas-api/offscreencanvas.transferrable-webgl-exception.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas-api/offscreencanvas.transferrable-webgl-exception.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas-api/offscreencanvas.transferrable-webgl-exception.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas-api/offscreencanvas.transferrable-webgl-exception.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas/bug1280361.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas/bug1280361.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas/bug1280361.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas/bug1280361.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas/bug1283434.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas/bug1283434.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas/bug1283434.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas/bug1283434.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas/canvas-createImageBitmap-webgl.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas/canvas-createImageBitmap-webgl.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas/canvas-createImageBitmap-webgl.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas/canvas-createImageBitmap-webgl.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas/color-space/canvas-webgl-imagetex.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas/color-space/canvas-webgl-imagetex.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas/color-space/canvas-webgl-imagetex.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas/color-space/canvas-webgl-imagetex.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas/OffscreenCanvas-2d-drawImage.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas/OffscreenCanvas-2d-drawImage.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas/OffscreenCanvas-2d-drawImage.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas/OffscreenCanvas-2d-drawImage.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas/rendering-contexts-back-references.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas/rendering-contexts-back-references.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas/rendering-contexts-back-references.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas/rendering-contexts-back-references.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/canvas/webgl/* [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/canvas/webgl/* [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/canvas/webgl/* [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/canvas/webgl/* [ Skip ] -crbug.com/1295317 [ Win11-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html [ Skip ] -crbug.com/1295317 [ Mac13-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html [ Skip ] -crbug.com/1295317 [ Mac12-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html [ Skip ] -crbug.com/1295317 [ Mac11-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-imagebitmaprenderingcontext.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-imagebitmaprenderingcontext.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-imagebitmaprenderingcontext.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-imagebitmaprenderingcontext.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/* [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/* [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/* [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/* [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] http/tests/canvas/webgl/origin-clean-conformance.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] http/tests/canvas/webgl/origin-clean-conformance.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] http/tests/canvas/webgl/origin-clean-conformance.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] http/tests/canvas/webgl/origin-clean-conformance.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] inspector-protocol/timeline/gpu-tasks.js [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] inspector-protocol/timeline/gpu-tasks.js [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] inspector-protocol/timeline/gpu-tasks.js [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] inspector-protocol/timeline/gpu-tasks.js [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] http/tests/security/cross-origin-OffscreenCanvasWebGL-texImage2D.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] http/tests/security/cross-origin-OffscreenCanvasWebGL-texImage2D.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] http/tests/security/cross-origin-OffscreenCanvasWebGL-texImage2D.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] http/tests/security/cross-origin-OffscreenCanvasWebGL-texImage2D.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] http/tests/security/webgl-remote-read-remote-image-allowed.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] http/tests/security/webgl-remote-read-remote-image-allowed.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] http/tests/security/webgl-remote-read-remote-image-allowed.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] http/tests/security/webgl-remote-read-remote-image-allowed.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] images/color-profile-munsell-adobe-to-srgb-webgl.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] images/color-profile-munsell-adobe-to-srgb-webgl.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] images/color-profile-munsell-adobe-to-srgb-webgl.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] images/color-profile-munsell-adobe-to-srgb-webgl.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] images/webgl-teximage2d.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] images/webgl-teximage2d.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] images/webgl-teximage2d.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] images/webgl-teximage2d.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] inspector-protocol/debugger/domdebugger-webgl-breakpoint.js [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] inspector-protocol/debugger/domdebugger-webgl-breakpoint.js [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] inspector-protocol/debugger/domdebugger-webgl-breakpoint.js [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] inspector-protocol/debugger/domdebugger-webgl-breakpoint.js [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] printing/webgl-repeated-printing-preservedrawingbuffer.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] printing/webgl-repeated-printing-preservedrawingbuffer.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] printing/webgl-repeated-printing-preservedrawingbuffer.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] printing/webgl-repeated-printing-preservedrawingbuffer.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] printing/webgl-repeated-printing.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] printing/webgl-repeated-printing.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] printing/webgl-repeated-printing.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] printing/webgl-repeated-printing.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] wpt_internal/webxr/* [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] wpt_internal/webxr/* [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] wpt_internal/webxr/* [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] wpt_internal/webxr/* [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] compositing/webgl/webgl-with-accelerated-background-color.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] compositing/webgl/webgl-with-accelerated-background-color.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] compositing/webgl/webgl-with-accelerated-background-color.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] compositing/webgl/webgl-with-accelerated-background-color.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/canvas-to-data-url.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/canvas-to-data-url.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/canvas-to-data-url.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/canvas-to-data-url.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/context-destroyed-crash.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/context-destroyed-crash.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/context-destroyed-crash.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/context-destroyed-crash.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/offscreenCanvas-context-lost-restored-worker.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/offscreenCanvas-context-lost-restored-worker.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/offscreenCanvas-context-lost-restored-worker.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/offscreenCanvas-context-lost-restored-worker.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/offscreenCanvas-context-lost-worker.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/offscreenCanvas-context-lost-worker.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/offscreenCanvas-context-lost-worker.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/offscreenCanvas-context-lost-worker.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/offscreenCanvas-transferToImageBitmap-invalid-mailbox.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/offscreenCanvas-transferToImageBitmap-invalid-mailbox.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/offscreenCanvas-transferToImageBitmap-invalid-mailbox.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/offscreenCanvas-transferToImageBitmap-invalid-mailbox.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/texImage-imageBitmap-from-blob-resize.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/texImage-imageBitmap-from-blob-resize.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/texImage-imageBitmap-from-blob-resize.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/texImage-imageBitmap-from-blob-resize.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/texImage-imageBitmap-from-canvas-resize.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/texImage-imageBitmap-from-canvas-resize.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/texImage-imageBitmap-from-canvas-resize.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/texImage-imageBitmap-from-canvas-resize.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/texImage-imageBitmap-from-image-resize.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/texImage-imageBitmap-from-image-resize.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/texImage-imageBitmap-from-image-resize.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/texImage-imageBitmap-from-image-resize.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/texImage-imageBitmap-from-image.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/texImage-imageBitmap-from-image.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/texImage-imageBitmap-from-image.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/texImage-imageBitmap-from-image.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/texImage-imageBitmap-from-offscreen-canvas-resize.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/texImage-imageBitmap-from-offscreen-canvas-resize.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/texImage-imageBitmap-from-offscreen-canvas-resize.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/texImage-imageBitmap-from-offscreen-canvas-resize.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/texImage-imageBitmap-from-video-resize.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/texImage-imageBitmap-from-video-resize.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/texImage-imageBitmap-from-video-resize.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/texImage-imageBitmap-from-video-resize.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/webgl-composite-modes-repaint.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/webgl-composite-modes-repaint.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/webgl-composite-modes-repaint.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/webgl-composite-modes-repaint.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/webgl-composite-modes-tabswitching.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/webgl-composite-modes-tabswitching.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/webgl-composite-modes-tabswitching.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/webgl-composite-modes-tabswitching.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/webgl-texture-binding-preserved.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/webgl-texture-binding-preserved.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/webgl-texture-binding-preserved.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/webgl-texture-binding-preserved.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] fast/webgl/webgl-viewport-parameters-preserved.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] fast/webgl/webgl-viewport-parameters-preserved.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] fast/webgl/webgl-viewport-parameters-preserved.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] fast/webgl/webgl-viewport-parameters-preserved.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-main.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-main.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-main.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-main.html [ Skip ] -crbug.com/1378476 [ Mac11-arm64 ] virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html [ Skip ] -crbug.com/1378476 [ Mac12-arm64 ] virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html [ Skip ] -crbug.com/1378476 [ Win11-arm64 ] virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html [ Skip ] -crbug.com/1378476 [ Mac13-arm64 ] virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html [ Skip ] - # Chrome for Testing specific tests that only run on Linux due to requiring FlagSpecific overrides. crbug.com/1446931 [ Android ] inspector-protocol/heap-profiler/heap-snapshot-exposes-cpp-internals.js [ Skip ] crbug.com/1446931 [ Fuchsia ] inspector-protocol/heap-profiler/heap-snapshot-exposes-cpp-internals.js [ Skip ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 8e5a695..8b389f7 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -5025,6 +5025,8 @@ # Sheriff 2021-06-25 # Flaky on Webkit Linux Leak crbug.com/1223601 [ Linux ] fast/scrolling/autoscroll-latch-clicked-node-if-parent-unscrollable.html [ Failure Pass ] +crbug.com/1223601 [ Linux ] fast/scrolling/reset-scroll-in-onscroll.html [ Failure Pass ] + # Sheriff 2021-07-12 crbug.com/1228432 [ Linux ] external/wpt/video-rvfc/request-video-frame-callback-before-xr-session.https.html [ Pass Timeout ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index 19a3fef..1303bb2 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -460,6 +460,7 @@ }, { "prefix": "fractional-scroll-offsets", + "owners": ["bokan@chromium.org", "skobes@chromium.org"], "platforms": ["Linux", "Mac", "Win"], "bases": ["external/wpt/css/css-position/sticky/", "external/wpt/css/css-viewport/zoom/scroll-top-test-with-zoom.html", @@ -1477,6 +1478,7 @@ }, { "prefix": "parakeet", + "owners": ["brandm@microsoft.com"], "platforms": ["Linux", "Mac", "Win"], "bases": ["external/wpt/parakeet"], "args": ["--enable-features=InterestGroupStorage,AdInterestGroupAPI,Parakeet"], @@ -1507,7 +1509,7 @@ "--enable-features=InterestGroupStorage,PrivacySandboxAdsAPIsOverride,FencedFrames:implementation_type/mparch,FledgeConsiderKAnonymity", "--disable-features=CookieDeprecationFacilitatedTesting,FledgeEnforceKAnonymity" ], - "expires": "Sep 1, 2024" + "expires": "Mar 1, 2025" }, "This virtual suite disables CookieDeprecationFacilitatedTesting while", "enabling fledge flags, to test fledge features that are disabled when", @@ -1527,7 +1529,7 @@ "--enable-features=InterestGroupStorage,PrivacySandboxAdsAPIsOverride,FencedFrames:implementation_type/mparch,FledgeConsiderKAnonymity", "--disable-features=CookieDeprecationFacilitatedTesting" ], - "expires": "Sep 1, 2024" + "expires": "Jan 1, 2025" }, { "prefix": "fledge-bidding-and-auction", @@ -1591,6 +1593,7 @@ }, { "prefix": "low-priority-script-loading", + "owners": ["chikamune@chromium.org"], "platforms": ["Linux", "Mac", "Win"], "bases": ["http/tests/devtools/network/resource-priority.js"], "args": ["--enable-features=LowPriorityScriptLoading"], @@ -1742,6 +1745,7 @@ }, { "prefix": "cors-non-wildcard-request-headers", + "owners": ["yoichio@chromium.org"], "platforms": ["Linux", "Mac", "Win"], "bases": ["external/wpt/fetch/api/cors/cors-preflight.any.js"], "args": ["--enable-features=CorsNonWildcardRequestHeadersSupport"], @@ -1822,6 +1826,7 @@ }, { "prefix": "threaded-preload-scanner", + "owners": ["cduvall@chromium.org"], "platforms": ["Linux", "Mac", "Win"], "bases": [ "external/wpt/html/semantics/scripting-1", @@ -1833,6 +1838,7 @@ }, { "prefix": "isolate-sandboxed-iframes", + "owners": ["wjmaclean@chromium.org", "creis@chromium.org", "alexmos@chromium.org"], "platforms": ["Linux", "Mac", "Win"], "bases": [ "external/wpt/html/infrastructure/urls/terminology-0/", @@ -2093,6 +2099,7 @@ }, { "prefix": "longtask-from-loaf", + "owners": ["nrosenthal@chromium.org"], "platforms": ["Linux"], "bases": ["external/wpt/longtask-timing"], "args": ["--enable-blink-features=LongTaskFromLongAnimationFrame"],
diff --git a/third_party/blink/web_tests/external/wpt/css/css-page/margin-boxes/paint-order-003-print-ref.html b/third_party/blink/web_tests/external/wpt/css/css-page/margin-boxes/paint-order-003-print-ref.html new file mode 100644 index 0000000..92bfe875 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-page/margin-boxes/paint-order-003-print-ref.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> +<style> + @page { + size: 500px; + margin: 0; + } + body { + margin: 0; + } +</style> +<div style="height:100px; background:green;"></div> +<div style="position:absolute; z-index:-1; left:0; bottom:0; width:100px; height:100px; background:cyan;"></div> +<div style="position:absolute; right:0; bottom:0; width:100px; height:100px; background:yellow;"></div> +<div style="display:flow-root; margin:0 50px; height:350px; background:#ddd;"> + <p>The margin area above this page should be green. No red.</p> + <p>The cyan square in the bottom left corner should be overlapped by the gray document background.</p> + <p>The yellow square in the bottom right corner should be on top of the gray document background.</p> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-page/margin-boxes/paint-order-003-print.html b/third_party/blink/web_tests/external/wpt/css/css-page/margin-boxes/paint-order-003-print.html new file mode 100644 index 0000000..0ce4618 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-page/margin-boxes/paint-order-003-print.html
@@ -0,0 +1,78 @@ +<!DOCTYPE html> +<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-page-3/#painting"> +<meta name="assert" content="Test margin boxes with z-index."> +<link rel="match" href="paint-order-003-print-ref.html"> +<style> + @page { + size: 500px; + margin: 50px; + margin-top: 100px; + @top-left-corner { + content: ""; + width: 100px; + height: 100px; + margin-right: -50px; + background: green; + z-index: -1; + } + @top-left { + content: ""; + border-left: 50px solid red; + border-right: 50px solid red; + width: 100px; + height: 100px; + background: green; + z-index: -2; + } + @top-center { + content: ""; + width: 100px; + height: 100px; + z-index: 1; + background: green; + } + @top-right { + content: ""; + border-left: 50px solid red; + border-right: 50px solid red; + width: 100px; + height: 100px; + background: green; + z-index: -2; + } + @top-right-corner { + content: ""; + width: 100px; + height: 100px; + margin-left: -50px; + background: green; + z-index: -1; + } + + @bottom-left-corner { + content: ""; + width: 100px; + height: 100px; + margin-top: -50px; + margin-right: -50px; + background: cyan; + z-index: -1; + } + @bottom-right-corner { + content: ""; + width: 100px; + height: 100px; + margin-top: -50px; + margin-left: -50px; + background: yellow; + } + } + body { + margin: 0; + background: #ddd; + } +</style> +<p>The margin area above this page should be green. No red.</p> +<p>The cyan square in the bottom left corner should be overlapped by the gray document background.</p> +<p>The yellow square in the bottom right corner should be on top of the gray document background.</p>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self-expected.txt b/third_party/blink/web_tests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self-expected.txt deleted file mode 100644 index f4861e70..0000000 --- a/third_party/blink/web_tests/external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-align-justify-self-expected.txt +++ /dev/null
@@ -1,15 +0,0 @@ -This is a testharness.js-based test. -[FAIL] <fieldset><legend align="left">x</legend></fieldset> - assert_equals: expected "left" but got "auto" -[FAIL] <fieldset><legend align="center">x</legend></fieldset> - assert_equals: expected "center" but got "auto" -[FAIL] <fieldset><legend align="right">x</legend></fieldset> - assert_equals: expected "right" but got "auto" -[FAIL] <fieldset><legend align="lEfT">x</legend></fieldset> - assert_equals: expected "left" but got "auto" -[FAIL] <fieldset><legend align="cEnTeR">x</legend></fieldset> - assert_equals: expected "center" but got "auto" -[FAIL] <fieldset><legend align="rIgHt">x</legend></fieldset> - assert_equals: expected "right" but got "auto" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/shadow-dom/reference-target/tentative/reference-target-basics.html b/third_party/blink/web_tests/external/wpt/shadow-dom/reference-target/tentative/reference-target-basics.html new file mode 100644 index 0000000..6718c5df --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/shadow-dom/reference-target/tentative/reference-target-basics.html
@@ -0,0 +1,72 @@ +<!DOCTYPE HTML> +<html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-vendor.js"></script> +</head> +<body> + +<div id="host1"> + <template shadowrootmode="open"></template> +</div> + +<div id="host2"> + <template shadowrootmode="open" shadowrootreferencetarget></template> +</div> + +<div id="host3"> + <template shadowrootmode="open" shadowrootreferencetarget="targetID"></template> +</div> + +<script> + +test(() => { + const shadow1 = document.querySelector("#host1").shadowRoot; + assert_equals(shadow1.referenceTarget, ""); + + const shadow2 = document.querySelector("#host2").shadowRoot; + assert_equals(shadow2.referenceTarget, ""); +}, "ShadowRoot.referenceTarget defaults to empty string when shadow is created declaratively"); + +test(() => { + const shadow1 = document.querySelector("#host3").shadowRoot; + assert_equals(shadow1.referenceTarget, "targetID"); +}, "<template> shadowrootreferencetarget sets referenceTarget on shadow root"); + +test(() => { + const host1 = document.createElement("div"); + const shadow1 = host1.attachShadow({"mode": "open"}); + assert_equals(shadow1.referenceTarget, ""); + + const host2 = document.createElement("div"); + const shadow2 = host2.attachShadow({"mode": "open", "referenceTarget": null}); + assert_equals(shadow2.referenceTarget, "null"); + + const host3 = document.createElement("div"); + const shadow3 = host3.attachShadow({"mode": "open", "referenceTarget": ""}); + assert_equals(shadow3.referenceTarget, ""); +}, "ShadowRoot.referenceTarget defaults to empty string when shadow is created imperatively"); + +test(() => { + const host1 = document.createElement("div"); + const shadow1 = host1.attachShadow({"mode": "open", "referenceTarget": "targetID"}); + assert_equals(shadow1.referenceTarget, "targetID"); + + const host2 = document.createElement("div"); + const shadow2 = host2.attachShadow({"mode": "open", "referenceTarget": 42}); + assert_equals(shadow2.referenceTarget, "42"); + + const host3 = document.createElement("div"); + const shadow3 = host3.attachShadow({"mode": "open", "referenceTarget": true}); + assert_equals(shadow3.referenceTarget, "true"); + + const host4 = document.createElement("div"); + const shadow4 = host4.attachShadow({"mode": "open", "referenceTarget": {"foo": "bar"}}); + assert_equals(shadow4.referenceTarget, "[object Object]"); +}, "ShadowRootInitDict can be used to set referenceTarget on shadow root"); + +</script> +</body> +</html>
diff --git a/third_party/blink/web_tests/fast/borders/fieldsetBorderRadius-expected.png b/third_party/blink/web_tests/fast/borders/fieldsetBorderRadius-expected.png index 2c002a8..18a31f7 100644 --- a/third_party/blink/web_tests/fast/borders/fieldsetBorderRadius-expected.png +++ b/third_party/blink/web_tests/fast/borders/fieldsetBorderRadius-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/fast/scrolling/reset-scroll-in-onscroll.html b/third_party/blink/web_tests/fast/scrolling/reset-scroll-in-onscroll.html index 2b1cd61..4cf6a5f9 100644 --- a/third_party/blink/web_tests/fast/scrolling/reset-scroll-in-onscroll.html +++ b/third_party/blink/web_tests/fast/scrolling/reset-scroll-in-onscroll.html
@@ -1,5 +1,5 @@ <!DOCTYPE html> -<html class="reftest-wait"> +<html> <link rel="match" href="reset-scroll-in-onscroll-expected.html"> <script src='../../resources/gesture-util.js'></script> <head> @@ -28,15 +28,16 @@ </style> <script> window.onload = async () => { - await waitForCompositorReady(); + if (window.testRunner) + window.testRunner.waitUntilDone(); + + await waitForCompositorCommit(); const scroller = document.getElementById('scroller'); scroller.addEventListener('scroll', () => { - const scrollendPromise = waitForScrollendEvent(scroller); scroller.scrollTop = 0; - scrollendPromise.then(() => { - document.documentElement.classList.remove('reftest-wait'); - }); + if (window.testRunner) + window.testRunner.notifyDone(); }); // Scroll the scroller an arbitrary amount. The scroll should be reset
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/fieldset/fieldset-align-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/fieldset/fieldset-align-expected.png index 9ad69a18..9df8858d 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/fieldset/fieldset-align-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/fast/forms/fieldset/fieldset-align-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/flag-specific/highdpi/paint/masks/fieldset-mask-expected.png b/third_party/blink/web_tests/flag-specific/highdpi/paint/masks/fieldset-mask-expected.png index 387a1f7..90b8117 100644 --- a/third_party/blink/web_tests/flag-specific/highdpi/paint/masks/fieldset-mask-expected.png +++ b/third_party/blink/web_tests/flag-specific/highdpi/paint/masks/fieldset-mask-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/paint/masks/fieldset-mask-expected.png b/third_party/blink/web_tests/paint/masks/fieldset-mask-expected.png index 8315143..8b5f70d 100644 --- a/third_party/blink/web_tests/paint/masks/fieldset-mask-expected.png +++ b/third_party/blink/web_tests/paint/masks/fieldset-mask-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/css/fieldset-display-row-expected.png b/third_party/blink/web_tests/platform/linux/fast/css/fieldset-display-row-expected.png index 818e326..7a86b8d 100644 --- a/third_party/blink/web_tests/platform/linux/fast/css/fieldset-display-row-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/css/fieldset-display-row-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/007-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/007-expected.png index 81b185f4..20ab1ed 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/007-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/007-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-align-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-align-expected.png index a0579c4..398a2ed 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-align-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-align-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png index a7ef99c..ea460f0 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-with-float-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-with-float-expected.png index 7009730..b6fd3a93 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-with-float-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/fieldset-with-float-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/float-before-fieldset-expected.png b/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/float-before-fieldset-expected.png index b09d095..af6bf35 100644 --- a/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/float-before-fieldset-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/forms/fieldset/float-before-fieldset-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/writing-mode/fieldsets-expected.png b/third_party/blink/web_tests/platform/linux/fast/writing-mode/fieldsets-expected.png index d367918..08d772a 100644 --- a/third_party/blink/web_tests/platform/linux/fast/writing-mode/fieldsets-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/writing-mode/fieldsets-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/custom/inline-svg-in-xhtml-expected.png b/third_party/blink/web_tests/platform/linux/svg/custom/inline-svg-in-xhtml-expected.png index 336bc1a7..979a570 100644 --- a/third_party/blink/web_tests/platform/linux/svg/custom/inline-svg-in-xhtml-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/custom/inline-svg-in-xhtml-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png b/third_party/blink/web_tests/platform/linux/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png index 5f058af..e9c62bd 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/block/basic/fieldset-stretch-to-legend-expected.png b/third_party/blink/web_tests/platform/mac/fast/block/basic/fieldset-stretch-to-legend-expected.png index f0081ff..dfe0c92 100644 --- a/third_party/blink/web_tests/platform/mac/fast/block/basic/fieldset-stretch-to-legend-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/block/basic/fieldset-stretch-to-legend-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/css/fieldset-display-row-expected.png b/third_party/blink/web_tests/platform/mac/fast/css/fieldset-display-row-expected.png index 3565133..6bdd503f 100644 --- a/third_party/blink/web_tests/platform/mac/fast/css/fieldset-display-row-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/css/fieldset-display-row-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/007-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/007-expected.png index 52359f8..bd93ed2 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/007-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/007-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-align-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-align-expected.png index 92d5139..5c37af6 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-align-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-align-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png index 6606ff5..963c4f8 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-with-float-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-with-float-expected.png index 295c6a3..5a781c0 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-with-float-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/fieldset-with-float-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/float-before-fieldset-expected.png b/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/float-before-fieldset-expected.png index a694544..392fc29 100644 --- a/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/float-before-fieldset-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/forms/fieldset/float-before-fieldset-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/writing-mode/fieldsets-expected.png b/third_party/blink/web_tests/platform/mac/fast/writing-mode/fieldsets-expected.png index e814ed8..89df268 100644 --- a/third_party/blink/web_tests/platform/mac/fast/writing-mode/fieldsets-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/writing-mode/fieldsets-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.png b/third_party/blink/web_tests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.png index 7e58c5c..b3022837 100644 --- a/third_party/blink/web_tests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png b/third_party/blink/web_tests/platform/mac/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png index 1509538..586d48e 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/block/basic/fieldset-stretch-to-legend-expected.png b/third_party/blink/web_tests/platform/win/fast/block/basic/fieldset-stretch-to-legend-expected.png index 1432f3e..2344ed2e 100644 --- a/third_party/blink/web_tests/platform/win/fast/block/basic/fieldset-stretch-to-legend-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/block/basic/fieldset-stretch-to-legend-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/css/fieldset-display-row-expected.png b/third_party/blink/web_tests/platform/win/fast/css/fieldset-display-row-expected.png index 553bd8dc..dbd22b36 100644 --- a/third_party/blink/web_tests/platform/win/fast/css/fieldset-display-row-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/css/fieldset-display-row-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/007-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/007-expected.png index b6b54a30..dc3e1dded 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/007-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/007-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-align-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-align-expected.png index df35f01..c15ffa0 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-align-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-align-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png index b5f8bf1..42d17a5 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-legend-padding-unclipped-fieldset-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-with-float-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-with-float-expected.png index e434ed9..d0db2436 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-with-float-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/fieldset/fieldset-with-float-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/forms/fieldset/float-before-fieldset-expected.png b/third_party/blink/web_tests/platform/win/fast/forms/fieldset/float-before-fieldset-expected.png index a68d96a..bee4bc2 100644 --- a/third_party/blink/web_tests/platform/win/fast/forms/fieldset/float-before-fieldset-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/forms/fieldset/float-before-fieldset-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/writing-mode/fieldsets-expected.png b/third_party/blink/web_tests/platform/win/fast/writing-mode/fieldsets-expected.png index c154a0d..77067625 100644 --- a/third_party/blink/web_tests/platform/win/fast/writing-mode/fieldsets-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/writing-mode/fieldsets-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/custom/inline-svg-in-xhtml-expected.png b/third_party/blink/web_tests/platform/win/svg/custom/inline-svg-in-xhtml-expected.png index dce1d1a9..33cbc24 100644 --- a/third_party/blink/web_tests/platform/win/svg/custom/inline-svg-in-xhtml-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/custom/inline-svg-in-xhtml-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png b/third_party/blink/web_tests/platform/win/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png index a5309107..df4ecca 100644 --- a/third_party/blink/web_tests/platform/win/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/text-antialias/whitespace/normal-after-nowrap-breaking-expected.png Binary files differ
diff --git a/third_party/catapult b/third_party/catapult index 21462df..663fc20 160000 --- a/third_party/catapult +++ b/third_party/catapult
@@ -1 +1 @@ -Subproject commit 21462dff937ce89720e90a43b7dc58425c82535d +Subproject commit 663fc204a73a11aaeb16b736f157f3d6369c7a8b
diff --git a/third_party/chromite b/third_party/chromite index 4402634..63ab822 160000 --- a/third_party/chromite +++ b/third_party/chromite
@@ -1 +1 @@ -Subproject commit 440263466a043eec253592e5ba53d67dc68448fa +Subproject commit 63ab822153c82b58bcd90754c99695cf52570d04
diff --git a/third_party/crashpad/README.chromium b/third_party/crashpad/README.chromium index 01a8a9aa..4deaf64 100644 --- a/third_party/crashpad/README.chromium +++ b/third_party/crashpad/README.chromium
@@ -2,7 +2,7 @@ Short Name: crashpad URL: https://crashpad.chromium.org/ Version: N/A -Revision: f9fa2d112bef458ea765043f1ba3104ce013b1fe +Revision: 915913bd5a721b26fa5ee6321ab9b26777ae9202 License: Apache 2.0 License File: crashpad/LICENSE Security Critical: yes
diff --git a/third_party/crashpad/crashpad/handler/BUILD.gn b/third_party/crashpad/crashpad/handler/BUILD.gn index 0b4f1bc..104e8502 100644 --- a/third_party/crashpad/crashpad/handler/BUILD.gn +++ b/third_party/crashpad/crashpad/handler/BUILD.gn
@@ -223,10 +223,13 @@ # Chromium's sanitizer runtime libraries do not include an unwinder, # so add Chromium's standard dependencies to link against the in-tree # libunwind. The coverage wrapper similarly requires an unwinder, as - # well as a few other bits from libc++abi. + # well as a few other bits from libc++abi. There are some issues with pgo + # as well. + import("//build/config/compiler/pgo/pgo.gni") import("//build/config/coverage/coverage.gni") import("//build/config/sanitizers/sanitizers.gni") - no_default_deps = !use_clang_coverage && !using_sanitizer + no_default_deps = + !use_clang_coverage && !using_sanitizer && chrome_pgo_phase != 1 remove_configs = [ "//build/config/android:default_orderfile_instrumentation" ] }
diff --git a/third_party/crossbench b/third_party/crossbench index 1a18b08..8a7bae5 160000 --- a/third_party/crossbench +++ b/third_party/crossbench
@@ -1 +1 @@ -Subproject commit 1a18b08fa770e397437c44944955169370a111cb +Subproject commit 8a7bae5d9b97c561304527e3c192a11eb49453dc
diff --git a/third_party/devtools-frontend-internal b/third_party/devtools-frontend-internal index e86d9e7..eafa1f8 160000 --- a/third_party/devtools-frontend-internal +++ b/third_party/devtools-frontend-internal
@@ -1 +1 @@ -Subproject commit e86d9e749a81f3ea6c928d79ae6f2492b0c180f9 +Subproject commit eafa1f8d0782656b27401d12d223eac3e87ef834
diff --git a/third_party/devtools-frontend/src b/third_party/devtools-frontend/src index 4d982f5..b12a19e 160000 --- a/third_party/devtools-frontend/src +++ b/third_party/devtools-frontend/src
@@ -1 +1 @@ -Subproject commit 4d982f5fa22ed2bb960119d79f74b161d98645bc +Subproject commit b12a19e856d1c4696a5dd7f078b34a94a0296a82
diff --git a/third_party/lens_server_proto/README.chromium b/third_party/lens_server_proto/README.chromium index ee37ef86..db385d7 100644 --- a/third_party/lens_server_proto/README.chromium +++ b/third_party/lens_server_proto/README.chromium
@@ -1,8 +1,8 @@ Name: Lens Protos Short Name: lens_overlay_proto URL: This is the canonical public repository -Version: 666053677 -Date: 2024-08-21 +Version: 670638968 +Date: 2024-09-03 License: BSD License File: LICENSE Shipped: yes
diff --git a/third_party/lens_server_proto/lens_overlay_interaction_request_metadata.proto b/third_party/lens_server_proto/lens_overlay_interaction_request_metadata.proto index b91bfa8..280c67fd 100644 --- a/third_party/lens_server_proto/lens_overlay_interaction_request_metadata.proto +++ b/third_party/lens_server_proto/lens_overlay_interaction_request_metadata.proto
@@ -16,17 +16,26 @@ // Type of interaction request. enum Type { UNKNOWN = 0; + // User's tap on the screen. TAP = 1; + // User's region selection on the screenshot. REGION = 2; + // User's text selection on the screenshot. TEXT_SELECTION = 3; + // User selected a bounding box to region search. REGION_SEARCH = 4; + // Requests selection and fulfillment of a specific object. OBJECT_FULFILLMENT = 5; + + // User sent a query in the contextual search box. + CONTEXTUAL_SEARCH_QUERY = 9; } + Type type = 1; // Metadata related to the selection associated with this interaction request. @@ -35,9 +44,11 @@ float x = 1; float y = 2; } + message Region { CenterRotatedBox region = 1; } + message Object { string object_id = 1; Geometry geometry = 2; @@ -49,6 +60,7 @@ Object object = 3; } } + SelectionMetadata selection_metadata = 2; // Metadata related to query. @@ -58,6 +70,7 @@ reserved 1; } + QueryMetadata query_metadata = 4; reserved 3;
diff --git a/third_party/leveldatabase/src b/third_party/leveldatabase/src index eb31d19..23e35d7 160000 --- a/third_party/leveldatabase/src +++ b/third_party/leveldatabase/src
@@ -1 +1 @@ -Subproject commit eb31d19999fdf2018df4ae815a0fe130dd407532 +Subproject commit 23e35d792b9154f922b8b575b12596a4d8664c65
diff --git a/third_party/perfetto b/third_party/perfetto index 4acdcdf..f2aa5c0 160000 --- a/third_party/perfetto +++ b/third_party/perfetto
@@ -1 +1 @@ -Subproject commit 4acdcdfaa037f456d793ba8e08c44f1756069971 +Subproject commit f2aa5c0df5f4b73f14b024288da6f900955b118a
diff --git a/third_party/skia b/third_party/skia index 42cf8c1..5515c08 160000 --- a/third_party/skia +++ b/third_party/skia
@@ -1 +1 @@ -Subproject commit 42cf8c1ffc1fdf58a78971155e3e99ac7a1b5b20 +Subproject commit 5515c08c2e444dca4d18fa252ea5e629f27850aa
diff --git a/third_party/sqlite/src b/third_party/sqlite/src index 8368e7f..360e7d4 160000 --- a/third_party/sqlite/src +++ b/third_party/sqlite/src
@@ -1 +1 @@ -Subproject commit 8368e7f47150c9f226bc1948745243dacbbe5c18 +Subproject commit 360e7d4402ca7182adbb7a46e554779beb474f3b
diff --git a/third_party/swiftshader b/third_party/swiftshader index 3c4bdf6..5561c71 160000 --- a/third_party/swiftshader +++ b/third_party/swiftshader
@@ -1 +1 @@ -Subproject commit 3c4bdf66d81d01a215b88bfea3ac4cc8ca507779 +Subproject commit 5561c71fa64e5f7f726f74f23a8aac5cc308d18a
diff --git a/third_party/vulkan-deps b/third_party/vulkan-deps index aa237b6..5e29f5c 160000 --- a/third_party/vulkan-deps +++ b/third_party/vulkan-deps
@@ -1 +1 @@ -Subproject commit aa237b66d8cc42000940a7ea1f116b142a0f40e7 +Subproject commit 5e29f5c97fc482e48e04309b4460b0d9be3804f3
diff --git a/third_party/vulkan-validation-layers/src b/third_party/vulkan-validation-layers/src index f6381d6..a44622e 160000 --- a/third_party/vulkan-validation-layers/src +++ b/third_party/vulkan-validation-layers/src
@@ -1 +1 @@ -Subproject commit f6381d64213a21d351a1cf83034be78e07f76301 +Subproject commit a44622ed6e1dfaa2754a65eec35ef1b19ec3e782
diff --git a/third_party/webgpu-cts/src b/third_party/webgpu-cts/src index 9b30f7a..07d31bd 160000 --- a/third_party/webgpu-cts/src +++ b/third_party/webgpu-cts/src
@@ -1 +1 @@ -Subproject commit 9b30f7a02d172ce36d138c02614d0a5a1edbfa72 +Subproject commit 07d31bdbc0cdde5dc561d563d4898f6ed7dae38c
diff --git a/third_party/wpt_tools/README.chromium b/third_party/wpt_tools/README.chromium index 1300f57..d973c61 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: 980adbd1736ec466358831b34c0206cf668fe98c +Version: 8c85e2c44e2e4572d6e64327ef4f01b602af3d78 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/wpt/tools/webdriver/webdriver/transport.py b/third_party/wpt_tools/wpt/tools/webdriver/webdriver/transport.py index 31d4997..6b95393 100644 --- a/third_party/wpt_tools/wpt/tools/webdriver/webdriver/transport.py +++ b/third_party/wpt_tools/wpt/tools/webdriver/webdriver/transport.py
@@ -93,7 +93,7 @@ headers = ResponseHeaders(http_response.getheaders()) except ValueError: raise ValueError("Failed to decode response body as JSON:\n" + - http_response.read()) + repr(http_response.read())) return cls(http_response.status, body, headers)
diff --git a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executorchrome.py b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executorchrome.py index 026907b..b1f1e69 100644 --- a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executorchrome.py +++ b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executorchrome.py
@@ -231,7 +231,7 @@ def __init__(self, executor, browser, capabilities, **kwargs): self.implements = list(ChromeDriverProtocol.implements) - if browser.leak_check: + if getattr(browser, "leak_check", False): self.implements.append(ChromeDriverLeakProtocolPart) super().__init__(executor, browser, capabilities, **kwargs)
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 c1748f1f..fe1fed1 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
@@ -275,18 +275,15 @@ def test_window_loaded(self): """Wait until the page in the new window has been loaded. - Hereby ignore Javascript exceptions that are thrown when + Hereby ignore Javascript execptions that are thrown when the document has been unloaded due to a process change. """ while True: try: self.parent.base.execute_script(self.window_loaded_script, asynchronous=True) break - except errors.JavascriptException as e: - if e.message.startswith("Script evaluation aborted: Actor"): - # Special-case JavaScript errors for a JSWindowActor destroy - # until a decision is made on bug 1673478. - pass + except errors.JavascriptException: + pass class MarionettePrefsProtocolPart(PrefsProtocolPart):
diff --git a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executorservo.py b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executorservo.py index a0deac31..d8bb47b 100644 --- a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executorservo.py +++ b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/executorservo.py
@@ -71,9 +71,9 @@ # The cwd is the servo repo for `./mach test-wpt`, but on WPT runners # it is the WPT repo. The nightly tar is extracted inside the python # virtual environment within the repo. This means that on WPT runners, - # the cwd has the `_venv/servo` directory inside which we find the + # the cwd has the `_venv3/servo` directory inside which we find the # binary and the 'resources' directory. - for dir in [".", "./_venv/servo"]: + for dir in [".", "./_venv3/servo"]: candidate = os.path.abspath(os.path.join(dir, default_path)) if os.path.isfile(candidate): return candidate
diff --git a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/protocol.py b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/protocol.py index ff8e6a8d..eb97a805 100644 --- a/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/protocol.py +++ b/third_party/wpt_tools/wpt/tools/wptrunner/wptrunner/executors/protocol.py
@@ -70,6 +70,8 @@ msg = "Post-connection steps failed" self.after_connect() + for cls in self.implements: + getattr(self, cls.name).after_connect() except Exception: message = "Protocol.setup caught an exception:\n" message += f"{msg}\n" if msg is not None else "" @@ -114,6 +116,11 @@ """Run any setup steps required for the ProtocolPart.""" pass + def after_connect(self): + """Run any post-connection steps. This happens after the ProtocolParts are + initalized so can depend on a fully-populated object.""" + pass + def teardown(self): """Run any teardown steps required for the ProtocolPart.""" pass @@ -620,7 +627,7 @@ name = "leak" - def setup(self): + def after_connect(self): self.parent.base.load("about:blank") self.expected_counters = collections.Counter(self.get_counters())
diff --git a/tools/accessibility/inspect/ax_event_server.cc b/tools/accessibility/inspect/ax_event_server.cc index a7912a9e..43a7720 100644 --- a/tools/accessibility/inspect/ax_event_server.cc +++ b/tools/accessibility/inspect/ax_event_server.cc
@@ -15,9 +15,11 @@ AXEventServer::AXEventServer(base::ProcessId pid, const ui::AXTreeSelector& selector, const ui::AXInspectScenario& scenario) - : recorder_(content::AXInspectFactory::CreatePlatformRecorder(nullptr, - pid, - selector)) { + : recorder_(content::AXInspectFactory::CreateRecorder( + content::AXInspectFactory::DefaultPlatformRecorderType(), + nullptr, + pid, + selector)) { recorder_->SetPropertyFilters(scenario.property_filters); recorder_->ListenToEvents( base::BindRepeating(&AXEventServer::OnEvent, base::Unretained(this)));
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 6dc09b54..165972c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -15966,6 +15966,7 @@ <int value="-1942058396" label="ThumbnailPlaceholder:enabled"/> <int value="-1942057472" label="ExperimentalAccessibilityLabels:enabled"/> <int value="-1941852572" label="floating-virtual-keyboard"/> + <int value="-1940928631" label="UseMLKEM:disabled"/> <int value="-1940806558" label="enable-syncfs-directory-operation"/> <int value="-1940377152" label="MacRTL:enabled"/> <int value="-1940291343" label="SpeculativeResourcePrefetching:enabled"/> @@ -17498,6 +17499,7 @@ <int value="-1305690805" label="PrecompileInlineScripts:enabled"/> <int value="-1304957199" label="OfflinePagesShowAlternateDinoPage:enabled"/> <int value="-1304758527" label="SyncSendTabToSelf:disabled"/> + <int value="-1304666215" label="UseMLKEM:enabled"/> <int value="-1304558220" label="EnableViewPpd:disabled"/> <int value="-1304401930" label="CSSContainerQueries:enabled"/> <int value="-1303986525" label="CCTBeforeUnload:enabled"/> @@ -24265,7 +24267,6 @@ <int value="1527172748" label="disable-http2-grease-settings"/> <int value="1527292264" label="DisplayChangeModal:enabled"/> <int value="1527444466" label="RelatedWebsiteSetsDevUI:enabled"/> - <int value="1527848574" label="OmniboxLimitKeywordModeSuggestions:enabled"/> <int value="1528149296" label="TabGroupPaneAndroid:enabled"/> <int value="1528633042" label="kFileSystemAccessPersistentPermissionsUpdatedPageInfo:disabled"/>
diff --git a/tools/metrics/histograms/histograms_xml_files.gni b/tools/metrics/histograms/histograms_xml_files.gni index b584ee16..45655a1 100644 --- a/tools/metrics/histograms/histograms_xml_files.gni +++ b/tools/metrics/histograms/histograms_xml_files.gni
@@ -218,6 +218,8 @@ "//tools/metrics/histograms/metadata/security/enums.xml", "//tools/metrics/histograms/metadata/security/histograms.xml", "//tools/metrics/histograms/metadata/segmentation_platform/histograms.xml", + "//tools/metrics/histograms/metadata/sensitive_content/enums.xml", + "//tools/metrics/histograms/metadata/sensitive_content/histograms.xml", "//tools/metrics/histograms/metadata/service/enums.xml", "//tools/metrics/histograms/metadata/service/histograms.xml", "//tools/metrics/histograms/metadata/session/enums.xml",
diff --git a/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS b/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS index bb65405..30f4384 100644 --- a/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS +++ b/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS
@@ -411,6 +411,9 @@ shaktisahu@chromium.org haileywang@google.com ritikagup@google.com +# sensitive_content +jkeitel@google.com +schwering@google.com # service wanderview@chromium.org ayui@chromium.org
diff --git a/tools/metrics/histograms/metadata/accessibility/enums.xml b/tools/metrics/histograms/metadata/accessibility/enums.xml index 7d201dc1..9e8aa83 100644 --- a/tools/metrics/histograms/metadata/accessibility/enums.xml +++ b/tools/metrics/histograms/metadata/accessibility/enums.xml
@@ -1243,6 +1243,17 @@ <int value="15" label="Invalid selection bounds"/> </enum> +<!-- LINT.IfChange(DependencyParserModelState) --> + +<enum name="DependencyParserModelState"> + <int value="0" label="Unknown"/> + <int value="1" label="Model file invalid"/> + <int value="2" label="Model file valid"/> + <int value="3" label="Model file valid and available"/> +</enum> + +<!-- LINT.ThenChange(//chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h:DependencyParserModelState) --> + <!-- LINT.IfChange(KeyboardShortcutsSemanticMeaning) --> <enum name="KeyboardShortcutsSemanticMeaning">
diff --git a/tools/metrics/histograms/metadata/accessibility/histograms.xml b/tools/metrics/histograms/metadata/accessibility/histograms.xml index 37ce6c2..93f2c7d2 100644 --- a/tools/metrics/histograms/metadata/accessibility/histograms.xml +++ b/tools/metrics/histograms/metadata/accessibility/histograms.xml
@@ -1158,6 +1158,28 @@ </token> </histogram> +<histogram name="Accessibility.DependencyParserModel.Create.Duration" + units="ms" expires_after="2025-02-28"> + <owner>xiangxiao@google.com</owner> + <owner>chrome-a11y-core@google.com</owner> + <summary> + The time takes to load the file and create the TFLite dependency parser + model. This histogram is recorded once for each successful creation of the + model. + </summary> +</histogram> + +<histogram + name="Accessibility.DependencyParserModel.DependencyParserModelState" + enum="DependencyParserModelState" expires_after="2025-02-28"> + <owner>xiangxiao@google.com</owner> + <owner>chrome-a11y-core@google.com</owner> + <summary> + The state of the dependency parser model used by Reading Mode. Recorded once + per model load attempt for each renderer process. + </summary> +</histogram> + <histogram name="Accessibility.DependencyParserModelLoader.DependencyParserModel.WasLoaded" enum="BooleanLoaded" expires_after="2025-02-28">
diff --git a/tools/metrics/histograms/metadata/ash/histograms.xml b/tools/metrics/histograms/metadata/ash/histograms.xml index b2d1097..e72837a 100644 --- a/tools/metrics/histograms/metadata/ash/histograms.xml +++ b/tools/metrics/histograms/metadata/ash/histograms.xml
@@ -5868,7 +5868,7 @@ </histogram> <histogram name="Ash.Notification.SmallImageMemorySizeInKB" units="KB" - expires_after="2024-09-01"> + expires_after="2025-02-18"> <owner>andrewxu@chromium.org</owner> <owner>cros-status-area-eng@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/enterprise/histograms.xml b/tools/metrics/histograms/metadata/enterprise/histograms.xml index e68f05f..a7c29c9 100644 --- a/tools/metrics/histograms/metadata/enterprise/histograms.xml +++ b/tools/metrics/histograms/metadata/enterprise/histograms.xml
@@ -174,7 +174,6 @@ <variant name="QueryRequest" summary="PSM Query request"/> <variant name="StateKeysRetrieval" summary="state keys retrieval"/> <variant name="StateRequest" summary="state request"/> - <variant name="SystemClockSync" summary="system clock sync"/> </variants> <variants name="WmiSystemSignal"> @@ -3009,15 +3008,6 @@ </summary> </histogram> -<histogram name="Enterprise.StateDetermination.EmbargoDatePassed" - enum="Boolean" expires_after="2025-02-02"> - <owner>sergiyb@google.com</owner> - <owner>chromeos-commercial-remote-management@google.com</owner> - <summary> - Tracks whether embargo date has passed during state determination. - </summary> -</histogram> - <histogram name="Enterprise.StateDetermination.Enabled" enum="Boolean" expires_after="2025-02-02"> <owner>sergiyb@google.com</owner> @@ -3124,15 +3114,6 @@ <token key="Step" variants="StateDeterminationSteps"/> </histogram> -<histogram name="Enterprise.StateDetermination.SystemClockSynchronized" - enum="Boolean" expires_after="2025-02-02"> - <owner>sergiyb@google.com</owner> - <owner>chromeos-commercial-remote-management@google.com</owner> - <summary> - Tracks whether system clock was synchronized during state determination. - </summary> -</histogram> - <histogram name="Enterprise.StateDetermination.TotalDuration" units="ms" expires_after="2025-02-02"> <owner>sergiyb@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/extensions/enums.xml b/tools/metrics/histograms/metadata/extensions/enums.xml index 56b2e23..d4f605bb 100644 --- a/tools/metrics/histograms/metadata/extensions/enums.xml +++ b/tools/metrics/histograms/metadata/extensions/enums.xml
@@ -2760,6 +2760,7 @@ <int value="1897" label="ACCESSIBILITY_PRIVATE_SCROLLATPOINT"/> <int value="1898" label="STORAGE_GETKEYS"/> <int value="1899" label="ACCESSIBILITY_PRIVATE_SENDGESTUREINFOTOSETTINGS"/> + <int value="1900" label="ENTERPRISEREPORTINGPRIVATE_REPORTDATAMASKINGEVENT"/> </enum> <enum name="ExtensionInstallationCrxInstallError">
diff --git a/tools/metrics/histograms/metadata/ios/histograms.xml b/tools/metrics/histograms/metadata/ios/histograms.xml index dfd4615..3d97344 100644 --- a/tools/metrics/histograms/metadata/ios/histograms.xml +++ b/tools/metrics/histograms/metadata/ios/histograms.xml
@@ -2068,6 +2068,17 @@ </summary> </histogram> +<histogram name="IOS.MemoryExperimenter.AllocationTime" units="ms" + expires_after="2025-08-14"> + <owner>ajuma@google.com</owner> + <owner>bling-fundamentals@google.com</owner> + <summary> + The time take to allocate memory and fill it with random bytes during memory + experimentation. Recorded each time that memory is allocated by the memory + experimenter provider. + </summary> +</histogram> + <histogram name="IOS.MetricKit.{MXVersion}ApplicationHangTime" units="ms" expires_after="never"> <!-- expires-never: guiding metric (internal: go/chrome-browser-guiding-metrics) -->
diff --git a/tools/metrics/histograms/metadata/media/histograms.xml b/tools/metrics/histograms/metadata/media/histograms.xml index 3d021f1c..b2d46ee 100644 --- a/tools/metrics/histograms/metadata/media/histograms.xml +++ b/tools/metrics/histograms/metadata/media/histograms.xml
@@ -400,7 +400,7 @@ </histogram> <histogram name="Media.Audible.ConcurrentTabsTime" units="ms" - expires_after="2024-09-15"> + expires_after="2025-09-03"> <owner>evliu@google.com</owner> <owner>media-dev-uma@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/navigation/histograms.xml b/tools/metrics/histograms/metadata/navigation/histograms.xml index c18df72..97f00460 100644 --- a/tools/metrics/histograms/metadata/navigation/histograms.xml +++ b/tools/metrics/histograms/metadata/navigation/histograms.xml
@@ -911,6 +911,27 @@ </summary> </histogram> +<histogram + name="Navigation.GestureTransition.IgnoredInputCount.{Reason}.{Position}" + units="count" expires_after="M140"> + <owner>liuwilliam@google.com</owner> + <owner>baranerf@google.com</owner> + <owner>chrome-seamless-core@google.com</owner> + <summary> + Counts the number of ignored TouchStart events on {Position} when the + animation was {Reason}. This metric is recorded per gesture for either + canceled or invoked state. + </summary> + <token key="Reason"> + <variant name="AnimationCanceled" summary="canceled"/> + <variant name="AnimationInvoked" summary="invoked"/> + </token> + <token key="Position"> + <variant name="OnDestination" summary="destination"/> + <variant name="OnSource" summary="source"/> + </token> +</histogram> + <histogram name="Navigation.GestureTransition.ScreenshotCacheSize" units="MB" expires_after="M140"> <owner>liuwilliam@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/net/enums.xml b/tools/metrics/histograms/metadata/net/enums.xml index 69836e000..cf14ffcd 100644 --- a/tools/metrics/histograms/metadata/net/enums.xml +++ b/tools/metrics/histograms/metadata/net/enums.xml
@@ -358,6 +358,7 @@ <int value="24" label="P-384"/> <int value="25" label="P-521"/> <int value="29" label="X25519"/> + <int value="4588" label="ML-KEM-768+X25519"/> <int value="16696" label="CECPQ2"/> <int value="25497" label="Kyber+X25519"/> </enum>
diff --git a/tools/metrics/histograms/metadata/page/histograms.xml b/tools/metrics/histograms/metadata/page/histograms.xml index 606b20a4..895342e 100644 --- a/tools/metrics/histograms/metadata/page/histograms.xml +++ b/tools/metrics/histograms/metadata/page/histograms.xml
@@ -387,7 +387,7 @@ <histogram base="true" name="PageLoad.AdPaintTiming.TopFrameNavigationToFirstContentfulPaint" - units="ms" expires_after="2024-10-12"> + units="ms" expires_after="2025-10-12"> <owner>jkarlin@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/payment/enums.xml b/tools/metrics/histograms/metadata/payment/enums.xml index 506206c..db6e5b6 100644 --- a/tools/metrics/histograms/metadata/payment/enums.xml +++ b/tools/metrics/histograms/metadata/payment/enums.xml
@@ -34,6 +34,11 @@ <int value="5" label="Admin Policy"/> </enum> +<enum name="PaymentRequestAddressEditorMode"> + <int value="0" label="Add new address"/> + <int value="1" label="Edit existing address"/> +</enum> + <enum name="PaymentRequestCheckoutFunnelSteps"> <int value="0" label="Initiated"/> <int value="1" label="Show() called"/>
diff --git a/tools/metrics/histograms/metadata/payment/histograms.xml b/tools/metrics/histograms/metadata/payment/histograms.xml index 56601ce..34f4390 100644 --- a/tools/metrics/histograms/metadata/payment/histograms.xml +++ b/tools/metrics/histograms/metadata/payment/histograms.xml
@@ -22,6 +22,18 @@ <histograms> +<histogram name="PaymentRequest.AddressEditorTrigerred" + enum="PaymentRequestAddressEditorMode" expires_after="2025-08-28"> + <owner>vykochko@chromium.org</owner> + <owner>smcgruer@google.com</owner> + <owner>payments-autofill-team@google.com</owner> + <summary> + Android specific metric. Recorded every time the address editor is opened + from the Payment Request UI for either adding a new address or editing + existing. + </summary> +</histogram> + <histogram name="PaymentRequest.CanMakePayment.CallAllowedByPref" enum="Boolean" expires_after="2025-01-26"> <owner>smcgruer@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/pdf/histograms.xml b/tools/metrics/histograms/metadata/pdf/histograms.xml index 635dd4e..cd948948 100644 --- a/tools/metrics/histograms/metadata/pdf/histograms.xml +++ b/tools/metrics/histograms/metadata/pdf/histograms.xml
@@ -24,7 +24,7 @@ <histogram name="PDF.Actions" enum="ChromePDFViewerActions" expires_after="2025-02-10"> - <owner>hnakashima@chromium.org</owner> + <owner>andyphan@chromium.org</owner> <owner>thestig@chromium.org</owner> <summary> Tracks user actions in the PDF viewer. Logged when the document is opened @@ -67,7 +67,7 @@ </histogram> <histogram name="PDF.PageCount" units="pages" expires_after="2025-02-09"> - <owner>hnakashima@chromium.org</owner> + <owner>andyphan@chromium.org</owner> <owner>thestig@chromium.org</owner> <summary> Tracks the number of pages in PDF documents opened in the PDF viewer.
diff --git a/tools/metrics/histograms/metadata/sensitive_content/OWNERS b/tools/metrics/histograms/metadata/sensitive_content/OWNERS new file mode 100644 index 0000000..9b05d76 --- /dev/null +++ b/tools/metrics/histograms/metadata/sensitive_content/OWNERS
@@ -0,0 +1,6 @@ +per-file OWNERS=file://tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS + +# Prefer sending CLs to the owners listed below. +# Use chromium-metrics-reviews@google.com as a backup. +jkeitel@google.com +schwering@google.com
diff --git a/tools/metrics/histograms/metadata/sensitive_content/enums.xml b/tools/metrics/histograms/metadata/sensitive_content/enums.xml new file mode 100644 index 0000000..60f1d26 --- /dev/null +++ b/tools/metrics/histograms/metadata/sensitive_content/enums.xml
@@ -0,0 +1,36 @@ +<!-- +Copyright 2024 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<!-- + +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="ContentSensitivity"> + <int value="0" label="Content sensitivity changed to not sensitive"/> + <int value="1" label="Content sensitivity changed to sensitive"/> +</enum> + +</enums> + +</histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/sensitive_content/histograms.xml b/tools/metrics/histograms/metadata/sensitive_content/histograms.xml new file mode 100644 index 0000000..474f8c13 --- /dev/null +++ b/tools/metrics/histograms/metadata/sensitive_content/histograms.xml
@@ -0,0 +1,46 @@ +<!-- +Copyright 2024 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<!-- +This file is used to generate a comprehensive list of Sensitive Content histograms +along with a detailed description for each histogram. + +For best practices on writing histogram descriptions, see +https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md + +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> + +<histograms> + +<variants name="Embedder"> + <variant name="Chrome" summary="Chrome for Android"/> + <variant name="WebView" summary="WebView"/> +</variants> + +<histogram name="SensitiveContent.{Embedder}.SensitivityChanged" + enum="ContentSensitivity" expires_after="2025-03-01"> + <owner>theocristea@google.com</owner> + <owner>jkeitel@google.com</owner> + <owner>chrome-autofill-alerts@google.com</owner> + <summary> + Emitted when the content changed its sensitivity from sensitive to not + sensitive and vice-versa, in {Embedder}. On page load, the content is + considered not sensitive. This metric gets recorded every time the content + sensitivity of a page changes. + </summary> + <token key="Embedder" variants="Embedder"/> +</histogram> + +</histograms> + +</histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/storage/histograms.xml b/tools/metrics/histograms/metadata/storage/histograms.xml index 8beeb03..604b67c 100644 --- a/tools/metrics/histograms/metadata/storage/histograms.xml +++ b/tools/metrics/histograms/metadata/storage/histograms.xml
@@ -545,6 +545,20 @@ </summary> </histogram> +<histogram name="Storage.FileSystemAccess.AttemptToObserveSymlinkOrJunction" + enum="Boolean" expires_after="2025-09-01"> + <owner>memmott@chromium.org</owner> + <owner>dslee@chromium.org</owner> + <owner>christinesm@chromium.org</owner> + <owner>src/content/browser/file_system_access/OWNERS</owner> + <summary> + Records whether a site attempted to observe a symlink or a junction using + the File System Observer API. Recorded on every observe() call after + validating the handle and ensuring that read permissions on the handle are + granted. + </summary> +</histogram> + <histogram name="Storage.FileSystemAccess.FilePathWatcherCallbackError" enum="FileSystemAccessWatchWithChangeInfoResult" expires_after="2025-06-27"> <owner>memmott@chromium.org</owner>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index 6f31388f..4790080d 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -8157,6 +8157,31 @@ </metric> </event> +<event name="FamilyLinkUser.ReauthenticationInterstitial"> + <owner>chrome-kids-eng@google.com</owner> + <summary> + These metrics are logged when an unauthenticated Family Link user tries to + navigate to YouTube in the main frame, prompting a re-authentication + interstitial. + </summary> + <metric name="InterstitialShown" enum="BooleanHit"> + <summary> + Recorded when the re-authentication interstitial is displayed. + </summary> + </metric> + <metric name="ReauthenticationCompleted" enum="BooleanHit"> + <summary> + Recorded when users successfully re-authenticates and can continue + navigation, and vice-versa for failed reauthentication. + </summary> + </metric> + <metric name="ReauthenticationStarted" enum="BooleanHit"> + <summary> + Recorded when users initiate re-authentication from the interstitial. + </summary> + </metric> +</event> + <event name="FastCheckout.FormStatus"> <owner>bwolfgang@google.com</owner> <owner>jkeitel@google.com</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 83a29ba..a02c279f 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -6,7 +6,7 @@ }, "win": { "hash": "265b0c463b580bc38ece580036c6f978ac973a9b", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/05afc6502af1a4b4635da544f060041b983b519f/trace_processor_shell.exe" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/4acdcdfaa037f456d793ba8e08c44f1756069971/trace_processor_shell.exe" }, "linux_arm": { "hash": "b5e5fcaf0e8ae5af509255c50c116d2ad6308221", @@ -22,7 +22,7 @@ }, "linux": { "hash": "9b09644fbb459a3f79cdb04e042ce8ae99748c1b", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/05afc6502af1a4b4635da544f060041b983b519f/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/4acdcdfaa037f456d793ba8e08c44f1756069971/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/ubsan/ignorelist.txt b/tools/ubsan/ignorelist.txt index ee5a7098..4dc90f7 100644 --- a/tools/ubsan/ignorelist.txt +++ b/tools/ubsan/ignorelist.txt
@@ -30,3 +30,7 @@ # https://crbug.com/363225486 [alignment] fun:*base*Pickle* + +# https://crbug.com/363264997 +[null] +fun:*performance_manager*PerformanceManagerImpl*RunCallbackWithGraph*
diff --git a/ui/accessibility/platform/ax_platform_node_ui_kit_element.h b/ui/accessibility/platform/ax_platform_node_ui_kit_element.h index 7f1046d9..6a7d9ba 100644 --- a/ui/accessibility/platform/ax_platform_node_ui_kit_element.h +++ b/ui/accessibility/platform/ax_platform_node_ui_kit_element.h
@@ -15,11 +15,11 @@ @interface AXPlatformNodeUIKitElement : UIAccessibilityElement // The accessibility tree node associated with this wrapper. -@property(nonatomic, readonly) AXPlatformNodeIOS* node; +@property(nonatomic, readonly) ui::AXPlatformNodeIOS* node; // This creates a UIKit accessibility element around the given // AXPlatformNodeIOS. -- (instancetype)initWithPlatformNode:(AXPlatformNodeIOS*)platformNode; +- (instancetype)initWithPlatformNode:(ui::AXPlatformNodeIOS*)platformNode; // Invalidate children for a non-ignored ancestor (including self). - (void)childrenChanged;
diff --git a/ui/accessibility/platform/ax_platform_node_ui_kit_element.mm b/ui/accessibility/platform/ax_platform_node_ui_kit_element.mm index 231d6be5..d931b31 100644 --- a/ui/accessibility/platform/ax_platform_node_ui_kit_element.mm +++ b/ui/accessibility/platform/ax_platform_node_ui_kit_element.mm
@@ -19,7 +19,7 @@ @implementation AXPlatformNodeUIKitElement { // The AXPlatformNode corresponding to this wrapper instance. - raw_ptr<AXPlatformNodeIOS> _node; + raw_ptr<ui::AXPlatformNodeIOS> _node; // An array of children of this object. Cached to avoid re-computing. NSMutableArray* _children; // Whether the children have changed and need to be updated. @@ -28,14 +28,15 @@ BOOL _gettingChildren; } -- (instancetype)initWithPlatformNode:(AXPlatformNodeIOS*)platformNode { +- (instancetype)initWithPlatformNode:(ui::AXPlatformNodeIOS*)platformNode { id container = platformNode->GetParent(); // TODO(crbug.com/336611337): Sometimes container is null for new subframes. // We need a way to retry after the AXTreeManager is connected to its parent. if (!container) { return nil; } - if (self = [super initWithAccessibilityContainer:platformNode->GetParent()]) { + if ((self = + [super initWithAccessibilityContainer:platformNode->GetParent()])) { _node = platformNode; _needsToUpdateChildren = YES; _gettingChildren = NO; @@ -49,8 +50,8 @@ } _needsToUpdateChildren = YES; if (![self isIncludedInPlatformTree]) { - AXPlatformNode* parentNode = - AXPlatformNode::FromNativeViewAccessible(_node->GetParent()); + ui::AXPlatformNode* parentNode = + ui::AXPlatformNode::FromNativeViewAccessible(_node->GetParent()); if (parentNode) { [parentNode->GetNativeViewAccessible() childrenChanged]; } @@ -63,7 +64,7 @@ _node = nullptr; } -- (AXPlatformNodeIOS*)node { +- (ui::AXPlatformNodeIOS*)node { return _node.get(); } @@ -92,7 +93,7 @@ ax::mojom::IntListAttribute::kIndirectChildIds); for (uint32_t i = 0; i < indirectChildIds.size(); ++i) { int32_t child_id = indirectChildIds[i]; - AXPlatformNode* child = _node->GetDelegate()->GetFromNodeID(child_id); + ui::AXPlatformNode* child = _node->GetDelegate()->GetFromNodeID(child_id); if (child) { [_children addObject:child->GetNativeViewAccessible()]; @@ -116,7 +117,7 @@ } gfx::Rect rect = _node->GetDelegate()->GetBoundsRect( - AXCoordinateSystem::kScreenDIPs, AXClippingBehavior::kClipped); + ui::AXCoordinateSystem::kScreenDIPs, ui::AXClippingBehavior::kClipped); rect = ScaleToRoundedRect( rect, 1.f / _node->GetIOSDelegate()->GetDeviceScaleFactor()); @@ -198,7 +199,7 @@ } - (BOOL)isImage { - return IsImage(_node->GetRole()) && + return ui::IsImage(_node->GetRole()) && !_node->GetBoolAttribute( ax::mojom::BoolAttribute::kCanvasHasFallback) && !_node->GetChildCount() &&
diff --git a/ui/android/java/src/org/chromium/ui/interpolators/Interpolators.java b/ui/android/java/src/org/chromium/ui/interpolators/Interpolators.java index 325b003..9f59e1ea 100644 --- a/ui/android/java/src/org/chromium/ui/interpolators/Interpolators.java +++ b/ui/android/java/src/org/chromium/ui/interpolators/Interpolators.java
@@ -20,6 +20,9 @@ public class Interpolators { public static final Interpolator STANDARD_INTERPOLATOR = PathInterpolatorCompat.create(0.2f, 0f, 0f, 1f); + public static final Interpolator STANDARD_ACCELERATE = + PathInterpolatorCompat.create(0.3f, 0f, 1f, 1f); + public static final AccelerateInterpolator ACCELERATE_INTERPOLATOR = new AccelerateInterpolator(); public static final DecelerateInterpolator DECELERATE_INTERPOLATOR =
diff --git a/ui/display/linux/test/virtual_display_util_linux.cc b/ui/display/linux/test/virtual_display_util_linux.cc index e3222a9c..2f7df67 100644 --- a/ui/display/linux/test/virtual_display_util_linux.cc +++ b/ui/display/linux/test/virtual_display_util_linux.cc
@@ -45,12 +45,6 @@ namespace display::test { -struct DisplayParams { - explicit DisplayParams(remoting::DesktopResolution resolution) - : resolution(resolution) {} - remoting::DesktopResolution resolution; -}; - VirtualDisplayUtilLinux::VirtualDisplayUtilLinux(Screen* screen) : screen_(screen), desktop_resizer_(std::make_unique<remoting::X11DesktopResizer>()), @@ -120,7 +114,9 @@ } CHECK(!current_layout_.layouts.empty()); last_requested_layout_ = current_layout_; - AppendScreen(last_requested_layout_, display_params.resolution); + AppendScreen(last_requested_layout_, + remoting::DesktopResolution(display_params.resolution, + display_params.dpi)); requested_ids_.push_back(id); desktop_resizer_->SetVideoLayout(last_requested_layout_); detected_added_display_ids_.clear(); @@ -228,18 +224,6 @@ } // static -const DisplayParams VirtualDisplayUtilLinux::k1920x1080 = DisplayParams( - remoting::DesktopResolution(gfx::Size(1920, 1080), gfx::Vector2d(96, 96))); -const DisplayParams VirtualDisplayUtilLinux::k1024x768 = DisplayParams( - remoting::DesktopResolution(gfx::Size(1024, 768), gfx::Vector2d(96, 96))); - -// VirtualDisplayUtil definitions: -const DisplayParams VirtualDisplayUtil::k1920x1080 = - VirtualDisplayUtilLinux::k1920x1080; -const DisplayParams VirtualDisplayUtil::k1024x768 = - VirtualDisplayUtilLinux::k1024x768; - -// static std::unique_ptr<VirtualDisplayUtil> VirtualDisplayUtil::TryCreate( Screen* screen) { if (!VirtualDisplayUtilLinux::IsAPIAvailable()) {
diff --git a/ui/display/linux/test/virtual_display_util_linux.h b/ui/display/linux/test/virtual_display_util_linux.h index 29502a8..e35f817 100644 --- a/ui/display/linux/test/virtual_display_util_linux.h +++ b/ui/display/linux/test/virtual_display_util_linux.h
@@ -38,12 +38,12 @@ void ResetDisplays() override; // These should be a subset of the resolutions configured in //testing/xvfb.py - static const DisplayParams k800x600; - static const DisplayParams k1024x768; - static const DisplayParams k1280x800; - static const DisplayParams k1920x1080; - static const DisplayParams k1600x1200; - static const DisplayParams k3840x2160; + static constexpr DisplayParams k800x600 = {gfx::Size(800, 600)}; + static constexpr DisplayParams k1024x768 = VirtualDisplayUtil::k1024x768; + static constexpr DisplayParams k1280x800 = {gfx::Size(1280, 800)}; + static constexpr DisplayParams k1920x1080 = VirtualDisplayUtil::k1920x1080; + static constexpr DisplayParams k1600x1200 = {gfx::Size(1600, 1200)}; + static constexpr DisplayParams k3840x2160 = {gfx::Size(3840, 2160)}; private: // display::DisplayObserver:
diff --git a/ui/display/mac/test/virtual_display_util_mac.mm b/ui/display/mac/test/virtual_display_util_mac.mm index cffaa27..4a04180 100644 --- a/ui/display/mac/test/virtual_display_util_mac.mm +++ b/ui/display/mac/test/virtual_display_util_mac.mm
@@ -301,29 +301,6 @@ namespace display::test { -struct DisplayParams { - DisplayParams(int width, - int height, - int ppi, - bool hiDPI, - std::string description) - : width(width), - height(height), - ppi(ppi), - hiDPI(hiDPI), - description(base::SysUTF8ToNSString(description)) {} - - bool IsValid() const { - return width > 0 && height > 0 && ppi > 0 && description.length > 0; - } - - int width; - int height; - int ppi; - BOOL hiDPI; - NSString* __strong description; -}; - VirtualDisplayUtilMac::VirtualDisplayUtilMac(Screen* screen) : screen_(screen) { CHECK(screen); screen->AddObserver(this); @@ -336,13 +313,16 @@ int64_t VirtualDisplayUtilMac::AddDisplay(uint8_t display_id, const DisplayParams& display_params) { - DCHECK(display_params.IsValid()); + CHECK(!display_params.resolution.IsEmpty()); + CHECK(!display_params.dpi.IsZero()); + CHECK_EQ(display_params.dpi.x(), display_params.dpi.y()); NSString* display_name = [NSString stringWithFormat:@"Virtual Display #%d", display_id]; CGVirtualDisplay* display = CreateVirtualDisplay( - display_params.width, display_params.height, display_params.ppi, - display_params.hiDPI, display_name, display_id); + display_params.resolution.width(), display_params.resolution.height(), + display_params.dpi.x(), /*hiDPI=*/display_params.dpi.x() >= 200, + display_name, display_id); DCHECK(display); // TODO(crbug.com/40148077): Please remove this log or replace it with @@ -356,8 +336,9 @@ WaitForDisplay(id, /*added=*/true); - EnsureDisplayWithResolution( - screen_, id, gfx::Size(display_params.width, display_params.height)); + EnsureDisplayWithResolution(screen_, id, + gfx::Size(display_params.resolution.width(), + display_params.resolution.height())); // TODO(crbug.com/40148077): Please remove this log or replace it with // [D]CHECK() ASAP when the TEST is stable. @@ -448,72 +429,61 @@ // Predefined display configurations from // https://en.wikipedia.org/wiki/Graphics_display_resolution and // https://www.theverge.com/tldr/2016/3/21/11278192/apple-iphone-ipad-screen-sizes-pixels-density-so-many-choices. -const DisplayParams VirtualDisplayUtilMac::k6016x3384 = - DisplayParams(6016, 3384, 218, true, "Apple Pro Display XDR"); -const DisplayParams VirtualDisplayUtilMac::k5120x2880 = - DisplayParams(5120, 2880, 218, true, "27-inch iMac with Retina 5K display"); -const DisplayParams VirtualDisplayUtilMac::k4096x2304 = - DisplayParams(4096, - 2304, - 219, - true, - "21.5-inch iMac with Retina 4K display"); -const DisplayParams VirtualDisplayUtilMac::k3840x2400 = - DisplayParams(3840, 2400, 200, true, "WQUXGA"); -const DisplayParams VirtualDisplayUtilMac::k3840x2160 = - DisplayParams(3840, 2160, 200, true, "UHD"); -const DisplayParams VirtualDisplayUtilMac::k3840x1600 = - DisplayParams(3840, 1600, 200, true, "WQHD+, UW-QHD+"); -const DisplayParams VirtualDisplayUtilMac::k3840x1080 = - DisplayParams(3840, 1080, 200, true, "DFHD"); -const DisplayParams VirtualDisplayUtilMac::k3072x1920 = - DisplayParams(3072, - 1920, - 226, - true, - "16-inch MacBook Pro with Retina display"); -const DisplayParams VirtualDisplayUtilMac::k2880x1800 = - DisplayParams(2880, - 1800, - 220, - true, - "15.4-inch MacBook Pro with Retina display"); -const DisplayParams VirtualDisplayUtilMac::k2560x1600 = - DisplayParams(2560, - 1600, - 227, - true, - "WQXGA, 13.3-inch MacBook Pro with Retina display"); -const DisplayParams VirtualDisplayUtilMac::k2560x1440 = - DisplayParams(2560, 1440, 109, false, "27-inch Apple Thunderbolt display"); -const DisplayParams VirtualDisplayUtilMac::k2304x1440 = - DisplayParams(2304, 1440, 226, true, "12-inch MacBook with Retina display"); -const DisplayParams VirtualDisplayUtilMac::k2048x1536 = - DisplayParams(2048, 1536, 150, false, "QXGA"); -const DisplayParams VirtualDisplayUtilMac::k2048x1152 = - DisplayParams(2048, 1152, 150, false, "QWXGA"); -const DisplayParams VirtualDisplayUtilMac::k1920x1200 = - DisplayParams(1920, 1200, 150, false, "WUXGA"); -const DisplayParams VirtualDisplayUtilMac::k1600x1200 = - DisplayParams(1600, 1200, 125, false, "UXGA"); -const DisplayParams VirtualDisplayUtilMac::k1920x1080 = - DisplayParams(1920, 1080, 102, false, "HD, 21.5-inch iMac"); -const DisplayParams VirtualDisplayUtilMac::k1680x1050 = - DisplayParams(1680, - 1050, - 99, - false, - "WSXGA+, Apple Cinema Display (20-inch), 20-inch iMac"); -const DisplayParams VirtualDisplayUtilMac::k1440x900 = - DisplayParams(1440, 900, 127, false, "WXGA+, 13.3-inch MacBook Air"); -const DisplayParams VirtualDisplayUtilMac::k1400x1050 = - DisplayParams(1400, 1050, 125, false, "SXGA+"); -const DisplayParams VirtualDisplayUtilMac::k1366x768 = - DisplayParams(1366, 768, 135, false, "11.6-inch MacBook Air"); -const DisplayParams VirtualDisplayUtilMac::k1280x1024 = - DisplayParams(1280, 1024, 100, false, "SXGA"); -const DisplayParams VirtualDisplayUtilMac::k1280x1800 = - DisplayParams(1280, 800, 113, false, "13.3-inch MacBook Pro"); +const DisplayParams VirtualDisplayUtilMac::k6016x3384 = { + gfx::Size(6016, 3384), gfx::Vector2d(218, 218), "Apple Pro Display XDR"}; +const DisplayParams VirtualDisplayUtilMac::k5120x2880 = { + gfx::Size(5120, 2880), gfx::Vector2d(218, 218), + "27-inch iMac with Retina 5K display"}; +const DisplayParams VirtualDisplayUtilMac::k4096x2304 = { + gfx::Size(4096, 2304), gfx::Vector2d(219, 219), + "21.5-inch iMac with Retina 4K display"}; +const DisplayParams VirtualDisplayUtilMac::k3840x2400 = { + gfx::Size(3840, 2400), gfx::Vector2d(200, 200), "WQUXGA"}; +const DisplayParams VirtualDisplayUtilMac::k3840x2160 = { + gfx::Size(3840, 2160), gfx::Vector2d(200, 200), "UHD"}; +const DisplayParams VirtualDisplayUtilMac::k3840x1600 = { + gfx::Size(3840, 1600), gfx::Vector2d(200, 200), "WQHD+, UW-QHD+"}; +const DisplayParams VirtualDisplayUtilMac::k3840x1080 = { + gfx::Size(3840, 1080), gfx::Vector2d(200, 200), "DFHD"}; +const DisplayParams VirtualDisplayUtilMac::k3072x1920 = { + gfx::Size(3072, 1920), gfx::Vector2d(226, 226), + "16-inch MacBook Pro with Retina display"}; +const DisplayParams VirtualDisplayUtilMac::k2880x1800 = { + gfx::Size(2880, 1800), gfx::Vector2d(220, 220), + "15.4-inch MacBook Pro with Retina display"}; +const DisplayParams VirtualDisplayUtilMac::k2560x1600 = { + gfx::Size(2560, 1600), gfx::Vector2d(227, 227), + "WQXGA, 13.3-inch MacBook Pro with Retina display"}; +const DisplayParams VirtualDisplayUtilMac::k2560x1440 = { + gfx::Size(2560, 1440), gfx::Vector2d(109, 109), + "27-inch Apple Thunderbolt display"}; +const DisplayParams VirtualDisplayUtilMac::k2304x1440 = { + gfx::Size(2304, 1440), gfx::Vector2d(226, 226), + "12-inch MacBook with Retina display"}; +const DisplayParams VirtualDisplayUtilMac::k2048x1536 = { + gfx::Size(2048, 1536), gfx::Vector2d(150, 150), "QXGA"}; +const DisplayParams VirtualDisplayUtilMac::k2048x1152 = { + gfx::Size(2048, 1152), gfx::Vector2d(150, 150), "QWXGA"}; +const DisplayParams VirtualDisplayUtilMac::k1920x1200 = { + gfx::Size(1920, 1200), gfx::Vector2d(150, 150), "WUXGA"}; +const DisplayParams VirtualDisplayUtilMac::k1600x1200 = { + gfx::Size(1600, 1200), gfx::Vector2d(125, 125), "UXGA"}; +const DisplayParams VirtualDisplayUtilMac::k1920x1080 = { + gfx::Size(1920, 1080), gfx::Vector2d(125, 125), "HD, 21.5-inch iMac"}; +const DisplayParams VirtualDisplayUtilMac::k1680x1050 = { + gfx::Size(1680, 1050), gfx::Vector2d(99, 99), + "WSXGA+, Apple Cinema Display (20-inch), 20-inch iMac"}; +const DisplayParams VirtualDisplayUtilMac::k1440x900 = { + gfx::Size(1440, 900), gfx::Vector2d(127, 127), + "WXGA+, 13.3-inch MacBook Air"}; +const DisplayParams VirtualDisplayUtilMac::k1400x1050 = { + gfx::Size(1400, 1050), gfx::Vector2d(125, 125), "SXGA+"}; +const DisplayParams VirtualDisplayUtilMac::k1366x768 = { + gfx::Size(1366, 768), gfx::Vector2d(135, 135), "11.6-inch MacBook Air"}; +const DisplayParams VirtualDisplayUtilMac::k1280x1024 = { + gfx::Size(1280, 1024), gfx::Vector2d(100, 100), "SXGA"}; +const DisplayParams VirtualDisplayUtilMac::k1280x1800 = { + gfx::Size(1280, 800), gfx::Vector2d(113, 113), "13.3-inch MacBook Pro"}; VirtualDisplayUtilMac::DisplaySleepBlocker::DisplaySleepBlocker() { IOReturn result = IOPMAssertionCreateWithName( @@ -602,12 +572,6 @@ run_loop_->Quit(); } -// VirtualDisplayUtil definitions: -const DisplayParams VirtualDisplayUtil::k1920x1080 = - VirtualDisplayUtilMac::k1920x1080; -const DisplayParams VirtualDisplayUtil::k1024x768 = - DisplayParams(1024, 768, 113, false, "XGA"); - // static std::unique_ptr<VirtualDisplayUtil> VirtualDisplayUtil::TryCreate( Screen* screen) {
diff --git a/ui/display/manager/display_manager.cc b/ui/display/manager/display_manager.cc index dcccee62..ce1a0fb 100644 --- a/ui/display/manager/display_manager.cc +++ b/ui/display/manager/display_manager.cc
@@ -1364,13 +1364,13 @@ } } + active_display_list_.resize(active_display_list_size); + is_updating_display_list_ = false; + if (!removed_displays.empty()) { NotifyDisplaysRemoved(removed_displays); } - active_display_list_.resize(active_display_list_size); - is_updating_display_list_ = false; - for (size_t index : added_display_indices) { NotifyDisplayAdded(active_display_list_[index]); }
diff --git a/ui/display/test/virtual_display_util.h b/ui/display/test/virtual_display_util.h index 8b38e452..197c9a4 100644 --- a/ui/display/test/virtual_display_util.h +++ b/ui/display/test/virtual_display_util.h
@@ -6,13 +6,35 @@ #define UI_DISPLAY_TEST_VIRTUAL_DISPLAY_UTIL_H_ #include <memory> + #include "ui/display/display_observer.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/geometry/vector2d.h" namespace display { class Screen; namespace test { -struct DisplayParams; + +struct DISPLAY_EXPORT DisplayParams { + gfx::Size resolution; + gfx::Vector2d dpi = gfx::Vector2d(96, 96); + std::string description; +}; + +bool constexpr operator<(const display::test::DisplayParams& a, + const display::test::DisplayParams& b) { + return std::tuple(a.resolution.width(), a.resolution.height(), a.dpi.x(), + a.dpi.y(), a.description) < + std::tuple(b.resolution.width(), b.resolution.height(), b.dpi.x(), + b.dpi.y(), b.description); +} + +bool constexpr operator==(const display::test::DisplayParams& a, + const display::test::DisplayParams& b) { + return a.resolution == b.resolution && a.dpi == b.dpi && + a.description == b.description; +} // This interface creates system-level virtual displays to support the automated // integration testing of display information and window management APIs in @@ -38,8 +60,8 @@ virtual void ResetDisplays() = 0; // Supported Display configurations. - static const DisplayParams k1920x1080; - static const DisplayParams k1024x768; + static constexpr DisplayParams k1920x1080 = {gfx::Size(1920, 1080)}; + static constexpr DisplayParams k1024x768 = {gfx::Size(1024, 768)}; }; } // namespace test
diff --git a/ui/display/test/virtual_display_util_stub.cc b/ui/display/test/virtual_display_util_stub.cc index e33f63d7..a1ef94f 100644 --- a/ui/display/test/virtual_display_util_stub.cc +++ b/ui/display/test/virtual_display_util_stub.cc
@@ -6,11 +6,7 @@ namespace display::test { -// Stub definitions for unimplemented platforms to prevent linker errors. - -struct DisplayParams {}; -const DisplayParams VirtualDisplayUtil::k1920x1080 = DisplayParams{}; -const DisplayParams VirtualDisplayUtil::k1024x768 = DisplayParams{}; +// Stub definition for unimplemented platforms to prevent linker errors. // static std::unique_ptr<VirtualDisplayUtil> VirtualDisplayUtil::TryCreate(
diff --git a/ui/display/win/test/virtual_display_util_win.cc b/ui/display/win/test/virtual_display_util_win.cc index 7642272..d4c715c 100644 --- a/ui/display/win/test/virtual_display_util_win.cc +++ b/ui/display/win/test/virtual_display_util_win.cc
@@ -5,21 +5,33 @@ #include "ui/display/win/test/virtual_display_util_win.h" #include <algorithm> +#include <functional> #include <iterator> +#include "base/containers/fixed_flat_map.h" #include "base/containers/flat_tree.h" #include "base/logging.h" #include "third_party/win_virtual_display/driver/public/properties.h" #include "ui/display/display.h" #include "ui/display/screen.h" +#include "ui/display/test/virtual_display_util.h" #include "ui/display/types/display_constants.h" #include "ui/display/win/display_config_helper.h" #include "ui/display/win/screen_win.h" namespace display::test { - namespace { +// Map of `VirtualDisplayUtil` configs to `MonitorConfig` defined in Windows +// driver controller code. +static const auto kConfigMap = base::MakeFixedFlatMap< + display::test::DisplayParams, + std::reference_wrapper<const display::test::MonitorConfig>>( + {{display::test::VirtualDisplayUtil::k1024x768, + display::test::MonitorConfig::k1024x768}, + {display::test::VirtualDisplayUtil::k1920x1080, + display::test::MonitorConfig::k1920x1080}}); + // Comparer for gfx:Size for use in sorting algorithms. struct SizeCompare { bool operator()(const gfx::Size& a, const gfx::Size& b) const { @@ -71,11 +83,6 @@ } // namespace -struct DisplayParams { - explicit DisplayParams(MonitorConfig config) : monitor_config(config) {} - MonitorConfig monitor_config; -}; - VirtualDisplayUtilWin::VirtualDisplayUtilWin(Screen* screen) : screen_(screen), is_headless_(IsHeadless()) { screen_->AddObserver(this); @@ -142,9 +149,10 @@ LOG(ERROR) << "Duplicate virtual display ID added: " << id; return kInvalidDisplayId; } - std::vector<MonitorConfig> monitors; - monitors = current_config_.requested_configs(); - MonitorConfig new_config = display_params.monitor_config; + std::vector<MonitorConfig> monitors = current_config_.requested_configs(); + auto it = kConfigMap.find(display_params); + CHECK(it != kConfigMap.end()) << "DisplayParams not mapped to MonitorConfig."; + MonitorConfig new_config = it->second; new_config.set_product_code(id); monitors.push_back(new_config); if (!SetDriverProperties(DriverProperties(monitors))) { @@ -190,7 +198,7 @@ // virtualized adapter. Therefore, we replace the default stub display with // our own virtual one. See: // https://learn.microsoft.com/en-us/windows-hardware/drivers/display/support-for-headless-systems - std::vector<MonitorConfig> configs{k1024x768.monitor_config}; + std::vector<MonitorConfig> configs{MonitorConfig::k1024x768}; configs[0].set_product_code(kHeadlessDisplayId); new_config = DriverProperties(configs); } @@ -263,17 +271,6 @@ run_loop_->Quit(); } -const DisplayParams VirtualDisplayUtilWin::k1920x1080 = - DisplayParams(MonitorConfig::k1920x1080); -const DisplayParams VirtualDisplayUtilWin::k1024x768 = - DisplayParams(MonitorConfig::k1024x768); - -// VirtualDisplayUtil definitions: -const DisplayParams VirtualDisplayUtil::k1920x1080 = - VirtualDisplayUtilWin::k1920x1080; -const DisplayParams VirtualDisplayUtil::k1024x768 = - VirtualDisplayUtilWin::k1024x768; - // static std::unique_ptr<VirtualDisplayUtil> VirtualDisplayUtil::TryCreate( Screen* screen) {
diff --git a/ui/display/win/test/virtual_display_util_win.h b/ui/display/win/test/virtual_display_util_win.h index 682f8e0..2f6a0a60 100644 --- a/ui/display/win/test/virtual_display_util_win.h +++ b/ui/display/win/test/virtual_display_util_win.h
@@ -42,8 +42,6 @@ int64_t AddDisplay(uint8_t id, const DisplayParams& display_params) override; void RemoveDisplay(int64_t display_id) override; void ResetDisplays() override; - static const DisplayParams k1920x1080; - static const DisplayParams k1024x768; private: // display::DisplayObserver:
diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc index 2d2d3dcc7..9c7fcc32 100644 --- a/ui/gl/gl_context_egl.cc +++ b/ui/gl/gl_context_egl.cc
@@ -16,6 +16,7 @@ #include "ui/gl/egl_util.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_display.h" +#include "ui/gl/gl_features.h" #include "ui/gl/gl_fence.h" #include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_surface_egl.h" @@ -204,10 +205,13 @@ bool is_swangle = IsSoftwareGLImplementation(GetGLImplementationParts()); if (attribs.webgl_compatibility_context && is_swangle && - IsARMSwiftShaderPlatform()) { + IsARMSwiftShaderPlatform() && + !features::IsSwiftShaderAllowedByCommandLine( + base::CommandLine::ForCurrentProcess())) { // crbug.com/1378476: LLVM 10 is used as the JIT compiler for SwiftShader, // which doesn't fully support ARM. Disable Swiftshader on ARM CPUs for // WebGL until LLVM is upgraded. + // Allow SwiftShader if explicitly requested by command line for testing. DVLOG(1) << __FUNCTION__ << ": Software WebGL contexts are not supported on ARM CPUs."; return false;
diff --git a/ui/gl/gl_features.cc b/ui/gl/gl_features.cc index bf18fac..750a3dd0 100644 --- a/ui/gl/gl_features.cc +++ b/ui/gl/gl_features.cc
@@ -234,4 +234,46 @@ #endif } +#if BUILDFLAG(ENABLE_SWIFTSHADER) +bool IsSwiftShaderAllowedByCommandLine(const base::CommandLine* command_line) { + // If the switch to opt-into unsafe SwiftShader is present, always allow + // SwiftShader. + if (command_line->HasSwitch(switches::kEnableUnsafeSwiftShader)) { + return true; + } + + std::string angle_name = + command_line->GetSwitchValueASCII(switches::kUseANGLE); + if (angle_name == gl::kANGLEImplementationSwiftShaderName) { + // If SwiftShader is specifically requested with the --use-angle command + // line flag, allow it. + return true; + } + + return false; +} + +// Allow fallback to SwfitShader without command line flags during the +// deprecation period. +BASE_FEATURE(kAllowSwiftShaderFallback, + "AllowSwiftShaderFallback", + base::FEATURE_ENABLED_BY_DEFAULT); + +bool IsSwiftShaderAllowedByFeature() { + return base::FeatureList::IsEnabled(kAllowSwiftShaderFallback); +} +#else +bool IsSwiftShaderAllowedByCommandLine(const base::CommandLine*) { + return false; +} + +bool IsSwiftShaderAllowedByFeature() { + return false; +} +#endif + +bool IsSwiftShaderAllowed(const base::CommandLine* command_line) { + return IsSwiftShaderAllowedByCommandLine(command_line) || + IsSwiftShaderAllowedByFeature(); +} } // namespace features
diff --git a/ui/gl/gl_features.h b/ui/gl/gl_features.h index 35e4884..4964e35f 100644 --- a/ui/gl/gl_features.h +++ b/ui/gl/gl_features.h
@@ -43,6 +43,24 @@ std::vector<std::string>& enabled_angle_features, std::vector<std::string>& disabled_angle_features); +#if BUILDFLAG(ENABLE_SWIFTSHADER) +GL_EXPORT BASE_DECLARE_FEATURE(kAllowSwiftShaderFallback); +#endif + +// If SwiftShader should be allowed as a GL implementation or WebGL fallback via +// command line flags. Disallowed by default unless explicitly requested with +// --use-angle=swiftshader[-for-webgl], --enable-unsafe-swiftshader +GL_EXPORT bool IsSwiftShaderAllowedByCommandLine( + const base::CommandLine* command_line); + +// If SwiftShader should be allowed due to the AllowSwiftShaderFallback +// killswitch feature. +GL_EXPORT bool IsSwiftShaderAllowedByFeature(); + +// SwiftShader is allowed by either IsSwiftShaderAllowedByCommandLine or +// IsSwiftShaderAllowedByFeature. +GL_EXPORT bool IsSwiftShaderAllowed(const base::CommandLine* command_line); + } // namespace features #endif // UI_GL_GL_FEATURES_H_
diff --git a/ui/gl/gl_implementation.cc b/ui/gl/gl_implementation.cc index 91a973d7..28c5813f 100644 --- a/ui/gl/gl_implementation.cc +++ b/ui/gl/gl_implementation.cc
@@ -23,6 +23,7 @@ #include "build/chromeos_buildflags.h" #include "ui/gl/buildflags.h" #include "ui/gl/gl_bindings.h" +#include "ui/gl/gl_features.h" #include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_version_info.h"
diff --git a/ui/gl/gl_switches.cc b/ui/gl/gl_switches.cc index 6f0bde6..f3cb601 100644 --- a/ui/gl/gl_switches.cc +++ b/ui/gl/gl_switches.cc
@@ -141,6 +141,9 @@ // only used on Windows, as LUID is a Windows specific structure. const char kUseAdapterLuid[] = "use-adapter-luid"; +// Allow usage of SwiftShader for WebGL +const char kEnableUnsafeSwiftShader[] = "enable-unsafe-swiftshader"; + // Used for overriding the swap chain format for direct composition SDR video // overlays. const char kDirectCompositionVideoSwapChainFormat[] = @@ -162,6 +165,7 @@ kEnableSwapBuffersWithBounds, kEnableDirectCompositionVideoOverlays, kDirectCompositionVideoSwapChainFormat, + kEnableUnsafeSwiftShader, }; const size_t kGLSwitchesCopiedFromGpuProcessHostNumSwitches = std::size(kGLSwitchesCopiedFromGpuProcessHost);
diff --git a/ui/gl/gl_switches.h b/ui/gl/gl_switches.h index a30aed9f..a832f6b 100644 --- a/ui/gl/gl_switches.h +++ b/ui/gl/gl_switches.h
@@ -72,6 +72,7 @@ GL_EXPORT extern const char kEnableSwapBuffersWithBounds[]; GL_EXPORT extern const char kEnableDirectCompositionVideoOverlays[]; GL_EXPORT extern const char kUseAdapterLuid[]; +GL_EXPORT extern const char kEnableUnsafeSwiftShader[]; GL_EXPORT extern const char kDirectCompositionVideoSwapChainFormat[];
diff --git a/ui/gl/init/gl_factory.cc b/ui/gl/init/gl_factory.cc index 17c9ebb..c461eb16 100644 --- a/ui/gl/init/gl_factory.cc +++ b/ui/gl/init/gl_factory.cc
@@ -15,6 +15,7 @@ #include "base/strings/string_util.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h" +#include "ui/gl/gl_features.h" #include "ui/gl/gl_share_group.h" #include "ui/gl/gl_surface.h" #include "ui/gl/gl_utils.h" @@ -51,11 +52,11 @@ // If the passthrough command decoder is enabled, put ANGLE first if allowed if (UsePassthroughCommandDecoder(cmd)) { std::vector<GLImplementationParts> angle_impls = {}; - bool software_gl_allowed = false; + bool software_gl_in_allow_list = false; auto iter = allowed_impls.begin(); while (iter != allowed_impls.end()) { if ((*iter) == GetSoftwareGLImplementation()) { - software_gl_allowed = true; + software_gl_in_allow_list = true; allowed_impls.erase(iter); } else if (iter->gl == kGLImplementationEGLANGLE) { angle_impls.emplace_back(*iter); @@ -67,8 +68,9 @@ allowed_impls.insert(allowed_impls.begin(), angle_impls.begin(), angle_impls.end()); // Insert software implementations at the end, after all other hardware - // implementations - if (software_gl_allowed) { + // implementations. If SwiftShader is not allowed as a fallback, don't + // re-insert it. + if (software_gl_in_allow_list && features::IsSwiftShaderAllowed(cmd)) { allowed_impls.emplace_back(GetSoftwareGLImplementation()); } } @@ -85,6 +87,8 @@ if (!impl_from_cmdline) return allowed_impls[0]; + // Allow software GL if explicitly requested by command line, even if it's not + // in the allowed_impls list. if (IsSoftwareGLImplementation(*impl_from_cmdline)) return *impl_from_cmdline;
diff --git a/ui/gtk/gtk_ui.cc b/ui/gtk/gtk_ui.cc index 3ad76e3..1d41088 100644 --- a/ui/gtk/gtk_ui.cc +++ b/ui/gtk/gtk_ui.cc
@@ -1004,12 +1004,17 @@ static_cast<GdkMonitor*>(g_list_model_get_item(list, i))); } } else { - primary = gdk_display_get_primary_monitor(display); const int n_monitors = gdk_display_get_n_monitors(display); monitors.reserve(n_monitors); for (int i = 0; i < n_monitors; i++) { monitors.push_back(gdk_display_get_monitor(display, i)); } + // In GDK3 Wayland this is always NULL; Fallback to the first monitor then. + // https://gitlab.gnome.org/GNOME/gtk/-/issues/1028 + primary = gdk_display_get_primary_monitor(display); + if (!primary && !monitors.empty()) { + primary = monitors.front(); + } } if (!primary) { return config;
diff --git a/ui/views/cocoa/drag_drop_client_mac.h b/ui/views/cocoa/drag_drop_client_mac.h index 386023f..293196e 100644 --- a/ui/views/cocoa/drag_drop_client_mac.h +++ b/ui/views/cocoa/drag_drop_client_mac.h
@@ -63,6 +63,7 @@ // Converts the given NSPoint to the coordinate system in Views. gfx::Point LocationInView(NSPoint point) const; + gfx::Point LocationInView(NSPoint point, NSWindow* destination_window) const; // Provides the data for the drag and drop session. std::unique_ptr<ui::OSExchangeData> exchange_data_;
diff --git a/ui/views/cocoa/drag_drop_client_mac.mm b/ui/views/cocoa/drag_drop_client_mac.mm index 5d04e16b..476fd01 100644 --- a/ui/views/cocoa/drag_drop_client_mac.mm +++ b/ui/views/cocoa/drag_drop_client_mac.mm
@@ -109,10 +109,11 @@ source_operation_ = ui::DragDropTypes::NSDragOperationToDragOperation( sender.draggingSourceOperationMask); } - - last_operation_ = drop_helper_.OnDragOver( - *exchange_data_, LocationInView([sender draggingLocation]), - source_operation_); + last_operation_ = + drop_helper_.OnDragOver(*exchange_data_, + LocationInView(sender.draggingLocation, + sender.draggingDestinationWindow), + source_operation_); return ui::DragDropTypes::DragOperationToNSDragOperation(last_operation_); } @@ -148,4 +149,16 @@ return gfx::Point(point.x, NSHeight(content_rect) - point.y); } +// In immersive fullscreen, the `NSToolbarFullScreenWindow` hosts both the tab +// strip and toolbar. Convert the point to the corresponding hosted view's +// coordinates. +gfx::Point DragDropClientMac::LocationInView( + NSPoint point, + NSWindow* destination_window) const { + if (remote_cocoa::IsNSToolbarFullScreenWindow(destination_window)) { + NSView* overlay_view = [destination_window.contentView hitTest:point]; + point = [overlay_view convertPoint:point fromView:nil]; + } + return LocationInView(point); +} } // namespace views
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc index 0b8d5c2..8986465 100644 --- a/ui/views/controls/menu/menu_controller_unittest.cc +++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -2970,6 +2970,16 @@ EXPECT_EQ(5, data.GetIntAttribute(ax::mojom::IntAttribute::kSetSize)); } +TEST_F(MenuControllerTest, AccessibleProperties) { + SubmenuView* const submenu = menu_item()->GetSubmenu(); + MenuScrollViewContainer* scroll_view_container = + submenu->GetScrollViewContainer(); + + ui::AXNodeData data; + scroll_view_container->GetViewAccessibility().GetAccessibleNodeData(&data); + EXPECT_EQ(data.role, ax::mojom::Role::kMenuBar); +} + TEST_F(MenuControllerTest, SetSelectionIndices_ChildrenChanged) { AddButtonMenuItems(/*single_child=*/false); SubmenuView* const submenu = menu_item()->GetSubmenu();
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc index ebbb2ca..81fabd1 100644 --- a/ui/views/controls/menu/menu_item_view.cc +++ b/ui/views/controls/menu/menu_item_view.cc
@@ -181,19 +181,6 @@ } void MenuItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) { - // Set the role based on the type of menu item. - switch (type_) { - case Type::kCheckbox: - node_data->role = ax::mojom::Role::kMenuItemCheckBox; - break; - case Type::kRadio: - node_data->role = ax::mojom::Role::kMenuItemRadio; - break; - default: - node_data->role = ax::mojom::Role::kMenuItem; - break; - } - node_data->SetName(CalculateAccessibleName()); switch (type_) { @@ -880,6 +867,7 @@ type_(type), command_(command) { GetViewAccessibility().set_needs_ax_tree_manager(true); + UpdateAccessibleRole(); if (type_ == Type::kCheckbox || type_ == Type::kRadio) { radio_check_image_view_ = AddChildView(std::make_unique<ImageView>()); bool show_check_radio_icon = @@ -1554,6 +1542,21 @@ GetViewAccessibility().SetIsSelected(IsTraversableByKeyboard() && selected_); } +void MenuItemView::UpdateAccessibleRole() { + // Set the role based on the type of menu item. + switch (type_) { + case Type::kCheckbox: + GetViewAccessibility().SetRole(ax::mojom::Role::kMenuItemCheckBox); + break; + case Type::kRadio: + GetViewAccessibility().SetRole(ax::mojom::Role::kMenuItemRadio); + break; + default: + GetViewAccessibility().SetRole(ax::mojom::Role::kMenuItem); + break; + } +} + BEGIN_METADATA(MenuItemView) END_METADATA
diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h index dc17df3b..f438b14 100644 --- a/ui/views/controls/menu/menu_item_view.h +++ b/ui/views/controls/menu/menu_item_view.h
@@ -596,6 +596,7 @@ // `vertical_margin_` is not set. int GetVerticalMargin() const; + void UpdateAccessibleRole(); void UpdateAccessibleKeyShortcuts(); void UpdateAccessibleSelection();
diff --git a/ui/views/controls/menu/menu_item_view_unittest.cc b/ui/views/controls/menu/menu_item_view_unittest.cc index 3d86139a..9dc4255f 100644 --- a/ui/views/controls/menu/menu_item_view_unittest.cc +++ b/ui/views/controls/menu/menu_item_view_unittest.cc
@@ -242,6 +242,31 @@ } } +TEST_F(MenuItemViewUnitTest, AccessibleProperties) { + views::TestMenuItemView root_menu; + views::MenuItemView* item1 = root_menu.AppendMenuItemImpl( + 0, u"checkbox", ui::ImageModel(), MenuItemView::Type::kCheckbox); + views::MenuItemView* item2 = root_menu.AppendMenuItemImpl( + 1, u"radio", ui::ImageModel(), MenuItemView::Type::kRadio); + views::MenuItemView* item3 = root_menu.AppendMenuItemImpl( + 2, u"title", ui::ImageModel(), MenuItemView::Type::kTitle); + views::MenuItemView* item4 = root_menu.AppendMenuItemImpl( + 3, u"highlighted", ui::ImageModel(), MenuItemView::Type::kHighlighted); + ui::AXNodeData data1, data2, data3, data4; + + item1->GetViewAccessibility().GetAccessibleNodeData(&data1); + EXPECT_EQ(data1.role, ax::mojom::Role::kMenuItemCheckBox); + + item2->GetViewAccessibility().GetAccessibleNodeData(&data2); + EXPECT_EQ(data2.role, ax::mojom::Role::kMenuItemRadio); + + item3->GetViewAccessibility().GetAccessibleNodeData(&data3); + EXPECT_EQ(data3.role, ax::mojom::Role::kMenuItem); + + item4->GetViewAccessibility().GetAccessibleNodeData(&data4); + EXPECT_EQ(data4.role, ax::mojom::Role::kMenuItem); +} + class TouchableMenuItemViewTest : public ViewsTestBase { public: TouchableMenuItemViewTest() = default;
diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc index 76f5831..026c58d 100644 --- a/ui/views/controls/menu/menu_scroll_view_container.cc +++ b/ui/views/controls/menu/menu_scroll_view_container.cc
@@ -30,6 +30,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/geometry/rounded_corners_f.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/bubble/bubble_border.h" @@ -260,6 +261,15 @@ // code needs to know the final size of the menu. Calling CreateBorder() is // the easiest way to do that. CreateBorder(); + + GetViewAccessibility().SetRole(ax::mojom::Role::kMenuBar); + // On macOS, NSMenus are not supposed to have anything wrapped around them. To + // allow VoiceOver to recognize this as a menu and to read aloud the total + // number of items inside it, we ignore the MenuScrollViewContainer (which + // holds the menu itself: the SubmenuView). +#if BUILDFLAG(IS_MAC) + GetViewAccessibility().SetIsIgnored(true); +#endif } bool MenuScrollViewContainer::HasBubbleBorder() const { @@ -298,18 +308,13 @@ } void MenuScrollViewContainer::GetAccessibleNodeData(ui::AXNodeData* node_data) { + // TODO(crbug.com/325137417): To ensure the name is set for content_view, the + // role must be assigned before calling GetAccessibleNodeData. Omitting this + // role could disrupt functionality, as the AXNodeData::SetName() function + // checks for the relevant role. + node_data->role = content_view_->GetViewAccessibility().GetCachedRole(); // Get the name from the submenu view. content_view_->GetAccessibleNodeData(node_data); - - // On macOS, NSMenus are not supposed to have anything wrapped around them. To - // allow VoiceOver to recognize this as a menu and to read aloud the total - // number of items inside it, we ignore the MenuScrollViewContainer (which - // holds the menu itself: the SubmenuView). -#if BUILDFLAG(IS_MAC) - node_data->role = ax::mojom::Role::kNone; -#else - node_data->role = ax::mojom::Role::kMenuBar; -#endif } gfx::Size MenuScrollViewContainer::CalculatePreferredSize(
diff --git a/ui/views/controls/menu/submenu_view.cc b/ui/views/controls/menu/submenu_view.cc index 7b85e558..68e4483 100644 --- a/ui/views/controls/menu/submenu_view.cc +++ b/ui/views/controls/menu/submenu_view.cc
@@ -67,6 +67,7 @@ // Menus in Chrome are always traversed in a vertical direction. GetViewAccessibility().SetIsVertical(true); + GetViewAccessibility().SetRole(ax::mojom::Role::kMenu); } SubmenuView::~SubmenuView() { @@ -301,9 +302,14 @@ void SubmenuView::GetAccessibleNodeData(ui::AXNodeData* node_data) { // Inherit most of the state from the parent menu item, except the role and // the orientation. - if (parent_menu_item_) + if (parent_menu_item_) { + // TODO(crbug.com/325137417): To ensure the name is set for + // parent_menu_item_, the role must be assigned before calling + // GetAccessibleNodeData. Omitting this role could disrupt functionality, as + // the AXNodeData::SetName() function checks for the relevant role. + node_data->role = parent_menu_item_->GetViewAccessibility().GetCachedRole(); parent_menu_item_->GetAccessibleNodeData(node_data); - node_data->role = ax::mojom::Role::kMenu; + } } void SubmenuView::PaintChildren(const PaintInfo& paint_info) {
diff --git a/v8 b/v8 index cf1d29a..225c383 160000 --- a/v8 +++ b/v8
@@ -1 +1 @@ -Subproject commit cf1d29a1bbb0f125d9400dcf002ddf1d7db6826c +Subproject commit 225c383245605b717d45c0debf45b8f6b4fabc5b